﻿var _i=Math.random();
if(document.compatMode == "BackCompat"){var dtd=false;}else{dtd=true;}
function clientWidth(){if(dtd){return document.documentElement.clientWidth;}else{return document.body.clientWidth;}}
function clientHeight(){if(dtd){return document.documentElement.clientHeight;}else{return document.body.clientHeight;}}
function scrollWidth(){if(dtd){return document.documentElement.scrollWidth;}else{return document.body.scrollWidth;}}
function scrollHeight(){if(dtd){return document.documentElement.scrollHeight;}else{return document.body.scrollHeight;}}
function scrollLeft(){if(dtd){return document.documentElement.scrollLeft;}else{return document.body.scrollLeft;}}
function scrollTop(){if(dtd){return document.documentElement.scrollTop;}else{return document.body.scrollTop;}}

function getId(id)
{
	return document.getElementById(id);
}

function getName(str)
{
	return document.getElementsByName(str);
}

function getTag(str)
{
	return document.getElementsByTagName(str);
}

function getFid(id)
{
	return parent.document.getElementById(id);
}

function classCldOpt(obj,typeid)
{
	var CldOpt=ajax("../class/classajax.asp","classid="+obj.value+"&typeid="+typeid,"Cldclassid");
}

//创建Option
function addOpt(OptIndex,OptValue,OptText,OptId)
{
	var OptId=getId(OptId);
    OptId.options[OptIndex]=new Option(OptText,OptValue);
    OptId.appendChild(OptId.options[OptIndex]);
}

function OpenWindow(Url,Width,Height,WindowObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'px;dialogHeight:'+Height+'px;status:no;help:no;scroll:no;status:0;help:0;scroll:0;');
	return ReturnStr;
}
function OpenThenSetValue(Url,Width,Height,WindowObj,SetObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'px;dialogHeight:'+Height+'px;status:no;help:no;scroll:no;status:0;help:0;scroll:0;');
	if (ReturnStr!='') SetObj.value=ReturnStr;
	return ReturnStr;
}

function T(id,n){ getId(id).style.fontSize=n+"px";}

function ajax(url,urlcs,secid)
{
	++_i;
	var responseStr=$.ajax({ url:url+"?alz="+_i+"&"+urlcs, async: false}).responseText;
	if(getId(secid)){getId(secid).innerHTML=responseStr;}
	return responseStr;
}

//得到URL参数值
function getPra(parameter){
var reg,url,url2,iLen,iStart,iEnd;
url = document.location.href;
reg = new RegExp(parameter);
if(url.search(reg) == -1)
	{
	   return "";
	}
	else
	{
		iLen = parameter.length;
		iStart = url.search(reg) + iLen +1;
		url2 = url.substr(iStart);
		iEnd = iStart + url2.search(/&/i);  
		if((iStart - 1) == iEnd)
		{
			return url.substr(iStart);
		}
		else
		{
			return url.substr(iStart,iEnd - iStart);
		}
	}
}

function showclass(id)
{
	if(getId("class"+id).style.display=="")
	{
		getId("class"+id).style.display="none"
		if(getId("class_"+id)){getId("class_"+id).innerHTML="<img src=skins/images/list5.gif />"}
	}
	else
	{
		getId("class"+id).style.display=""
		if(getId("class_"+id)){getId("class_"+id).innerHTML="<img src=skins/images/list4.gif />"}
	}			
			
	for(i=1;i<500;i++)
	{
		if(getId("class"+i)&&i!=id)	{getId("class"+i).style.display="none"}
		if(getId("class_"+i)&&i!=id){getId("class_"+i).innerHTML="<img src=skins/images/list5.gif />"}
	}
}

//数字格式控制
function onlynum(obj){obj.value=obj.value.replace(/\D/g,'')}


//搜索
function Search_check(str1,str2)
{
	if (getId("keyword").value=="" || getId("keyword").value==str1)
	{
		alert(getId("keyword").value);
		getId("keyword").focus();
		return false;
	}
}

//背景色改变效果
function bgcc(obj)
{
	obj.style.backgroundColor="#efefef"
	obj.onmouseout=function(){obj.style.backgroundColor=""}
	
}

function buttonbgcc(obj)
{
	obj.className="mybuttonstyle2"
	obj.onmouseout=function(){obj.className="mybuttonstyle"}
	
}

