﻿//鏄剧ず闂儊鎻愮ず
var p = 0;
function ShowNotice(varIndex,iTimes)
{
	sBackBgColor = document.all(varIndex).style.backgroundColor;
	if (iTimes == 0 )
		document.all(varIndex).style.backgroundColor = "#fad185";
	else if(iTimes == 1 )
		document.all(varIndex).style.backgroundColor = "#fdffea";
	if(p>8)
	{
	   document.all(varIndex).style.backgroundColor = "#fdffea";
	   p = 0;
	   return "";
	 }
	    
	tmpIndex = document.all(varIndex).sourceIndex;
	if(iTimes==0)
	{
	    p ++;
	    window.setTimeout("ShowNotice(tmpIndex,1);",400);
	 }
	else if(iTimes == 1 )
	{
	    p ++;
	    window.setTimeout("ShowNotice(tmpIndex,0);",400);
	 }
   
}
function Check(varIndex,Message)
{
   var Name = varIndex.split("-");
   var n = 0;
  
   while (n<Name.length)
   {
        if(document.all(Name[n]).value == "")
        {
            document.all(Name[n]).focus();
            alert(Message);
            ShowNotice(Name[n],1);
            return false;
         }
        else if(n>=Name.length)
            return true;
        n ++;
    }
    
}
//鏍规嵁浼佷笟绫诲瀷 瀹氫箟鏌ョ湅浼佷笟鐨勯〉闈㈣繛鎺?
function GetEntPageUrl(EntKind)
{
	var root;
	EntKind=EntKind.toLowerCase();  
	root='/sycredit/';
    switch(EntKind)
    {
        case 'recon':
            return root+'Enterprise/EntPage/reconInfo.aspx?EntID='; 
        case 'design':
            return root+'Enterprise/EntPage/DesignInfo.aspx?EntID=';      
        case 'drawing':
            return root+'Enterprise/EntPage/auditInfo.aspx?EntID='; 
         case 'construct':
            return root+"Enterprise/EntPage/ConstructInfo.aspx?EntID="; 
        case "reality":       
            if(window.document.getElementById('h_Type').value=='reality')
            {
                return '/ASite/WebApp/bulletin/EnterpriseInfo.aspx?eid=';
            }
            return root+"Enterprise/EntPage/realityInfo.aspx?EntID="; 
        case "agent":
            return root+"Enterprise/EntPage/agentInfo.aspx?EntID="; 
        case "cost":
            return root+"Enterprise/EntPage/CostInfo.aspx?EntID="; 
        case "supervise":
            return root+"Enterprise/EntPage/superviseInfo.aspx?EntID="; 
        case "trial":
            return root+"Enterprise/EntPage/trialInfo.aspx?EntID="; 
        default :
            return root+"Enterprise/EntPage/DesignInfo.aspx?EntID=";
    }    
}
 
function dialog(Code,Name,WindowsName,entkind)
{
    if(window.document.getElementById(Code).value!="")
    {
        if(!window.confirm("鎸塠纭畾]閲嶆柊閫夋嫨浼佷笟锛屾寜[鍙栨秷]鏌ョ湅褰撳墠浼佷笟淇℃伅"))
        {  
            //鏍规嵁浼佷笟绫诲瀷鍙婄紪鐮侊紝鏌ョ湅浼佷笟淇℃伅
            ///ASite/WebApp/bulletin/EnterpriseInfo.aspx?eid=aa56a106-66c4-4d98-8c70-6aeeff997316
            //&begin=2006-9-1+10%3a23%3a31&end=9999-12-31+23%3a59%3a59&name=
            //%c9%f2%d1%f4%bd%f0%cd%d8%b7%bf%ce%dd%bf%aa%b7%a2%d3%d0%cf%de%b9%ab%cb%be
      if((window.document.getElementById('h_Type').value=='reality')&&entkind=='reality')
        {
                window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&begin=2006-9-1+10%3a23%3a31&end=9999-12-31+23%3a59%3a59&name='+window.document.getElementById(Name).value); 
                return ;            
            }
            window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
            return;
        
        }   
    }   
    str=window.showModalDialog(WindowsName+'?EntKind='+entkind,window,'dialogWidth:500px;dialogHeight:400px;scroll:yes;status:no; ');
   
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	   window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }               
         
 }
 
 function dialog_new(Code,Name,WindowsName,entkind)
{
    
    if(window.document.getElementById(Code).value!="")
    {   
        if(!window.confirm("点击确定选择相关信息,取消查看相关信用信息"))
        {  
            return;
            //			if(window.document.getElementById('h_Type')==null)
//			{
//				 window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
//	             return;
//			}
//			else
//			{  
//				 if((window.document.getElementById('h_Type').value=='reality')&&entkind=='reality')
//				{
//					window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&begin=2006-9-1+10%3a23%3a31&end=9999-12-31+23%3a59%3a59&name='+window.document.getElementById(Name).value); 
//					return ;            
//				}
//				else
//				{
//					window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
//					return;
//				}
//			} 
        }   
    }   
//   str=window.showModalDialog(WindowsName+'?EntKind='+entkind,window,'dialogWidth:500px;dialogHeight:500px;scroll:yes');
    
   var str=window.open(WindowsName+'?EntKind='+entkind+'&code='+Code+'&name='+Name,'Entwindow','toolbar=no,width=500,height=400');
   
  
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	  window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }               
         
 }
 
 /*为了在选择施工企业后自动显示安全生产许可证号*/
