﻿// JScript 文件

 
function Objectshow(obj,n)
{
     if(n==1)
     {
          searchMenu = document.getElementById(obj);
          searchMenu.style.visibility = "hidden";
          searchMenu.style.display = 'none';
          return ;
      }
      if(n==2)
      {
          searchMenu = document.getElementById(obj);
          searchMenu.style.visibility = "visible";
          searchMenu.style.display = '';
          return ;
        }
 }
//得到复选框的值

function getCboxValue(ostr)
{
       var vstr='';
       var  obj=document.getElementsByName(ostr) ;  
 
         for  (var  i=0;  i<obj.length;  i++)
         {  
             if(obj[i].checked  == true)
             {
              vstr= vstr + ','+ obj[i].value ;
             }
         }     
         return vstr;
}
//得到select的Value值

function getSelectValue(ostr)
{
       var  obj=document.getElementById(ostr) ;  
 
         for  (var  i=0;  i<obj.length;  i++)
         {  
             if(obj[i].selected  == true)
             {
              return obj[i].value ;
             }
         }           
}


//得到select的Text值

function getSelectText(ostr)
{
       var  obj=document.getElementById(ostr) ;  
 
         for  (var  i=0;  i<obj.length;  i++)
         {  
             if(obj[i].selected  == true)
             {
              return obj[i].text ;
             }
         }           
}

//设置selected

function setSelected(ostr,vstr)
{
       var  obj=document.getElementById(ostr) ;  
       if(obj!=null) 
       {
         for  (var  i=0;  i<obj.length;  i++)
         {  
             if(obj[i].value  == vstr)
             {
             obj[i].selected=true;
              return   ;
             }
         }   
         }        
}

//得到listBox的value值

function getListBox(ostr,mark)
{
    var reStr="";
    var obj=document.getElementById(ostr);
       for  (var  i=0;  i<obj.length;  i++)
     {  
         if(obj[i].selected  == true)
         {
            if(reStr=="")
            {
            reStr=obj[i].value ;
            }
            else
            {
            reStr=reStr +mark+ obj[i].value ;
            }
         }
     }  
     return  reStr
}

//从一个ListBox到另外一个ListBox
    function FormToList(objFrom,objTo)
    {
      var oFrom=document.getElementById(objFrom);
      var oTo=document.getElementById(objTo);

      for(var i=oFrom.length-1;i>=0;i--)
      {
        if(oFrom[i].selected==true)
        {
            var opt=new  Option(oFrom[i].text,oFrom[i].value);   
            oTo.options.add(opt); 
            oTo[oTo.length-1].selected=true;
            oFrom.removeChild(oFrom[i]);  
        }
      }
    }
/*
 JavaScript 实现的Sleep功能
*/

function Pause(obj,iMinSecond){ 
 if (window.eventList==null) window.eventList=new Array(); 
 var ind=-1; 
 for (var i=0;i<window.eventList.length;i++){ 
  if (window.eventList[i]==null) { 
   window.eventList[i]=obj; 
   ind=i; 
   break; 
  } 
 } 
  
 if (ind==-1){ 
  ind=window.eventList.length; 
  window.eventList[ind]=obj; 
 } 
 setTimeout("GoOn(" + ind + ")",iMinSecond); 
} 
/* 
该函数把要暂停的函数放到数组window.eventList里，同时通过setTimeout来调用继续函数。 

继续函数如下： 
*/ 

function GoOn(ind){ 
 var obj=window.eventList[ind]; 
 window.eventList[ind]=null; 
 if (obj.NextStep) obj.NextStep(); 
 else obj(); 
} 
/* 
/*
 JavaScript 实现的Sleep功能
*/
//
  function getQuery(name)   
  {   
      var reg =new  RegExp("(^|&)"+   name   +"=([^&]*)(&|$)");   
      var r=window.location.search.substr(1).match(reg);   
      if(r!=null) 
      {  
      return  unescape(r[2]); 
      }
      else
      {
        return   null;   
      }
  }  
