﻿function MinToolbarShow(obj)
{
            for (var i=0;i<=7;i++)
            {
                if(i==obj)
                {
                    document.getElementById("MinToolbar"+i).style.display="block";
                    switch(obj)
                    {
                        case 1:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        case 2:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        case 3:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        case 4:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        case 5:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        case 6:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                        break;
                        default:
                        document.getElementById("MinToolbar_left_title").innerHTML="";
                    }
                }
                else
                {
                    document.getElementById("MinToolbar"+i).style.display="none";
                }
		}
}

function MinToolbarShowOver1(i,obj)
{
	if (i!=obj)
	{
		document.getElementById("maintoolbar"+obj).className="mainbg1";
	}
}

function MinToolbarShowOut1(i,obj)
{
	document.getElementById("maintoolbar"+obj).className="";
}

//产品图片
function MouseOver(n)
{        
  document.getElementById("img"+n).className='img1';
}  

function MouseOut(n)
{           
  document.getElementById("img"+n).className='img';  
}  
//产品图片

//图片按比例缩放,可输入参数设定初始大小
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 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 resizeimg1(ImgD,iwidth,iheight,str) {
     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=str;
        }
        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=str;
         }
    }
}
//图片按比例缩放,可输入参数设定初始大小 

//检测空字符
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);
}


//信息反馈
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 (subject=="")
	{
		alert("请输入标题");
		form.subject.focus();
		return false;
	}
	if (email=="")
	{
		alert("请输入邮件地址");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(email))
	{
		alert("请输入正确的邮件地址");
		form.email.focus();
		return false;
	}
	if (name=="")
	{
		alert("请输入您的姓名");
		form.name.focus();
		return false;
	}
	if (telphone=="")
	{
		alert("请输入电话");
		form.telphone.focus();
		return false;
	}
	if (content=="")
	{
		alert("请输入反馈内容");
		form.content.focus();
		return false;
	}
	
	
}
//信息反馈
function check()
{
	if (checkspace(document.f.Title.value))
	{
		alert("留言标题为必须填写项");
		document.f.Title.focus();
		return false;
	}
	if (checkspace(document.f.Content.value))
	{
		alert("留言内容为必须填写项");
		document.f.Content.focus();
		return false;
	}
}