﻿// JScript 文件

//显示隐藏左栏
function hide_div(hid_id,opener_id)
{
    var obj=document.getElementById (hid_id);
    if (obj.style.display=="none")
{
    obj.style.display="";
    document.getElementById (opener_id).title ="关闭";
    document.getElementById(opener_id).src="/App_themes/default/img/1_mid_close_btn.jpg";
}
else
{
    obj.style.display="none";
    document.getElementById (opener_id).title ="打开";
    document.getElementById(opener_id).src="/App_themes/default/img/1_mid_open_btn.jpg";
    
}
}

//翻转图片
function swap_div(mainid,childid,swapcss,swapoffcss)
{
var swap_obj=document.getElementById(childid);
var swap_mainobj=document.getElementById(mainid);
if (swap_obj.style.display=="none")
{
swap_obj.style.display="";
swap_mainobj.className=swapcss;
}
else
{
swap_obj.style.display="none";
swap_mainobj.className=swapoffcss;

}
}

//预先加载图片

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


  //选项卡菜单旧方法,不推荐使用
  
   var bar_count=0;
    function show_bar(t)
    {    
    obj=document.getElementById ("t"+t);
    obj_a=document.getElementById ("m"+t)
    for (i=0;i<bar_count;i++)
    {
    document.getElementById ("t"+i).style.display="none";
    document.getElementById ("m"+i).className ="tabbar";
     }
    obj.style.display="";
    obj_a.className="tabbar_visited";
    }
  
  
//选项卡菜单
//
var b_count=1;
function show_tab(m,t,i)
{
obj=document.getElementById(t+i);
obj_a=document.getElementById(m+i);
for (ii=0;ii<b_count;ii++)
{
  document.getElementById (t+ii).style.display="none";
  document.getElementById (m+ii).className ="tabbar";

}
obj.style.display="";
obj_a.className="tabbar_visited";
}  
  

//只拖拽层不改变大小
// var   ms1=0;   
//  function   dragdiv(obj){
//  ms1=obj;   
//  event.srcElement.setCapture();   
//  x=document.all(ms1).style.pixelLeft-event.x;   
//  y=document.all(ms1).style.pixelTop-event.y;   
//  }   
//    
//  function   document.onmousemove(){   
//  if(ms1!=""){   
//  document.all(ms1).style.pixelLeft=x+event.x;   
//  document.all(ms1).style.pixelTop=y+event.y;   
//  }   
//  }   
//    
//  function   document.onmouseup(){   
//  if(ms1!=""){   
//  event.srcElement.releaseCapture();   
//  ms1=0;   
//  }   
//  }  
  

//拖拽图层

 var   ms=0;   
   var _evt1=0;
  function   did(obj,_evt){
  ms=obj;   
_evt1=_evt;
  event.srcElement.setCapture();   
  x=document.all(ms).style.pixelLeft-event.x;   
  y=document.all(ms).style.pixelTop-event.y;   
  }   
    
  function   document.onmousemove(){   
  if(ms!=""){   
  if (_evt1=="1")
  {
  document.all(ms).style.pixelLeft=x+event.x;   
  document.all(ms).style.pixelTop=y+event.y;   
  }
  else if(_evt1=="2")
  {
   document.all(ms).style.width=event.clientX-document.all(ms).style.pixelLeft;   
 document.all(ms).style.height=event.clientY-document.all(ms).style.pixelTop;   
  }
  }   
  }   
    
  function   document.onmouseup(){   
  if(ms!=""){   
  event.srcElement.releaseCapture();   
  ms=0;   
  _evt1=0;
  }   
  }  
  
  
  
  
  
  //以下无用
// var  msdiv=0;   
//  function   div_resize(obj){
//  msdiv=obj;   
//  event.srcElement.setCapture();   
//  x=document.all(msdiv).style.pixelLeft-event.x;   
//  y=document.all(msdiv).style.pixelTop-event.y;   
//  }   
//    
//  function   document.onmousemove(){   
//  if(msdiv!=""){   
//  document.all(msdiv).style.width=x+event.x;   
//  document.all(msdiv).style.height=y+event.y;   
//  }   
//  }   
//    
//  function   document.onmouseup(){   
//  if(msdiv!=""){   
//  event.srcElement.releaseCapture();   
//  msdiv=0;   
//  }   
//  }  


