﻿function XMLHttpRequest()
{
   var xmlhttp=null;
   if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)  {
      xmlhttp=new XMLHttpRequest();
   }
   return xmlhttp;
}

var url=String(window.location.href);
var filename=url.slice(url.lastIndexOf("/")+1);
filename=filename.toLowerCase() //专为小写

function products0()
{ 
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("post","session.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(null);
	location.href="new_products.htm";
}

function products()
{ 
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("post","session.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send(null);
	location.href="products.htm";
}

function products1(values)
{ 
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("post","session.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send("values="+escape(values))
	location.href="products.htm";
}

function products2(values)
{ 
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("post","session.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.send("values="+escape(values))
	location.href="products.htm";
}


function Response_top(types,div)
{ 
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("post","top.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			document.getElementById(div).innerHTML = xmlhttp.responseText;
			xmlhttp = null;
		}
	}
	xmlhttp.send("types="+escape(types));	
}

function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
document.getElementById("pic"+sid).src="images/open.gif";
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
document.getElementById("pic"+sid).src="images/close.gif";
}
}

//图片按比例缩放,可输入参数设定初始大小
function resizeimg(ImgD,iwidth,iheight) {
     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="width×height:"+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="width×height:"+image.width+"×"+image.height;
         }
		 
　　　　//ImgD.style.cursor= "pointer"; //改变鼠标指针
　　　　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 = "点击图片可在新窗口打开";
　　　　}
    }
}

//图片按比例缩放,可输入参数设定初始大小 


function CheckEmail(email)
{
	var RegExpStr = /^([\w\_\-\.]{1,})(@)([\w\-\.]{1,})(\.)([a-zA-Z\.]{1,})$/;
	return RegExpStr.test(email);
}

//信息反馈
function infor_insert()
{
	var subject=(document.form.subject.value).replace(/(^\s*)|(\s*$)/g,"");
	var email=(document.form.email.value).replace(/(^\s*)|(\s*$)/g,"");
	var name=(document.form.name.value).replace(/(^\s*)|(\s*$)/g,"");
	var company=(document.form.company.value).replace(/(^\s*)|(\s*$)/g,"");
	var address=(document.form.address.value).replace(/(^\s*)|(\s*$)/g,"");
	var telphone=(document.form.telphone.value).replace(/(^\s*)|(\s*$)/g,"");
	var fax=(document.form.fax.value).replace(/(^\s*)|(\s*$)/g,"");
	var content=(document.form.content.value).replace(/(^\s*)|(\s*$)/g,"");
	
	if (email=="")
	{
		alert("Enter e-mail address");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(email))
	{
		alert("Enter right e-mail address");
		form.email.focus();
		return false;
	}
	if (name=="")
	{
		alert("Please enter your name");
		form.name.focus();
		return false;
	}
	if (telphone=="")
	{
		alert("Enter Phone");
		form.telphone.focus();
		return false;
	}
	if (content=="")
	{
		alert("Please enter Content");
		form.content.focus();
		return false;
	}
	
	var xmlhttp=XMLHttpRequest();
	xmlhttp.open("POST","InforFeedback_save.asp",true);
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		{
			alert(xmlhttp.responseText);
			xmlhttp = null;
			Response_list("feedback","feedback"); 
		}
	}
	xmlhttp.send("subject="+escape(subject)+"&email="+escape(email)+"&name="+escape(name)+"&company="+escape(company)+"&address="+escape(address)+"&telphone="+escape(telphone)+"&fax="+escape(fax)+"&content="+escape(content));	
	
}
//信息反馈