////////////////////
//common function
///////////////////
function getBrowser(){
	var s = navigator.userAgent.toLowerCase();
	var a = new Array("msie", "firefox", "safari", "opera", "netscape");
	for(var i = 0; i < a.length; i ++){
	   if(s.indexOf(a[i]) != -1){
	    return a[i];
	   }
	}
	return "other";
}

function openWindow(url,width,height){
	var b=getBrowser();
	if(!width)
		width=780;
	if(!height)
		height=500;
	var features = "model=yes,location=no,menubar=no,status=no,dialog=yes,scrollbars=yes,width=" + width + "px,height=" + height + "px";
	switch(b){
		case "msie":
			closedChild=window.open(url,"test",features);
			break;
		case "firefox":
			closedChild=window.open(url, "test", features);
			break;
		default:
			closedChild=window.open(url);
			break;
	}
	return closedChild;
}
	
function delay(t){
	var t0=(new Date()).getTime();
	while((new Date()).getTime()-t0<t){
	}
}

function newXmlHttp(){
 var xmlHttp;
 try{
	 if( window.XMLHttpRequest ){
	  	xmlHttp = new XMLHttpRequest();
	 }else if( window.ActiveXObject ){
	   for( var i = 5; i; i-- ){
		   try{
			    if( i == 2 ){
			      xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
			     }else{
			      xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
			     }
			    break;
		   }
		   catch(e){
		    	xmlHttp = false;
		   }
	  	}
	 } 
 }catch(e){ xmlHttp = false; } 
 return xmlHttp;
}