﻿//快速分页条转
function FP_jumpMenu(el,frm,sel) {//v1.0
 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
 if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}

//产品图片
function MouseOver(n)
{        
  document.getElementById("img"+n).className='img1';
}  

function MouseOut(n)
{           
  document.getElementById("img"+n).className='img';  
}  
//产品图片

function CheckForm(n)
{
  var Msg = "";
  if (document.se.KeyWords.value == "")
  {
	alert("Enter KeysWords");
	document.se.KeyWords.focus();
	return false;
    Msg = "Err";
   }
  if (Msg == "")
  {
	  if (n==1)
	  {
		  var lu="";
	  }
	  else
	  {
		  var lu="../";
	  }
	  
	//alert("search.html?KeyWords="+document.se.KeyWords.value);
	document.se.action=lu+"search.html?KeyWords="+encodeURI(document.se.KeyWords.value);
	document.se.submit();
   }
}

function Ctlent()
{
	if(window.event.keyCode==13){CheckForm();}
}

function continue_shopping()
{
	document.shopping1.target="_parent";
	document.shopping1.action="../go_shopping.html";
	document.shopping1.submit();
}

//图片按比例缩放,可输入参数设定初始大小
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="宽×高:"+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 look_pic(id)
{
	if (id!="")
	{
	document.getElementById("pic_span").innerHTML="<img src='"+id+"' border='0'>";
	}
}

//检测空字符
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//检测空字符

function CheckEmail(email)
{
	var RegExpStr = /^([\w\_\-\.]{1,})(@)([\w\-\.]{1,})(\.)([a-zA-Z\.]{1,})$/;
	return RegExpStr.test(email);
}


// JavaScript Document
function createXMLHttpRequest()  //针对不同浏览器设置XMLHttpRequest方式
{ 
    xmlhttp = false; 
     
    if(window.XMLHttpRequest)
	{        //for Mozilla 
        xmlhttp = new XMLHttpRequest(); 
        if(xmlhttp.overrideMimeType)
		{ 
            xmlhttp.overrideMimeType("text/xml"); 
        } 
    } 
    else if(window.ActiveXObject)
	{   //for IE 
        try
		{ 
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
        }
		catch(e)
		{ 
            try
			{ 
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
            }
		catch(e)
		{} 
        } 
    } 
}


//信息反馈界面
function feedback_en()
{
	var xmlHttp = createXMLHttpRequest();
	var getURL = "template/feedback_en.asp?action=start";
	xmlhttp.open("POST",getURL,true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	xmlhttp.onreadystatechange=function() 
	{
		if ( xmlhttp.readyState==4 || xmlhttp.readyState=='complete' )
		{
			document.getElementById("feedback").innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}


//信息反馈
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,"");
	
	var msg="yes";
	
	if (subject=="")
	{
		msg="no";
		alert("Enter Country");
		form.subject.focus();
		return false;
	}
	if (email=="")
	{
		msg="no";
		alert("Enter e-mail address");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(email))
	{
		msg="no";
		alert("Enter right e-mail address");
		form.email.focus();
		return false;
	} 
	if (name=="")
	{
		msg="no";
		alert("Please enter your name");
		form.name.focus();
		return false;
	}
	if (company=="")
	{
		msg="no";
		alert("Please enter your company");
		form.company.focus();
		return false;
	}
	if (telphone=="")
	{
		msg="no";
		alert("Enter Phone");
		form.telphone.focus();
		return false;
	}
	if (content=="")
	{
		msg="no";
		alert("Please enter Content");
		form.content.focus();
		return false;
	}
	
	if (msg=="yes")
	{
		var xmlHttp = createXMLHttpRequest();
		var getURL = "template/feedback_en.asp";
		var posturl = "action=save&subject="+subject+"&email="+email+"&name="+name+"&company="+company+"&telphone="+telphone+"&address="+address+"&fax="+fax+"&content="+content;
		xmlhttp.open("POST",getURL,true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.onreadystatechange=function() 
		{
			if ( xmlhttp.readyState==4 || xmlhttp.readyState=='complete' )
			{
				document.getElementById("feedback").innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(posturl);
	}
	else
	{
		alert("Please fill out complete information on request!");
		return false;
	}
	
}