function bgcc(e,tags,color)
{
	if(Null(color))color=cs_cbgc;
	if(!e.target)e.target = e.srcElement;
	var el = e.target;
	if(el.nodeName!=tags)
	{
		while(el.parentNode&&el.parentNode.tagName!=tags)el=el.parentNode;
		el=el.parentNode;
	}
	if(el)
	{
		el.style.backgroundColor=color;
		el.onmouseout=function(){el.style.backgroundColor="";};
	}
}

function inputc(e,color)
{	
	if(!e.target)e.target = e.srcElement;
	var el = e.target;
	if(el.nodeName=="INPUT"&&(el.type=="text"||el.type=="password")||el.nodeName=="TEXTAREA")
	{
		var theclear=false;
		if(el.className.indexOf("alz")>=0)theclear=true;		
		var inputdefvalue=el.value;		
		el.onfocus=function()
		{
			if(theclear)el.value="";
			el.style.backgroundColor=color;
		}
		el.onblur=function()
		{
			if(theclear&&el.value=="")el.value=inputdefvalue;
			el.style.backgroundColor="";
		}
	}
}

function loadImg(srcs)
{
	var imgArr=srcs.split(",");
	for(i=0;i<imgArr.length;i++)
	{
		eval("var imgs"+i+"=new Image();imgs"+i+".src=imgArr["+i+"];");
	}
}

function target(id,cases)
{
	var obj=getId(id);
	if(obj)
	{
		var objs=obj.getElementsByTagName("a");	
		if(objs)
		{
			for(i=0;i<objs.length;i++){objs[i].target=cases;}
		}
	}
}

function thetarget(obj)
{
	var objs=obj.getElementsByTagName("A");
	for(i=0;i<objs.length;i++)objs[i].target="frmright";
}

function noright(){noright2(window.document);}
function noright2(obj)
{
	obj.oncontextmenu = function(){return false;}
	obj.ondragstart = function(){return false;}
	obj.onselectstart = function(){return false;}
	obj.onselect = function(){obj.selection.empty();}
	obj.oncopy = function(){obj.selection.empty();}
	obj.onbeforecopy = function(){return false;}
}

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 getFCK(id){return FCKeditorAPI.GetInstance(id).GetXHTML(true);}

function lang(lanstr)
{
	if(lanstr.indexOf("?")>0)
		return eval(lanstr.split("?")[0]);
	else
		return eval(lanstr);
}

function Null(str)
{
	if(typeof(str)=="undefined"||str=="")
	return true;
	else
	return false;
}

function formatnum(nums,err)
{
	if(typeof(nums)=="undefined"||nums==""||isNaN(nums))
	return parseInt(err);
	else
	return parseInt(nums);
}

function yajax(url,urlcs,secid)
{
	var xmlhttp = ajax_driv();	
	xmlhttp.open("get", url+"?_t="+Math.random()+"&"+urlcs,true);		
	xmlhttp.onreadystatechange = function()
	{		
		var obj=getId(secid);
		if (xmlhttp.readyState < 4 && obj){	obj.innerHTML="<img src='"+webpath+"images/loading3.gif' />";}		
		if (xmlhttp.readyState == 4)
		{		
			var response = xmlhttp.responseText;
			if(obj)obj.innerHTML=response;
		}
	};		
	xmlhttp.send(null);	
}

function ajaxstr(url,urlcs,secid,str)
{
	var xmlhttp = ajax_driv();	
	xmlhttp.open("get", url+"?_t="+Math.random()+"&"+urlcs,true);		
	xmlhttp.onreadystatechange = function()
	{		
		var obj=getId(secid);
		if (xmlhttp.readyState < 4 && obj){	obj.innerHTML=str;}		
		if (xmlhttp.readyState == 4)
		{		
			var response = xmlhttp.responseText;
			if(obj)obj.innerHTML=response;
		}
	};		
	xmlhttp.send(null);	
}

function ajax_driv()
{
	var xmlhttp;
	if(window.ActiveXObject)
	{/*@cc_on @*/
	/*@if (@_jscript_version >= 5)try {xmlhttp = new ActiveXObject("Msxml2.xmlhttp");} catch (e) {try {
	xmlhttp = new ActiveXObject("Microsoft.xmlhttp");} catch (e) {xmlhttp = false;}}
	@end @*/}else{xmlhttp=new XMLHttpRequest();}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {xmlhttp = new XMLHttpRequest();}
	return xmlhttp;
}


function pageloading()
{
	var objload=getId("pageloading");
	var pagewidth=clientWidth();
	var pageheight=clientHeight();
	var pagescrollTop=scrollTop();
	if(objload)
	{
		objload.style.top=(pageheight-objload.clientHeight+pagescrollTop)/2-30;
		objload.style.left=(pagewidth-objload.clientWidth)/2;
	}
}

