function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function killErrors() {
return true;
}

window.onerror = killErrors;
minimum=1;
// 判断电子邮件是否格式正确
function is_email(object_name)
{
	var string;
	string=new String(object_name);
	var len=string.length;
	if (string.indexOf("@",1)==-1||string.indexOf(".",1)==-1||string.length<7)
		{
		alert("电子邮箱的格式不对！");
		return false;
		}
	if (string.charAt(len-1)=="."||string.charAt(len-1)=="@")
		{
		alert("电子邮箱的格式不对！");
		return false;
		}
}
//判断是输入栏否为空
function is_null(object_name,tishi,word,kongge)  // object_name 为对象名称，tishi=1 为是否显示对话框,word 为提示语句,kongge=1 为去除空格,
{
	var string;
	string=new String(object_name);
	if (kongge==1)
	{string=javaTrim(string);} //删除空格的字符 
	//alert("返回的字符集="+string+"长度为="+string.length)
	if (string.length==0)
	{
		if (tishi==1)
		{
		alert(word);
		}
		return false;
	}
}

//字体大小
function doZoom(size){
	document.getElementById('zoom').style.fontSize=size+'px'
//	setTailPosition()
	return false;
}


//删除字符开头和结尾的空格
function javaTrim(str){
	var i=0;
	var j;
	var len=str.length;

	trimstr="";
	if(j<0) return trimstr;
	flagbegin= true;
	flagend= true;
		
	while (flagbegin== true){
		if (str.charAt(i)==" "){
			i++;
			flagbegin=true;
		}
		else
		{
			
			flagbegin=false;
		}
	} 
	//前面有i个空格
	j=len-1;
	var k=0;
	while (flagend==true)
	{
		if (str.charAt(j)==" ")
		{
			j--;
			flagend=true;
			k++;
		}
		else{
			flagend=false;
		}
	}
        
	//后面有k个空格
	//alert('前面有'+i+'个空格！');
	//alert('后面有'+k+'个空格！');
	if (str.length==i)
	{
	 //alert("你的输入全为空格！")
	 trimstr="";
	 return trimstr;
	}
	trimstr=str.substring(i,j+1);
	//alert("bf"+trimstr+"fb");
	return trimstr;
}
//判断输入栏的最小和最大长度是否越界
function over_length(object_name,max,min,max_word,min_word,kongge) //kongge=1 为处理掉字符串中的空格
{
	var string;
	string=new String(object_name);
	if (kongge==1)
		{
		 string=javaTrim(string);
		}
	if (string.length>max)
		{
		 alert(max_word);
		 return false;
		}
	if (string.length<min)
		{
		 alert(min_word);
		 return false;
		}
	}
   function isWhitespace (s) //是否包涵空格
    {  
  		var whitespace = " \t\n\r";
 	    var i;
  		for (i = 0; i < s.length; i++)
  		 {   
   		    var c = s.charAt(i);
   		    if (whitespace.indexOf(c) >= 0) 
			   {
			  return true;
	 			 }
  			}

     return false;
    }

function IsPassword(strPassword)
{
	if(strPassword=="") return false;
	var lngLength = strPassword.length;
	var strCharSet="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
	for(i=0; i<lngLength; i++)
	{
		if (strCharSet.search(strPassword.substr(i,1))<0) return false;
	}
	return true;
}

//全选复选框
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
}

//弹出窗口
function urll(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-700/2;
y = totaly/2-420/2;
window.open(url,"","toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,height=420,width=700,top="+y+",left="+x+"");
}

//弹出窗口(详细信息) <a href="javascript:urll2('../info/add.asp')"></a>
function urll2(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-800/2;
y = totaly/2-620/2;
window.open(url,"","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,height=500,width=600,top="+y+",left="+x+"");
}

//弹出窗口(详细信息) <a href="javascript:urll2('../info/add.asp')"></a>
function urll3(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-300/2;
y = totaly/2-220/2;
window.open(url,"","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,height=250,width=380,top="+y+",left="+x+"");
}

// 图片查看
function picview(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-700/2;
y = totaly/2-420/2;
window.open(url,"","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,height=400,width=560,top="+y+",left="+x+"");
}
//禁止使用右键
function click() {
if (event.button==2) {   //改成button==2为禁止右键
alert('禁止复制！\n本站内所有图片及文字资源都属洁岚公司所有')
}
}
document.onmousedown=click
//禁右
if (window.Event) 
  document.captureEvents(Event.MOUSEUP); 
 
function nocontextmenu() 
{
 event.cancelBubble = true
 event.returnValue = false;
 
 return false;
}
 
