// Place JS functions here
function setTitle(str){
	top.document.title = str;
}

function showHelp(str){
	divEl = findObj('help')
	if (divEl != null){
		divEl.innerHTML = str;
		clearTimeout(helpHideHandle);		
		showElement('help');
		helpHideHandle = setTimeout("hideElement('help');",6000);
	}
	
}

var helpHideTimeout = 2000;
var helpHideHandle;
function hideHelp(){
	clearTimeout(helpHideHandle);
	helpHideHandle = setTimeout("hideElement('help');",helpHideTimeout);
}

function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showElement(name) { 
	var obj;
	if ((obj=findObj(name))!=null) { 
    	if (obj.style) { obj=obj.style; }
    	obj.visibility='visible'; 
	}
}

function hideElement(name) { 
	var obj;
	if ((obj=findObj(name))!=null) { 
    	if (obj.style) { obj=obj.style; }
    	obj.visibility='hidden'; 
	}
}

function setImage(name,url){
	var obj;
	if ((obj=findObj(name))!=null) { 
    	obj.src = url;
	}
}

function setHelp(name, str){
	//alert(name);
	if ((obj=findObj(name))!= null){
		obj.onMouseOver="showHelp('"+str+"');"
		obj.onMouseOut="hideHelp();"
	}
}

function preloadImages() { 
	if(document.images){ 
		if(!document.PrelImgs) document.PrelImgs=new Array();
	    var i,j=document.PrelImgs.length,a=preloadImages.arguments; 
		for(i=0; i<a.length; i++)
	    	if (a[i].indexOf("#")!=0){ 
				document.PrelImgs[j]=new Image; 
				document.PrelImgs[j++].src=a[i];
			}
	}
}

function setLang(lang){
	window.open("/common/setlang.asp?lang="+lang,null, "scrollbars=0,toolbar=0,resizable=0,height=50,width=50");
}