//拖拽图层结束

//打开定制的窗口
function open_win(u,r,l,h,w)
{
var myheight=h;
var mywidth=w;
load_top=(screen.availheight/2-myheight/2-50);
load_left=(screen.availwidth/2-mywidth/2);
window.open(u,r,"height="+ myheight +", width="+ mywidth +", top="+ load_top +", left="+ load_left +",toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, status=no");

}
 

//打开特定窗口结束

//打开模态窗口
function open_da()
{


}


//打开模态窗口结束

// 顶层执行代码

function changeFaceAdpter(str){
			var msgw,msgh,bordercolor;
			msgw=380;//提示窗口的宽度
			msgh=120;//提示窗口的高度
			titleheight=25 //提示窗口标题高度
			bordercolor="#333";//提示窗口的边框颜色 
			titlecolor="#445588";//提示窗口的标题颜色
			
			var sWidth,sHeight;
			sWidth=screen.width;
			
			sHeight=top.document.body.scrollHeight;

			var bgObj=top.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=3,opacity=25,finishOpacity=75,finishOpacity=100);";
			bgObj.style.opacity="0.6";
			bgObj.style.left="0";
			bgObj.style.width=sWidth + "px";
			bgObj.style.height=sHeight + "px";
			bgObj.style.zIndex = "10000";
			top.document.body.appendChild(bgObj);
			//bgObj=null;
			
			
			var msgObj=top.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 = (sWidth - msgw) / 2 + "px";
            msgObj.style.top = "35%";
            msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
            msgObj.style.marginLeft = "0" ;
            msgObj.style.marginTop = /*-75+*/top.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";
   			msgObj.style.padding = "0 0 20px 0";
			
		   var title=top.document.createElement("h4");
		   title.setAttribute("id","msgTitle");
		   title.setAttribute("align","right");
		   title.style.margin="0";
		   title.style.padding="3px";
		   title.style.background="#333";
		   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="关闭";
		   title.onclick=function alertclose(){
		        			top.document.body.removeChild(bgObj);
	                top.document.getElementById("msgDiv").removeChild(title);
        	        top.document.body.removeChild(msgObj);
        	       bgObj=null;
        	       msgObj=null;
        	       title=null;
        	       skinnercontainer=null;
                	}
		   
		   
		
		 var skinnercontainer = top.document.createElement("div");
		
		 skinnercontainer.style.marginTop="10px";
		 
		 var skinners = new Array();
		 skinners[0]="blue";
		 skinners[1]="silver";
		 skinners[2]="yellow";
	
		 var skinnersdes = new Array();
		 skinnersdes[0]="<br>蓝色</br>";
		 skinnersdes[1]="<br>银色</br>";
		 skinnersdes[2]="<br>黄色</br>";
	
		 for(i=0;i<skinners.length;i++){
		 	
			var skinner=top.document.createElement("a");
			skinner.style.width="60px";
			skinner.style.cssFloat="left";
			skinner.href="#";
			skinner.name=skinners[i];
			skinner.onclick=function mk(){
					var URL = top.location.href;	
					if(URL != null && URL.indexOf("?theme=") != -1){
					URL = URL.substring(0,URL.indexOf("?theme="));
					top.document.body.removeChild(bgObj);
	                top.document.getElementById("msgDiv").removeChild(title);
        	        top.document.body.removeChild(msgObj);
        	        top.window.onunload=function () { return false;};
        	       bgObj=null;
        	       msgObj=null;
        	       title=null;
        	       skinnercontainer=null;
				}
				top.location = URL + "?theme=" + this.name;
//				deleteCookie("road");
//				var the_date = new Date("December 31, 2020");
//				setCookie("road",this.name,the_date,"/");
//				alertclose();
				}
			
		 //	skinner.innerHTML="<img src='img/pic/"+skinners[i]+".gif' width='48' border=0 />"+skinnersdes[i];
		 skinner.innerHTML="<img src='img/theme_"+skinners[i]+".jpg' width='40' border=0 />"+skinnersdes[i];
		 	skinner.style.padding="3px 3px 3px 3px";
		 	
//			if(getCookie('road')&&getCookie('road')==skinners[i]){
//				skinner.style.background="FFCC66";
//			}
//			
			
			var skinnerbox=top.document.createElement('span');
			
			skinnerbox.appendChild(skinner);
			
			
		 	skinnercontainer.appendChild(skinnerbox);
		 	msgObj.appendChild(title);
		    msgObj.appendChild(skinnercontainer);
top.document.body.appendChild(msgObj);

		//	msgObj=null;
 
			 }
		 
     }




