String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

/* //  Published at: scripts.tropicalpcsolutions.com
var reloaded = false;
var loc=""+document.location;
loc = loc.indexOf("?reloaded=")!=-1?loc.substring(loc.indexOf("?reloaded=")+10,loc.length):"";
loc = loc.indexOf("&")!=-1?loc.substring(0,loc.indexOf("&")):loc;
reloaded = loc!=""?(loc=="true"):reloaded;

function reloadOnceOnly() {
    if (!reloaded) 
        window.location.replace(window.location+"?reloaded=true");
}
reloadOnceOnly(); //You can call this via the body tag if desired*/

if(navigator.userAgent.indexOf("Firefox")!=-1){
	var nn4 = true;
	var nn6 = true;
}
else{
	var nn4 = false;
	var nn6 = true;
}
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);

function loadPage(id,nestref,url,content_frame) {
	if (nn4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id) : document.layers[id]
		lyr.load(url,lyr.clip.width)
	}
	else 
	if(ie4){
		parent.contentFRM.location = url;
	}
	else 
	if(ie5 || nn6){
		document.getElementById(content_frame).src = url;
	}
	else{
		//alert('not supported: '+url);
	}
}

function showPage(id,content_frame) {
	var loc;
	
	if(window.frames[content_frame].document.getElementById('ForDialog')!=null){	
		if(window.frames[content_frame].document.getElementById('ForDialog').innerHTML.trim()!=""){
			//Display dialog
			jQuery.facebox(window.frames[content_frame].document.getElementById('ForDialog').innerHTML);			
			
			//Set auto close
			if(window.frames[content_frame].document.getElementById('DialogAutoClose')!=null){
				if(window.frames[content_frame].document.getElementById('DialogAutoClose').value!=0){
					//Close after specificed timing
					setTimeout('$.facebox.close()', window.frames[content_frame].document.getElementById('DialogAutoClose').value);
				}
			}
			else{
				//Default to close after 5 secs 
				setTimeout('$.facebox.close()', 5000);
			}
		}
	}
	
	if(window.frames[content_frame].document.getElementById('ForContent')!=null){	
		if(window.frames[content_frame].document.getElementById('ForContent').innerHTML.trim()!=""){
			document.getElementById('TheBody').innerHTML=window.frames[content_frame].document.getElementById('ForContent').innerHTML;
		}
	}
	
	if(window.frames[content_frame].document.getElementById('Refresh')!=null){	
		//Refresh page if required	
		if(window.frames[content_frame].document.getElementById('Refresh').value!=""){	
			if(window.frames[content_frame].document.getElementById('Refresh').value=="_top"){	
				//window.frames[content_frame].location="";
				if(nn4){
					//window.location=window.location;
					window.location.reload(true);					
				}
				else 
				if(ie4 || ie5 || nn6){
					window.location.reload(true);
				}
			}
			else{
				var refresh_target=window.frames[content_frame].document.getElementById('Refresh').value;				
				//alert(refresh_target);
				window.frames[refresh_target].location.reload(true);
				//bind_js();
			}
		}
	}
		
	if(window.frames[content_frame].document.getElementById('Refresh2')!=null){	
		//Refresh page if required
		if(window.frames[content_frame].document.getElementById('Refresh2').value!=""){	
			if(window.frames[content_frame].document.getElementById('Refresh2').value=="_top"){	
				//window.frames[content_frame].location="";
				if(nn4){
					//window.location=window.location;
					window.location.reload(true);
				}
				else 
				if(ie4 || ie5 || nn6){
					window.location.reload(true);
				}
			}
			else{
				var refresh_target=window.frames[content_frame].document.getElementById('Refresh2').value;
				//alert(refresh_target);
				window.frames[refresh_target].location.reload(true);
				//bind_js();
			}
		}	
	}
}

function refreshPageContent(id,content_frame) {	
	if(window.frames[content_frame].document.getElementById('theBody')==null){
		//alert("Error Code: 2" + content_frame);
	}
	if(document.getElementById(id)!=null){
		document.getElementById(id).innerHTML=window.frames[content_frame].document.getElementById('theBody').innerHTML;
		//alert(document.getElementById(id).innerHTML);
		//bind_js();
	}
}