function pageloaded()
{
	var obj=G("#pageloading")[0];
	if(obj){G(document).ready(function(){obj.style.display="none";});}
	window.onerror = function(){return true;}
}

function minheight(id,h)
{
	var obj=getId(id);
	if(obj)
	{
		var h2=obj.offsetHeight;
		if(h2>h){obj.style.height="auto";}else{obj.style.height=h+"px";}
	}
}

function ajax(url,urlcs,secid)
{
	if(urlcs==""){urlcs="alz=1";}
	var responseStr=G.ajax({ url:url+"?t="+Math.random()+"&"+urlcs, async: false}).responseText;
	if(getId(secid)){getId(secid).innerHTML=responseStr;}
	return responseStr;
}

function ajax2(url,urlcs)
{
	if(urlcs==""){urlcs="alz=1"}
	var img=new Image();
	img.src=url+"?"+urlcs+"&t="+Math.random();
}

//得到URL参数值
function getPra(paramName){
	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
	var oMatch = oRegex.exec( location.search ) ;	
	if ( oMatch && oMatch.length > 1 )
		return decodeURIComponent( oMatch[1] ) ;
	else
		return "";
}

function wndClose(){
	try{
		parent.DvWnd.close();
	}
	catch(e){
		window.close()
	}
}

function switchdiv(namestr,n,a,b){
	for(var i=a;i<=b;i++){ getId(namestr+i).style.display = "none";}
	getId(namestr+n).style.display = "block";
}

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 showclass(ids)
{
	var idarr=ids.split(",")
	var obj1=getId("Class_"+idarr[0])		
	if (obj1.style.display == "none"){newdisplay=""}else{newdisplay="none"};
	for(i=0;i<idarr.length;i++)
	{
		var obj=getId("Class_"+idarr[i])
		if(obj){obj.style.display=newdisplay};
	}
}

//数字格式控制
function onlynum(obj){obj.value=obj.value.replace(/\D/g,'')}


//搜索
function Search_check(str1,str2)
{
	if (getId("keyword").value=="" || getId("keyword").value==str1)
	{
		alert(str2);
		getId("keyword").focus();
		return false;
	}
	getId("SearchForm").submit();
}

function buttonbgcc(obj)
{
	obj.className="mybuttonOn";
	obj.onmouseout=function(){obj.className="mybutton";}	
}

//关键字写入录入框
function ctag(obj,str,types)
{
	if(getId(str).value=="")
	{
		getId(str).value=obj.title;
	}
	else
	{
		getId(str).value=getId(str).value+ "," +obj.title
		if(types==1||obj.title==""){getId(str).value=obj.title;}
	}
}
//保存数据的时候，锁提交按纽
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 showMsg2(title,src,w,h)
{
	if(typeof(w)=="undefined"||w=="")w=900;
	if(typeof(h)=="undefined"||h=="")h=500;
	showMsg(title,'<iframe src="'+src+'" scrolling="auto" width="100%" height="'+h+'" frameborder="0"></iframe>',w,0)
}

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");
	var Fw=parent.clientWidth();
	var Fh=parent.clientHeight();
	if (Fid.style.display == "none")
	{
		getFid("showMsg_title").innerHTML=str1;
		getFid("showMsg_content").innerHTML=str2;
		Fid.style.display="";
		Fid.style.left=(Fw-w)/2+"px";
		Fid.style.width=w+"px";
		if(top!=0){	Fid.style.top=top+"px"}else{Fid.style.top=(Fh-Fid.offsetHeight)/2+"px"}
		bgs.style.display="";
		bgs.style.left="0px";
		bgs.style.width="100%";
		bgs.style.height=parent.document.body.clientHeight+"px";
		bgs_ifr.style.display="";
		Cid.style.width=w+"px";
		Tid.style.width=w+"px";		
	}
	else
	{
		Fid.style.display="none";
		bgs.style.display="none";
		bgs_ifr.style.display="none";
		getFid("showMsg_title").innerHTML="";
		getFid("showMsg_content").innerHTML="";
	}
}


function closeMsg(url,urlcs)
{
	var frmright=getFid("frmright");
	if(urlcs==""||typeof(urlcs)=="undefined"){urlcs="i_="+Math.random();}	
	if(frmright&&url!=""&&typeof(url)!="undefined")
	{
		url+="?"+urlcs;	
		frmright.src=url;	
	}
	getFid("bgs").style.display="none";
	getFid("showMsg_Id").style.display="none";	
}

function switchTab(n,a,b,str){
	for(var i=a;i<=b;i++){
		if(i!=n){
			getId("ContentBody"+n).style.display = "block";
			getId("ContentBody"+i).style.display = "none";
			getId("ListTitle"+i).className = str+"off";
			getId("ListTitle"+n).className = str+"on";
		}
	}
	if(getId("ShowAll")){getId("ShowAll").className = str+"off";}
}

