if(!document.getElementById)
{
	if(document.all)
	{
		document.getElementById = function()
		{
			if(typeof document.all[arguments[0]]!="undefined")
			{
				return document.all[arguments[0]];
			}
			else
			{
				return null;
			}
		};
	}
	else if(document.layers)
	{
		document.getElementById = function()
		{
			if(typeof document[arguments[0]]!="undefined")
			{
				return document[arguments[0]];
			}
			else
			{
				return null;
			}
		};
	}
};

function activateMenu(id)
{
	obj = document.getElementById('head.swf');
	obj.activateMenu(id);
}

// visa eller gom en div
	function toggle(a){
	var e=document.getElementById(a);
	if(!e) {return true;}
	if(e.style.display=="none"){
	e.style.display="block";
	} else {
	e.style.display="none";
	}
	return true;
	};

var currentPic = 1;
function showGalleryPic(id, filename, offset, text)
{
	$(".vimmelPicBorder").hide();
	$("#VPB_"+id).show();
	$("#vimmelPicImg").attr("src", filename);

	newPicNum = parseInt(offset)+parseInt(id);
	$("#picText").html(text);
	$("#picCounter").html(newPicNum);

	currentPic = id;
}

function showToolbar(toolbar)
{
	//$("#"+toolbar+" a img").fadeTo("fast",0.33);
	$("#"+toolbar).fadeTo("fast", 0.66);
}

function hideToolbar(toolbar)
{
	//$("#"+toolbar+" a img").fadeOut("fast");
	$("#"+toolbar).fadeTo("fast", 0);
}

function nextPic(picLimit, currentOffset, numItems)
{
	currentPic++;
	if (currentPic > imgCount)
	{
		if (picLimit!='' && picLimit < numItems)
		{
			newoffset = parseInt(currentOffset)+parseInt(picLimit);
			if ((newoffset+1) > parseInt(numItems))
				newoffset = 0;

			//location.href='index.php?pageId=5&offset='+(newoffset);
			leftLoad('pageId=5&offset='+(newoffset));
			return;
		}
		else
			currentPic=1;
	}

	showGalleryPic(currentPic, imgFile[currentPic], currentOffset, imgText[currentPic]);
}

function prevPic(picLimit, currentOffset, numItems)
{
	currentPic--;
	if (currentPic<1)
	{
		if (picLimit!='' && picLimit < numItems)
		{
			newoffset = parseInt(currentOffset)-parseInt(picLimit);
			if (newoffset < 0)
			{
				//newoffset = (numItems-picLimit)+(picLimit - (numItems%picLimit));
				newoffset = numItems-(numItems%picLimit);
			}

			//location.href='index.php?pageId=5&offset='+(newoffset)+"&drc=1";
			leftLoad('pageId=5&offset='+(newoffset)+"&drc=1");
			return;
		}
		else
			currentPic=imgCount;
	}

	showGalleryPic(currentPic, imgFile[currentPic], currentOffset, imgText[currentPic]);
}

function isGoto(qs)
{
	if(qs!="")
		$(".contentLeft").load("index.php?"+qs);
}

function menuClicked(id)
{
	this.parent.frames['historyStack'].location.href = 'history.php?go=LoadContent&pageId='+id; 
	return false;

}

function leftLoad(qs)
{
	this.parent.frames['historyStack'].location.href = 'history.php?go=LoadContent&'+qs; 
	return false;
}

function musicPlayerPlaying(playing)
{
	//alert("MPP: "+playing);
	var swf = document.getElementById("head.swf");
	swf.musicPlayerPlaying(playing);
}

function changeButton(buttonType)
{
	$("#browseButton").hide();
	$("#uploadPicButton").show();
}


function switchDiv(off, on)
{
	$("#"+off).hide();
	$("#"+on).show();
}

$(document).ready(
		function() { blushade(); }
);

function blushade() {
	$(".bluShade").css("opacity", "0.0");
	$(".eventBluListener").hover(
			function()
			{
				pobj = $(this).prev();
				$(pobj).fadeTo("fast", 0.4);
			},
			function()
			{
				pobj = $(this).prev();
				$(pobj).fadeTo("fast", 0);
			}
		);
}

