window.onerror=new Function("return true");
window.onload = function(){

	resizeimg();
	}
function $(ID){
    if(document.getElementById&&document.getElementById(ID)){
		return document.getElementById(ID);
	}else if (document.all&&document.all(ID)) {
		return document.all(ID);
	}else if (document.layers&&document.layers[ID]){
		return document.layers[ID];
	}else{
		return false;
	}
}
var Loading="<div style='text-align:center;font:bold 12px arial;line-height:50px;height:200px;color:#ccc'>";
	Loading+="Please wait...";
	Loading+="<br \/><img src='images/loading.gif' alt='' /><br \/><br \/><\/div>";
//显示时间
function ShowDate(){
setInterval("time.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
}
//##########################################
//#AJAX类
//##########################################
function AJAX(){
	var $HTTP=false;var $Me=this;
	try{$HTTP=new XMLHttpRequest;}
		catch(e){
	try{$HTTP=new ActiveXObject("MSXML2.XMLHTTP");}
		catch(e2){
	try{$HTTP=new ActiveXObject("Microsoft.XMLHTTP");}
		catch(e3){$HTTP=false;}}}
	if (!$HTTP){return false;}
	this.method="POST";
	this.URL;
	this.ASYNC=true;
	this.content="";
	this.callback=function(obj) {return obj;}
	this.send=function(){
	if(!this.method||!this.URL||!this.ASYNC){return false;}
	//$HTTP.open (this.method,this.URL+"&Time="+new Date().getTime(), this.ASYNC);
	$HTTP.open (this.method,this.URL,this.ASYNC);   
	if(this.method=="POST"){$HTTP.setRequestHeader("Content-Type","application/x-www-form-URLencoded");}
	$HTTP.onreadystatechange=function(){$Me.callback($HTTP);}
	if(this.method=="POST"){$HTTP.send(this.content);}else{$HTTP.send(null);}
	}
}
//设为首页
function homepage(e,NAME){
	e.style.behavior='url(#default#homepage)';e.setHomePage(NAME);
}
//加入收藏
function Favorite(URL,NAME){
	window.external.AddFavorite(URL,NAME)
}
//图片按比例缩放,可输入参数设定初始大小
function resizeimg() {
	var picTarget=document.getElementById("content").getElementsByTagName("img");
	for (var i=0;i<picTarget.length;i++){
	var image=new Image();
    image.src=picTarget[i].src;
	var iheight = 500;var iwidth= 600; 
	if(image.width>0 && image.height>0){
        if(image.width/image.height>= iwidth/iheight){
           if(image.width>iwidth){
               picTarget[i].width=iwidth;
               picTarget[i].height=(image.height*iwidth)/image.width;
           }else{
                  picTarget[i].width=image.width;
                  picTarget[i].height=image.height;
                }
               picTarget[i].alt=image.width+"×"+image.height;
        }
        else{
                if(image.height>iheight){
                       picTarget[i].height=iheight;
                       picTarget[i].width=(image.width*iheight)/image.height;
                }else{
                        picTarget[i].width=image.width;
                        picTarget[i].height=image.height;
                     }
                picTarget[i].alt=image.width+"×"+image.height;
            }
　　　　　picTarget[i].style.cursor= "pointer"; //改变鼠标指针
　　　　　picTarget[i].onclick = function() { window.open(this.src);} //点击打开大图片
　　　　if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器，如果是IE
　　　　　　picTarget[i].title = "请使用鼠标滚轮缩放图片，点击图片可在新窗口打开";
　　　　　　picTarget[i].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
　　　　　　　     picTarget[i].title = "点击图片可在新窗口打开";
　　　　　　   }
    }	
	}
}
//显示列表
function Load_list(action,div){
var Ajax=new AJAX();
    Ajax.method="GET";
    Ajax.URL="Ajax.asp?To="+action+"";
    Ajax.callback=function($HTTP){if ($HTTP.readyState==4){$(div).innerHTML=$HTTP.responseText;}else{$(div).innerHTML=Loading;}}
    Ajax.send(null);	
	}
	
//显示内容
function Load_show(action,div,id){
var Ajax=new AJAX();
    Ajax.method="GET";
    Ajax.URL="Ajax.asp?To="+action+"&ID="+id+"";
    Ajax.callback=function($HTTP){if ($HTTP.readyState==4){$(div).innerHTML=$HTTP.responseText;}else{$(div).innerHTML=Loading;}}
    Ajax.send(null);	
	}	
//分页
function GetPage(URL,Page){
var Ajax=new AJAX();
    Ajax.method="GET";
    Ajax.URL=""+URL+"&Page="+Page+"";
    Ajax.callback=function($HTTP){if ($HTTP.readyState==4){$("center").innerHTML=$HTTP.responseText;}else{$("center").innerHTML=Loading;}}
    Ajax.send(null);
}﻿

//显示FLASH
window.onerror=new Function("return true");

