﻿
function selectAll(Obj)
{
    var myObj=Obj.checked;
    
    for(var i=0;i < document.getElementsByName("chkselect").length;i++)
    {
       document.getElementsByName("chkselect")[i].checked=myObj;
    }
}


function isChkSelect()
{
    var isSelect=false;
    
    for(var i=0;i < document.getElementsByName("chkselect").length;i++)
    {
        if(document.getElementsByName("chkselect")[i].checked==true)
        {
            isSelect=true;
            break;
        }
    }
    
    if(isSelect)
    {
       //

       if(document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].value!="请选择")
       {
           if(document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].value=="删除")
           {
              if(confirm('您确定要删除所选择的项吗，删除后不可恢复，是否继续？'))
              {
                  return true;
              }
              else
              {
                  return false;
              }
           }
       }
       else
       {
           alert("抱歉，您还没有选择操作类型，请先选择！");
           return false;
       }       
    } 
    else
    {
       alert("抱歉，您没有选择任何项进行操作，请选择！");
       return false;
    }
}


function init()
{
   var allPage="";
   var myStr="";
   
   

   for(var i=0;i <=20;i++)
   {

      var myObj=eval("document.getElementById(\"oContentDiv_"+i+"\")");
      
	  if(i == 1)
	  {
		  if(myObj != null)
		  {
			  myStr+="<a style=\"cursor:pointer;font-weight:bold;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
			  allPage += 1;
		  }
		  else
		  {
			  myStr+="<a style=\"cursor:pointer;font-weight:bold;\" onclick=\"changePage('"+(i-1)+"')\">[第"+i+"页]</a>&nbsp;";
			  allPage += 1;
		  }
		  
	  }
	  else if(i > 1)
	  {
		  if(myObj != null)
		  {
		      myStr+="<a style=\"cursor:pointer;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
			  allPage += 1;
		  }
		
	  }
	  else
	  {
		  if(myObj != null)
		  {
			  var o = eval("document.getElementById(\"oContentDiv_"+i+"\")");
			  o.style.display = "block";
		  }
	  }
	  
   }
   
   if(allPage>1)
   {
      document.getElementById("ctl00_ContentPlaceHolder1_NewsShow1_ContentShow1_Pager").innerHTML=myStr; 
   }
}


/*function init()
{
   var allPage="";
   var myStr="";
   
   

   for(var i=1;i <=20;i++)
   {

      var myObj=eval("document.getElementById(\"oContentDiv_"+i+"\")");
      

      if(myObj!=null)
      {
         if(i==1)
         {
            myStr+="<a style=\"cursor:pointer;font-weight:bold;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
         }
         else
         {
           myStr+="<a style=\"cursor:pointer;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
         }
         allPage+=1;
      }
      else
      {
         var o = eval("document.getElementById(\"oContentDiv_0\")");
         o.style.display = "block";
         break;
      }

   }
   
   if(allPage!=1)
   {
      document.getElementById("ctl00_ContentPlaceHolder1_NewsShow1_ContentShow1_Pager").innerHTML=myStr; 
   }
}*/

function changePage(myValue)
{
   var allPage="";
   var myStr="";
   
   for(var i=1;i <=20;i++)
   {
      var myObj=eval("document.getElementById(\"oContentDiv_"+i+"\")");
      
      if(myObj!=null)
      {
         if(myValue==i)
         {
            myObj.style.display="block";
         }
         else
         {
            myObj.style.display="none";
         }
         
         if(myValue==i)
         {
            myStr+="<a style=\"cursor:pointer;font-weight:bold;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
         }
         else
         {
           myStr+="<a style=\"cursor:pointer;\" onclick=\"changePage('"+i+"')\">[第"+i+"页]</a>&nbsp;";
         }
         allPage+=1;
      }
      else
      {
         break;
      }
      
      if(allPage!=1)
      {
         document.getElementById("ctl00_ContentPlaceHolder1_NewsShow1_ContentShow1_Pager").innerHTML=myStr; 
      }
   }
}