//关键字写入录入框
function ctag(obj,str)
{
	if(getId(str).value=="")
	{
		getId(str).value=obj.innerText
	}
	else
	{
		getId(str).value=getId(str).value+ " " +obj.innerText
	}
}
//保存数据的时候，锁提交按纽
function lock_button(obj1,obj2,obj3,str)
{
	if(getId(obj1))
	{
	getId(obj1).style.display="none";
	}
	if(getId(obj2))
	{
	getId(obj2).style.display="none";
	}
	if(getId(obj3))
	{
	getId(obj3).innerHTML=str;
	}
}

//后台，消息浮动层显示，相对于固定高宽的满屏窗口
function showMsg(str1,str2,w,top)
{
	var Fid = getFid("showMsg_Id");
	var Cid = getFid("showMsg_content");
	var Tid = getFid("showMsg_title");	
	var bgs=getFid("bgs");
	var bgs_ifr=getFid("bgs_ifr");
	if (Fid.style.display == "none")
	{
		eval("Fid.style.display=\"\";");
		eval("Fid.style.left=\""+(screen.width-w)/2+"px\";");
		eval("Fid.style.width=\""+w+"px\";");
		eval("Fid.style.top=\""+top+"px\";");
		eval("bgs.style.left=\"0px\";");
		eval("bgs.style.width=\"100%\";");
		eval("bgs.style.height=\""+parent.document.body.clientHeight+"px\";");
		eval("bgs.style.display=\"\";");
		eval("bgs_ifr.style.display=\"\";");
		eval("Cid.style.width=\""+w+"px\";");
		eval("Tid.style.width=\""+w+"px\";");
		getFid("showMsg_title").innerHTML=str1;
		getFid("showMsg_content").innerHTML=str2;
	}
	else
	{
		eval("Fid.style.display=\"none\";");
		eval("bgs.style.display=\"none\";");
		eval("bgs_ifr.style.display=\"none\";");
		getFid("showMsg_title").innerHTML="";
		getFid("showMsg_content").innerHTML="";
	}
}

//前台消息浮动层显示，相对于本窗口eval("Fid.style.top=\""+(document.body.scrollTop+top)+"px\";");
function showMsg2(str1,str2,w,top)
{
	var Fid = getFid("showMsg_Id");
	var Cid = getFid("showMsg_content");
	var Tid = getFid("showMsg_title");	
	var bgs=getFid("bgs");
	var bgs_ifr=getFid("bgs_ifr");
	if (Fid.style.display == "none")
	{
		eval("Fid.style.display=\"\";");
		eval("Fid.style.left=\""+(screen.width-w)/2+"px\";");
		eval("Fid.style.width=\""+w+"px\";");
		eval("Fid.style.top=\""+(document.body.scrollTop+top)+"px\";");
		eval("bgs.style.left=\"0px\";");
		eval("bgs.style.width=\"100%\";");
		eval("bgs.style.height=\""+parent.document.body.clientHeight+"px\";");
		eval("bgs.style.display=\"\";");
		eval("bgs_ifr.style.display=\"\";");
		eval("Cid.style.width=\""+w+"px\";");
		eval("Tid.style.width=\""+w+"px\";");
		getFid("showMsg_title").innerHTML=str1;
		getFid("showMsg_content").innerHTML=str2;
	}
	else
	{
		eval("Fid.style.display=\"none\";");
		eval("bgs.style.display=\"none\";");
		eval("bgs_ifr.style.display=\"none\";");
		getFid("showMsg_title").innerHTML="";
		getFid("showMsg_content").innerHTML="";
	}
}

function switchTab(n,a,b,str){
	for(var i=a;i<=b;i++){
		if(i!=n ){
			getId("ContentBody"+n).style.display = "";
			getId("ContentBody"+i).style.display = "none";
			getId("ListTitle"+i).className = str+"off";
			getId("ListTitle"+n).className = str+"on";
		}
	}
}


//图片按比例缩放 
var flag=false; 
function setimgs(ImgD,w,h){ 
 var image=new Image(); 
 var iwidth = w;
 var iheight = h;
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 flag=true; 
 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; 
  } 
 } 
}

//多产品图片时的切换
function chang_img(obj)
{
	src=obj.src;
	Arry_src=src.split("propic/");
	N_src="images/propic/big/"+Arry_src[1]
	getId("big_img").src=N_src;
}