function norightclick(e) 
{
 if (window.Event) 
 {
  if (e.which == 2 || e.which == 3)
   return false;
 }
 else
  if (event.button == 2 || event.button == 3)
  {
   event.cancelBubble = true
   event.returnValue = false;
   return false;
  }
 
}
 
document.oncontextmenu = nocontextmenu;  // for IE5+
document.onmousedown = norightclick;  // for all others

// 跳出窗口
function send(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-700/2;
y = totaly/2-420/2;
window.open(url,"","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,height=420,width=700,top="+y+",left="+x+"");
}
//弹出对话框
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//日期选择
function fPopUpDlg(endtarget,ctl,WINname,WINwidth,WINheight){
	
	showx =  WINwidth + 200  ; // + deltaX;
	showy = WINheight ; // + deltaY;

	newWINwidth = WINwidth + 4 + 18;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog(endtarget, WINname , features );
	if( retval != null ){
		ctl.value = retval;
	}else{
		//alert("canceled");
	}
}

function checkseearch(){
    if (window.document.search.Keys.value=="")
      {
        alert("请输入搜索关键词")
        window.document.search.Keys.focus()
        return false
       }
    if (window.document.search.Keys.value=="请输入搜索内容")
      {
        alert("请输入搜索关键词")
        window.document.search.Keys.focus()
        return false
       }
  else
  return true;
}

//验证用户登陆
function checklogin(){
    if (window.document.form1.username.value=="")
      {
        alert("请输入您的用户名！")
        window.document.form1.username.focus()
        return false
       }
    if (window.document.form1.password.value=="")
      {
        alert("请输入您的密码！")
        window.document.form1.password.focus()
        return false
       }
  else
  return true;
}

//留言框
function gbcount(message,total,used,remain)
{
	var max;
	max = total.value;
	if (message.value.length > max) {
	message.value = message.value.substring(0,max);
	used.value = max;
	remain.value = 0;
	alert("留言不能超过 200 个字!");
	}
	else {
	used.value = message.value.length;
	remain.value = max - used.value;
	}
}

////自动设置iframe
var iframeids=["main"] 
var iframehide="yes" 
function dyniframesize() 
{ 
var dyniframe=new Array() 
for (i=0; i<iframeids.length; i++) 
{ 
if (document.getElementById) 
{ 
dyniframe[dyniframe.length] = document.getElementById(iframeids); 
if (dyniframe && !window.opera) 
{ 
dyniframe.style.display="block" 
if (dyniframe.contentDocument && dyniframe.contentDocument.body.offsetHeight) 
dyniframe.height = dyniframe.contentDocument.body.offsetHeight; 
else if (dyniframe.Document && dyniframe.Document.body.scrollHeight) 
dyniframe.height = dyniframe.Document.body.scrollHeight; 
} 
} 
if ((document.all || document.getElementById) && iframehide=="no") 
{ 
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids) 
tempobj.style.display="block" 
} 
} 
} 
if (window.addEventListener) 
window.addEventListener("load", dyniframesize, false) 
else if (window.attachEvent) 
window.attachEvent("onload", dyniframesize) 
else 
window.onload=dyniframesize 

//图片较果
//<img src="074.gif" style="filter:alpha(opacity=20)" onMouseOver="makevisible(this,0)" onMouseOut="makevisible(this,1)">
function makevisible(cur,which){

if (which==0)

cur.filters.alpha.opacity=100

else

cur.filters.alpha.opacity=70

}