function showSysSugg(){
			var msgw,msgh,bordercolor;
			//var URL="a.html";
			msgw=550;
			msgh=400;
			bordercolor="#333";
			
			var sWidth,sHeight;
			sWidth=screen.width;
			sHeight=top.document.body.scrollHeight;

			var bgObj=top.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=3,opacity=25,finishOpacity=75,finishOpacity=100);";
			bgObj.style.opacity="0.6";
			bgObj.style.left="0";
			bgObj.style.width=sWidth + "px";
			bgObj.style.height=sHeight + "px";
			bgObj.style.zIndex = "10000";
			//var bgiframe=top.document.body.createElement("iframe");
			//bgiframe.
			// var str1 = '<iframe frameborder=0 width=0 height=0 marginheight=0 marginwidth=0 scrolling=no></iframe>'
//			var str1='<iframe  style="filter:progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75,finishOpacity=100);opacity:0.6; height:100%;width:100%;position: absolute;clear: none;vertical-align: middle; text-align: center; left:0px; top:0px; background-color: #ccccff;" frameborder=0 ></iframe>';
//bgObj.innerHTML='<iframe  style="filter:progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75,finishOpacity=100);opacity:0.6; height:100%;width:100%;position: absolute;clear: none;vertical-align: middle; text-align: center; left:0px; top:0px; background-color: #ccccff;" frameborder=0 ></iframe>';		 
			top.document.body.appendChild(bgObj);
			
            var msgObj=top.document.createElement("div")
            msgObj.setAttribute("id","msgDiv");
            //msgObj.style.background="white";
            //msgObj.style.border="1px solid " + bordercolor;
            msgObj.style.position = "absolute";
            msgObj.style.left = (sWidth - msgw) / 2 + "px";
            msgObj.style.top = "17%";
            msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
            msgObj.style.marginLeft = "0" ;
            msgObj.style.marginTop = /*-75+*/top.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";
            msgObj.style.padding = "0 0 0 0";
		   
		
		   
		      var title=top.document.createElement("h4");
		   title.setAttribute("id","msgTitle");
		   title.setAttribute("align","right");
		   title.style.margin="0";
		   title.style.padding="3px";
		   title.style.background="#333";
		   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="<font onclick=window.parent.remove();>关闭</font>";
		
//	 title.onclick=function alertclose(){
//		        	top.document.body.removeChild(bgObj);
//	                top.document.getElementById("msgDiv").removeChild(title);
//	             //   top.document.getElementById("divHelp").innerHTML="";
//	            //    top.document.getElementById("bgDiv").innerHTML="";
//	                top.document.getElementById("msgDiv").removeChild(divHelper);
//        	        top.document.body.removeChild(msgObj);
//        	       divHelper=null;
//        	       title=null;
//        	        msgObj=null;
//        	         bgObj=null; 
//                	}
		
		   
	

		 var divHelper = top.document.createElement("div");
		 divHelper.style.marginTop="0px";
		 divHelper.style.zIndex="9999";
		 divHelper.setAttribute("id","divHelp");
		 divHelper.style.width="100%";
		 divHelper.style.height="100%";
		 

                divHelper.innerHTML= '<iframe id=objiframe name=objiframe frameborder=0 src="login.aspx?tmp='+ Math.random() +'" width=100% height=100% marginheight=0 marginwidth=0 scrolling=no></iframe>';
 
            msgObj.appendChild(title);
            msgObj.appendChild(divHelper);
            top.document.body.appendChild(msgObj);
		

}