//QQ自由移动层控制
var Obj=''
var index=10000;
function MDown(obj)
{
	if (Ym)clearTimeout(Ym);
	obj.setCapture();	
	obj.setCapture()
	px=obj.offsetLeft-event.x;
	py=obj.offsetTop-event.y;	
	obj.onmousemove=function()
	{
		if(obj)
		{
 			obj.style.left=event.x+px;
 			obj.style.top=event.y+py;			
 		}
	}
	obj.onmouseup=function()
	{
		if (obj)
		{
			var p;
			if (window.innerHeight)p = window.pageYOffset;
  			else if (document.documentElement && document.documentElement.scrollTop)p = document.documentElement.scrollTop;
  			else if (document.body)p = document.body.scrollTop;
			theTop=obj.offsetTop-p;
			theTop=theTop<0?0:theTop;
			obj.releaseCapture();obj=null;initFloatTips();			
		}
	}
}


//控制层移动MDown2(obj)
var Obj2=''
var index2=10000;
document.onmouseup=MUp2
document.onmousemove=MMove2
function MDown2(Object){
Obj2=Object.id
document.all(Obj2).setCapture()
pX=event.x-document.all(Obj2).style.pixelLeft;
pY=event.y-document.all(Obj2).style.pixelTop;
}
function MMove2(){
if(Obj2!=''){
 document.all(Obj2).style.left=event.x-pX;
 document.all(Obj2).style.top=event.y-pY;
 }
}
function MUp2(){
if(Obj2!=''){
 document.all(Obj2).releaseCapture();
 Obj2='';
 }
}

//全选操作
function sel(name){ 
obj=getName(name)
	for(i=0;i<obj.length;i++)
	{
		if(obj[i].checked)
		{
			obj[i].checked=false;  
		}
		else
		{
			obj[i].checked=true;
		}
	}
	
}

//层显示与关闭
function showmenu(menuid)
{
	obj=getId("menuid"+menuid)	
	if (obj.style.display == "none")
	{
		obj.style.display = "";
	}
	else
	{
		obj.style.display = "none";
	}
}

//图片预览
function viewpic(pic,path)
{
	obj=getId("viewpic")
	if (obj.style.display == "none")
	{
		obj.style.display = "";
		obj.src=pic;
		obj.style.left = event.x+20+"px";
		obj.style.top = event.y+20+"px";
	}
	else
	{
		obj.style.display = "none";
		obj.src="";
	}
	obj.onerror=function(){obj.src=path+"skins/images/nophoto.jpg" }
	obj.onload=setimgs(obj,150,150);
}

//翻页跳转
function gotopage(obj){
	var jmpurl=obj.value;
	if(jmpurl!='')
	{
		location.href=jmpurl;
	}
	else
	{
		this.selectedindex=0;};
	}


//操作判断
function confirm_do(){
	if (confirm("您确定如此操作吗？")){
		return true;
	}
	return false;
}

//后台版面控制
forumpath="../"
function DvMenuCls(){
	var MenuHides = new Array();
	this.Show = function(obj,depth){
		var childNode = this.GetChildNode(obj);
		if (!childNode){return ;}
		if (typeof(MenuHides[depth])=="object"){
			this.closediv(MenuHides[depth]);
			MenuHides[depth] = '';
		};
		if (depth>0){
			if (childNode.parentNode.offsetWidth>0){
				childNode.style.left= childNode.parentNode.offsetWidth+'px';
				
			}else{
				childNode.style.left='100px';
			};
			
			childNode.style.top = '-2px';
		};
		childNode.style.display ='block';
		MenuHides[depth]=childNode;
	
	};
	this.closediv = function(obj){
		if (typeof(obj)=="object"){
			if (obj.style.display!='none'){
			obj.style.display='none';
			}
		}
	}
	this.Hide = function(depth){
		var i=0;
		if (depth>0){
			i = depth
		};
		while(MenuHides[i]!=null && MenuHides[i]!=''){
			this.closediv(MenuHides[i]);
			MenuHides[i]='';
			i++;
		};
	
	};
	this.Clear = function(){
		for(var i=0;i<MenuHides.length;i++){
			if (MenuHides[i]!=null && MenuHides[i]!=''){
				MenuHides[i].style.display='none';
				MenuHides[i]='';
			}
		}
	}
	this.GetChildNode = function(submenu){
		for(var i=0;i<submenu.childNodes.length;i++)
		{
			if(submenu.childNodes[i].nodeName.toLowerCase()=="div")
			{
				var obj=submenu.childNodes[i];
				break;
			}
		}
		return obj;
	}
}