//多产品图片时的切换
function chang_img(url)
{
	var obj=getId("big_img");
	var img_h,img_h,obj_w,obj_h
	obj.src="images/loading2.gif";
	obj.style.width=32+"px";
	obj.style.height=32+"px";
	var img=new Image();
	img.onload=function()
	{
		obj.src=img.src;
		img_w=img.width;
		img_h=img.height;
		obj_h=img_h>300?300:img_h;
		obj_w=img_w*obj_h/img_h;
		obj.style.width=obj_w;
		obj.style.height=img_h>300?300:img_h+"px";
	}
	img.src="images/propic/"+url;	
}


//选择操作（typeid: 1全选 2反选 3取消）
function sel(name,typeid)
{ 
	obj=getName(name)
	if(typeid==1)
	{
		for(i=0;i<obj.length;i++){obj[i].checked=true;}
		getId("ids").checked=true;
	}
	else if(typeid==3)
	{
		for(i=0;i<obj.length;i++){obj[i].checked=false;}	
		getId("ids").checked=false;
	}
	else
	{
		for(i=0;i<obj.length;i++)
		{
			if(obj[i].checked)
			{
				obj[i].checked=false;  
			}
			else
			{
				obj[i].checked=true;
			}
		}	
	}
}

//层显示与关闭
function showmenu(menuid)
{
	var obj=getId("menuid"+menuid);
	var olddisplay="";
	if(obj){olddisplay=obj.style.display;}
	var obj2=G(".smallclass");
	for(var i=0;i<obj2.length;i++)
	{
		obj2[i].style.display="none";
	}	
	if (olddisplay == "none")
	{
		obj.style.display = "";
	}
	else
	{
		obj.style.display = "none";
	}
}

//翻页跳转
function topage(obj){
	var jmpurl=obj.value;
	if(jmpurl!='')
	{
		location.href=jmpurl;
	}
	else
	{
		this.selectedindex=0;};
	}


//操作判断
function confirm_do(){
	if (confirm(lan_suredo)){
		return true;
	}
	return false;
}



function AutoIframe(obj)
{
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight=getFFVersion>=0.1? 16 : 0;
	if (obj && !window.opera)
	{
		obj.style.display="block";
		if(obj.contentDocument && obj.contentDocument.body.offsetHeight)
		{
			obj.height = obj.contentDocument.body.offsetHeight+FFextraHeight; 
		}
		else if(obj.Document && obj.Document.body.scrollHeight)
		{
			obj.height = obj.Document.body.scrollHeight;
		}
	}	
	var obj2=getId("Iframeload");	   
	if(obj2){obj2.style.display="none";}

}

//拖动对象
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.getFullYear();
  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.getFullYear();
  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("clock").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 showall(a,b)
{	
	for(i=a;i<=b;i++)
	{
		getId("ContentBody"+i).style.display="";
		getId("ListTitle"+i).className="ConfigSetOff";		
	}
	getId("ShowAll").className="ConfigSetOn";
}

function re_weather()
{
	getId("weather_str").innerHTML="&lt;iframe src=&quot;http://m.weather.com.cn/m/p6/weather1.htm?id=101280601T&quot; width=&quot;222&quot; height=&quot;20&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; allowTransparency=&quot;true&quot;&gt;&lt;/iframe&gt;";
}

function showclassmenu(id)
{
	var obj=getId("class"+id);
	var objpic=getId("class_"+id);
	var oldid=getCookie("adminleftclassid");
	var objC=getId("class"+oldid);
	if(objC&&oldid!=id)
	{
		objC.style.display="none"
		getId("class_"+oldid).innerHTML="<img src=skins/images/list5.gif />";	
	}	
	if(obj)
	{
		if(obj.style.display=="")
		{
			obj.style.display="none"
			objpic.innerHTML="<img src=skins/images/list5.gif />";
		}
		else
		{
			obj.style.display=""
			objpic.innerHTML="<img src=skins/images/list4.gif />";
		}
	}
	setCookie("adminleftclassid",id);
}

function rollleft(speed,idname)
{
	var demo=getId(idname);
	var demo1=getId(idname+"1");
	var demo2=getId(idname+"2");
	demo2.innerHTML=demo1.innerHTML;
	function Marquee()
	{
		if(demo2.offsetWidth-demo.scrollLeft<=0)
		{
			demo.scrollLeft-=demo1.offsetWidth;
		}
		else
		{
			demo.scrollLeft++;
		}
	}
	var MyMar=setInterval(Marquee,speed);
	demo.onmouseover=function(){clearInterval(MyMar);}
	demo.onmouseout=function(){MyMar=setInterval(Marquee,speed);}	
}

