/*  Razor JavaScript framework, version 1.0.0
 *
 *	Author: YuYanxin
 *  Date:   2009-04-18
 *  So that a more simple JavaScript
 *
 *--------------------------------------------------------------------------*/

function $(sID) {
  return document.getElementById(sID);
}

function $s(sID) {
  return document.getElementById(sID).style;
}

function getTop(e){
var offset=e.offsetTop;
if(e.offsetParent!=null) offset+=getTop(e.offsetParent);
return offset;
}

function getLeft(e){
var offset=e.offsetLeft;
if(e.offsetParent!=null) offset+=getLeft(e.offsetParent);
return offset;
}

function showCenter(obj,w,h){
    obj.style.top = (document.documentElement.scrollTop + (document.documentElement.clientHeight -h)/3) + "px";
    obj.style.left = (document.documentElement.scrollLeft + (document.documentElement.clientWidth - w)/2) + "px";
}

String.prototype.Trim = function() {
  return this.replace(/(^\s*)|(\s*$)/g,"");
}

var xmlHttp = false;

function Ajax(sURL,dele) {
	
	try {
		
		xmlHttp = new XMLHttpRequest();
	} 
	catch (trymicrosoft) {
		
		try {
			
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) {
			
			try {
				
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (failed) {
				
					xmlHttp = false;
			}
		}
	}
	if (!xmlHttp) {
		alert("request failed");
	}
	else {
		
		var url = sURL;
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = dele;
		xmlHttp.send(null);
	}
}

