var countryKey = 'N/A';
(function($) {
    var prodInfo=new Array();var slideshow_interval=null;var len=Math.floor($('.imgList .topR').length/4);if(len>0){var topR=$('.imgList .topR');for(var i=0;i<len*4;i++){topR.eq(i).addClass('short')}}
    //shareSNS
    var link=[{name:'Facebook',icon:'facebook',china:true,tip:'Share on facebook',url:'http://www.facebook.com/sharer.php?t={title}&u={url}'},{name:'Twitter',icon:'twitter',china:true,tip:'Share on twitter',url:'http://twitter.com/intent/tweet?status={title}:+{url}'},{name:'Linkedin',icon:'linkedin',tip:'Share on linkedin',url:'http://www.linkedin.com/cws/share?url={url}&title={title}'},{name:'Reddit',icon:'reddit',tip:'Share on reddit',url:'http://reddit.com/submit?title={title}&url={url}'},{name:'Delicious',icon:'delicious',tip:'Share on delicious',url:'http://www.delicious.com/post?title={title}&url={url}'},{name:'StumbleUpon',icon:'stumbleupon',tip:'Share on stumbleupon',url:'http://www.stumbleupon.com/submit?title={title}&url={url}'},{name:'Digg',icon:'digg',tip:'Share on digg',url:'http://digg.com/submit?phase=2&title={title}&url={url}'}];
    var slideshareSNS=function(config){config=$.extend({shortLink:4,threshold:600},config);var me=this;this._init=function(){me.threshold=config.threshold||600;config.shortLink=config.shortLink<link.length?config.shortLink:4;var title=document.title.length>140?encodeURIComponent(document.title.substring(0,137))+"...":encodeURIComponent(document.title);var url=encodeURIComponent(location);config.obj.after(me.shareBox=$('<div style="z-index: 1000000; position: absolute; display: none;" id="sharebox"><div id="ats_inner"><div id="ats_head"><span>Bookmark / Share</span><a  id="atsptx">X</a></div><div id="at_hover"></div></div></div>'));this.itemBox=this.shareBox.find("#at_hover:first");var count=0;(("china"==countryKey.toLowerCase())?$(link).filter(function(){return!this.china}):$(link)).each(function(index,item){if(count==1){var titleUrl=document.title.length>118?encodeURIComponent(document.title.substring(0,115))+"...":encodeURIComponent(document.title);if(count<config.shortLink){count++;config.obj.append('<a target="_blank" rel="nofollow" title="'+(item.tip||item.name)+'" class="'+item.icon+'" href="'+item.url.replace("{title}",titleUrl).replace("{url}",url)+'">'+item.name+'</a>')}me.itemBox.append('<a target="_blank" rel="nofollow" title="'+(item.tip||item.name)+'" href="'+item.url.replace("{title}",titleUrl).replace("{url}",url)+'" class="atic_'+item.icon+'"><span>'+item.name+'</span></a>')}else{if(count<config.shortLink){count++;config.obj.append('<a target="_blank" rel="nofollow" title="'+(item.tip||item.name)+'" class="'+item.icon+'" href="'+item.url.replace("{title}",title).replace("{url}",url)+'">'+item.name+'</a>')}me.itemBox.append('<a target="_blank" rel="nofollow" title="'+(item.tip||item.name)+'" href="'+item.url.replace("{title}",title).replace("{url}",url)+'" class="atic_'+item.icon+'"><span>'+item.name+'</span></a>')}});this.shareBox.find("#atsptx:first").click(function(){me._hide()})};this.show=function(){if(this.shareBox){if(this.timer){clearTimeout(this.timer)}var curObjOffset=config.obj.offset();var itemHeight=$("#sharebox").outerHeight(true);var visualHeight=document.documentElement.clientHeight;var curObjVisualTop=parseInt(curObjOffset.top)-parseInt(jQuery(document).scrollTop());var divTop=visualHeight>750?(visualHeight-750)/2:0;if(visualHeight>750){var top=(visualHeight-curObjVisualTop)>(30+config.obj.height()+itemHeight)?(curObjVisualTop+config.obj.height()):(650-itemHeight-config.obj.height())}else{var top=(visualHeight-curObjVisualTop)>(30+config.obj.height()+itemHeight)?(650+config.obj.height()):(650-itemHeight-config.obj.height())}this.shareBox.css("top",top+"px");this.shareBox.css("display","block");this.shareBox.unbind().hover(function(){me.show()},function(){me.lazyHide()})}else{this._init()}};this._hide=function(){this.shareBox.css("display","none")};this.lazyHide=function(){this.timer=setTimeout(function(){me._hide()},this.threshold)};this._init()};
    $.fn.slideshareSNS=function(){return this.each(function(){var shareSNSPlugin=new slideshareSNS({obj:$(this),container:$("body")});$(this).find('.slideshareAll:first').hover(function(){if($('.last').css("display")!="block")shareSNSPlugin.show()},function(){shareSNSPlugin.lazyHide()})})}

   //Resize image on ready or resize
$.fn.supersized=function(){$.paused=false;$("span[class='slide'] a").click(function(){var imgId=Number($(this).attr("id"));var nextId=imgId+1;var preId=imgId-1;loadImg();if($("div[class='picItem'] a[id="+imgId+"]").length==0){$("div[class='picItem']").append("<a id='"+imgId+"' style='display:none' target='_blank' href='"+prodInfo[imgId].prodUrl+"'><img src='images/loading_nail.gif'></a>")}if(nextId<=(prodInfo.length-1)&&$("div[class='picItem'] a[id="+nextId+"]").length==0){$("div[class='picItem']").append("<a id='"+nextId+"' style='display:none' target='_blank' href='"+prodInfo[nextId].prodUrl+"'><img src='images/loading_nail.gif'></a>")}if(preId>=1&&$("div[class='picItem'] a[id="+preId+"]").length==0){$("div[class='picItem']").append("<a id='"+preId+"' style='display:none' target='_blank' href='"+prodInfo[preId].prodUrl+"'><img src='images/loading_nail.gif'></a>")}showFlash(imgId);imgSize(imgId);if($('#supersize .activeslide').length==0)$('#supersize a[id='+$(this).attr("id")+']').addClass('activeslide');picInformation($(this).attr("id"));$('#supersize .activeslide').css('display','block');if($(this).attr("id")==1){$("div[class='prePic']").hide()}$('#slidecounter .slidenumber').html(imgId);$('#slidecounter .totalslides').html(prodInfo.length-1);slideshow_interval=setInterval(nextslide,$('#slideInterval').val());if(imgId==(prodInfo.length-1)){$.paused=true;$('#pauseplay').attr("title","Play").addClass("play")}imgSize(nextId);imgSize(preId)});window.onresize=function(){$("#slideShow").css("overflow","");$(".layer").css("padding-top","");var clientHeight=document.documentElement.clientHeight;var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);if((version>=5.5&&version<7.0)&&(document.body.filters)){if(clientHeight>750){$(".layer").css("padding-top",(clientHeight-750)/2)}else{$("#slideShow").css("overflow","auto").css("height","850px");$("#selectDrop").css("top","-81px")}}else{if(clientHeight>750){$(".layer").css("padding-top",(clientHeight-750)/2)}else $("#slideShow").css("overflow","auto")}};$(".select input.sel").each(function(i){$(this).click(function(){if($.paused==false){var curObj=$(this);curObj.siblings("ul").toggle()}}).mousedown(function(){if($.paused==false){$(this).addClass("on")}});if($.paused==false){if($.trim($(this).siblings("ul").children("li.hover").text())!=""){$(this).val($(this).siblings("ul").children("li.hover").text());$(this).siblings("input[class!='sel on']").val($(this).siblings("ul").children("li.hover").attr("name"))}else{$(this).siblings("ul").children("li").eq(0).addClass("hover")}}});$(".select ul li").each(function(i){$(this).mouseover(function(){if($.paused==false){$(this).siblings("li").removeClass("hover on");$(this).addClass("hover on")}}).click(function(){if($.paused==false){changeChannel(this);clearInterval(slideshow_interval);slideshow_interval=setInterval(nextslide,$('#slideInterval').val());$(this).parent().siblings("input.sel").val($(this).text()).removeClass("on");$(this).parent().toggle()}})});var changeChannel=function(curObj){var menuItemText=$.trim($(curObj).text());if(menuItemText=="3s"){$("#slideInterval").val("3000")}else if(menuItemText=="5s"){$("#slideInterval").val("5000")}else if(menuItemText=="8s"){$("#slideInterval").val("8000")}else if(menuItemText=="12s"){$("#slideInterval").val("12000")}};$('#nextslide').click(function(){if($.paused){$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play")}clearInterval(slideshow_interval);nextslide();if($('#slidecounter .slidenumber').html()<(prodInfo.length-1)){slideshow_interval=setInterval(nextslide,$('#slideInterval').val())}return false});$('.next').click(function(){if($.paused){$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play")}clearInterval(slideshow_interval);nextslide();if($('#slidecounter .slidenumber').html()<(prodInfo.length-1)){slideshow_interval=setInterval(nextslide,$('#slideInterval').val())}return false});$('#prevslide').click(function(){if($.paused){$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play")}clearInterval(slideshow_interval);prevslide();slideshow_interval=setInterval(nextslide,$('#slideInterval').val());return false});$('.pre').click(function(){if($('#slidecounter .slidenumber').html()==1)return false;if($.paused){$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play")}clearInterval(slideshow_interval);prevslide();slideshow_interval=setInterval(nextslide,$('#slideInterval').val());return false});$(".closeLayer").click(function(){clearInterval(slideshow_interval);closeFlash();return false});$(".close").click(function(){clearInterval(slideshow_interval);$('.lastWrap').css("display","none");$('.lastBg').css("display","none");$('.last').css("display","none");return false});$(".cancel").click(function(){clearInterval(slideshow_interval);$('.lastWrap').css("display","none");$('.lastBg').css("display","none");$('.last').css("display","none");return false});$('#pauseplay').click(function(){if($.paused==true){if($('#slidecounter .slidenumber').html()==(prodInfo.length-1)){clearInterval(slideshow_interval);replay();slideshow_interval=setInterval(nextslide,$('#slideInterval').val())}else{$.paused=false;slideshow_interval=setInterval(nextslide,$('#slideInterval').val());$('#pauseplay').attr("title","Pause").removeClass("play")}}else{clearInterval(slideshow_interval);$('#pauseplay').attr("title","Play").addClass("play");$.paused=true}return false});$('#replay').click(function(){clearInterval(slideshow_interval);$('.lastWrap').attr("style","display:none");$('.lastBg').attr("style","display:none");$('.last').attr("style","display:none");replay();slideshow_interval=setInterval(nextslide,$('#slideInterval').val());return false})};

    //Slideshow replay
    function replay(){$('#supersize .activeslide').attr("style","display:none");$('#supersize .activeslide').removeClass('activeslide');if($("div[class='picItem'] a[id=1]").length==0){$("div[class='picItem']").append("<a id='1' style='display:none' target='_blank' href='"+prodInfo[1].prodUrl+"'><img src='images/loading_nail.gif'></a>");imgSize(1)}$('#supersize a[id=1]').addClass('activeslide');picInformation(1);$('#supersize .activeslide').attr("style","display:block");$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play");$('#slidecounter .slidenumber').html(1);$('#slidecounter .totalslides').html((prodInfo.length-1));$("div[class='prePic']").hide();if((prodInfo.length-1)>=2&&$("div[class='picItem'] a[id=2]").length==0){$("div[class='picItem']").append("<a id='2' style='display:none' target='_blank' href='"+prodInfo[2].prodUrl+"'><img src='images/loading_nail.gif'></a>");imgSize(2)}}

    //Slideshow Next Slide
    function nextslide(){var imgId=Number($('#supersize .activeslide').attr("id"))+1;var totlePic=prodInfo.length-1;var nextId=imgId+1;if(nextId<=totlePic&&$("div[class='picItem'] a[id="+nextId+"]").length==0){$("div[class='picItem']").append("<a id='"+nextId+"' style='display:none' target='_blank' href='"+prodInfo[nextId].prodUrl+"'><img src='images/loading_nail.gif'></a>")}imgSize(nextId);if(imgId>totlePic){$('.lastWrap').attr("style","display:block");$('.lastBg').attr("style","display:block");$('.last').attr("style","display:block");$('#pauseplay').attr("title","Play").addClass("play");$.paused=true}else{if(imgId==totlePic){$(".select input.sel").removeClass("on");$(".select input.sel").siblings("ul").css("display","none");$('#pauseplay').attr("title","Play").addClass("play");$.paused=true}$('#supersize .activeslide').attr("style","display:none");$('#supersize .activeslide').removeClass('activeslide');var nextslide=$('#supersize a[id='+imgId+']');$('#slidecounter .slidenumber').html(imgId);nextslide.addClass('activeslide');nextslide.fadeIn(750,function(){});picInformation($('#supersize .activeslide').attr("id"));if(imgId==2){$("div[class='prePic']").show()}}}

    //Slideshow Previous Slide
    function prevslide(){var imgId=Number($('#supersize .activeslide').attr("id"))-1;var preId=imgId-1;if(preId>=1&&$("div[class='picItem'] a[id="+preId+"]").length==0){$("div[class='picItem']").append("<a id='"+preId+"' style='display:none' target='_blank' href='"+prodInfo[preId].prodUrl+"'><img src='images/loading_nail.gif'></a>")}imgSize(preId);var totlePic=prodInfo.length-1;$('#supersize .activeslide').removeClass('activeslide');$('#supersize a').attr("style","display:none");var nextslide=$('#supersize a[id='+imgId+']');$('#slidecounter .slidenumber').html(imgId);nextslide.addClass('activeslide');nextslide.fadeIn(750,function(){});picInformation($('#supersize .activeslide').attr("id"));if(imgId==1){$("div[class='prePic']").hide()}}

    //Slideshow loadImg
    function loadImg(){var num=0;if(prodInfo.length==0){$.each(prodInfo1,function(i,map){num=Number(i)>num?Number(i):num;prodInfo[i]=prodInfo1[i]});if(typeof(prodInfo2)!="undefined"){$.each(prodInfo2,function(i,map){var id=Number(i)+Number(num);prodInfo[id]=prodInfo2[i]})}}}
    
    //Adjust image size
    function imgSize(id){$("div[class='picItem'] a[id="+id+"] img").each(function(){var newPhoto=new Image();newPhoto.src=prodInfo[id].photoURL.replace('2f1','2f0');newPhoto.onload=function(){var iwidth=newPhoto.width;var iheight=newPhoto.height;if(iwidth>800||iheight>550){var picWidthScale=iwidth/800;var picHightScale=iheight/550;if(picWidthScale>picHightScale){iwidth=800;iheight=iheight/picWidthScale}else{iwidth=iwidth/picHightScale;iheight=550}$("div[class='picItem'] a[id="+id+"] img").css("width",iwidth);$("div[class='picItem'] a[id="+id+"] img").css("height",iheight)}$("div[class='picItem'] a[id="+id+"] img").attr("src",newPhoto.src)};newPhoto.src=prodInfo[id].photoURL.replace('2f1','2f0')})}

    //Slideshow show
    function showFlash(id){var clientHeight=document.documentElement.clientHeight;if(clientHeight>750){$(".layer").css("padding-top",(clientHeight-750)/2)}else $("#slideShow").css("overflow","auto");$("#slideShow").fadeIn('slow');$("div[class=layerBg]").bgiframe();$('#slideShow').parents("body").css("background-image","url(about:blank)").css("background-attachment","fixed");$('#slideShow').parents("body").css("overflow","hidden").attr("scoll","no")}

    //Slideshow close
    function closeFlash(){if($.paused==true){$.paused=false;$('#pauseplay').attr("title","Pause").removeClass("play")}$('#supersize .activeslide').attr('style','display:none');$('#supersize .activeslide').removeClass('activeslide');$("#slideShow").fadeOut('slow');$("div[class='prePic']").show();$('.lastWrap').css("display","none");$('.lastBg').css("display","none");$('.last').css("display","none");$('#slideShow').parents("body").removeAttr("style")}

    //Slideshow picture information add
    function picInformation(i){$("#productName").html(prodInfo[i].productName);if(typeof(prodInfo[i].prodUrl)!="undefined"){$("#productName").parents("a").attr("href",prodInfo[i].prodUrl)}else{$("#productName").parents("a").attr("href","#")}$("#companyName").html(prodInfo[i].companyName);if(typeof(prodInfo[i].companyInfo)!="undefined"){$("#companyName").parents("a").attr("href",prodInfo[i].companyInfo)}else{$("#companyName").parents("a").attr("href","#")}prodInfo[i].goldMember>0?$("#goldMember").show():$("#goldMember").hide();$("#ASFlag").parent("a").attr("href",prodInfo[i].reportUrl);prodInfo[i].ASFlag==1?$("#ASFlag").show():$("#ASFlag").hide();$("#3DService").parent("a").attr("href",prodInfo[i].ThreeDurl);prodInfo[i].has3DService==1?$("#3DService").show():$("#3DService").hide();$(".more").attr("href",prodInfo[i].prodUrl);prodInfo[i].unitPrice!=null&&prodInfo[i].unitPrice!=""?$("#unitPrice").html("<em>Unit Price: </em>"+prodInfo[i].unitPrice):$("#unitPrice").html("");prodInfo[i].minOrder!=null&&prodInfo[i].minOrder!=""?$("#minOrder").html("<em>Minimum Order: </em>"+prodInfo[i].minOrder):$("#minOrder").html("");prodInfo[i].transportation!=null&&prodInfo[i].transportation!=""?$("#transportion").html("<em>Shipment Terms: </em>"+prodInfo[i].transportation):$("#transportion").html("")}
})(jQuery);

jQuery(document).ready(function(){var o=document.createElement("script");o.src="http://membercenter.made-in-china.com/account.do?xcase=parseIPToCountryKey";o.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(o);var ipLoadTime=500;if(jQuery(".slideshareSNS").length){setTimeout(function(){jQuery(".slideshareSNS").slideshareSNS()},ipLoadTime)}$('#supersize').supersized()});

