//wwg add start
var xmlHttp = false;
try {
  xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
  try {
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
    try {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (failed) {
      xmlHttp = false;
    }
  }
}
if (!xmlHttp)
  alert("初始化错误!");
//wwg add end 
function get(temp)
{
   alert(temp);
}

function change(temp)
{

  //alert("id : " + temp);
 document.getElementById("keynight").value=temp;
 var ajaxrequest = new AjaxRequest("/ajaxtaconite");
 ajaxrequest.addFormElementsById("keynight");
 ajaxrequest.sendRequest();
 

 
}

function change_(temp)
{
 document.getElementById("keynight").value=temp;
 var ajaxrequest = new AjaxRequest("/ajaxchange");
 ajaxrequest.addFormElementsById("keynight");
 ajaxrequest.sendRequest();
}

function ts(ttid,flagid)
{

   //   document.getElementById("erji").value="ts";
   //   var ajaxrequest = new AjaxRequest("/ajaxej");
   //   ajaxrequest.addFormElementsById("erji");
   //   ajaxrequest.sendRequest();
   document.getElementById("changecontent").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
    var url = "/portal/jsp/ajax/changetablebody2.jsp?ty=1&p=1&id="+ttid+"&flagid="+flagid;
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagets;
  xmlHttp.send(null);

}
function updatePagets() {
  if (xmlHttp.readyState == 4) {
  	if (xmlHttp.status == 200)
  	{
    	var response = xmlHttp.responseText;
    	document.getElementById("changecontent").innerHTML = xmlHttp.responseText;
    }
    else if(xmlHttp.status == 404){alert("请求页面不存在！");} 
    else if(xmlHttp.status == 403){alert("访问拒绝！");}   
  	else {alert("服务器响应错误!");}
  }
}
function zn(ttid)
{
 //     document.getElementById("erji").value="zn";
 //     var ajaxrequest = new AjaxRequest("/ajaxej");
 //	  ajaxrequest.addFormElementsById("erji");
 //	  ajaxrequest.sendRequest();
  document.getElementById("changecontent").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
  var url = "/portal/jsp/ajax/changetablebody2.jsp?ty=1&p=2&id="+ttid;
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);
}
//wwg add start
function updatePage() {
  if (xmlHttp.readyState == 4) {
  	if (xmlHttp.status == 200)
  	{
    	var response = xmlHttp.responseText;
    	document.getElementById("changecontent").innerHTML = xmlHttp.responseText;
    }
    else if(xmlHttp.status == 404){alert("请求页面不存在！");} 
    else if(xmlHttp.status == 403){alert("访问拒绝！");}   
  	else {alert("服务器响应错误!");}
  }
}
//wwg add end;
function changeColor(trId,temp) 
{ 
document.getElementById("divlm").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
document.getElementById("insertone").innerHTML = "";
document.getElementById("tiaozhuan").innerHTML = "";
document.getElementById("inserttwo").innerHTML = "";
document.getElementById("tiaozhuan2").innerHTML = "";
var tr = document.getElementsByTagName("div");
for(var i=0;i<tr.length;i++) 
{ 
if(tr[i].id=="kkk"){

//tr[i].style.backgroundColor="#FEFEF8"; 
tr[i].className="border3-5"; 
}
} 
//trId.style.backgroundColor="#FFF5E6";  
trId.className="border3-4";
change_(temp);
} 

function changeColor2(trId,temp) 
{ 
document.getElementById("insertone").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
document.getElementById("tiaozhuan").innerHTML = "";
document.getElementById("inserttwo").innerHTML = "";
document.getElementById("tiaozhuan2").innerHTML = "";
var tr = document.getElementsByTagName("div"); 
for(var i=0;i<tr.length;i++) 
{ 
if(tr[i].id=="kkkk"){
//tr[i].style.backgroundColor="#FEFEF8"; 
tr[i].className="border3-5"; 
} 
}
//trId.style.backgroundColor="#FFF5E6";  
trId.className="border3-4"; 
change(temp);
} 
function changeColor22(trId,id) 
{ document.getElementById("ysh").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
var tr = document.getElementsByTagName("p"); 
for(var i=0;i<tr.length;i++) 
{ 
tr[i].style.backgroundColor="#FEFEF8"; 
} 
trId.style.backgroundColor="#FFF5E6"; 
  var url = "/portal/jsp/ajax/changetablebody2.jsp?ty=2&id="+id;
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage2;
  xmlHttp.send(null);
} 
function updatePage2() {
  if (xmlHttp.readyState == 4) {
  	if (xmlHttp.status == 200)
  	{
    	var response = xmlHttp.responseText;
    	document.getElementById("ysh").innerHTML = xmlHttp.responseText;
    }
    else if(xmlHttp.status == 404){alert("请求页面不存在！");} 
    else if(xmlHttp.status == 403){alert("访问拒绝！");}   
  	else {alert("服务器响应错误!");}
  }
}
function changeColor4(trId,ttid) 
{ 
var tr = document.getElementsByTagName("td"); 
for(var i=0;i<tr.length;i++) 
{ 

 if(tr[i].id=="rrr"){
tr[i].style.backgroundImage="url(portal/images/labBackground.gif)";
}
} 

trId.style.backgroundImage="url(portal/images/selectedLabBackground.gif)";
zn(ttid);
} 
function changeColor5(trId,ttid,flagid) 
{ 

var tr = document.getElementsByTagName("td"); 
for(var i=0;i<tr.length;i++) 
{ 

 if(tr[i].id=="rrr"){
tr[i].style.backgroundImage="url(portal/images/labBackground.gif)";
}
} 

trId.style.backgroundImage="url(portal/images/selectedLabBackground.gif)"; 
ts(ttid,flagid);
} 

