﻿// JScript 文件
function showLists(te,num)
{
	if(num==0)
	{
	   document.getElementById(te).className="lm";
	}
	if(num==1)
	{
	   document.getElementById(te).className="lmOver";
	}
}


function showList(te,num,cssclass)
{
	if(num==0)
	{
	   document.getElementById(te).className=cssclass;
	}
	if(num==1)
	{
	   document.getElementById(te).className=cssclass;
	}
}


function delaysearch(obj,num){
   nn=setTimeout(function(){var a=document.getElementById("theul").getElementsByTagName("li");
for(var i=0;i<a.length;i++)
{
       a[i].className="";
}
document.getElementById(obj).className="active";document.getElementById("Pattern").value=num;},500);
}
function cannelbrek(){
clearTimeout(nn);
}

function SubSearch(obj,num)
{
   var a=document.getElementById("theul").getElementsByTagName("li");
for(var i=0;i<a.length;i++)
{
       a[i].className="";
}
document.getElementById(obj).className="active";
document.getElementById("Pattern").value=num;
}


function GoEwSearch()
{
  var bbskeyname=null;
  bbskeyname=document.getElementById("diskeyword").value;//关键词
  var showtype = document.getElementById("Pattern").value;//搜索条件
  if(bbskeyname==null || bbskeyname=="")
  {
     GetNullStr('请输入搜索的关键词！');
     return false;
  }
  else
  {
    window.open("http://so.ewsos.com/search.aspx?keyWord=" + escape(bbskeyname) +"&Pattern="+showtype);
    return false;
  }
}

function GetNullStr(showstr)
{
        var windowstr="<div class='win_box'><h6><a href='javascript:closeWindow();'><img src='/disImage/windows/off.jpg' border=0 alt='关闭' /></a>提示</h6><dl><dt><img src='/disImage/windows/tip.jpg' alt='出错了！' width='39' height='39' /></dt><dd>"+showstr+"</dd></dl><p><a href='javascript:closeWindow();'><img src='/disImage/windows/an.jpg' alt='确定' border=0 /></a></p></div>";
	 	document.getElementById("infoDiv").innerHTML=windowstr;
	 	document.getElementById("infoDiv").style.left=((document.body.clientWidth-302)>0?(document.body.clientWidth-302):0)/2+"px";
	 	document.getElementById("infoDiv").style.top=(document.documentElement.scrollTop+260)+"px";
	 	document.getElementById("infoDiv").style.width=302;
	 	document.getElementById("tranDiv").style.height=document.body.clientHeight+ "px";
	 	document.getElementById("tranDiv").style.width=document.body.clientWidth+ "px";
		document.getElementById("tranDiv").style.display="";
		document.getElementById("tranDivBack").style.display="";
		document.getElementById("infoDiv").style.display="";
}

//关闭层

function closeWindow(){
	document.getElementById("tranDiv").style.display="none";
}


function sellay(num,myid,nots,ntes){
 for(var id = 1;id<=num;id++)
 {
  var ss=nots+id;
  if(id==myid)
  document.getElementById(ss).style.display="block";
  else
  document.getElementById(ss).style.display="none";
 }
 
 for(var id = 1;id<=num;id++)
 {
  var bb=ntes+id;
  if(id==myid)
  document.getElementById(bb).className="active";
  else
  document.getElementById(bb).className="";
 } 
}


function CheckSumbit()
{
  var t=null;
  var c=null;
  var s=null;
  t=document.getElementById("subject").value;//标题
  c=document.getElementById("cont").value;//内容
  s=document.getElementById("bbscode").value;//验证码

  if(t=='' ||t==null)
  {
     GetNullStr('咨询标题不能为空！');
     return false;
  }
  else if(c=='' ||c==null)
  {
     GetNullStr('咨询内容不能为空！');
     return false;
  }
  else if(s=='' ||s==null)
  {
     GetNullStr('验证码不能为空！');
     return false;
  }
  else
  {
     return true;
  }
}

function getChkCode()
{
    document.getElementById("ChkCode").innerHTML="<img src='/System/CheckCode.aspx?"+Math.random()+"' alt='点击图片重新加载验证码' style='cursor: pointer;' width='70px' height='22px' onclick='javascript:dogetChkCode()' />";
}

function dogetChkCode()
{
        document.getElementById("ChkCode").innerHTML="<img src='/disimage/loading1.gif' alt=''/>";
        setTimeout("getChkCode()",500);
}

function resizeimg(ImgD,iwidth,iheight,show) {   
     var image=new Image();   
     image.src=ImgD.src;   
     if(image.width>0 && image.height>0){   
        if(image.width/image.height>= iwidth/iheight){   
           if(image.width>iwidth){   
               ImgD.width=iwidth;   
               ImgD.height=(image.height*iwidth)/image.width;   
           }else{   
                  ImgD.width=image.width;   
                  ImgD.height=image.height;   
                }   
               ImgD.alt=image.width+"×"+image.height;   
        }   
        else{   
                if(image.height>iheight){   
                       ImgD.height=iheight;   
                       ImgD.width=(image.width*iheight)/image.height;   
                }else{   
                        ImgD.width=image.width;   
                        ImgD.height=image.height;   
                     }   
                ImgD.alt=image.width+"×"+image.height;   
            }   
　　　　　ImgD.style.cursor= "pointer"; //改变鼠标指针  
         if(show)
		 {
　　　　　ImgD.onclick = function() { window.open(this.src);} //点击打开大图片   
　　　　    if (navigator.userAgent.toLowerCase().indexOf("ie") > -1){    
        //判断浏览器，如果是IE   
　　　　　　  ImgD.title = "请使用鼠标滚轮缩放图片，点击图片可在新窗口打开";   
　　　　　　  ImgD.onmousewheel = function img_zoom() //滚轮缩放   
　　　　　    {   
　　　　　　　　　　var zoom = parseInt(this.style.zoom, 10) || 100;   
　　　　　　　　　　zoom += event.wheelDelta / 12;   
　　　　　　　　　　if (zoom> 0)　this.style.zoom = zoom + "%";   
　　　　　　　　　　return false;   
　　　　    　 }   
　　　      } 
              else { //如果不是IE   
　　　　　　　     ImgD.title = "点击图片可在新窗口打开";   
　　　　　　   }  
		 }
    }   
}  