function rollright(speed,idname)
{
	var demo=getId(idname);
	var demo1=getId(idname+"1");
	var demo2=getId(idname+"2");
	demo2.innerHTML=demo1.innerHTML;
	function Marquee()
	{
		if(demo.scrollLeft<=0)
		{
			demo.scrollLeft+=demo1.offsetWidth;
		}
		else
		{
			demo.scrollLeft--;
		}
	}
	var MyMar=setInterval(Marquee,speed);
	demo.onmouseover=function(){clearInterval(MyMar);}
	demo.onmouseout=function(){MyMar=setInterval(Marquee,speed);}	
}

function rollup(speed,idname)
{
	var demo=getId(idname); 
	var demo1=getId(idname+"1"); 
	var demo2=getId(idname+"2"); 
	demo2.innerHTML=demo1.innerHTML;
	function Marquee()
	{ 
		if(demo2.offsetTop-demo.scrollTop<=0)
		{ 
			demo.scrollTop-=demo1.offsetHeight;
		}
		else
		{ 
			demo.scrollTop++;
		} 
	}
	var MyMar=setInterval(Marquee,speed) 
	demo.onmouseover=function(){clearInterval(MyMar);} 
	demo.onmouseout=function(){MyMar=setInterval(Marquee,speed);}
}

function left_right(obj,speed,idname,l_r)
{
	var demo=getId(idname);
	var demo1=getId(idname+"1");
	var demo2=getId(idname+"2");
	demo2.innerHTML=demo1.innerHTML;
	function Marquee()
	{
		if(l_r==0)
		{
			if(demo2.offsetWidth-demo.scrollLeft<=0)
			{
				demo.scrollLeft-=demo1.offsetWidth;
			}
			else
			{
				demo.scrollLeft++;
				demo.scrollLeft++;
			}
		}
		else
		{
			if(demo.scrollLeft<=0)
			{
				demo.scrollLeft+=demo1.offsetWidth;
			}
			else
			{
				demo.scrollLeft--;
				demo.scrollLeft--;
			}
		}
	}
	var MyMar=setInterval(Marquee,speed);
	obj.onmouseup=function(){clearInterval(MyMar);}
}

//图片预览
function picview(thiss,url,path)
{
	var sTop=scrollTop();
	var sheight=scrollHeight();
	var cheight=clientHeight();
	sTop=sTop+1;
	var thetop=parseInt(event.y+sTop);	
	thetop+=150*(cheight-event.y)/cheight-100;
	var obj=getId("viewpic");
	obj.src=path+"skins/images/loading2.gif";
	var imagev=new Image(); 
	imagev.onload=function(){setimg(obj,150,500,url);}
	imagev.src=url;
	obj.style.display = "inline";
	obj.style.left = event.x+20+"px";
	obj.style.top = thetop+"px";
	thiss.onmouseout=function(){obj.style.display = "none";}
}
	
//图片按比例缩放
function setimg(ImgD,w,h,url)
{
	var image=new Image(); 
	var iwidth = w;
	var iheight = h;
	image.onload=function()
	{
		ImgD.onload=null;
		ImgD.src=url;	
		if(image.width>0 && image.height>0)
		{
			if(image.width/image.height>= iwidth/iheight)
			{ 
				if(image.width>iwidth)
				{   
					ImgD.width=iwidth;
				}
				else
				{ 
					ImgD.width=image.width
				}
				//ImgD.alt=image.width+"×"+image.height; 
				} 
			else
			{ 
				if(image.height>iheight)
				{
					ImgD.height=iheight; 
				}
				else
				{ 
					ImgD.width=image.width;
				}
			//ImgD.alt=image.width+"×"+image.height; 
			}
		}
	}	
	image.src=url;
}

//自动生成缩略图切换
function ismallpic(obj)
{	
	var objsamll=getId("smallpic");
	if(obj.checked){objsamll.style.display="none"}else{objsamll.style.display="inline"}
	
}

