
function loadjscssfile(filename,filetype){if(filetype=="js"){alert(filename);var fileref=document.createElement('script');fileref.setAttribute("type","text/javascript");fileref.setAttribute("src",filename);}else if(filetype=="css"){var fileref=document.createElement("link");fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",filename);}if(typeof fileref!="undefined")document.getElementsByTagName("head")[0].appendChild(fileref);}var filesadded="";function checkloadjscssfile(filename,filetype){if(filesadded.indexOf("["+filename+"]")==-1){loadjscssfile(filename,filetype);filesadded+="["+filename+"]";}else{alert("file already added!");}}window.onload=fixed;function hideDiv(id){if($(id)!=null){$(id).className='none';}}function sh(id){var obj=document.getElementById(id);obj.className=(obj.className=='lli none')?'lli show':'lli none';}function isBlank(s){var len=s.length;var result=true;for(i=0;i<len;i++){if(s.charAt(i)!=" "){result=false;break;}}return result;}function checkSearchValue(f){var curForm;if(f==1){curForm=document.searchform1;}else{curForm=document.searchform;}if(curForm.keyword.value=="Keyword"){curForm.keyword.value="";}if(isBlank(curForm.keyword.value)){alert("please fill in the key words!");curForm.keyword.focus();return false;}return true;}function showImage(image,validWidth,validHeight){var img=new Image();img.src=image.src;var zoom=validWidth*100/img.width;if(zoom>validHeight*100/img.height)zoom=validHeight*100/img.height;zoom=zoom>100?100:zoom;image.width=parseInt(img.width*zoom/100,10);image.height=parseInt(img.height*zoom/100,10);if(image.height<validHeight){image.style.marginTop=(validHeight-image.height)/2+"px";}}function fixed(){if(document.getElementById("content")!="undefined"&&document.getElementById("content")!=null){var height=300;var lefth=document.getElementById("left_side");var lefthp=lefth.scrollHeight;var righth=document.getElementById("content");var righthp=righth.scrollHeight;if(Math.max(lefthp,righthp)<height){lefth.style.height=height+"px";righth.style.height=height+"px";}else if(lefthp>righthp){righth.style.height=lefthp+"px";}else{lefth.style.height=righthp+"px";}}}function addFavoriteCompany(){var home_site="ZHEN DA TOOLS ELECTRIC CO.,LTD";var url_site="http://localhost";try{if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){window.external.AddFavorite(url_site,home_site);}else{window.sidebar.addPanel(home_site,url_site,'');}}catch(e){alert("Sorry! Please Press [Ctrl + D].");}}function add2Fav(obj){var nextPage=obj.nextFavAction.value;if(nextPage==""||nextPage==null){obj.nextPage.value=window.location.href;document.favForm.submit();}else{var curreUrl=encodeURI(window.location.href);obj.successUrl.value=curreUrl;obj.m_nextPage.value=nextPage+"&successUrl="+curreUrl;document.favForm.submit();}}window.moveTo(0,0);window.resizeTo(screen.availWidth,screen.availHeight);function playswf(sFile,sWidth,sHeight){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="'+sWidth+'" height="'+sHeight+'">  ');document.write(' <param name="movie" value="'+sFile+'">  ');document.write(' <param name="quality" value="high">  ');document.write(' <param name="wmode" value="transparent">  ');document.write(' <embed src="'+sFile+'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+sWidth+'" height="'+sHeight+'"></embed>  ');document.write('</object> ');}function getFlv(files,swf_width,swf_height,texts,flvContainer){var config='0:自动播放|2:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|60:主体透明度|0x66ff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:logo文字|:logo地址|:结束swf地址';if(files==''||flvContainer==''){return false;}if(swf_width==''){swf_width=202;}if(swf_height==''){swf_width=143;}var vcastrurl='http://www.zdexp.com';var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+swf_width+'" height="'+swf_height+'">';str+='<param name="movie" value="'+vcastrurl+'/attachment/media/vcastr.swf"><param name="quality" value="high">';str+='<param name="menu" value="false"><param name=wmode value="opaque">';str+='<param name="FlashVars" value="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'">';str+='<embed src="'+vcastrurl+'/attachment/media/vcastr.swf" wmode="opaque" FlashVars="vcastr_file='+files+'&vcastr_title='+texts+'&vcastr_config='+config+'" menu="false" quality="high" width="'+swf_width+'" height="'+swf_height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';str+='</object>';$('#'+flvContainer).html(str);}$(document).ready(function(){getFlv('http://www.zdexp.com/attachment/media/Evanescence.flv',202,143,'test','video1');$('#banner').cycle();$('#left_side #keys').bind('blur',function(){return false;});$('a').focus(function(){this.blur();});$('#keyword').focus();$('#submit').click(function(){if(jQuery.trim($('#keyword').attr("value")).length<2){alert('关键词太简单');$('#keyword').attr("value",'');$('#keyword').focus();return false;}else{return true;}});$('#content a,#service a').focus(function(){this.blur();});$("#nav ul li a").bind("focus",function(){this.blur();});$(".leftnav ul li a").bind("focus",function(){this.blur();});$('#content img.pro').each(function(validWidth,validHeight){var img=new Image();validWidth=150;validHeight=123;img=this;var zoom=validWidth*100/img.width;if(zoom>validHeight*100/img.height){zoom=validHeight*100/img.height;}zoom=zoom>100?100:zoom;$(img).css('width',parseInt(img.width*zoom/100,10)+"px");$(img).css('height',parseInt(img.height*zoom/100,10)+"px");if(img.height<validHeight){$(img).css('margin-top',(validHeight-img.height)/2+"px");}});$('#content img#pro_detail').each(function(validWidth,validHeight){var img=new Image();validWidth=200;validHeight=200;img=this;var zoom=validWidth*100/img.width;if(zoom>validHeight*100/img.height){zoom=validHeight*100/img.height;}zoom=zoom>100?100:zoom;$(img).css('width',parseInt(img.width*zoom/100,10)+"px");$(img).css('height',parseInt(img.height*zoom/100,10)+"px");if(img.height<validHeight){$(img).css('margin-top',(validHeight-img.height)/2+"px");}});var timeout=6000;var closetimer=0;var ddmenuitem=0;var submenu=0;ddmenuitem=$("#ms2").eq(0).css("display","block");function menu_close(){if(ddmenuitem){ddmenuitem.css('display','none');$("#menu-main a").removeClass("menua");}}function menu_timer(){closetimer=window.setTimeout(menu_close,timeout);}function menu_canceltimer(){if(closetimer){window.clearTimeout(closetimer);closetimer=null;}}function menu_open(){menu_canceltimer();menu_close();$(this).addClass("menua");ddmenuitem=$("#ms"+this.id.replace("mm",'')).eq(0).css("display","block");}$("#menu-main a").bind('mouseover',menu_open);$("#menu-main a").bind('mouseout',menu_timer);document.onclick=menu_close;var show_news,ntag;$("#news-tag a").bind('mouseover',function(){if(typeof show_news!="object")show_news=$("#ncon1");$(show_news).css("display","none");if(typeof ntag=="object")ntag.removeClass("taga");show_news=$("#ncon"+this.id.replace("ntag","")).eq(0).css("display","block");ntag=$(this);$(this).addClass("taga");});});function testChar(){for(i=0;i<255;i++){document.writeln(i+'--->'+String.fromCharCode(i)+'<br>');}document.writeln("一".charCodeAt(0).toString(16))}function isSBCcase(str){var pattern=/[\uFE30-\uFFA0]/gi;if(pattern.test(str)){alert("不能用全角");return false;}else{return true;}}function stripTags(str){return str.replace(/<\/?[^>]+>/gi,'');}function checkemail(email){var myReg=/^[-a-zA-Z0-9_\.]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,5}$/;if(myReg.test(email)){return true;}else{return false;}}function checkTel(str){var reg=/^(((\()?\d{2,4}(\))?[-(\s)*]){0,2})?(\d{7,8})$/;if(reg.test(str)){return true;}else{return false;}}function get_object(idname){if(document.getElementById){return document.getElementById(idname);}else if(document.all){return document.all[idname];}else if(document.layers){return document.layers[idname];}else{return null;}}if(!window.XMLHttpRequest){window.XMLHttpRequest=function(){var xmlHttp=null;var ex;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP.4.0");}catch(ex){try{xmlHttp=new ActiveXObject("MSXML2.XMLHTTP");}catch(ex){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){}}}return xmlHttp;}}function AJAX(callback){switch(typeof(callback)){case"function":case"string":break;default:return null;}var xml_method=0;var http=new XMLHttpRequest();if(http==null){return null;}http.onreadystatechange=function(){if(http.readyState==4){try{var ret=http.responseText;if(typeof(callback)=="function"){callback(ret);}else if(typeof(callback)=="string"){var lc=callback.indexOf("(");var rc=callback.indexOf(")");if((lc<0)&&(rc<0)){s=callback+"(ret)";}else{var a="";a=(rc-lc<2)?"":",";r=/\)/g;s=callback.replace(r,a+"ret)");}eval(s);}}catch(e){}}};this.get=function(url){try{http.open('get',url,true);http.send(null);}catch(e){}};this.post=function(url,args){try{http.open('post',url,true);http.setRequestHeader("Method","POST "+url+" HTTP/1.1");http.setRequestHeader("Charset","GB2312");http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var arg_g_arr=args.split("&");for(key in arg_g_arr){value_arr=arg_g_arr[key].split("=");value_arr[1]=encodeURI(value_arr[1]);arg_g_arr[key]=value_arr.join("=");}args=arg_g_arr.join("&");http.send(args);}catch(e){}};}function trim(str){　　return str.replace(/(^\s*)|(\s*$)/g,"");}function ltrim(str){格
　　return str.replace(/(^\s*)/g,"");}function rtrim(str){　　return str.replace(/(\s*$)/g,"");　　}function in_array(v,a){for(key in a){if(a[key]==v)return true;}return false;}function jq_in_array1(v,a){return jQuery.inArray(v,a)>=0;}