function Flash(Path,Width,Height)
{
var Tmp
	Tmp='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="FlashH" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+Width+'" height="'+Height+'">'
	Tmp+='<param name="movie" value="'+Path+'"/>'
	Tmp+='<param name="quality" value="High"/>'
	Tmp+='<param name="scale" value="ExactFit"/>'
	Tmp+=' <param name="wmode" value="transparent"/>';
	Tmp+='<embed wmode="transparent" src="'+Path+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="FlashH" width="'+Width+'" height="'+Height+'" scale="ExactFit"/>'
	Tmp+='</object>'
document.write(Tmp);
}
//分页
//分页
function PageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\" title='第 1 页'>|&lsaquo;</a> ");
	document.write("<a href=\"" + sUrl + i + "\" title='上一页(第 " + i + " 页)'>&lsaquo;&lsaquo;</a> ");
	for(i=Math.max(1,iPage-5);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\" title='第 " + i + " 页'><b>" + i + "</b></a> ");
	}
	document.write("<span class=\"current\">" + iPage + "</span> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+5);i++){
		document.write("<a href=\""+sUrl + i + "\" title='第 " + i + " 页'><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	//if(iCount>iPage+5) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\" title='下一页(第 " + i + " 页)'>&rsaquo;&rsaquo;</a> ");
	document.write("<a href=\"" + sUrl + iCount + "\" title='最后一页(第 " + iCount + " 页)'>&rsaquo;|</a> ");
}
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\"   class=\"page01\"></a> ");
	document.write("<a href=\"" + sUrl + i + "\"  class=\"page02\" ></a> ");
	for(i=Math.max(1,iPage-5);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\" ><b>" + i + "</b></a> ");
	}
	document.write("<span class=\"current\">" + iPage + "</span> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+5);i++){
		document.write("<a href=\""+sUrl + i + "\" ><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	//if(iCount>iPage+5) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\"  class=\"page03\"></a> ");
	document.write("<a href=\"" + sUrl + iCount + "\"   class=\"page04\"></a> ");
}
//搜索
function Getguest(form,action,div){
var err = document.getElementById("ordererr");
var company = document.orderform.company;
var youname = document.orderform.youname;
var tel = document.orderform.tel;
var fax = document.orderform.fax;
var strm = document.orderform.mail.value   //提交mail地址的文本框
var regm = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;//验证Mail的正则表达式,^[a-zA-Z0-9_-]:
if (company.value == ""){
	err.innerHTML = "公司名称不能为空" ;
	company.focus()
	return false
}
if (youname.value == ""){
	err.innerHTML = "你的姓名不能为空" ;
	youname.focus()
	return false
}
if (tel.value == ""){
	err.innerHTML = "电话号码不能为空。" ;
	tel.focus()
	return false
}
if (fax.value == ""){
	err.innerHTML = "传真号码不能为空。" ;
	fax.focus()
	return false
}
if (!strm.match(regm) ||  strm==""){
alert('邮箱地址格式错误或含有非法字符!请检查！')
document.orderform.mail.select();   
return false;	   
}

var Ajax=new AJAX();
    Ajax.method="POST";
    Ajax.URL="Guestbook.asp?To="+action+"";
	Ajax.content=GetString(form);
    Ajax.callback=function($HTTP){
			if($HTTP.readyState == 4){
	if($HTTP.status == 200){  
			var ss=unescape($HTTP.responseText);
			alert("留言成功,谢谢。")
		location.reload()

	}else{Dialog.alert("您所请求的页面有异常。");} 
	}
}
	Ajax.send(null);
	
}

function GetString(form){
var param =[];var cname = [];var oEditorName = [];var oEditor = [];
for   (var   i=0;i<document.forms[form.name].elements.length;i++){ 
	var e = document.forms[form.name].elements[i] ;
	switch (e.type){		
	//编辑器
	case "textarea" :
	if($(e.name).style.display=="none"){
		oEditor = new Array(FCKeditorAPI.GetInstance(e.name).GetXHTML(true)); 	
		param.push(e.name+ "=" +escape(oEditor))
	}else{
		param.push(e.name + "=" + escape(e.value))
	}
	break;	
	//单选
	case "radio":
	if(e.checked){param.push(e.name + "=" + escape(e.value));};break;
	//多选框
	case "checkbox":
	if(e.checked == false){param.push(escape(e.name) +"=0");}
	if(e.checked){param.push(escape(e.name)+"="+escape(e.value));};break;
	//
	case "select-one":
	for(var j=0;j<e.options.length;j++){
	if(e.options[j].selected){
	param.push(e.name + "=" + escape(e.options[j].value));
	}
	}
	break;
	case "select-multiple":
	for(var j=0;j<e.options.length;j++){
		param.push(e.name + "=" +escape(e.options[j].value))
		};break;
	
	default:
	param.push(e.name + "=" + escape(e.value));
	}
}
return param.join("&");
}
function  DrawImage(ImgD,iwidth,iheight){
      var  image=new  Image();
      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;
          }
        }
      /*else{
        ImgD.src="";
        ImgD.alt=""
        }*/
      }  