function getvoteids()
{
	var ids="";
	var votelist=document.getElementsByName("voteids")
	for(i=0;i<votelist.length;i++)
	{
		if(votelist[i].checked)
		{
			ids+=votelist[i].value+',';	
		}
	}
	ids=ids.substring(0,ids.length-1)	
	if (ids==""){alert("请选择投票选项！"); return;}
	myvoteajax(ids);
	for(i=0;i<votelist.length;i++)
	{
		votelist[i].checked=false;
	}
}

function myvoteajax(id)
{
++_i;
var responseText=$.ajax({ url:"fun/vote/alz_vote_do.asp?id="+id+"&a="+_i, async: false }).responseText;
	if(responseText=="0")
	{
		alert('此投票已经过期，无效投票！');
	}	
	else if(responseText=="1")
	{	
		alert('此IP已经投过票，感谢您热情的参与！');
	}
	else if(responseText=="2")
	{
		alert('投票成功，感谢您的参与！');
	}	
	else
	{
	alert('投票时间间隔为'+responseText.substring(1,5)+'分钟');
	}
}

function getvoteids2()
{
	var ids="";
	var votelist=document.getElementsByName("voteids")
	for(i=0;i<votelist.length;i++)
	{
		if(votelist[i].checked)
		{
			ids+=votelist[i].value+',';	
		}
	}
	ids=ids.substring(0,ids.length-1)	
	if (ids==""){alert("请选择投票选项！"); return;}
	myvoteajax2(ids);
	for(i=0;i<votelist.length;i++)
	{
		votelist[i].checked=false;
	}
}

function myvoteajax2(id)
{
++_i;
var responseText=$.ajax({ url:"alz_vote_do.asp?id="+id+"&a="+_i, async: false }).responseText;
	if(responseText=="0")
	{
		alert('此投票已经过期，无效投票！');
	}	
	else if(responseText=="1")
	{	
		alert('此IP已经投过票，感谢您热情的参与！');
	}
	else if(responseText=="2")
	{
		alert('投票成功，感谢您的参与！');
	}	
	else
	{
	alert('投票时间间隔为'+responseText.substring(1,5)+'分钟');
	}
}

function AutoIframe(obj)
{
	if(document.readyState!='complete')
	{
		setTimeout( function(){AutoIframe(obj);},25 );
		return;
	}
	else
	{
	   obj.height= obj.contentWindow.document.body.scrollHeight;
	}
}

//拖动对象
var move_obj={o:null,z:0,x:0,y:0}
function move_(e)
{ 
    e=window.event||e;
    var oDragHandle = e.target || event.srcElement; 
    var topElement = "HTML"; 
    while (oDragHandle.tagName != topElement && oDragHandle.className != "alt_")
    { 
        oDragHandle =oDragHandle.parentNode||oDragHandle.parentElement; 
    } 
    if (oDragHandle.className=="alt_")
    { 
        isdrag = true; 
        move_obj.o = oDragHandle;
        move_obj.z=move_obj.o.style.zIndex;
        move_obj.o.style.zIndex=999;
        y = e.clientY-parseInt(move_obj.o.style.top+0); 
        x = e.clientX-parseInt(move_obj.o.style.left+0); 
        document.onmousemove=function moveMouse(e)
        {
            e=window.event||e;
            if (move_obj.o)with(move_obj.o.style)
            {
                var yy=e.clientY-y;if (yy<0)yy=0;else if (yy+move_obj.o.offsetHeight>document.body.clientHeight)yy=document.body.clientHeight-move_obj.o.offsetHeight;
                var xx=e.clientX-x;if (xx<0)xx=0;else if (xx+move_obj.o.offsetWidth>=document.body.clientWidth)xx=document.body.clientWidth-move_obj.o.offsetWidth;
                top=yy+"px";left=xx+"px";return false;
            }
        } 
        move_obj.o.onmouseup=function(){if(move_obj.o){document.onmousemove=null;move_obj.o.style.zIndex=move_obj.z;}move_obj.o=null;}
        return false; 
    } 
}