//页面分页函数
function pagelist(classid,pagesetup,typeid,lan,urlstr)
{
	var pagenums=ajax("../../fun/getpage.asp","classid="+classid+"&pagesetup="+pagesetup+"&typeid="+typeid);
	var obj=getId("newslist");
	if(getCookie('newsmodel')=="2"&&obj){obj.className="newslist2";}
		
	if(pagenums>0)
	{
		var group_pernum=10;	 //每组显示多少页
		var text1,text2,text3,text4,text5,text6,text7,text8,text9,text10,url;
		if(lan)
		{
			text1="上一页";	
			text2="下一页";	
			text3="转到第 ";	
			text4=" 页";
			text5="上一组";
			text6="下一组";
			text7="共";
			text8="页";
			text9="第";
			text10="页";
		}
		else
		{
			text1="BACK";	
			text2="NEXT";	
			text3="GO TO PAGE  ";	
			text4="";
			text5="BACK GROUP";
			text6="NEXT GROUP";
			text7="ALL";
			text8="PAGES";
			text9="PAGE";
			text10="";
		}
		var theurl=location.href;
		if(theurl.indexOf("/")>0&&theurl.indexOf(".html")>0)
		{
			var arr=theurl.split("/");
			filename=arr[arr.length-1];
			pageon=filename.split(".html")[0];
			if(pageon.indexOf("_")>0)
			{
				pageon=pageon.split("_")[1];
			}
			else
			{
				pageon=pagenums;
			}
		}
		else
		{
			pageon=pagenums;
		}
		if(typeof pageon=="undefined")pageon=1;
		pageon=parseInt(pageon);		
		pageon=(pagenums-pageon+1);
		if(typeof urlstr=="undefined")
		{
			if(theurl.indexOf("/")>0)
			{
				var arr=theurl.split("/");
				filename=arr[arr.length-1];
				filename=filename.replace("_"+pageon,"");
				urlstr=filename.split(".html")[0];
			}
		}
		var gounps=Math.ceil(pagenums/group_pernum) //一共分多少组
		var gounpon=Math.ceil(pageon/group_pernum) //当前页码位于多少组	
		prepage=pageon-1;
		nextpage=pageon+1;
		pregroup=pageon-group_pernum;
		nextgroup=pageon+group_pernum;
		if(prepage<1){prepage=1;}
		if(nextpage>pagenums){nextpage=pagenums;}
		if(pregroup<1){pregroup=1;}
		if(nextgroup>pagenums){nextgroup=pagenums;}	
		document.write("<div id='mypage'>");
		document.write("<a>"+text7+" "+pagenums+" "+text8+" / "+text9+" "+pageon+" "+text10+"</a>");
		if(pageon==1)
		{
			document.write("<a class='page_no'>"+text1+"</a>");
		}
		else
		{
			url=urlstr+"_"+(pagenums-prepage+1)+".html";
			url=url.replace("_"+pagenums+".html",".html");
			document.write("<a href='"+url+"'>"+text1+"</a>");//上一页
		}
		
		if(gounpon>1) //当前组大于一时，显示上一组
		{
			pregroup=pagenums-pregroup+1;
			url=urlstr+"_"+pregroup+".html";
			url=url.replace("_"+pagenums+".html",".html");
			document.write("<a href='"+url+"' title='"+text5+"'>&lt;&lt;</a>");
		}
		
		for(var i=(gounpon-1)*group_pernum+1;i<=gounpon*group_pernum;i++) //显示位于当前组的页码
		{
			url=urlstr+"_"+(pagenums-i+1)+".html";
			url=url.replace("_"+pagenums+".html",".html");
			if(i>pagenums){break;}
			document.write("<a href='"+url+"'");
			if(pageon==i){document.write(" class='page_on'");}
			document.write(" title='"+text3+i+text4+"'>"+i+"</a>");
		}
		
		if(gounpon<gounps) //当前组小于总组数时，显示下一组
		{
			nextgroup=pagenums-nextgroup+1;
			document.write("<a href='"+urlstr+"_"+nextgroup+".html' title='"+text6+"'>&gt;&gt;</a>");
		}
		
		if(pageon==pagenums)
		{
			document.write("<a class='page_no'>"+text2+"</a>");
		}
		else
		{
			url=urlstr+"_"+(pagenums-nextpage+1)+".html"; //下一页
			document.write("<a href='"+url+"'>"+text2+"</a>");
		}
		document.write("</div>");
	}
}