// 跳出窗口
function send(url)
{
totalx = screen.availWidth;
totaly = screen.availHeight;
x = totalx/2-700/2;
y = totaly/2-420/2;
window.open(url,"","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,height=420,width=700,top="+y+",left="+x+"");
}
//发送邮件在线支持
  function sendmail() {
    if (window.document.form1.strName.value=="")
      {
        alert("请填写联系人姓名！！")
        window.document.form1.strName.focus()
        return false
       }
   	if (window.document.form1.select.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select.focus()
        return false
       }
   	if (window.document.form1.select2.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select2.focus()
        return false
       }
	if (window.document.form1.strCompany.value=="")
      {
        alert("请填写贵公司名称！！")
        window.document.form1.strCompany.focus()
        return false
       }
    if (window.document.form1.strTel.value=="")
      {
        alert("请填写您的联系电话！！")
        window.document.form1.strTel.focus()
        return false
       }
	if (is_email(document.form1.strEmail.value)==false){
		window.document.form1.strEmail.focus()
		return false;
	}
	if (window.document.form1.strMatter.value=="")
      {
        alert("请填写您的咨询内容！！")
        window.document.form1.strMatter.focus()
        return false
       }
    if (window.document.form1.strMatter.value.length>500)
      {
        alert("咨询内容请保持在500字左右！！")
        window.document.form1.strMatter.focus()
        return false
       }
  else
  return true;
}

  //购物车检查
  function cart() {
    if (window.document.form1.strName.value=="")
      {
        alert("请填写联系人姓名！！")
        window.document.form1.strName.focus()
        return false
       }
    if (window.document.form1.strCompany.value=="")
      {
        alert("请填写公司名称！！")
        window.document.form1.strCompany.focus()
        return false
       }
   	if (window.document.form1.select.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select.focus()
        return false
       }
   	if (window.document.form1.select2.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select2.focus()
        return false
       }
    if (window.document.form1.strCountryID.value=="")
      {
        alert("请填写您的国际区号[中国为86]！！")
        window.document.form1.strCountryID.focus()
        return false
       }
    if(isNaN(form1.strCountryID.value)||form1.strCountryID.value=="")
    {
    alert("请检查您填写的国际区号格式-[只能填写数字]");
    form1.strCountryID.focus();
    return false;
    }
    if (window.document.form1.strAreaID.value=="")
      {
        alert("请填写您的地区区号！！")
        window.document.form1.strAreaID.focus()
        return false
       }
    if(isNaN(form1.strAreaID.value)||form1.strAreaID.value=="")
    {
    alert("请检查您填写的地区区号格式-[只能填写数字]。");
    form1.strAreaID.focus();
    return false;
    }
    if (window.document.form1.strTel.value=="")
      {
        alert("请填写您的电话号码！！")
        window.document.form1.strTel.focus()
        return false
       }
    if(isNaN(form1.strTel.value)||form1.strTel.value=="")
    {
    alert("请检查您填写的电话号码格式-[只能填写数字]。");
    form1.strTel.focus();
    return false;
    }
	if (is_email(document.form1.strEmail.value)==false){
		window.document.form1.strEmail.focus()
		return false;
	}

  if (window.document.form1.strSubjects.value!="")
  {
	if (is_null (document.form1.strSubjects.value,1,"标题填写错误[空格不算字符]！",1)==false){		   
	   window.document.form1.strSubjects.focus()
	   return false;
	}
  }
  if (window.document.form1.strBody.value!="")
  {
	if (over_length (document.form1.strBody.value,1000,5,"留言内容不能超过1000个字符！","留言内容不能少于5个字符！",1)==false){		window.document.form1.strBody.focus()   
	   return false;
	}
  }
  else
  return true;
}
//产品咨询
  function sendmatter() {
    if (window.document.form1.s_cpname.value=="")
      {
        alert("请填公司名称！！")
        window.document.form1.s_cpname.focus()
        return false
       }
   	if (window.document.form1.select.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select.focus()
        return false
       }
   	if (window.document.form1.select2.value=="")
      {
        alert("请选择您所在地区！！")
        window.document.form1.select2.focus()
        return false
       }
    if (window.document.form1.s_name.value=="")
      {
        alert("请填写您的姓名！！")
        window.document.form1.s_name.focus()
        return false
       }
    if (window.document.form1.s_tel.value=="")
      {
        alert("请填写您的联系电话！！")
        window.document.form1.s_tel.focus()
        return false
       }
	if (is_email(document.form1.zc_email.value)==false){
		window.document.form1.zc_email.focus()
		return false;
	}
	if (window.document.form1.s_title.value=="")
      {
        alert("请填写标题！！")
        window.document.form1.s_title.focus()
        return false
       }
	if (window.document.form1.s_title.value.length>40)
      {
        alert("标题不要20个字符！！")
        window.document.form1.s_title.focus()
        return false
       }
	if (window.document.form1.s_matter.value=="")
      {
        alert("请填写咨询内容！！")
        window.document.form1.s_matter.focus()
        return false
       }
    if (window.document.form1.s_matter.value.length>500)
      {
        alert("咨询内容请保持在500字左右！！")
        window.document.form1.s_matter.focus()
        return false
       }
  else
  return true;
}

//单选
function jump_url(){
    for(var i=0;i<document.formvote.elements.length;i++){
		if (document.forms["formvote"].elements[i].checked){
		    var s = document.forms["formvote"].elements[i].value; 
		    break;
		}
	
	}
	if(!s) {
		alert("对不起，您还没有选择要提问的问题类型呢！");
		return 0;
	}
	//alert(s);
	window.document.location.href=s;
}