function FindObj(n,d){
	try{
		if(typeof(n)=="string"){
			d=d?d.document:document;
			if(d.getElementById(n)){
				d = d.getElementById(n)
			}else{
				d = d.getElementByName(n)
			}
			return d
		}else{
			return n;
		}
	}catch(e){
		return null
	}
}

function URLEncode(u){
	if(typeof(encodeURIComponent)=="function"){
		return encodeURIComponent(u);
	}else{
		return u;
	}
}

function isIE(){
	return (navigator.appName=="Microsoft Internet Explorer")
}

//===========================

function MenuFocus(m){
	var r=(m==vMenu);
	if(!r){
		for(i in aMenu){
			var s=aMenu[i];
			FindObj("Menu" + s).src = "/image/button-" + s.toLowerCase() + "-" + ((s==m)?"":"un") + "selected.gif";
		}
		FindObj("cm").innerHTML = FindObj("Menu" + m + "Sub").innerHTML;
		vMenu = m;
	}
	window.focus();
	return r;
}

function PageReload(i){
	if(i>0){
		window.onload=function(){window.setTimeout("location.reload()",i*1000)}
	}else{
		location.reload();
	}
	return false;
}

//===========================

var oForm;
function FormReset(v){
	var o=document.getElementsByTagName("input");
	for(i=0; i<o.length; i++) {
		if(o[i].type=="submit"){
			o[i].disabled=(v?"":"disabled");
			o[i].className=(v?"submit":"submitoff");
		}
	}
}
function FormSubmit(o){
	FormReset(0);
	oForm=o;
	return 1;
}
function FormGo(u,m){
	var s="",i=u.indexOf("#");
	if(i!=-1){
		s=u.substring(i,u.length);
		u=u.substring(0,i);
	}
	u+=((u.indexOf("?")==-1)?"?":"&")+Math.random()+".NowIW."+Math.random();
	location.replace(u+s);
	if(m)alert(m);
}
function FormError(o,e){
	FormReset(1);
	alert(e);
	if(o!="XXX"){
		try{
			if(oForm){
				if(isIE()){
					oForm.item(o).focus()
				}else{
					oForm.elements[o].focus()
				}
			}else{
				FindObj(o).focus()
			}
		}catch(e){}
	}
}
//===========================

function sp_lndel(d, l, n){
	if(confirm("Are you sure of delete Link: "+n+"\nUrl: "+l)){
		location.replace("/setup/link-delete/?Domain="+d+"&Link="+escape(l)+"&Name="+escape(n));
	}
	return false;
}
