// JScript 文件
//产品展示显示效果
var now = 1;
function $(e){
 return document.getElementById(e);
}
function s(a){
if(a!=now) {
 $('l'+a).className='c'
 $('l'+now).className='none'
 $('bk'+now).className = 'hidden subDiv'
 $('bk'+a).className = 'display subDiv'
 now=a
}
 return false
}
//-----------------------------------------------------------------------

//创建XmlHttp对象
var xmlHttp;
var strall="";
function createXMLHttpRequest()
{
 if(window.ActiveXObject)
 {
  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
 }
 else if(window.XMLHTTPRequest)
 {
  xmlHttp = new XMLHTTPRequest();
 }
}
 var str3="";
function xmlhttp()
{   
    createXMLHttpRequest();
    var str=document.getElementById("username").value;
    if(str=="")
    {
    str="n"
    }
    var str2=document.getElementById("countnet").value;
    if(str2=="")
    {
    str2="n"
    }

    
   if(document.getElementById("isuser").checked)
   {
   str3="n";
   } 
   else
   {  
      str3="y";
   }
var a=0;
if(document.getElementById("a1").checked)
{
a=1;
}

if(document.getElementById("a2").checked)
{
a=2;
}

if(document.getElementById("a3").checked)
{
a=3;
}
if(document.getElementById("a4").checked)
{
a=4;
}
if(document.getElementById("a5").checked)
{
a=5;
}
strall=str+"$"+str2+"$"+str3;
 var url   = "../Ajax/TopAjax.aspx?str="+strall+"&pf="+a+"&isdo=addPL&fd="+Math.random();
 alert("../Ajax/TopAjax.aspx?str="+strall+"&pf="+a+"&isdo=addPL&fd="+Math.random());
 xmlHttp.onreadystatechange = handleStateChange;
 xmlHttp.open("GET",url,true);
 xmlHttp.send(null);
}

function  handleStateChange()
{
  var Results="";
  if(xmlHttp.readyState == 4)
  {
      if(xmlHttp.status == 200)
       {
         Results = xmlHttp.responseText;
         alert(Results);
       }
  }
}
function a()
{
alert("fd");
}
//评论限制字符输入
function textCounter(field,counter,maxlimit,linecounter) {
 // text width//
 var fieldWidth =  parseInt(field.offsetWidth);
 var charcnt = field.value.length;        
 // trim the extra text
 if (charcnt > maxlimit) { 
  field.value = field.value.substring(0, maxlimit);
 }
 else { 
 // progress bar percentage
 var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
 document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
 document.getElementById(counter).innerHTML=percentage+"%"
 setcolor(document.getElementById(counter),percentage,"background-color");
 }
}
function setcolor(obj,percentage,prop){
 obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}