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; } location.href='products.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,.editorc2').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 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(){ if ($('.editorc').length>0 || $('.editorc2').length>0) PicWidth(); });