function dialog_new2(Code,Name,safecode,WindowsName,entkind)
{
    
    if(window.document.getElementById(Code).value!="")
    {   
        if(!window.confirm("点击确定选择相关信息,取消查看相关信用信息"))
        {  
            return;
			   
//			if(window.document.getElementById('h_Type')==null)
//			{
//				 window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
//	             return;
//			}
//			else
//			{  
//				 if((window.document.getElementById('h_Type').value=='reality')&&entkind=='reality')
//				{
//					window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&begin=2006-9-1+10%3a23%3a31&end=9999-12-31+23%3a59%3a59&name='+window.document.getElementById(Name).value); 
//					return ;            
//				}
//				else
//				{
//					window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
//					return;
//				}
//			} 
        }   
    }   
//   str=window.showModalDialog(WindowsName+'?EntKind='+entkind,window,'dialogWidth:500px;dialogHeight:500px;scroll:yes');
    
   var str=window.open(WindowsName+'?EntKind='+entkind+'&code='+Code+'&name='+Name+'&safecode='+safecode,'Entwindow','toolbar=no,width=500,height=400');
   
  
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	  window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }               
         
 }
 
 
 function dialog_newSuperviser(Code,Name,WindowsName,entkind)
 {
       var str=window.open(WindowsName+'?EntKind='+entkind+'&code='+Code+'&name='+Name,'Entwindow','toolbar=no,width=500,height=400');
   
  
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	  window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }
 }
 function dialog_new_manager(Code,Name,WindowsName,entkind)
{
   var str=window.open(WindowsName+'?EntNo='+entkind+'&code='+Code+'&name='+Name,'Managerwindow','toolbar=no,width=500,height=400');
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	  window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }               
         
 }
 
function dialog_allEnt(Code,Name,WindowsName)
{
   var str=window.open(WindowsName+'?code='+Code+'&name='+Name,'Managerwindow','toolbar=no,width=500,height=400');
   if (str != null)
   {
      if(str.length>0)
      {
	   s=str.split('|');
	   
	  window.document.getElementById(Code).value=s[0];
	    window.document.getElementById(Name).value=s[1];
	  }
    }               
         
 }
  function dialog_Construct(Code,Name,WindowsName,entkind)
{
 if(window.document.getElementById(Code).value!="")
    {
        if(!window.confirm("鎸塠纭畾]閲嶆柊閫夋嫨浼佷笟锛屾寜[鍙栨秷]鏌ョ湅褰撳墠浼佷笟淇℃伅"))
        {  
            //鏍规嵁浼佷笟绫诲瀷鍙婄紪鐮侊紝鏌ョ湅浼佷笟淇℃伅
            if((window.document.getElementById('h_Type').value=='reality')&&entkind=='reality')
				 {
                window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value.split('|')[0]+'&begin=2006-9-1+10%3a23%3a31&end=9999-12-31+23%3a59%3a59&name='+window.document.getElementById(Name).value,'',''); 
                return ;            
            }
            window.open(GetEntPageUrl(entkind)+window.document.getElementById(Code).value.split('|')[0]+'&EnterpriseKind='+entkind+'&OtherCity=0&IsRead=1'); 
            return;
        
        }   
    }   
          
   //str=window.showModalDialog(WindowsName+'?EntKind='+entkind,window,'dialogWidth:500px;dialogHeight:400px;scroll:yes');
   //alert(WindowsName+'?EntKind='+entkind);
   var str=window.open(WindowsName+'?EntKind='+entkind+'&code='+Code+'&name='+Name,null,'toolbar=no,width=500,height=500');
   
    
   if (str != null)
   {   
      if(str.length>0)
      {
	   s=str.split('|');
	   
	    document.getelementbyid(code).value=str;
	     document.getelementbyid(name).value=s[1];
	  }
    }               
         
 }
  
 
 function resutn()
 {             
   returnValue=window.document.getElementById("h_SelectItem").value;
   close();
 }
  function resutn1()
 {            
   close();
}

function  WindowAlert(str)
{ alert(str); }
function WindowLocation(url)
{
    location=url;
}

/*wangguangda 20070621*/
var s=top.location.href;
  var ss=location.href;
  //alert(s.indexOf('pagestate'));
  //alert(ss.indexOf('pagestate'));
 if((s.indexOf('pagestate')>0)&ss.indexOf('pagestate')<0)
 {
    if(ss.indexOf('?')>0)
    {
        location+='&pagestate=111111';    
    }
    else
    {
         location+='?pagestate=111111';   
    }
}
