// JavaScript Document
function trim( str ) {
	if( (str.charAt(0) != ' ') && (str.charAt(str.length-1) != ' ') ) { return str; }
	while( str.charAt(0)  == ' ' ) str = '' + str.substring(1,str.length);
	while( str.charAt(str.length-1)  == ' ' ) str = '' + str.substring(0,str.length-1);
	return str;
}

function r_popup(url, w, h, r, s, l, t) {
	l = ((l)?l:((screen.width/2)-(w/2)));
	t = ((t)?t:((screen.height/2)-(h/2)));
	r = ((r)?"resizable=yes,":"");
	s = ((r)?"scrollbars=yes,":"");
	var www = window.open(url, "popup"+(new Date()).getTime(), r+s+"left="+l+",top="+t+",width="+w+",height="+h);
	return ((www)?true:false);
}

function popup(url, w, h) { return (r_popup(url, w, h, 1, 1, 0, 0)); }

function fix_popup(url, w, h) { return (r_popup(url, w, h, 0, 0, 0, 0)); }

function scrollable_popup(url, w, h) { return (r_popup(url, w, h, 0, 1, 0, 0)); }

function resizable_popup(url, w, h) { return (r_popup(url, w, h, 1, 0, 0, 0)); }

function jump2page(url) { window.document.location = url; }

var cs_html = new Array();
function get_html(uri, id, callback_func) {
	var xmlHttpReqAjax = false;
	var self = this;
	if (window.XMLHttpRequest) self.xmlHttpReqAjax = new XMLHttpRequest();
	else if (window.ActiveXObject) self.xmlHttpReqAjax = new ActiveXObject("Microsoft.XMLHTTP");
	self.xmlHttpReqAjax.open("POST", uri, true);
	self.xmlHttpReqAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	self.xmlHttpReqAjax.onreadystatechange = function() {
		if (self.xmlHttpReqAjax.readyState == 4) {
			var html = self.xmlHttpReqAjax.responseText;
			if ( callback_func == null ) set_data(id, html);
			else { cs_html[id] = html; eval(callback_func); }
		}
	}
	self.xmlHttpReqAjax.send("");
}

//function set_data(id, data) { var holder = document.getElementById(id); if ( holder ) { holder.innerHTML = ""+data+""; if ( id == "MESSAGE" ) {holder.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bgcolor=\"#FDF69E\" style=\"border:1px solid #FFE93B\"><tr bgcolor=\"#FFE93B\"><td align=\"left\"><a href=\"javascript:void(0);\" onclick=\"if ( document.getElementById('MESSAGE_BODY').style.display == '' ) document.getElementById('MESSAGE_BODY').style.display = 'none'; else document.getElementById('MESSAGE_BODY').style.display = '';\" class=\"toplinksbig\">[-]</a></td><td align=\"right\"><a href=\"javascript:void(0);\" onclick=\"close_window('MESSAGE');\" class=\"toplinksbig\">[X]</a></td></tr><tr id=\"MESSAGE_BODY\"><td colspan=\"2\">"+holder.innerHTML+"</td></tr></table>"; holder.style.display = ""; setTimeout("document.getElementById('MESSAGE').style.display = 'none';", 30000); window.scrollTo(0, 0); } } }
function set_data(id, data) { var holder = document.getElementById(id); if ( holder ) { holder.innerHTML = ""+data+""; if ( id == "MESSAGE" ) {holder.innerHTML = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr><td align=\"right\">[ <a href=\"javascript:void(0);\" onclick=\"if ( document.getElementById('MESSAGE_BODY').style.display == '' ) document.getElementById('MESSAGE_BODY').style.display = 'none'; else document.getElementById('MESSAGE_BODY').style.display = '';\" class=\"toplinksbig\">-</a> ] [ <a href=\"javascript:void(0);\" onclick=\"close_window('MESSAGE');\" class=\"toplinksbig\">X</a> ]</td></tr><tr id=\"MESSAGE_BODY\"><td colspan=\"2\">"+holder.innerHTML+"</td></tr></table>"; holder.style.display = ""; update_message(); setTimeout("document.getElementById('MESSAGE').style.display = 'none';", 30000); } } }
function update_content_on_success(id, data) { if ( cs_html[id] == "SUCCESS" ) set_data(id, data); else set_data("MESSAGE", cs_html[id]); }
function update_message()
{
	var t;
	if ( window.scrollY )
		t = window.scrollY;
	else if ( document.documentElement )
		t = document.documentElement.scrollTop;
	else if ( document.body )
		t = document.body.scrollTop;
	document.getElementById("MESSAGE").style.top = (t+80)+"px";
}