function c_remove() {
	//调用父窗口index.jsp中的remove()方法
	window.parent.remove();
}
remove = function() {
	
	top.document.getElementById("msgDiv").removeChild(document.getElementById('msgTitle'));
	 top.document.getElementById("msgDiv").removeChild(document.getElementById('divHelp'));
	 document.body.removeChild(document.getElementById('bgDiv'));
	document.body.removeChild(document.getElementById('msgDiv'));
	//document.body.removeChild(document.getElementById('sysSuggestionDiv'));
	//var floatDiv = document.getElementById('floatDiv');
	//floatDiv.style.visibility = 'visible';
}
//顶层执行代码结束

// 层的方式显示提示信息


function hide_div_msg()
{
top.document.getElementById ("DivBg").style.display ="none";
top.document.getElementById("DivMsg").style.display ="none";
}
function show_div_msg(msg)
{
top.document.getElementById("DivMsg").style.display ="";
top.document.getElementById ("DivBg").style.display ="";
top.document.getElementById('DivMsg_Header_title').innerHTML ='系统提示';
top.document.getElementById('DivMsg_Msg').innerHTML=msg;
//document.getElementsByName("DivMsg_Msg")[0].innerHTML='难道不能使用BYNAME吗？';
}


//层的方式显示信息结束
//层的方式显示框架页

function show_div_iframe(modelname,url,width,height)
{
 //alert("fds");
top.document.getElementById ('DivIframeBg').style.display ='';
top.document.getElementById("DivIframe").style.display ="";
top.document.getElementById('DivIframe').style.left=(top.document.body.clientWidth-width)/2;
//top.document.getElementById('DivIframe').style.top=(top.document.body.clientHeight-height)/2;
top.document.getElementById('DivIframe').style.top="100px";
top.document.getElementById('DivIframe').style.width=width+"px";
top.document.getElementById('DivIframe').style.height=height+"px";
top.document.getElementById('DivIframe_Header_model').innerHTML ="[农易网]"+modelname;
top.document.getElementById('Div_Iframe_iframe').src=url+'&tmp='+Math.random();
//document.getElementsByName("DivMsg_Msg")[0].innerHTML='难道不能使用BYNAME吗？';
 
//top.document.getElementById('DivIframe_Header_title_new').onclick=function ()
//{
//  open_win(url,'','',height,width);
//  hid_div_iframe();

//}
//top.document.getElementById('DivIframe_Header_title_dk').onclick=function ()
//{
//    var div_obj=top.document.getElementById ("DivIframe_Header_title_dk");
//    if (div_obj.title=="最大化")
//    {
//   max_div_iframe();
//   div_obj.title="还原窗口"
//   }
//   else{
//   
//   top.document.getElementById ('DivIframeBg').style.display ='';
//top.document.getElementById("DivIframe").style.display ="";
//top.document.getElementById('DivIframe').style.left=(top.document.body.clientWidth-width)/2;
//top.document.getElementById('DivIframe').style.top=(top.document.body.clientHeight-height)/2;
//top.document.getElementById('DivIframe').style.width=width+"px";
//top.document.getElementById('DivIframe').style.height=height+"px";
// div_obj.title="最大化";
//    }  
//  

//}
 


}
function hid_div_iframe()
{

top.document.getElementById ('DivIframeBg').style.display ='none';
top.document.getElementById("DivIframe").style.display ='none';
top.document.getElementById('DivIframe_Header_model').innerHTML ='';
top.document.getElementById('Div_Iframe_iframe').src='about:blank';
 
}

function max_div_iframe()
{

top.document.getElementById ('DivIframeBg').style.display ='';
top.document.getElementById("DivIframe").style.display ="";
top.document.getElementById('DivIframe').style.left=0;
top.document.getElementById('DivIframe').style.top=0;
top.document.getElementById('DivIframe').style.width=top.document.body.clientWidth;
top.document.getElementById('DivIframe').style.height=top.document.body.clientHeight;
 


}

 
 



//层的方式显示框架页结束

//层的方式显示确认框

