﻿/*String.prototype.Trim = function(){return this.replace(/(^[\s]*)|([\s]*$)/g, "");}
String.prototype.LTrim = function(){return this.replace(/(^[\s]*)/g, "");}
String.prototype.RTrim = function(){return this.replace(/([\s]*$)/g, "");}
function $(_sId){return document.getElementById(_sId);}*/
/*
获取客户端Radio的value值
*/
function GetRadioValue(elementsname)
	{	
	    tempstr='';
		for(var i=0;i<document.getElementsByName(elementsname).length;i++){
		if(document.getElementsByName(elementsname)[i].checked){
			 tempstr=document.getElementsByName(elementsname)[i].value;
			 break;
			}
		}
		return tempstr;
	}
function exist(s){return $(s)!=null;}
function closediv(d){$(d).style.display=$(d).style.display=="none"?"":"none";}
function removediv(d){document.body.removeChild(d);}
function switchstate(s){$(s).style.border=($(s).style.border=="")?"1px solid #000000":"";}
function relocation(url,t){
 	setTimeout("top.location.href='"+url+"';",t);
 }
 function thisrelocation(url,t){
 	setTimeout("window.location.href='"+url+"';",t);
 }
function getFrameNode(sNode){
	return document.frames ? document.frames[sNode] : document.getElementById(sNode).contentWindow;
}
function existChild(s,f){
	var children=document.getElementById(s).childNodes;
	if (children.length!=f){return false;}else{ return true;}
}
function InFrameResize(){
	if(getFrameNode("index").document.body.scrollHeight<$('MemberLeft').offsetHeight){
		window.parent.document.getElementById("index").style.height=$('MemberLeft').offsetHeight+"px";
	}else{
		window.parent.document.getElementById("index").style.height=getFrameNode("index").document.body.scrollHeight+"px";
		$('MemberB')['style']['height']=getFrameNode("index").document.body.scrollHeight+"px";
	}
	   // $('MemberB')['style']['height']=window.parent.document.getElementById("index").style.height-1+"px";
}
    function CheckAll(form)  
      {  
      for (var i=0;i<form.elements.length;i++)  
        {  
        var e = form.elements[i];  
        if (e.name != 'chkall')  
           e.checked = form.chkall.checked;  
        }  
      }  
function GetXY(){
		var theX,theY; 
		if(window.innerWidth){ 
		theX=window.innerWidth; 
		}
		else if(document.documentElement && document.documentElement.clientWidth){ 
		theX=document.documentElement.clientWidth; 
		}else if(document.body){ 
		theX=document.body.clientWidth; 
		} 
		if(window.innerHeight){ 
		theY=window.innerHeight; 
		}else if(document.documentElement && document.documentElement.clientHeight){ 
		theY=document.documentElement.clientHeight; 
		}else if(document.body){ 
		theY=document.body.clientHeight; 
		}
		return[theX,theY];
}
 //层初始化位置
 function divInit(_sId,int1,int2){ 
 	 var xy=GetXY();
 	$(_sId)['style']['display'] = '';
	$(_sId)['style']['position'] = "absolute";
 	 switch(int1){
 	 	 case 1://left
 	 	 	 $(_sId)['style']['left'] = '5px';
 	 	 	 break;
 	 	 case 2://right
 	 	 	 $(_sId)['style']['left'] = (xy[0]-$(_sId).offsetWidth -5)+"px";
 	 	 	 break;
 	 	 default:
 	 	 	 document.getElementById(_sId)['style']['left'] = (xy[0] / 2) - ($(_sId).offsetWidth / 2)+"px";
 	 	 	 break;
	 }
	 switch(int2){
	 	case 1://top
	 		$(_sId)['style']['top'] ='5px';
	 		break;
	 	default://mid
	 		$(_sId)['style']['top'] = (xy[1] / 2 + document.body.scrollTop) - ($(_sId).offsetHeight / 2)+"px";
	 		break;
	 }
 }
 function addschedule(int1){
 	 if(int1==0){
	 	var m=document.createElement('div');
	 	m.id='schedule';
	 	m['style']['position'] = "absolute";
	 	m['style']['z-index']='999';	 	
	 	m['style']['border']='1px solid #6298CD';
	 	m['style']['width']='200px';
	 	m['style']['padding']='15 15 15 15';
	 	m['style']['backgroundColor']='#EFF3FB';
	 	m.innerHTML='正在加载信息……';
	 	document.body.appendChild(m);
	 	divInit('schedule',0,0);
 	 }else{
 	 	 if(exist('schedule')){
 	 	 	document.body.removeChild($('schedule'));
 	 	 }
 	 }
 }
 
 function movediv(){
 	function $(_sId){return document.getElementById(_sId)}
 	this.moveStart = function (event, _sId){
		var oObj = $(_sId);
		oObj.onmousemove = mousemove;
		oObj.onmouseup = mouseup;
		oObj.setCapture ? oObj.setCapture() : function(){};
		oEvent = window.event ? window.event : event;
		var dragData = {x : oEvent.clientX, y : oEvent.clientY};
		var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
		function mousemove(){
			var oEvent = window.event ? window.event : event;
			var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
			var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
			oObj.style.left = iLeft;
			oObj.style.top = iTop;
			dragData = {x: oEvent.clientX, y: oEvent.clientY};			
		}
		function mouseup(){
			var oEvent = window.event ? window.event : event;
			oObj.onmousemove = null;
			oObj.onmouseup = null;
			if(oEvent.clientX < 1 || oEvent.clientY < 1 || oEvent.clientX > document.body.clientWidth || oEvent.clientY > document.body.clientHeight){
				oObj.style.left = backData.y;
				oObj.style.top = backData.x;
			}
			oObj.releaseCapture ? oObj.releaseCapture() : function(){};
		}
	}	
 }
 
 /*检测是否加载了js文件*/
	function IsInitJs(jsname){
		var f=false;
		for(var i=0;i<document.scripts.length;i++){
			var s=document.scripts[i].src;			
			s=s.split('/');
			var f=s[s.length-1];
			f=f.substr(1,f.length-3);
			if(f.toLowerCase()==jsname.toLowerCase()){
				f=true;
				break;
			}
		}
		return f;
	}
