var sDOMAIN = "/";
function jsSetMenuHighlight( pcode ) {
	var container = document.getElementById("ContainerLeft");
	if( pcode && container ) {
		var anc = document.getElementById("anc" + pcode);
		var home = document.getElementById("ancHome");
		var lst = container.getElementsByTagName("a");
		for(var i=0; i<lst.length; i++){
		if (lst[i] != anc) {
			lst[i].parentNode.className = "m";
		}
		}
		if( home ){
			home.parentNode.className = "";
	
		}

		if( anc ){
			anc.parentNode.className = "Current";
	
		}
	}
}
function jsUpdateLoadStatus() {
	var iWidth = (!document.all)?window.innerWidth:document.body.clientWidth;
    var iHeight = (!document.all)?window.innerHeight:document.body.clientHeight;
	var winLeft = (iWidth - 100) / 2;
	var winUp = (iHeight - 200) / 2;
    var statusElem  = document.getElementById(statusDiv);
	if( statusElem ) {
		statusElem.style.left = winLeft + "px";
		statusElem.style.top = winUp + "px";
	}
}
function jsWinOpen(x,w,h, haveScroll) {
	var winLeft = (screen.width - w) / 2;
	var winUp = (screen.height - h) / 2;
	if (! window.focus)
		return true;
	if( haveScroll == "" )
		haveScroll = "no";
	return window.open(x,"","width=" + w + ",height=" + h + ",top="+ winUp+",left="+ winLeft +",resizable=no,statusbar=no,menubar=no,scrollbars=" + haveScroll);
}
function jsLoadPage( pcode ) {
	var d = new Date();
	dojoSubmit( "", sDOMAIN + "pageloader.asp?PCODE=" + pcode + "&T=" + d.getSeconds() +"" + d.getMilliseconds() , "Content", false );
	jsSetMenuHighlight( pcode );
	//if( document.location.href.indexOf("#")==-1 ) document.location.href+="#TOP";
}
function jsGOTO( x ) {
	document.location.href = sDOMAIN + x;
}
function fncGetSubmitString(){
	var str = "";	
	for(var i = 0; i <document.forms[0].elements.length; i++) {
		var elm = document.forms[0].elements[i];
		if( elm.name != "__VIEWSTATE" && elm.name != "" && elm.type != "button" ) {
			if( trim(elm.value) != "" )	{
				if( (elm.type != "checkbox" && elm.type != "radio" ) ||
					( (elm.type == "checkbox" || elm.type == "radio") && elm.checked ) ) {	
					if( str != "" )
						str+= "&";
					if( elm.type != "select-multiple" )
						str += elm.name + "=" + escape(elm.value);
					else {
						var selectValue = "";
						for( var j=0; j<elm.options.length; j++ ) {
							if( elm.options[j].selected ){
								if( selectValue != "" ) selectValue += "," + elm.options[j].value;
								else selectValue += escape(elm.options[j].value);
							}	
						}
						str += elm.name + "=" + selectValue;
					}
				}
			}
		}
	}
	return str;
}
function trim( str ){	//remove whitespace
	if( str ) return str.replace(/^\s*|\s*$/g,"");
	return "";
}
function jsViewFolder( fcode ){
	var d = new Date();
	dojoSubmit( "", sDOMAIN + "expg_GALLERY2.asp?FCODE=" + fcode + "&T=" + d.getSeconds() +"" + d.getMilliseconds() , "Content", false );
	window.focus();
}
function jsPicEnlarge( picId ) {
	jsWinOpen( sDOMAIN + "expg_GALLERYPIC.asp?PICID=" + picId, 420, 350, 'no');
}
function jsSubmitEnquiry() {
	var d = new Date();
	dojoSubmit( "", sDOMAIN + "expg_ENQUIRY.asp?ENQUIRY=SEND&" + fncGetSubmitString() + "&T=" + d.getSeconds() +"" + d.getMilliseconds() , "Content", false );
}
function jsSubmitAppointment() {
	var d = new Date();
	dojoSubmit( "", sDOMAIN + "expg_APPOINTMENT.asp?APPOINTMENT=SEND&" + fncGetSubmitString() + "&T=" + d.getSeconds() +"" + d.getMilliseconds() , "Content", false );
}
function jsSubmitSiteVisit() {
	var d = new Date();
	dojoSubmit( "", sDOMAIN + "expg_ABOUTUS.asp?SITEVISIT=SEND&" + fncGetSubmitString() + "&T=" + d.getSeconds() +"" + d.getMilliseconds() , "Content", false );
}
function jsGoCP(){
	jsGOTO('controlpanel/default.asp');
}
function jsGoMain() {
	jsGOTO('default.asp');
}