
/*2010-11-03 add by liu*/
function sAlert(str,urlstr){//
	var msgw,msgh,bordercolor,urlstr;
	msgw=400;//
	msgh=100;//
	titleheight=25 //
	bordercolor="#5F90C5";//
	titlecolor="#5F90C5";//
	
	var sWidth,sHeight;
	sWidth=document.body.offsetWidth;
	sHeight=screen.height;
	
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#777";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=1,opacity=25,finishOpacity=75";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width=document.documentElement.clientWidth || document.body.clientWidth;
	bgObj.style.height=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
	bgObj.style.zIndex = "10000";
	document.body.appendChild(bgObj);
	
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	msgObj.setAttribute("align","center");
	msgObj.style.background="white";
	msgObj.style.border="1px solid " + bordercolor;
	msgObj.style.position = "absolute";
	msgObj.style.left = "50%";
	msgObj.style.top = "50%";
	msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	msgObj.style.marginLeft = "-225px" ;
	msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height =msgh + "px";
	msgObj.style.textAlign = "center";
	msgObj.style.lineHeight ="25px";
	msgObj.style.zIndex = "10001";
	
	var title=document.createElement("h4");
	title.setAttribute("id","msgTitle");
	title.setAttribute("align","right");
	title.style.margin="0";
	title.style.padding="3px";
	title.style.background=bordercolor;
	title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
	title.style.opacity="0.75";
	title.style.border="1px solid " + bordercolor;
	title.style.height="18px";
	title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
	title.style.color="white";
	title.style.cursor="pointer";
	title.innerHTML="close";
	title.onclick=function(){
		document.body.removeChild(bgObj);
		document.getElementById("msgDiv").removeChild(title);
		document.body.removeChild(msgObj);
			if(urlstr!="")
			{
				eval(urlstr);
			}
		}
	document.body.appendChild(msgObj);
	document.getElementById("msgDiv").appendChild(title);
	var txt=document.createElement("p");
	txt.style.margin="1em 0"
	txt.setAttribute("id","msgTxt");
	txt.innerHTML=str+"<br><br>";
	
	
	/*var btn=document.createElement("INPUT");   
        btn.setAttribute("type","button");   
        btn.setAttribute("name","newname");   
        btn.setAttribute("value","close");
        btn.setAttribute("className","button");
	btn.onclick=function(){
		document.body.removeChild(bgObj);
		document.getElementById("msgDiv").removeChild(title);
		document.body.removeChild(msgObj);
			if(urlstr!="")
			{
				eval(urlstr);
			}
		}*/
	document.getElementById("msgDiv").appendChild(txt);
	document.getElementById("msgTxt").appendChild(btn);
}







function toboxs(){
		var boxs = document.getElementsByName("idbox");
		var id = document.getElementById("id");
		id.value="";
		for(var i = 0 ; i< boxs.length ;i++){
			if(boxs[i].checked)	
			id.value +=boxs[i].value+"@";
		}
	}

function tobox(obj){
		var boxid = document.getElementById("id");
		var boxes = document.getElementsByName("idbox");   
            for (var i = 0; i < boxes.length; i++){
	        if (boxes[i]==obj){
	          boxid.value = obj.value;
	          obj.checked;
	        }else{
	        	boxes[i].checked='';
	        } 
        } 
      //alert(boxid.value);
	}
	//left
	function ltrim(s){ 
	return s.replace( /^\s*/, ""); 
	} 
	//right
	function rtrim(s){ 
	return s.replace( /\s*$/, ""); 
	} 

	function trim(s){ 
	return rtrim(ltrim(s)); 
	} 
	
	
	
		function drag(o,s)  
			{  
		   if (typeof o == "string") o = document.getElementById(o);  
		   o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;  
		   o.orig_y = parseInt(o.style.top) - document.body.scrollTop;  
		   o.orig_index = o.style.zIndex;  
		         
		   o.onmousedown = function(a)  
		   {  
		       this.style.cursor = "move";  
		       this.style.zIndex = 10000;  
		       var d=document;  
		       if(!a)a=window.event;  
		       var x = a.clientX+d.body.scrollLeft-o.offsetLeft;  
		       var y = a.clientY+d.body.scrollTop-o.offsetTop;  
		       //author: www.longbill.cn  
		       d.ondragstart = "return false;"  
		       d.onselectstart = "return false;"  
		       d.onselect = "document.selection.empty();"  
		                 
		       if(o.setCapture)  
		           o.setCapture();  
		       else if(window.captureEvents)  
		           window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  
		
		       d.onmousemove = function(a)  
		       {  
		           if(!a)a=window.event;  
		           o.style.left = a.clientX+document.body.scrollLeft-x;  
		           o.style.top = a.clientY+document.body.scrollTop-y;  
		           o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;  
		           o.orig_y = parseInt(o.style.top) - document.body.scrollTop;  
		       }  
		
		       d.onmouseup = function()  
		       {  
		           if(o.releaseCapture)  
		               o.releaseCapture();  
		           else if(window.captureEvents)  
		               window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  
		           d.onmousemove = null;  
		           d.onmouseup = null;  
		           d.ondragstart = null;  
		           d.onselectstart = null;  
		           d.onselect = null;  
		           o.style.cursor = "normal";  
		           o.style.zIndex = o.orig_index;  
		       }  
		   }  
		     
		   if (s)  
		   {  
		       var orig_scroll = window.onscroll?window.onscroll:function (){};  
		       window.onscroll = function ()  
		       {  
		           orig_scroll();  
		           o.style.left = o.orig_x + document.body.scrollLeft;  
		           o.style.top = o.orig_y + document.body.scrollTop;  
		       }  
		   }  
			} 