function showtime() {
  var d = new Date();
  var iYear = d.getYear()
  var iMonth = d.getMonth()
  var iDay = d.getDate()
  var sWeek = d.getDay()
  var sHour  = d.getHours()
  var sMinute = d.getMinutes()
  var sSecond = d.getSeconds()
  if(sWeek == 0) sWeek = "<font color=#ff0000 title=周末愉快>星期日</font>";
  if(sWeek == 1) sWeek = "星期一";
  if(sWeek == 2) sWeek = "星期二";
  if(sWeek == 3) sWeek = "星期三";
  if(sWeek == 4) sWeek = "星期四";
  if(sWeek == 5) sWeek = "星期五";
  if(sWeek == 6) sWeek = "<font color=#ff0000 title=周末愉快>星期六</font>";
  if(sHour <= 9) sHour = "0" + sHour;
  if(sMinute <= 9) sMinute = "0" + sMinute;
  if(sSecond <= 9) sSecond = "0" + sSecond;
  sClock = iYear + "年" + (iMonth + 1) + "月" + iDay + "日 " 
    + " " + sHour + ":" + sMinute + ":" + sSecond + "&nbsp;"+sWeek;
getId("clock").innerHTML = sClock;
setTimeout("showtime()", 1000);
}

function eshowtime() {
  var d = new Date();
  var iYear = d.getYear()
  var iMonth = d.getMonth()
  var iDay = d.getDate()
  var sWeek = d.getDay()
  var sHour  = d.getHours()
  var sMinute = d.getMinutes()
  var sSecond = d.getSeconds()
  if(sWeek == 0) sWeek = "<font color=#ff0000 title='Happy weekend'>sunday</font>";
  if(sWeek == 1) sWeek = "monday";
  if(sWeek == 2) sWeek = "tuesday";
  if(sWeek == 3) sWeek = "wednesday";
  if(sWeek == 4) sWeek = "thursday";
  if(sWeek == 5) sWeek = "friday";
  if(sWeek == 6) sWeek = "<font color=#ff0000 title='Happy weekend'>saturday</font>";
  if(sHour <= 9) sHour = "0" + sHour;
  if(sMinute <= 9) sMinute = "0" + sMinute;
  if(sSecond <= 9) sSecond = "0" + sSecond;
  sClock = (iMonth + 1) + "/" + iDay + "/" + iYear 
    + " " + sHour + ":" + sMinute + ":" + sSecond + "&nbsp;"+sWeek;
getId("eclock").innerHTML = sClock;
setTimeout("eshowtime()", 1000);
}

function tendygg()
{
var iii=2;
var speed=30;
tendydemo0=getId("tendy_gg");
tendydemo1=getId("tendy_gg1");
tendydemo2=getId("tendy_gg2");

tendydemo2.innerHTML=tendydemo1.innerHTML;
function Marquee()
{
	if(tendydemo2.offsetWidth-tendydemo0.scrollLeft<=0)
	tendydemo0.scrollLeft-=tendydemo1.offsetWidth;
else
{
	tendydemo0.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tendydemo0.onmouseover=function() {clearInterval(MyMar)}
tendydemo0.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}

function initMarquee() {
 var str=marqueeContent[0];
 document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
 marqueeId++;
 marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
 }
function startMarquee() {
 var str=marqueeContent[marqueeId];
  marqueeId++;
 if(marqueeId>=marqueeContent.length) marqueeId=0;
 if(marqueeBox.childNodes.length==1) {
  var nextLine=document.createElement('DIV');
  nextLine.innerHTML=str;
  marqueeBox.appendChild(nextLine);
  }
 else {
  marqueeBox.childNodes[0].innerHTML=str;
  marqueeBox.appendChild(marqueeBox.childNodes[0]);
  marqueeBox.scrollTop=0;
  }
 clearInterval(marqueeInterval[1]);
 marqueeInterval[1]=setInterval("scrollMarquee()",10);
 }
function scrollMarquee() {
	marqueeBox.scrollTop++;
	if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){
	clearInterval(marqueeInterval[1]);
	}
}

function showall(a,b)
{
	
	for(i=a;i<=b;i++){getId("ContentBody"+i).style.display=""}
}

window.onerror=function (){return true;}