function fy(temp,page_record,all_record)
{
var pagecount = all_record%page_record==0?all_record/page_record:(parseInt(all_record/page_record)+1);
if(temp==0)
	alert("已经是第一页了！");
else if(temp>pagecount)
	alert("已经是最后一页了！");
else
{
document.getElementById("insertone").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
document.getElementById("tiaozhuan").innerHTML = "";
   var ajaxrequest = new AjaxRequest("/ajaxfy?id="+temp+"&page_record="+page_record+"&all_record="+all_record);
   ajaxrequest.sendRequest();
 }
}
function fy2(temp,page_record,all_record)
{var pagecount = all_record%page_record==0?all_record/page_record:(parseInt(all_record/page_record)+1);
if(temp==0)
	alert("已经是第一页了！");
else if(temp>pagecount)
	alert("已经是最后一页了！");
else
{
	document.getElementById("inserttwo").innerHTML = "<img src='/portal/images/waiting__.gif'/>";
document.getElementById("tiaozhuan2").innerHTML = "";
   var ajaxrequest = new AjaxRequest("/ajaxfy2?id="+temp+"&page_record="+page_record+"&all_record="+all_record);
   ajaxrequest.sendRequest();
 }
}

function haha(fid)
{
//  alert("aa");

  var keys = document.getElementById("key"+fid).value;
 // var r = encodeURIComponent(keys);
  //alert("r：　"　+r);
  var k = keys.length;
  //alert("i : " + k);
  if(k%2 == 0)
  {
  }
  else
  {
    keys = "囧"+keys+"囧囧";
    
  }
 // alert("keys : " + keys);
  //alert("fid : " + fid);
  var select = document.getElementById("select"+fid).value;
  if(select==0)
  	alert("请选择分类!");
  else
  {
  var temp;
    if(k%2 == 0)
    {
     temp= '/reachaction.do?method='+fid+'&id='+select+'&name='+keys+'';
    }
    else
    {
      temp = '/reachaction.do?method='+fid+'&id='+select+'&name='+keys+'';
    }
 

  	window.open(temp,'newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');
  }
  //	window.open('/reachaction.do?id='+select+'&name='+keys+'&method='+fid+','newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');
 // var temp = document.getElementById("smfu").value;
  
 // var temp_ = document.getElementById("qefu").value;
  
//  var gov = document.getElementById("gov").value;
  
 // var val = document.getElementById("keywords").value;
  
 // alert(val);
 // if(val != "" && temp_ == "" && gov == "")
 // {
 //     window.open('/reachaction.do?id='+temp+'&name='+val+'&method=smfu','newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');

 // }
 // else if(val != "" && temp == "" && gov == "")
 // {
 //   window.open('/reachaction.do?id='+temp_+'&name='+val+'&method=qefu','newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');
    
 // }
 // else if(val !="" && temp=="" && temp_=="")
 // {
 //  window.open('/reachaction.do?id='+gov+'&name='+val+'&method=gov','newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');
    
 // }
 // else
 // {
 //    alert("请输入您要查询的关键字");
//  }
  
 // alert(temp);
}

function zxzx(temp)
{
 // alert(temp.value);
  if(temp.value!="s")
  {
  		window.open('/zxzxaction.do?id='+temp.value+'','newwindow', 'height=600, width=600, top=100, left=100, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=no, status=no');
  }
}

function zx(temp)
{
   var ajaxrequest = new AjaxRequest("/ajaxzxzx?id="+temp+"");
   ajaxrequest.sendRequest();
}

function bjsh(temp)
{
   var ajaxrequest = new AjaxRequest("/ajaxbjsh?id="+temp+"");
   ajaxrequest.sendRequest();
}

function changeColorbjss(trId,temp) 
{ 
var tr = document.getElementsByTagName("p"); 
for(var i=0;i<tr.length;i++) 
{ 
tr[i].style.backgroundColor="#FEFEF8"; 
} 
trId.style.backgroundColor="#FFF5E6"; 

 bjsh(temp);
} 