var img_path = "";

function fixIE(divName)
{
	if (isMSIE) 
	{
		self.scrollTo(0);
	}
	
	//alert(document.body.clientHeight);
	//var docHeight = document.getElementById(divName).clientHeight
	//alert(docHeight);
	
}

function RolloverImgs(img,ref,path) 
{ 
	obj = document.images[img];
	if (obj)
	{
		ref = img_path + path + "/" + ref;
		obj.src = ref;
	}
}

function LinkUnderline(id,type)
{
	obj = document.getElementById(id); 
	if (obj != null)
	{
		obj.style.textDecoration = type;
	}
}


function checkKey(e,withCtrl,keys,urls)
{
	var code;
	if (!e) var e = window.event;
	
	if (withCtrl == 1)
	{
		if (e.keyCode && e.ctrlKey) code = e.keyCode;
		else if (e.which && e.ctrlKey) code = e.which;	
	}
	else
	{
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;			
	}

	//alert(code);
	if (keys.length>0)
	{
		for (i=0; i < keys.length; i++)
		{
			if (code == keys[i])
			{
				if (urls[i])
				{
					//alert(urls[i]);
					window.location = urls[i];
				}
			}
		}
	}	
}

function clearValue(id) 
{
	document.getElementById(id).value = "";
}

//for menu

var MenuOn=0, MenuSH = new Array, TimeId;

function navig_d (par,type,nIdDiv,source) 
{
	var lay=document.getElementById(par);

	if (type==0) 
	{
		MenuSH[par]=1;
		MenuOn=1;
		clearTimeout(TimeId);
		lay.style.display="block";
		lay.style.visibility="visible";
	} //end if type=0

	//for current
	if (nIdDiv) 
	{
		lay_main=document.getElementById(nIdDiv);
		if (source)
			lay_main.className = source;
	}
	//end for current

	if (type==1) 
	{
		MenuSH[par]=0;
		if (source=="div") 
		{
			MenuOn=0;
			clearTimeout(TimeId);
			TimeId=setTimeout('HideAllDivs()',100);
		} else 
		{
			if (MenuOn) 
			{
				//clearTimeout(TimeId);
				TimeId=setTimeout('MenuOff("'+par+'","'+nIdDiv+'","'+source+'")',100);
			}
		}
	}//end if type==1
}

function hideChild(arr,current) {
	for (i=0; i < arr.length; i++) 
	{	
		if (arr[i])
		{
			if (arr[i]!=current) {
				document.getElementById(arr[i]).style.display="none";
				document.getElementById(arr[i]).style.visibility="hidden";
			}
		}
	}
}

function hideCurrent(item,item2,style) {
	document.getElementById(item).style.display="none";
	document.getElementById(item).style.visibility="hidden";
	if (item2) {
		lay_main=document.getElementById(item2);
		lay_main.className = style;
	}	
}

function showCurrent(item,item2,style) {
	document.getElementById(item).style.display="block";
	document.getElementById(item).style.visibility="visible";
	if (item2) {
		lay_main=document.getElementById(item2);
		lay_main.className = style;
	}	
}

function HideAllDivs () {
	if (!MenuOn) {
		for (i=0; i < MainDivs.length; i++) 
		{
			if (MainDivs[i])
			{
				document.getElementById(MainDivs[i]).style.display="none";
				document.getElementById(MainDivs[i]).style.visibility="hidden";
			}
		}
	}
}

function MenuOff (lid,img,source) 
{
	if ( (!MenuSH[lid]) ) {	
		document.getElementById(lid).style.display="none";
		document.getElementById(lid).style.visibility="hidden";
		//for current
		if (img) {
			lay_main=document.getElementById(img);
			if (source)
				lay_main.className = source;
		}		
		//end for current
	}
}