//页内分页函数
function pagelist2(pagenums,lan,urlstr)
{
	var obj=getId("newslist");
	if(getCookie('newsmodel')=="2"&&obj){obj.className="newslist2";}
		
	if(pagenums>0)
	{
		var group_pernum=10;	 //每组显示多少页
		var text1,text2,text3,text4,text5,text6,text7,text8,text9,text10,url;
		if(lan)
		{
			text1="上一页";	
			text2="下一页";	
			text3="转到第 ";	
			text4=" 页";
			text5="上一组";
			text6="下一组";
			text7="共";
			text8="页";
			text9="第";
			text10="页";
		}
		else
		{
			text1="BACK";	
			text2="NEXT";	
			text3="GO TO PAGE  ";	
			text4="";
			text5="BACK GROUP";
			text6="NEXT GROUP";
			text7="ALL";
			text8="PAGES";
			text9="PAGE";
			text10="";
		}
		var theurl=location.href;
		if(theurl.indexOf("/")>0&&theurl.indexOf(".html")>0)
		{
			var arr=theurl.split("/");
			filename=arr[arr.length-1];
			pageon=filename.split(".html")[0];
			if(pageon.indexOf("_")>0)
			{
				pageon=pageon.split("_")[1];
			}
			else
			pageon=1;
		}
		if(typeof pageon=="undefined")pageon=1;
		pageon=parseInt(pageon);	
		if(typeof urlstr=="undefined")
		{
			if(theurl.indexOf("/")>0)
			{
				var arr=theurl.split("/");
				filename=arr[arr.length-1];
				filename=filename.replace("_"+pageon,"")
				urlstr=filename.split(".html")[0];
			}
		}
		var gounps=Math.ceil(pagenums/group_pernum) //一共分多少组
		var gounpon=Math.ceil(pageon/group_pernum) //当前页码位于多少组	
		prepage=pageon-1;
		nextpage=pageon+1;
		pregroup=pageon-group_pernum;
		nextgroup=pageon+group_pernum;
		if(prepage<1){prepage=1;}
		if(nextpage>pagenums){nextpage=pagenums;}
		if(pregroup<1){pregroup=1;}
		if(nextgroup>pagenums){nextgroup=pagenums;}	
		document.write("<div id='mypage'>")
		document.write("<a>"+text7+" "+pagenums+" "+text8+" / "+text9+" "+pageon+" "+text10+"</a>");
		if(pageon==1)
		{
			document.write("<a class='page_no'>"+text1+"</a>");
		}
		else
		{
			url=urlstr+"_"+prepage+".html";
			url=url.replace("_1.html",".html");
			document.write("<a href='"+url+"'>"+text1+"</a>");
		}
		
		if(gounpon>1)
		{
			url=urlstr+"_"+pregroup+".html"
			url=url.replace("_1.html",".html");
			document.write("<a href='+url+' title='"+text5+"'>&lt;&lt;</a>");
		} //当前组大于一时，显示上一组
		
		for(var i=(gounpon-1)*group_pernum+1;i<=gounpon*group_pernum;i++) //显示位于当前组的页码
		{
			url=urlstr+"_"+i+".html";
			url=url.replace("_1.html",".html");
			if(i>pagenums){break;}
			document.write("<a href='"+url+"'");
			if(pageon==i){document.write(" class='page_on'");}
			document.write(" title='"+text3+i+text4+"'>"+i+"</a>");
		}
		
		if(gounpon<gounps){	document.write("<a href='"+urlstr+"_"+nextgroup+".html' title='"+text6+"'>&gt;&gt;</a>");} //当前组小于总组数时，显示下一组
		
		if(pageon==pagenums)
		{
			document.write("<a class='page_no'>"+text2+"</a>");
		}
		else
		{
			url=urlstr+"_"+nextpage+".html";
			url=url.replace(urlstr+"_1.html",urlstr+".html");
			document.write("<a href='"+url+"'>"+text2+"</a>");
		}
		document.write("</div>");
	}
}
//图片——链接类型 1为无 2为大图片 3为自定义
function linktypes(typeid)
{
	if(typeid=="3")
	{getId("link").style.display="";}
	else
	{getId("link").style.display="none";}
}

function setCookie(name,value)
{
	var Days = 30;
	var exp = new Date();
	exp.setTime(exp.getTime() + Days*24*60*60*1000);
	document.cookie=escape(name)+"="+escape(value)+";expires="+exp.toGMTString()+";path=/";
}

function getCookie(name)
{
	var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	if(arr=document.cookie.match(reg)) return unescape(arr[2]);
	else return '';
}
   
function changemodel(types)
{
	if(types=="news")
	{
		var obj=getId("newslist");
		if(obj)
		{
			if(obj.className=="newslist")
			{
				obj.className="newslist2";
				setCookie("newsmodel","2");
			}
			else
			{
				obj.className="newslist";
				setCookie("newsmodel","1");
			}
		}
	}
	else
	{
		var obj2=getId("pro_list");	
		if(types=="pro1"){if(obj2){obj2.className="pro_list1";setCookie("pro_model","pro_list1");changemodel2(1);}}
		if(types=="pro2"){if(obj2){obj2.className="pro_list2";setCookie("pro_model","pro_list2");changemodel2(2);}}
		if(types=="pro3"){if(obj2){obj2.className="pro_list3";setCookie("pro_model","pro_list3");changemodel2(3);}}
	}
}

function changemodel2(id)
{
	for(i=1;i<=3;i++)
	{
		getId("promodel_"+i).src=getId("promodel_"+i).src.replace("on.gif",".gif");
	}
	getId("promodel_"+id).src=getId("promodel_"+id).src.replace(".gif","on.gif");
}