//打开网页
/*
 function OpenStr(obj,Url)
 {
  str=window.showModalDialog(Url,'','dialogWidth=650px;dialogHeight=450px');
  if(str==null)
  {
  str='';
  }
  if(str!='')
  {
  z=document.getElementById(obj);
  z.value=str;
  }
 }
 */
  function OpenStr(obj,Url)
 {
    var x = window.screen.width/2;
    var y = window.screen.height/2;
    var str;
    var isMSIE= (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器 
    if (isMSIE) 
    { 
        str = window.showModalDialog(Url,'',"dialogWidth:650px; dialogHeight:450px;status:no; directories:yes;scrollbars:no;Resizable=no;"); 
    } 
    else 
    { 
     var win = window.open(Url, "mcePopup", "top=150,left=150,dialog=yes,modal=yes,width=650px,height=400px,resizable=no" ); 
     win.focus(); 
    } 
  
  if(str==null)
  {
  str='';
  }
  if(str!='')
  {
  z=document.getElementById(obj);
  z.value=str;
  }
 }

  function OpenStr2(obj,Url,w,h)
 {
    var x = window.screen.width/2;
    var y = window.screen.height/2;
    var str;
    var isMSIE= (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器 
    if (isMSIE) 
    { 
        str = window.showModalDialog(Url,'',"dialogWidth:"+w+"px; dialogHeight:"+h+"px;status:no; directories:yes;scrollbars:no;Resizable=no;"); 
    } 
    else 
    { 
     var win = window.open(Url, "mcePopup", "top=150,left=150,dialog=yes,modal=yes,width="+w+"px,height="+h+"px,resizable=no" ); 
     win.focus(); 
    } 
  
  if(str==null)
  {
  str='';
  }
  if(str!='')
  {
  z=document.getElementById(obj);
  z.value=str;
  }
 }

  function ShowIssueid()
        {//gv_show__ctl11_lbl_issueid
            document.getElementById("p_issueid").value = "";
            var count = document.getElementById("ttb_PageIndex").value;
            //count = count+2;
            for(var i=2;i<count;i++)
            {            
                 var aa = "gv_show__ctl"+i+"_lbl_issueid";
                 var bb = "gv_show__ctl"+i+"_cb_checked";
                 if(document.getElementById(bb).checked)
                 {
                    document.getElementById("p_issueid").value +=document.getElementById(aa).value+"|";
                 }
            }
        }
        
        
        function clearkeytxt(controlid,txt)
    {
        if(document.getElementById(controlid).value==txt)
            {
                document.getElementById(controlid).value = "";
            }
    }
    
    function addkeytxt(controlid,txt)
    {
        if(document.getElementById(controlid).value.length<=0)
            {
                document.getElementById(controlid).value = txt;
            }
    }
        function GetCurrentUrl()
            {
                document.getElementById("Top_Txt_url").value = self.location;
            }
            
            
   function table_checkbox(id)//遍历table下的所有checkbox
            {
             var count = 0;
             var obj = document.getElementById(id);
             for(var a=0;a<obj.rows.length;a++)
                {
                    for(var b=0;b<obj.rows[a].cells.length;b++)
                        {
                            if(obj.rows[a].cells[b].firstChild!=null)
                                {
                                   if(obj.rows[a].cells[b].firstChild.type=="checkbox");
                                        {
                                            if(obj.rows[a].cells[b].firstChild.checked)
                                                {
                                                    count=count+1;
                                                    if(count>=3)
                                                        {
                                                           table_true(count,id);
                                                        }
                                                     else
                                                        {
                                                            table_false(id)
                                                        }   
                                                }
                                        }
                                }
                        }
                } 
            } 
            
         function  table_true(count,id)
          {
             var obj = document.getElementById(id);
             for(var a=0;a<obj.rows.length;a++)
                {
                    for(var b=0;b<obj.rows[a].cells.length;b++)
                        {
                            if(obj.rows[a].cells[b].firstChild!=null)
                                {
                                   if(obj.rows[a].cells[b].firstChild.type=="checkbox");
                                        {
                                            if(obj.rows[a].cells[b].firstChild.checked)
                                                {
                                                    obj.rows[a].cells[b].firstChild.disabled = false;
                                                }
                                             else
                                                {
                                                    obj.rows[a].cells[b].firstChild.disabled = true;
                                                }   
                                        }
                                }
                        }
                } 
            }
            
         function  table_false(id)
          {
             var obj = document.getElementById(id);
             for(var a=0;a<obj.rows.length;a++)
                {
                    for(var b=0;b<obj.rows[a].cells.length;b++)
                        {
                            if(obj.rows[a].cells[b].firstChild!=null)
                                {
                                   if(obj.rows[a].cells[b].firstChild.type=="checkbox");
                                        {
                                            obj.rows[a].cells[b].firstChild.disabled = false;
                                        }
                                }
                        }
                } 
            }
    
     
/* <![CDATA[ */
function toBreakWord(intLen,objid)
{
if(document.all)  return;
var obj=document.getElementById(objid);
var strContent=obj.innerHTML;
var strTemp="";
while(strContent.length>intLen)
{
strTemp+=strContent.substr(0,intLen)+"&#10;";
strContent=strContent.substr(intLen,strContent.length);
}
strTemp+="&#10;"+strContent;
obj.innerHTML=strTemp;
}

/* ]]> */  
              
              
 /*
 2008-03-17
 tongweifu 
 ___Predigest Application___*/
function $(el)
{
	if(!el)
	{
		return null;
	}
	else if(typeof el=='string')
	{
		return document.getElementById(el);
	}
	else if(typeof el=='object')
	{
		return el;
	}
}  
      