function show_div_confirm(modelname,_event)
{
top.document.getElementById ('DivIframeBg').style.display ='';
top.document.getElementById("DivIframe").style.display ="";
top.document.getElementById('DivIframe').style.left=(document.body.clientWidth-width)/2;
top.document.getElementById('DivIframe').style.top=(document.body.clientHeight-height)/2;
top.document.getElementById('DivIframe').style.width=width+"px";
top.document.getElementById('DivIframe').style.height=height+"px";
top.document.getElementById('DivIframe_Header_model').innerHTML =modelname;
top.document.getElementById('Div_Iframe_iframe').src=url+'?tmp='+Math.random();
//document.getElementsByName("DivMsg_Msg")[0].innerHTML='难道不能使用BYNAME吗？';
}
function hid_div_confirm()
{
top.document.getElementById ('DivIframeBg').style.display ='none';
top.document.getElementById("DivIframe").style.display ='none';
top.document.getElementById('DivIframe_Header_model').innerHTML ='';
top.document.getElementById('Div_Iframe_iframe').src='';
}



//层的方式显示确认框结束




//联合选择CHECKBOX ，全选和反选

  function OnGridViewChecked(gv_obj) 
        { 
      
            var ele = event.srcElement; 
            if(ele.type=='checkbox') 
            { 
          
              //  var childrenDivID = ele.id.replace('CheckBox','Nodes'); 
                var div = document.getElementById(gv_obj); 
                if(div==null)
                    return;
                  //   alert('dd');
                var checkBoxs = div.getElementsByTagName('INPUT');
                for(var i=0;i<checkBoxs.length;i++)
                {
                   
                    if(checkBoxs[i].type=='checkbox'){
                        checkBoxs[i].checked=ele.checked;
                        }
                }
            } 
}


//注册AJAX方法：
var xmlHttp

function initializeXmlHttpRequest()
{
    var xmlhttp;
    try
    {
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlhttp=new XMLHttpRequest();
            }
            catch (e) {}
        }
    }
    return xmlhttp;
}

//xmlHttp=initializeXmlHttpRequest();
var i=0;



//返回innerhtml
function AjaxRequestHtml(urlstring,str,objdiv)
{ 
var url=""+ urlstring +"?sid=" + Math.random() + "&q=" + str
//ar objdiv="txtHint";
//var objdiv="txtHint";
xmlHttp=initializeXmlHttpRequest();
xmlHttp.onreadystatechange = function () {
if(xmlHttp.readyState == 1)
{
  document.getElementById(objdiv).innerHTML="<img src=/img/busy.gif align =absmiddle >&nbsp; loading...";
}
  if(xmlHttp.readyState == 4) {
  if(xmlHttp.status == 200) {
  //将结果反馈到HTML中id为readbook的标签里
  document.getElementById(objdiv).innerHTML=xmlHttp.responseText;
  }
  }
};

  xmlHttp.open("GET", url, true);
  xmlHttp.send(null);
  
} 


//返回value
function AjaxRequestValue(urlstring,str,obj)
{ 
var url=""+ urlstring +"?sid=" + Math.random() + "&q=" + str
//ar objdiv="txtHint";
//var objdiv="txtHint";
xmlHttp=initializeXmlHttpRequest();
xmlHttp.onreadystatechange = function () {
if(xmlHttp.readyState == 1)
{
  document.getElementById(obj).value="正在获取数据...";
}
  if(xmlHttp.readyState == 4) {
  if(xmlHttp.status == 200) {
  //将结果反馈到HTML中id为readbook的标签里
  document.getElementById(obj).value=xmlHttp.responseText;
  }
  }
};

  xmlHttp.open("GET", url, true);
  xmlHttp.send(null);
  
} 


//function show_div(div1,div2,div1,div2)
//{
//    
//    div1.className="news_title";
//    div2.className="new_content_show";
//    div3.className="news_title1";
//    div4.className="new_content_hiden";
//}

function getproductcode()
{

 var productcode ;
productcode=document.getElementById('hf_productcode').value;    
return productcode;
}
function getusercode()
{
 var usercode ;
usercode=document.getElementById ('hf_usercode').value ;
return usercode;
}