function setProModel()
{
	var proClassName=getCookie("pro_model");
	if(proClassName){getId("pro_list").className=proClassName;}
	if(proClassName=="pro_list3")
	{		
		getId("promodel_1").src="images/view_mode_a.gif";
		getId("promodel_2").src="images/view_mode_b.gif";
		getId("promodel_3").src="images/view_mode_con.gif";
	}
	else if(proClassName=="pro_list2")
	{
		getId("promodel_1").src="images/view_mode_a.gif";
		getId("promodel_2").src="images/view_mode_bon.gif";
		getId("promodel_3").src="images/view_mode_c.gif";
	}
	else
	{
		getId("promodel_1").src="images/view_mode_aon.gif";
		getId("promodel_2").src="images/view_mode_b.gif";
		getId("promodel_3").src="images/view_mode_c.gif";
	}
}

function changeorder(types)
{
	var orders=getCookie(co_+types+"_order_type");
	if(orders=="1")
	{
		setCookie(co_+types+"_order_type",2);
		history.go(0);
	}
	else
	{
		setCookie(co_+types+"_order_type",1);
		history.go(0);
	}	
}

function setProOrder()
{
	var orders=getCookie(co_+"pro_order_type");
	var pro_order=getId("pro_order");
	if(orders==1)
	{
		pro_order.src="images/view_mode_d.gif";
	}
	else
	{
		pro_order.src="images/view_mode_don.gif";
	}
}

function backtolist(cases)
{
	var url=getCookie("news_list_url");
	if(url&&Null(cases))
	{
		location.href=url;
	}
	else
	{
		location.href="../../";
	}
}

function OK(url)
{
	if(url)
	{
		if(url.indexOf("?")>0)
		{
			url+="&_t="+Math.random();
		}
		else
		{
			url+="?_t="+Math.random();
		}
		parent.window.open(url,"frmright");
	}
	if(parent.window.getId("bgs"))parent.window.getId("bgs").style.display="none";
	if(parent.window.getId("showMsg_Id"))parent.window.getId("showMsg_Id").style.display="none";	
}

//进度条函数，结合sub loadingbar使用
function loadingbar(id,numson,numsall,w)
{
	var barwidth=numson/numsall*w;
	var percenter=parseInt(numson/numsall*100)+"%";	
	getId("loadingbar"+id).style.width=barwidth;
	getId("loadnum"+id).innerHTML=percenter;
}

//zmr8
function gotosearch(str)
{
	getId("keyword").value=str;
}
function gotocity(str)
{
	alert("成功切入追梦人吧"+str+"站！");
}

function searchform()
{
	var keyword=getId("keyword");
	if(keyword&&keyword.value==""){alert("请输入搜索关键词！");keyword.focus();return false;}
}

function picclick(id,path)
{
	ajax2(path+"picclick.asp","id="+id+"&add=1");	
}
function videosjbg()
{
	var i=randomChar(1,"videobg");
	getId("videolook").style.background="url("+webpath+"images/videobg_"+i+".jpg)";
}

function randomChar(m,types)
{
	var tmp="";
	var str="0123456789poiuytrewqasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM";
	var str1="0123456789poiuytrewqasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM";
	if(types=="num"){str="0123456789";str1="0123456789";}
	if(types=="Num"){str="0123456789";str1="123456789";}
	if(types=="videobg"){str="0123456789";str1="12345";}
	for(var i=0;i<m;i++)
	{
		if(i==0)
		{tmp += str1.charAt(Math.ceil(Math.random()*100000000)%str1.length);}
		else
		{tmp += str.charAt(Math.ceil(Math.random()*100000000)%str.length);}
	}
	return tmp;
}

function get_Code(path)
{
	var Dv_CodeFile = path+"alz_admin/alz_GetCode.asp?t="+Math.random();
	var codeimg=getId("codeimg");
	if(codeimg)codeimg.src=Dv_CodeFile;
}

function submitForm(formID)
{ 
	if(window.event.ctrlKey&&window.event.keyCode==13)
	{ 
		document.getElementById(formID).submit(); 
	} 
}

function copy(obj){
	obj.select();
	js=obj.createTextRange();
	js.execCommand("Copy");
}

function movediv(divId,moveobj2)
{
	var posX;
	var posY;  
	alert(moveobj2)
	moveobj = document.getElementById(divId);
	moveobj2.onmousedown=function(e)
	{
	  if(!e) e = window.event; //如果是IE
	  posX = e.clientX - parseInt(moveobj.style.left);
	  posY = e.clientY - parseInt(moveobj.style.top);
	  document.onmousemove = mousemove;  
	}
	document.onmouseup = function()
	{
	  document.onmousemove = null;
	}
	function mousemove(ev)
	{
	  if(ev==null) ev = window.event;//如果是IE
	  moveobj.style.left = (ev.clientX - posX) + "px";
	  moveobj.style.top = (ev.clientY - posY) + "px";
	}
}

