var objCurrent

function SetVisible(sName){
	var objIn
	//objCurrent = sName
	//alert(sName);

	//alert(window.document.getElementById(sName)
	//alert(document.forms[0].id)
	

	//objIn = eval('window.MainForm.'+sName)
	objIn = eval('window.aspnetForm.'+sName)
	
	//aspnetForm
	objIn.style.visibility = 'visible';	
}

function SetHidden(sName){
	var objIn
	//objCurrent = sName
	//objIn = eval('window.MainForm.'+sName)
	objIn = eval('window.aspnetForm.'+sName)
	if (sName != objCurrent){
	//if (objIn.style.visibility != 'hidden'){
		objIn.style.visibility = 'hidden';   
	}
}


// LAG EN TOLLLEVISIBILITY-funksjon i stedet for å ha en til visible og en til hidden!!

function HideAll(iCat){
	var iL, objNew
	for (var iL=1; iL <= iCat; iL++){
		objNew = eval('window.MainForm.dot'+iL)
		objNew.style.visibility = 'hidden';   
	}
}

function SetVisibleToStay(iCat, sName, sURL){
	objCurrent = sName;
	HideAll(iCat);
	SetVisible(sName);
	window.document.location = sURL;
}

//function IndexClicked(Element, sImgSrc, sBGColor, iImgCount){
function IndexClicked(sLargeImgURL){
	//CellNumber.Attributes.Add("onclick", "javascript:MainForm.MImg.src='../../" & arrImgSrc(i) & "';")
	//ClearAll(iImgCount)
	//alert(Element.id)
	//Element.style.backgroundColor = sBGColor;
	//MainForm.MImg.src = sImgSrc
	//alert(iImgCount);
	OpenAWindow(sLargeImgURL,'400','400');
}

function SlideOver(Element, sImgSrc, sBGColor){
	Element.style.backgroundColor = sBGColor;
	MainForm.MImg.src = sImgSrc
}

function OpenAWindow(sURL, height, width)
{
	l = ( screen.width - width)/2;
	t = ( screen.height -height) /2;
	var newwin = window.open(sURL,"winEditor","toolbar=no,menubar=no,location=no,direcories=no,status=no,height=" + height + ",Width=" + width +",left=" + l + ",top=" + t + ",resizable,scrollbars=no");
	//newwin.leftmargin = 0; 
	//newwin.document.writeln("<BODY BGColor=#FFFFFF LeftMargin=0>") 
	newwin.focus();
}

function OpenAWin(img, height, width){
	var popwin=window.open("","_blank","toolbar=no,menubar=no,location=no,direcories=no,status=no,height=" + height + ",Width=" + width +",left=" + l + ",top=" + t + ",resizable,scrollbars=no")
	popwin.document.open()
	popwin.document.write('<html><head><title>'+img+'</title></head><body bgcolor=white scroll=no topmargin=0 leftmargin=0 rightmargin=0 bottomargin=0 marginheight=0 marginwidth=0><div style="position: absolute; top:0px;left:0px"><a href="javascript:window.close()">  <img src="'+img+'" width="'+wd+'" height="'+ht+'" border="0"></a></div></body></html>')
	popwin.document.close()
}


function ClearAll(iImageCount){
	var iL, objNew
	for (var iL=0; iL <= iImageCount; iL++){
		objNew = eval('MainForm.RightMenu1_ThumbControl1_IndexCell'+iL)
		alert(objNew);
		//objNew.style.backgroundColor = 'white';
	}
}
