﻿//图片变换颜色========================
function picover(obj){
   obj.style.filter="";
}
function picout(obj){
   obj.style.filter="gray";
}
//结束================================

function alertmsg(msg){
    alert("系统提醒您^_^ \n\n"+msg+"");
}

function checkgoto(str){
   if (document.all.page.value==""){
      alertmsg("请输入页码!");
	  document.all.page.focus();
	  return(false);
   }
   if (isNaN(document.all.page.value)){
      alertmsg("页码只能是数值!");
	  document.all.page.value="";
	  document.all.page.focus();
	  return(false);
   }
}

function findisok(obj){
   if(obj.keyword.value==""){
     alertmsg("请输入要搜索的关键字！");
     obj.keyword.focus();
	 return false;
   }
   return true;
}

function openpage(url,width,height){
    left=(screen.width-width)/2;
	top2=(screen.height-height)/2-30;
    window.open(url,"","scrollbars=no,left="+left+",top="+top2+",height="+height+",width="+width);
}


function swf(name,width,height,transparent){
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'>");
    document.write("<param name='movie' value='"+name+"'>");
    document.write("<param name='quality' value='high'>");
    document.write("<param name='menu' value='false'>");
    if(transparent==1) document.write("<param name='wmode' value='transparent'>");
    document.write("<embed src='"+name+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed>");
    document.write("</object>");
}

function DrawImage(ImgD,w,h){
   xwidth=w;
   xheight=h;
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= xwidth/xheight){
     if(image.width>xwidth){  
     ImgD.width=xwidth;
     ImgD.height=(image.height*xwidth)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    else{
     if(image.height>xheight){  
     ImgD.height=xheight;
     ImgD.width=(image.width*xheight)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    }
}


//显示左边产品菜单
function switchMenu(curr_id, total_num) {
     for(var i=0; i<total_num; i++)
	 {         //二级菜单         
		  var el = document.getElementById('leftmenu3-'+i);          
		  if(!el) return;          //一级菜单前面的图片    
		  var el2 = document.getElementById('leftmenu1-'+i);
		  var el3 = document.getElementById('leftmenu2-'+i);
		  if(i == curr_id)         
		  {             
		     if(el.style.display =="block"){
			    el2.className="leftmenu1";
				el.style.display = "none";
			    el3.style.color="";
		     }
			 else{
				el2.className="leftmenu1a";
		        el.style.display = "block";
		        el3.style.color="#E84C00";
		     }
		  }
		  else{
		  el2.className="leftmenu1";
		  el.style.display = "none";
		  el3.style.color="";
		  }
	 }

}

var flag = false;   //控制小图
function DrawImage(ImgD, maxwidth, maxheight) {
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        flag = true;
        if (image.width / image.height >= maxwidth / maxheight) {
            if (image.width > maxwidth) {
                ImgD.width = maxwidth;
                ImgD.height = (image.height * maxwidth) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
        else {
            if (image.height > maxheight) {
                ImgD.height = maxheight;
                ImgD.width = (image.width * maxheight) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
        }
    }
}