function setfile(title,path,secid,other)
{
	showMsg(title,'<iframe src="file/index.asp?path='+path+'&secid='+secid+'&other='+other+'&_i='+Math.random()+'" scrolling="no" width="100%" height="500" frameborder="0"></iframe>',900,0)
}

function setfile2(title,path,secid,other)
{
	DvWnd.open("文件管理",'alz_admin/file/index.asp?path='+path+'&secid='+secid+'&other='+other+'&_i='+Math.random(),0,900,530)
}

function autosuo(id)
{
	if(id)
	{
		getId("suo").style.display="";	
	}
	else
	{
		getId("suo").style.display="none";
	}
}

function ding(typeid,id)
{
	var dingF=G("#dings b iframe")[0];
	var dingA=G("#dings a")[0];	
	if(dingA){dingA.innerHTML="<img src='images/loading3.gif' />";}
	ajax2(webpath+"fun/comment/ding.asp","typeid="+typeid+"&id="+id+"&add=1");
	dingF.src=webpath+"fun/comment/ding.asp?typeid="+typeid+"&id="+id+"&t="+Math.random();
	if(dingA){dingA.innerHTML="谢谢参与";}
}

function commetok(typeid,id)
{
	var dingF=parent.G("#comment b iframe")[0];
	var commentF=parent.G(".comment_content iframe")[0];
	var newSrc=webpath+"fun/comment/ping.asp?typeid="+typeid+"&id="+id+"&t="+Math.random();
	var commentSrc=webpath+"fun/comment/index.asp?typeid="+typeid+"&id="+id+"&t="+Math.random();
	if(dingF)dingF.src=newSrc;
	if(commentF)commentF.src=commentSrc;
	wndClose();
}

function seachtype(typeid)
{
	var obj=getId("keyword");
	var objform=getId("searchform");
	if(typeid==2)
	{
		if(objform){objform.action="http://www.google.cn/custom";objform.target="_blank";}	
		if(obj)obj.name="q";
	}
	else if(typeid==3)
	{
		if(objform){objform.action="http://www.baidu.com/baidu";objform.target="_blank";}
		if(obj)obj.name="word";
	}
	else
	{
		if(objform){objform.action="search.asp";objform.target="";}
		if(obj)obj.name="keyword";
	}
}

function vPic(id,altStr,cStr)
{
	var mPic=getId("matherPic");
	noright2(mPic);	
	mPic.title=cStr;
	mPic.onclick=function(){mPic.style.display='none';};	
	var obj=getId(id);
	var objImg=obj.getElementsByTagName("img");
	for(i=0;i<objImg.length;i++)
	{
		objImg[i].alt=altStr;
		objImg[i].style.cursor="pointer";
		eval("var obj"+i+"=objImg["+i+"]");
		eval("obj"+i+".onclick=function(){toBig(obj"+i+")};");
	}	
}
function toBig(obj)
{
	var imgs=new Image();
	imgs.src=obj.src;
	obj=imgs;
	var mPic=getId("matherPic");
	mPic.style.display="";
	var sTop=scrollTop();
	var allWeidth=clientWidth();
	var allHeight=clientHeight();
	var picW=obj.width;
	var picH=obj.height;
	var w=picW;
	var h=picH;
	if(picW/picH>allWeidth/allHeight&&picW>allWeidth){w=allWeidth;h=allWeidth/(picW/picH);}	
	//if(picW/picH<allWeidth/allHeight&&picH>allHeight){h=allHeight;w=allHeight/(picH/picW);}
	if(h>allHeight){mPic.style.top=sTop+"px";}else{mPic.style.top=(allHeight-h)/2+sTop-3+"px";	}	
	mPic.style.left=(allWeidth-w)/2+"px";	
	mPic.innerHTML="<img src='"+obj.src+"' width='"+w+"' heidht='"+h+"' />";
}

function pro_dh(typeid,text,id,np)
{
	document.write(text+id);
}

function returnimgcode(theimg)
{
	var imghtml="";
	if(theimg[1]!="")imghtml='<a href="'+theimg[1]+'" target="_blank">';
	imghtml+='<img src="'+theimg[0]+'" />';
	if(theimg[1]!="")imghtml+='</a>';
	return imghtml;
}

function modifyimage(loadarea,imgindex)
{
	var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)";
	var imgobj=getId(loadarea);
	if(imgobj.filters && window.createPopup)
	{
		imgobj.style.filter=filterstring;
		imgobj.filters[0].Apply();
	}
	imgobj.innerHTML=returnimgcode(proimgs[imgindex]);
	if(imgobj.filters && window.createPopup)imgobj.filters[0].Play();
	return false;
}

window.onerror=function(){return true;}