function $2(ObjID){ return document.getElementById(ObjID); } function MarqueeImage(ObjDiv,Direction,Speed){ var objdiv=document.getElementById(ObjDiv); var divs=document.createElement("DIV"); var div1=document.createElement("DIV"); var html=''; switch(Direction){ case "left": case "right": divs.style.width="32766px"; div1.style.styleFloat="left"; div1.style.cssFloat="left"; div1.innerHTML=objdiv.innerHTML; objdiv.appendChild(divs); divs.appendChild(div1); var div1_width=div1.offsetWidth; if (div1_width<=objdiv.offsetWidth){divs.parentNode.removeChild(divs);return false;}; html+='
'; html+='
'+div1.innerHTML+'
'; html+='
'+div1.innerHTML+'
'; html+'
'; objdiv.innerHTML=html; break; case "top": case "bottom": div1.innerHTML=objdiv.innerHTML; objdiv.appendChild(div1); var div1_height=div1.offsetHeight; if (div1_height<=objdiv.offsetHeight){div1.parentNode.removeChild(div1);return false;}; html+=div1.innerHTML; html+=div1.innerHTML; divs.style.height=div1_height*2+"px"; divs.innerHTML=html; objdiv.innerHTML=""; objdiv.appendChild(divs); break; } var Tid=setInterval(Marquee,Speed) objdiv.onmouseover=function(){clearInterval(Tid)} objdiv.onmouseout=function(){Tid=setInterval(Marquee,Speed)} function Marquee(){ switch(Direction){ case "left": if(objdiv.scrollLeft>=div1_width) objdiv.scrollLeft=0; else objdiv.scrollLeft++; break; case "right": if(objdiv.scrollLeft==0) objdiv.scrollLeft=div1_width; else objdiv.scrollLeft--; break; case "top": if(objdiv.scrollTop>=div1_height) objdiv.scrollTop=0; else objdiv.scrollTop++; break; case "bottom": if(objdiv.scrollTop==0) objdiv.scrollTop=div1_height; else objdiv.scrollTop--; break; } } } function AddFavorite(sURL,sTitle){ sURL=encodeURI(sURL); try{ window.external.addFavorite(sURL,sTitle); }catch(e){ try{ window.sidebar.addPanel(sTitle,sURL,""); }catch(e){ alert("鎮ㄥソ锛屾偍鐨勬祻瑙堝櫒涓嶆敮鎸佽嚜鍔ㄥ姞鍏ユ敹钘忓姛鑳斤紝璇蜂娇鐢–trl+D杩涜娣诲姞锛屾垨鎵嬪姩鍦ㄦ祻瑙堝櫒閲岃繘琛岃缃紒"); } } } function SetHome(Url){ if (document.all){ document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage(Url); }else{ alert("鎮ㄥソ锛屾偍鐨勬祻瑙堝櫒涓嶆敮鎸佽嚜鍔ㄨ缃〉闈负棣栭〉鍔熻兘锛岃鎮ㄦ墜鍔ㄥ湪娴忚鍣ㄩ噷璁剧疆璇ラ〉闈负棣栭〉锛?); } } function key(e){ var keynum; if(window.event){ keynum = e.keyCode; }else if(e.which){ keynum = e.which; } if(keynum == 17){ //alert("绂佹澶嶅埗鍐呭锛?); return false; } } function CheckSearch(Evt,Language){ var keycode=0; if (Evt!='click'){ Evt=Evt?Evt:(window.event?window.event:""); keycode=Evt.keyCode?Evt.keyCode:Evt.which; } if (Evt=='click' || keycode==13){ var search_key=$('#search_key'); if (EmptyStr($(search_key).val())){ var str_1='璇疯緭鍏ユ悳绱㈠叧閿瓧锛?; if (Language=='en') str_1='Please enter keywords!'; alert(str_1); $(search_key).focus(); return; } if (Language=='en'){ location.href='/en/search.php?search_key='+encodeURIComponent($(search_key).val()); }else{ location.href='/search.php?search_key='+encodeURIComponent($(search_key).val()); } } } function FloatDiv(ObjID,Ch){ var Did=$2(ObjID); var DidTop=parseInt(Did.style.top); var Diff=(document.documentElement.scrollTop+document.body.scrollTop+Ch-DidTop)*.80; Did.style.top=Ch+document.documentElement.scrollTop+document.body.scrollTop-Diff+"px"; setTimeout("FloatDiv('"+ObjID+"',"+Ch+")",20); } function FloatDiv2(ObjID,Ch){ var Did=$2(ObjID); var DidTop=parseInt(Did.style.top); var Diff=(document.documentElement.clientHeight-53-Ch+document.documentElement.scrollTop+document.body.scrollTop-DidTop)*.80; Did.style.top=document.documentElement.clientHeight-53-Ch+document.documentElement.scrollTop+document.body.scrollTop-Diff+"px"; setTimeout("FloatDiv2('"+ObjID+"',"+Ch+")",20); } function PicWidth(){ $('.editorc').each(function(){ if ($(this).attr('data-aw')!='no'){ var editroc=$(this); $(editroc).find('img').each(function(){ if (parseInt($(this).width())>=$(editroc).width()) $(this).css({'width':'100%','height':'auto'}); }); } }); setTimeout(PicWidth,500); } function ScrollTo(ObjID,Ch,Speed){ $('html,body').animate({scrollTop:($(ObjID).offset().top-Ch)+'px'},Speed); } function ScrollTop(Speed){ $('html,body').animate({scrollTop:'0px'},Speed); } function Strlen(Str){ var realLength=0,len=Str.length,charCode=-1; for (var i=0;i=0 && charCode<=128){ realLength+=1; }else{ realLength+=2; } } return realLength; } function EmptyStr(Str){ if (Str=='') return true; Str=Str.replace(/^\s+/g,''); Str=Str.replace(/\s+$/g,''); Str=Str.replace(/ /g,''); if (Str==''){ return true; }else{ return false; } } function ProductsMenu(ObjID){ var sy=$(ObjID).index(); $('.products_detail').hide().eq(sy).show(); $(ObjID).addClass('active').siblings().removeAttr('class'); var editroc=$('.products_detail').eq(sy); $(editroc).find('img').each(function(){ if (parseInt($(this).width())>=$(editroc).width()) $(this).css({'width':'100%','height':'auto'}); }); } function Message(ObjForm){ if (EmptyStr(ObjForm.f_name.value)){ alert('璇疯緭鍏ユ偍鐨勫鍚嶏紒'); ObjForm.f_name.focus(); return false; } if (EmptyStr(ObjForm.f_tel.value)){ alert('璇疯緭鍏ヨ仈绯诲鍚嶏紒'); ObjForm.f_tel.focus(); return false; } if (EmptyStr(ObjForm.f_email.value)){ alert('璇疯緭鍏ョ數瀛愰偖绠憋紒'); ObjForm.f_email.focus(); return false; } if (EmptyStr(ObjForm.f_content.value)){ alert('璇疯緭鍏ョ暀瑷€鍐呭锛?); ObjForm.f_content.focus(); return false; } if (EmptyStr(ObjForm.f_code.value)){ alert('璇疯緭鍏ラ獙璇佺爜锛?); ObjForm.f_code.focus(); return false; } var reg=/^\w{4}$/; if (!reg.test(ObjForm.f_code.value)){ alert('鏃犳晥鐨勯獙璇佺爜锛?); return false; } Loading(1); } /*=============================================================================================================*/ function Loading(ShowBg){ if ($("#win_loading").length==0){ var Div=$("
"); $("body").append(Div); if (ShowBg==1){ if ($("#win_loading_bg").length==0){ var Div_Bg=$("
"); $("body").append(Div_Bg); } } } } function Loading_Remove(Val){ if ($("#win_loading").length>0) $("#win_loading").remove(); if (Val==1) if ($("#win_loading_bg").length>0) $("#win_loading_bg").remove(); } var win_ts_tid1; var win_ts_tid2; function Wints(Content){ if (win_ts_tid1) clearTimeout(win_ts_tid1); if (win_ts_tid2) clearTimeout(win_ts_tid2); if ($("#win_ts").length>0) $("#win_ts").remove(); var Div=$("
").html(Content); $("body").append(Div); $("#win_ts").css({"top":"40%","opacity":"1","marginTop":"-"+parseInt($("#win_ts").outerHeight()/2)+"px"}); win_ts_tid1=setTimeout(function(){$("#win_ts").css({"top":"20%","opacity":"0"});},2000); win_ts_tid2=setTimeout(function(){$("#win_ts").remove();},2500); } /*=============================================================================================================*/ $(function(){ $('#header_menu').on('click',function(){ if ($(this).find('span').hasClass('active')){ $(this).find('span').removeClass('active'); $('#menu').css('transform','translateX(-100%)'); $('.menu_slist').css('transform','translateX(-100%)'); }else{ $(this).find('span').addClass('active'); $('#menu').css('transform','translateX(0)'); } }); $('.menu_xs').on('click',function(){ $('.menu_slist').css('transform','translateX(-100%)'); $(this).next().css('transform','translateX(0)'); }); $('.menu_name').on('click',function(){ $(this).parent().css('transform','translateX(-100%)'); }); $('#header_search').on('click',function(e){ e.stopPropagation(); $('#search').css('transform','translateY(0)'); }); $('body').on('click',function(e){ if(e.target.id!='search_key' && e.target.id!='search_button') $('#search').css('transform','translateY(-120%)'); }); if ($('#mmenu').length>0){ $('#mtitle_menu').on('click',function(){ if ($(this).find('span').prop('class')=='active'){ $(this).find('span').removeProp('class'); }else{ $(this).find('span').prop('class','active'); } $('#mmenu').slideToggle(400); }); } if ($('.editorc').length>0) PicWidth(); if ($('#profd_class_box').length>0){ $(window).scroll(function(){ $('#profd_class_bg').height($('#profd_class_box').outerHeight()); if ($(window).scrollTop()>=$('#profd_class_bg').offset().top){ $('#profd_class_box').css('position','fixed'); }else{ $('#profd_class_box').css('position','relative'); } }); } });