
var arrImageFilenoListOri;var arrImageFilenoList;var CatalogWidth=445;var CatalogHeight=576;var CatalogOID=-1;var SupplierID=-1;var PageNoOffSet=0;var OriTotalNoOfPages=260;var TotalNoOfPages=260;var bolDebug=false;var IsSlide=true;var SearchCriteria="";var CatalogDisplayFormat=0;var PreviousCatalogDisplayFormat=0;var NoOfPagesPerScreen=2;var strPassword="";var TotalNoOfScreens=1;var ImageSizeRatio=1;var LastSelected=-1;var SizeCoefficient=1;var CssZIndex=100;var bolZoomed=false;var bolHotSpotClicked=false;var bolDblClicked=false;var strVisited=",";var strMouseOverInitialized=",";var strHotSpotForSearchResult="";var intBorder=1;var bolHasTOC=false;var intSinglePageAjust=18;var intDoubleClickTimeLimit=500;var intShowMouseOver=1;var bolMouseoverShown=false;var bolNoMatch=true;var bolShowLeadGenerator=false;var bolUseLargeImage=true;var bolMoreStickyNotes=false;var intStickyNoteHeight=0;var StickyNotesPageNos=null;var strStickyNotesPageNos="";var strAllowSharing="false";var intNoOfPagesThrough=0;var intMaxNoOfPageswnoReload=10;var bolIPad=false;var intNoOfTOCRecords=7;var strTrackingCodePromoCode="";var strTrackingCodeCatalog="";var CCMargin="#333333";var CCWorking="#666666";var CCAccent="#333333";var CCPageNo="#000000";var CCHeader="#FFFFFF";var CCFooter="#FFFFFF";var CCTOCArea="#000000";var CCTOCFont="#FFFFFF";var CCMouseoverHeader="#bababa";var CCMouseoverBody="#FFFFFF";var CCMouseoverBorder="#666666";var strSendEmail="false";var strSearchBoxPromptText="Enter search term(s)";var HorizontalInterval=15;var VerticalInterval=15;var MyCorners=['bottomMiddle','topMiddle','leftMiddle','rightMiddle','topLeft','topRight','bottomRight'];var MyOpposites=['topMiddle','bottomMiddle','rightMiddle','leftMiddle','bottomLeft','bottomRight','topRight'];$(document).ready(InitializeWindow);function InitializeWindow(){HandleColorConfig();if(HandleSecurity()==false){}
else{DetectIPad();InitMenuButton();SetCatalogInfo();HandleLogoName();SetContentSize();DoSearch(true);HandlePDFEmailPrint();$(window).bind('resize',function(e){if((SearchCriteria!="")&&(bolNoMatch==false)){GoToPage(LastSelected,"next");}
else{SetContentSize();}});if(bolIPad==true){$(window).bind('orientationchange',function(e){var windowwidth=$(window).width();var windowheight=$(window).height();if((CatalogDisplayFormat==0)&&(windowwidth<windowheight)){ChangeDisplayFormat(1,true);return;}
else if((CatalogDisplayFormat==1)&&(windowwidth>windowheight)){ChangeDisplayFormat(0,true);return;}});}
$('#txtSearch').bind('keypress',function(e){var code=(e.keyCode?e.keyCode:e.which);if(code==13){DoSearch(true);}});$('#txtPageNo').bind('keypress',function(e){var code=(e.keyCode?e.keyCode:e.which);if(code==13){var intValid=ValidatePageNo();if(intValid!=-1){JumpToPage(intValid);}}});$('#btnGoToPageNo').bind('click',function(e){if(SearchCriteria==""){var intValid=ValidatePageNo();if(intValid!=-1){JumpToPage(intValid);}}
else{$("#txtSearch").attr("value",strSearchBoxPromptText);DoSearch(true);}});$('#txtPageNo').bind('click',function(e){$("#txtPageNo").attr("value","");});$("#txtSearch").bind('click',function(e){$("#txtSearch").attr("value","");});$("#txtSearch").bind('blur',function(e){if($("#txtSearch").attr("value")==""){$("#txtSearch").attr("value",strSearchBoxPromptText);}});$("#btnSearch").bind('click',function(e){DoSearch(true);});$("#btnClearSearch").bind('click',function(e){$("#txtSearch").attr("value",strSearchBoxPromptText);DoSearch(true);});$("#imgSingle").bind('click',function(e){ChangeDisplayFormat($(this).attr("Format"),true);});$("#imgDouble").bind('click',function(e){ChangeDisplayFormat($(this).attr("Format"),true);});$("#imgThumbnail").bind('click',function(e){ChangeDisplayFormat($(this).attr("Format"),true);});$("#imgZoom").bind('click',function(e){ZoomInAndOut(null);});$("#imgHelp").bind("click",function(e){ShowHelp();});HandleSocialMediaLinks();$('#StickyNotesAdd').bind("click",function(){AddStickyNote();if((SearchCriteria!="")&&(CatalogDisplayFormat==0)){LastSelected-=1;setTimeout(function(){AddStickyNote();},500);}});GetStickyNotesPageNosAndLoad();setTimeout(function(){LoadTOC()},2500);}}
function DetectIPad(){var Apple={};Apple.UA=navigator.userAgent;Apple.Device=false;Apple.Types=["iPad","iPhone"];for(var d=0;d<Apple.Types.length;d++){var t=Apple.Types[d];Apple[t]=!!Apple.UA.match(new RegExp(t,"i"));Apple.Device=Apple.Device||Apple[t];}
bolIPad=Apple.Device;}
function ShowHelp(){var intWidth=screen.width;var width=465;var height=530;var intLeft=$(window).width()-width-75;var property="top=100, left="+intLeft+", scrollbars=no, width="+width+", height="+height;var winHelp=window.open("helpNew.htm",'Help',property);try{winHelp.focus();}
catch(ex){}}
function GetCatalogTitle(){var strName=GetParameterFromHiddenVariable("hidCatalogName","")
return escape(strName);}
function HandleSocialMediaLinks(){if(strAllowSharing=="true"){$("#imgFacebook").css("visibility","visible").bind("click",function(e){HandleFaceBook();});$("#imgTwitter").css("visibility","visible").bind("click",function(e){HandleTwitter();});$("#imgLinkedIn").css("visibility","visible").bind("click",function(e){HandleLinkedIn();});}
else{$("#imgFacebook").css("width","1px").css("visibility","hidden");$("#imgTwitter").css("width","1px").css("visibility","hidden");$("#imgLinkedIn").css("width","1px").css("visibility","hidden");$("#spFacebookScript").html("");$(".imgBottomSpacer").css("width","1px");$("#spVerticalBar").css("visibility","hidden");}}
function CreatURL() {
    var strSiteURL = GetParameterFromHiddenVariable("hidSiteURL", "https://www.activemerchandiser.com/"); var strURL = "JQCatalogView.aspx?Replace=true&CatalogOID=" + CatalogOID + "&SupplierID=" + SupplierID; strURL += "&Password=" + strPassword; strURL += "&PageNo=" + LastSelected + "&Format=" + CatalogDisplayFormat; if (SearchCriteria != "") { strURL += "&SearchCriteria=" + escape(SearchCriteria); }
return strSiteURL+strURL;}
function HandleFaceBook(){var strURL=CreatURL();var strFacebookURL="https://www.facebook.com/sharer.php?u="+escape(strURL)+"&t="+GetCatalogTitle();var strEventURL="JQeventLog.aspx?EventName=Sharing&Media=Facebook&CatalogOID="+CatalogOID+"&PageNo="+LastSelected+"&URL="+escape(strURL);showexternal(strFacebookURL,strEventURL);}
function CreatURLForTwitter(){var strSiteURL=GetParameterFromHiddenVariable("hidSiteURL","https://www.activemerchandiser.com/");var strURL="JQTW.aspx?CI="+CatalogOID+"&SI="+SupplierID;strURL+="&PN="+LastSelected;if(SearchCriteria!=""){strURL+="&SC="+escape(SearchCriteria);}
return strSiteURL+strURL;}
function HandleTwitter(){var strURL=CreatURLForTwitter();var strTwitterURL="https://twitter.com/home?status=A+Catalog+Page+"+escape(strURL);var strEventURL="JQeventLog.aspx?EventName=Sharing&Media=Twitter&CatalogOID="+CatalogOID+"&PageNo="+LastSelected+"&URL="+escape(strURL);showexternal(strTwitterURL,strEventURL);}
function HandleLinkedIn(){var strURL=CreatURL();var strLinkedInURL="https://www.linkedin.com/shareArticle?mini=true&url="+escape(strURL)+"&title=A+Catalog+Page";var strEventURL="JQeventLog.aspx?EventName=Sharing&Media=Twitter&CatalogOID="+CatalogOID+"&PageNo="+LastSelected+"&URL="+escape(strURL);showexternal(strLinkedInURL,strEventURL);}
function HandleColorConfig(){var strColorConfig=$("#hidColorConfig").attr("value");if(strColorConfig!=""){var strColorList=strColorConfig.split(",");try{CCMargin=strColorList[0];CCWorking=strColorList[1];CCAccent=strColorList[2];CCPageNo=strColorList[3];CCHeader=strColorList[4];CCFooter=strColorList[5];CCTOCArea=strColorList[6];CCTOCFont=strColorList[7];CCMouseoverHeader=strColorList[8];CCMouseoverBody=strColorList[9];CCMouseoverBorder=strColorList[10];}
catch(e){}
$(".tblHeader").css("background-color",CCHeader);$(".tblFooter").css("background-color",CCFooter);$(".tblContent").css("background-color",CCMargin);$("#divCatalogContent").css("background-color",CCWorking);$(".PageNoText").css("color",CCPageNo);$(".CatalogName").css("color",CCAccent);$("#spCatalogName").css("font-weight","bold").css("font-size","13px");$("#btnGoToPageNo").css("background-color",CCFooter).css("color",CCPageNo).css("border","solid 1px "+CCPageNo).css("height","19px").css("width","22px").css("padding-top","0px").css("padding-bottom","6px");$(".Search").css("background-color",CCAccent).css("color",CCHeader);$(".ClearSearch").css("color",CCAccent).css("background-color",CCHeader).css("border","solid 1px "+CCAccent);}}
function HandleLogoName(){var intShowLogoNameNone=GetIntParameterFromHiddenVariable("hidShowLogoNameNone",2);switch(intShowLogoNameNone){case 0:{var strLogoSuffix=GetParameterFromHiddenVariable("hidLogoSuffix",".jpg");$("#imgLogo").attr("src","images/LogosCatalog/"+CatalogOID+strLogoSuffix);var strLogoSize=$("#hidLogoSize").attr("value");if(strLogoSize!=""){try{var strLogoSizeNos=strLogoSize.split(",");var intWidth=parseInt(strLogoSizeNos[0]);var intHeight=parseInt(strLogoSizeNos[1]);var dblRatioforSpaceAvailable=($(window).width()*0.30)/50.0;if((intWidth>($(window).width()*0.30))||(intHeight>50)){if(intWidth/intHeight<dblRatioforSpaceAvailable){$("#imgLogo").css("height","50px");}
else{$("#imgLogo").css("width",$(window).width()*0.30+"px");}}}
catch(e){}}
break;}
case 1:{var strCatalogName=GetParameterFromHiddenVariable("hidCatalogName","");$("#spCatalogName").html(strCatalogName).css("vertical-align","middle");$("#spCatalogName").css("width",$(window).width()*0.32+"px")
break;}
default:{break;}}}
function HandlePDFEmailPrint(){var strPDFFile=GetParameterFromHiddenVariable("hidPDFFile");if(strPDFFile!=""){$("#imgPDF").bind('click',function(e){window.open(strPDFFile,"PDFDownload","top=60, left=60, resizable=1, width=720, height=600","");});}
else{$("#imgPDF").css("visibility","hidden");}
ShowHideZoomEmailPDF();$("#imgPrint").bind('click',function(e){HandlePrint2();});strSendEmail=GetParameterFromHiddenVariable('hidSendEmail');if((strSendEmail=="true")&&(CatalogDisplayFormat!=2)){$("#imgEmail").bind('click',function(e){ShowIframe("JQEmailCatalogPage.aspx?CatalogOID="+CatalogOID+"&pageno="+LastSelected+"&format="+CatalogDisplayFormat);});}
else{$("#imgEmail").css("visibility","hidden");}}
function HandlePrint2(){var property="resizable=1, width=1000, height=800";var winPrint=window.open("jqPrintable.aspx?CatalogOID="+CatalogOID+"&format="+CatalogDisplayFormat+"&pageno="+LastSelected,'ActiveMerchandiser',property);try{winPrint.focus();}
catch(ex){}}
function HandleSecurity(){var SecirutyCheckingResult=$("#hidSecirutyCheckingResult").attr("value");var bolResult=false;switch(SecirutyCheckingResult)
{case"0":{bolResult=true;break;}
case"1":{ShowIframe("JQErrorCatalogNotAvailable.htm?Rand="+Math.random());bolResult=false;break;}
case"2":{ShowIframe("JQErrorCatalogCantBeShown.htm?Rand="+Math.random());bolResult=false;break;}
default:{ShowIframe("JQErrorUnknown.htm?Rand="+Math.random());bolResult=false;break;}}
if(bolResult==false){$("#imgPrevious").css("visibility","hidden");$("#imgNext").css("visibility","hidden");$("#spGoToCaption").css("visibility","hidden");$("#txtPageNo").css("visibility","hidden");$("spPageNos").css("visibility","hidden");}
return bolResult;}
function SetCatalogInfo(){$("#imgDouble").attr("src",$("#imgDouble").attr("src").replace("_off","_on"));if(bolIPad==true)$("#imgThumbnail").css("width","1px").css("visibility","hidden");CatalogOID=getIntParameterByNameFromURL("CatalogOID",-1);strPassword=getParameterByNameFromURL("Password","");if(strPassword==""){strAllowSharing=GetParameterFromHiddenVariable("hidAllowSharing","false");}
else{strAllowSharing="false";}
SupplierID=GetIntParameterFromHiddenVariable("hidSupplierID",-1);CatalogWidth=GetIntParameterFromHiddenVariable("hidWidth",445);CatalogHeight=GetIntParameterFromHiddenVariable("hidHeight",576);PageNoOffSet=GetIntParameterFromHiddenVariable("hidPageNoOffSet",0);ShowMouseOver=GetIntParameterFromHiddenVariable("hidShowMouseOver",1);intBorder=GetIntParameterFromHiddenVariable("hidShowBorder",1);bolUseLargeImage=GetIntParameterFromHiddenVariable("hidUseLargeImage",1);bolShowLeadGenerator=GetIntParameterFromHiddenVariable("hidShowLeadGenerator",0);strTrackingCodePromoCode=GetParameterFromHiddenVariable("hidPromoTrackingCode","");strTrackingCodeCatalog=GetParameterFromHiddenVariable("hidCatalogTrackingCode","");var Replace=getParameterByNameFromURL("Replace","false").toLowerCase();var strsearch="";var intDisplayFormat=0;if(Replace!="true"){intDisplayFormat=GetIntParameterFromHiddenVariable("hidCurrentDisplayFormat",0);LastSelected=GetIntParameterFromHiddenVariable("hidCurrentOpenPage",0);}else{intDisplayFormat=getIntParameterByNameFromURL("Format",0);LastSelected=getIntParameterByNameFromURL("OpenPage",-9999);if(LastSelected==-9999){LastSelected=getIntParameterByNameFromURL("PageNo",0);}
if((intDisplayFormat==1)&&(PageNoOffSet%2==0)){LastSelected-=1;}}
strsearch=getParameterByNameFromURL("SearchCriteria","");if(strsearch==""){strsearch=GetParameterFromHiddenVariable("hidCurrentSearchCriteria","");}
if(strsearch!=""){$("#txtSearch").attr("value",strsearch);}
else{SetDisplayFormat(intDisplayFormat);$("#txtSearch").attr("value",strSearchBoxPromptText);}
ShowHideZoomEmailPDF();}
function SetDisplayFormat(intDisplayFormat){PreviousCatalogDisplayFormat=CatalogDisplayFormat;CatalogDisplayFormat=intDisplayFormat;SetNoOfPagesPerScreenImageSizeRatio();ShowHideZoomEmailPDF();FixViewImage(intDisplayFormat);}
function DoSearch(bolGoToPage){var strNewSearchCriteria=$("#txtSearch").attr("value").replace(strSearchBoxPromptText,"");if(SearchCriteria!=strNewSearchCriteria){strHotSpotForSearchResult="";SearchCriteria=strNewSearchCriteria;if(strNewSearchCriteria!=""){ClearImageMapMouseOver();if(bolIPad==false){SetDisplayFormat(2);}
LastSelected=0;LoadContent();}
else{ClearSearch(bolGoToPage);LastSelected=0;}}
else if((arrImageFilenoListOri==null)&&(SearchCriteria=="")){SetNoOfPagesPerScreenImageSizeRatio();LoadContent();}}
function ClearSearch(bolGoToPage){$("#txtSearch").attr("value",strSearchBoxPromptText);SearchCriteria="";LastSelected=0;bolNoMatch=false;ClearImageMapMouseOver();if(arrImageFilenoListOri!=null){CopyIntArray(arrImageFilenoListOri,arrImageFilenoList);TotalNoOfPages=OriTotalNoOfPages;ArrangeContent(bolGoToPage);}
else{LoadContent();}
$("#btnClearSearch").css("visibility","hidden");}
function ClearImageMapMouseOver(){strMouseOverInitialized=",";strVisited=",";}
function CopyIntArray(source,destination){var intCount=0;while(intCount<source.length){destination[intCount]=source[intCount];intCount++;}}
function ArrangeContent(bolGoToPage){var strContent="";var intNoOfPages=0;var intPageNo=1;var intNoOfPagesInCurrentScreen=0;var intNoOfScreen=0;while(intNoOfPages<arrImageFilenoList.length){if(intNoOfPagesInCurrentScreen==NoOfPagesPerScreen){intNoOfPagesInCurrentScreen=0;intNoOfScreen+=1;}
var bolAddPage=false;if(CatalogDisplayFormat==1){if(arrImageFilenoList[intNoOfPages]>0){bolAddPage=true;}}
else{bolAddPage=true;}
if(bolAddPage==true){var ImageNo=arrImageFilenoList[intNoOfPages];if(intNoOfPagesInCurrentScreen==0){strContent+="<div class='glidecontent' id='div"+intNoOfScreen+"' name='div"+intNoOfScreen+"'>";}
if(CatalogDisplayFormat==2){strContent+="<div class='innerdiv' imageno='"+ImageNo+"' id='div"+intNoOfScreen+"_"+intNoOfPages+"' name='div"+intNoOfScreen+"_"+intNoOfPages+"'>";}
strContent+="<img class='pageimage' alt='' pageno='"+intPageNo+"'";strContent+=" imageno='"+ImageNo+"' src='images/shared/spacer.gif'";if(CatalogDisplayFormat!=2){strContent+=" usemap='#map_"+(intNoOfPages+1)+"'";}
strContent+=" />";if(CatalogDisplayFormat==2){strContent+="</div>";}
if(intNoOfPagesInCurrentScreen==NoOfPagesPerScreen-1){strContent+="</div>";}
intPageNo+=1;intNoOfPagesInCurrentScreen++;}
intNoOfPages++;}
$('#divCatalogContent').html(strContent).css("visibility","visible");TotalNoOfScreens=$('#divCatalogContent .glidecontent').length;ProcessingAfterArrangeContent(bolGoToPage);}
function ProcessingAfterArrangeContent(bolGoToPage){var strImageFileDir=GetImageDir(false);PreloadAScreen(0,strImageFileDir,true);$('#divCatalogContent .glidecontent').css("left",(-2)*$('#divCatalogContent').width()+"px");$('#divCatalogContent .glidecontent .pageimage').css("Z-Index",1).css("border","solid "+intBorder+"px #666666");if(bolGoToPage==true){GoToPage(null,'tbd');BindUnBindPreviousNext(true);}
if((CatalogDisplayFormat==0)&&(bolIPad==false)){$('#divCatalogContent .glidecontent .pageimage').dblclick(function(e){ZoomInAndOut(e);});}
else if(CatalogDisplayFormat==2){$('#divCatalogContent .glidecontent .innerdiv .pageimage').click(function(e){LastSelected=parseInt($(this).attr("pageno"));if(LastSelected%2==0)LastSelected-=1;ChangeDisplayFormat(0,true);});$('#divCatalogContent .glidecontent .innerdiv .pageimage').css("cursor","pointer");}
SetContentSize();}
function BindUnBindPreviousNext(bolBind){if(bolBind==false){$('.PreviousNextButton').unbind('click');}
else{$('.PreviousNextButton').bind('click',function(){GoToPage($(this).attr("loadpage"),$(this).attr("direction"));});}}
function HandleError(EventName,ajaxrequest){var strErrorMessage="Error "+EventName+".";if(bolDebug==true){strErrorMessage+="<br />Server Response: "+ajaxrequest.responseText;}
$('#divCatalogContent').html(strErrorMessage);}
function LoadTOC(){var strURL="JQCatalogViewTOC.aspx?CatalogOID="+CatalogOID;strURL+="&Rand="+Math.random();$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Loading TOC",ajaxrequest);},success:function(content){HandleTOC(content);}})}
function HandleTOC(content){if((content=="")||(content==null)){bolHasTOC=false;$("#imgTOC").unbind('click');$('#imgTOC').attr("rel","Table of contents is not available.");$('#imgTOC').each(function(){$(this).css("cursor","default");SetQTip(this,3,140);});}
else{bolHasTOC=true;var strNoOfRecords=7;if(content.indexOf("|")!=-1){strNoOfRecords=content.substring(0,content.indexOf("|"));content=content.substring(content.indexOf("|")+2);}
intNoOfTOCRecords=parseInt(strNoOfRecords);$('#divtoc').html(content);$('#imgTOC').attr("rel","<b>Table of Contents</b> - Click to open table of contents.");$('#imgTOC').each(function(){$(this).css("cursor","pointer");SetQTip(this,3,170);});$("#imgTOC").bind('click',function(e){ShowTOC();});$('#imgTOCClose').css('cursor','pointer').bind('click',function(e){HideTOC();});$('.TOCImage').css("width",Math.floor(CatalogWidth*0.225)+"px");$('.divTOCImage').css("width",Math.floor(CatalogWidth*0.225)*2+4+"px").css("cursor","pointer");$('.CategoryLink').css("width",Math.floor(CatalogWidth*0.225)*2+4+"px").css("font-size","13px").css("font-weight","bold").css("color",CCTOCFont).css("cursor","pointer");$('.CategoryLink').bind('mouseover',function(e){$(this).css('text-decoration','underline');});$('.CategoryLink').bind('mouseout',function(e){$(this).css('text-decoration','none');});$('.divTOCImage').bind('mouseover',function(e){$(this).css('border','solid 2px '+CCTOCFont);});$('.divTOCImage').bind('mouseout',function(e){$(this).css('border','solid 2px '+CCTOCArea);});$('.CategoryLink').bind('click',function(e){GoToCategory($(this).attr("pageno"));});$('.divTOCImage').bind('click',function(e){GoToCategory($(this).attr("pageno"));});$(".toc").css("background-color",CCTOCArea);$(".divTOCImage").css("border","solid 2px "+CCTOCArea);}}
function GoToCategory(pageno){if(SearchCriteria!=""){$("#txtSearch").attr("value",strSearchBoxPromptText);DoSearch(false);}
if(CatalogDisplayFormat!=0){ChangeDisplayFormat(0,false);}
PreloadAScreen(Math.floor(pageno/NoOfPagesPerScreen),GetImageDir(false),true);setTimeout(function(){GoToPage(pageno,"tbd");},1000);}
function ShowTOC(){CloseIframe();$('#divtoc').css('left','-250px');var endpoint={left:0};$('#divtoc').animate(endpoint,500,function(){var intLeft=224;$('#imgTOCClose').css("position","absolute").css("left",intLeft+"px").css("top","125px");$('#imgTOCClose').each(function(){$(this).css("cursor","pointer");});if(bolIPad==true){$('.tdTOCright').css("width","50px");$('#imgTOCClose').css("left",intLeft+8+"px")
$('#imgTOCUp').css("position","absolute").css("top","70px").css("left",intLeft+"px").css("cursor","pointer").css("visibility","visible");$('#imgTOCDown').css("position","absolute").css("top","320px").css("left",intLeft+"px").css("cursor","pointer").css("visibility","visible");$('#imgTOCUp').unbind("click");$('#imgTOCUp').bind("click",function(){TOCMove(1);});$('#imgTOCDown').unbind("click");$('#imgTOCDown').bind("click",function(){TOCMove(-1);});}
if(bolIPad==false){$('#imgTOCClose').unbind("mouseover");$('#imgTOCClose').bind("mouseover",function(e){$('#divToolTipTOCClose').css("visibility","visible").css("left","242px").css("top","200px");});$('#imgTOCClose').unbind("mouseout");$('#imgTOCClose').bind("mouseout",function(e){$('#divToolTipTOCClose').css("visibility","hidden");});}
$('#imgTOCClose').css("visibility","visible");});$("#imgTOC").unbind('click');}
function TOCMove(intDirection){var intTop=$('#tblTOC').css("top");if(intTop=="auto"){intTop=0;}
else{intTop=parseInt(intTop);}
var intHeight=intNoOfTOCRecords*(CatalogHeight*0.225+4+20);var intVisibleHeight=parseInt($('#divtoc').css("height"));$('#tblTOC').css("position","absolute").css("left","0px");if(intDirection<0){if(intTop+intHeight-intVisibleHeight>(CatalogHeight*0.225+4+20)*(-1)){var intNewTop=intTop+intDirection*300;var endpoint={top:intNewTop};$('#tblTOC').animate(endpoint,250);}}
else{if(intTop<0){var endpoint={top:intTop+intDirection*300};$('#tblTOC').animate(endpoint,250);}}}
function HideTOC(){var endpoint={left:-270};$('#divtoc').animate(endpoint,250);if(bolHasTOC==true){$("#imgTOC").bind('click',function(e){ShowTOC();});}
$('#imgTOCClose').css("visibility","hidden");$('#imgTOCUp').css("visibility","hidden");$('#imgTOCDown').css("visibility","hidden");}
function LoadContent(){var strURL="JQCatalogViewContent.aspx?CatalogOID="+CatalogOID;if(SearchCriteria!=""){strURL+="&SearchCriteria="+escape(SearchCriteria);}
strURL+="&Rand="+Math.random();BindUnBindPreviousNext(false);$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Loading Content",ajaxrequest);},success:function(strTotalAndImageFilenoList){var strImageFilenoList="";var strTotal="";if(strTotalAndImageFilenoList.indexOf("||")!=-1){strImageFilenoList=strTotalAndImageFilenoList.substring(strTotalAndImageFilenoList.indexOf("||")+2);strTotal=strTotalAndImageFilenoList.substring(0,strTotalAndImageFilenoList.indexOf("||"));}
$('#hidImageFileNoList').attr("value",strImageFilenoList);if(strImageFilenoList!=""){arrImageFilenoList=strImageFilenoList.split(",");}
else{arrImageFilenoList=new Array();}
if(SearchCriteria!=""){if(arrImageFilenoList.length==0){$("#btnClearSearch").css("visibility","hidden");bolNoMatch=true;ShowIframe("JQErrorNoMatch.htm?Rand="+Math.random());}
else{bolNoMatch=false;TotalNoOfPages=parseInt(strTotal);ArrangeContent(true);}
$("#btnClearSearch").css("visibility","visible");}
else{bolNoMatch=false;arrImageFilenoListOri=strImageFilenoList.split(",");OriTotalNoOfPages=parseInt(strTotal);TotalNoOfPages=OriTotalNoOfPages;ArrangeContent(true);}}})}
function FixViewImage(intFormat){$('.ViewButton').each(function(){$(this).attr("src",$(this).attr("src").replace("_on","_off"));});$('.ViewButton').unbind("mouseout").bind("mouseout",function(){$(this).attr("src",$(this).attr("src").replace("_on","_off"));});$(".ViewButton[format='"+intFormat+"']").each(function(){$(this).attr("src",$(this).attr("src").replace("_off","_on"));$(this).unbind("mouseout").bind("mouseout",function(){});});}
function ChangeDisplayFormat(newformat,bolGoToPage){if(bolNoMatch==true){ClearSearch(true);}
if(newformat!=CatalogDisplayFormat){var intAdjust=0;if((CatalogDisplayFormat!=1)&&(newformat==1)){if((PageNoOffSet%2==0)&&(SearchCriteria=="")&&(LastSelected%2==1)){intAdjust=-1;}
if((SearchCriteria!="")&&(LastSelected%2==0)){intAdjust=1;}}
if((CatalogDisplayFormat==1)&&(newformat!=1))
{if((PageNoOffSet%2==0)&&(SearchCriteria=="")&&(LastSelected%2==1)){intAdjust=1;}}
SetDisplayFormat(newformat);strVisited=",";var TotalNoOfScreens=$('#divCatalogContent .glidecontent').length;LastSelected+=intAdjust;if(LastSelected<0){LastSelected=0;}
if((CatalogDisplayFormat==1)&&(LastSelected%2==0)&&(PageNoOffSet%2==0))LastSelected-=1;$('#imgNext').attr("loadpage",GetNextPreviousPageNo(LastSelected,"next"));$('#imgPrevious').attr("loadpage",GetNextPreviousPageNo(LastSelected,"previous"));ArrangeContent(bolGoToPage);}}
function ShowHideZoomEmailPDF(){if((CatalogDisplayFormat==0)&&(bolIPad==false)){$('#imgVerticalBar').css("visibility","visible");$('#imgZoom').css("visibility","visible");}
else{$('#imgVerticalBar').css("visibility","hidden");$('#imgZoom').css("visibility","hidden");}
if(CatalogDisplayFormat==2){$("#imgPrint").css("visibility","hidden");$("#imgEmail").css("visibility","hidden");}
else{if(bolIPad==false){$("#imgPrint").css("visibility","visible");}
else{$("#imgPrint").css("visibility","hidden");}
if(strSendEmail=="true"){$("#imgEmail").css("visibility","visible");}}}
function GetNextPreviousPageNo(myselected,IsPrev){if(IsPrev=="previous"){var PreviousPageNo=myselected-NoOfPagesPerScreen<0?(TotalNoOfScreens-1)*NoOfPagesPerScreen:myselected-NoOfPagesPerScreen;return PreviousPageNo;}
else{var NextPageNo=myselected+NoOfPagesPerScreen<=TotalNoOfPages?myselected+NoOfPagesPerScreen:0;return NextPageNo;}}
function SetNoOfPagesPerScreenImageSizeRatio(){switch(CatalogDisplayFormat.toString()){case"1":{NoOfPagesPerScreen=1;ImageSizeRatio=2;break;}
case"2":{NoOfPagesPerScreen=18;ImageSizeRatio=0.45;break;}
default:{NoOfPagesPerScreen=2;ImageSizeRatio=1;break;}}}
function ResetZoomButton(){SetZoomImage("zoomed_","zoom_");}
function SetZoomButton(){SetZoomImage("zoom_","zoomed_");}
function SetZoomImage(strOri,strNew){var strZoomSrc=$("#imgZoom").attr("src").replace(strOri,strNew);$("#imgZoom").attr("src",strZoomSrc);}
function ReloadPage(isprev){var intIncrement=1;if(isprev=="previous"){intIncrement=-1;}
intIncrement=intIncrement*NoOfPagesPerScreen;intNoOfPagesThrough+=intIncrement;var intPageNo=LastSelected+intIncrement;if((CatalogDisplayFormat==1)&&(PageNoOffSet%2==0)){intPageNo+=1;}
if(Math.abs(intNoOfPagesThrough)>intMaxNoOfPageswnoReload){var strURL="JQCatalogView.aspx?Replace=true&CatalogOID="+CatalogOID;strURL+="&SupplierID="+SupplierID+"&Password="+strPassword+"&Format="+CatalogDisplayFormat;strURL+="&PageNo="+intPageNo+"&rand="+Math.random();window.location=strURL;}}
function GoToPage(showpage,isprev){if((LastSelected>0)&&(showpage==null)){showpage=LastSelected;}
if(showpage==null){showpage="0";}
var selected=parseInt(showpage);if(isprev=="tbd"){if(LastSelected<=selected){isprev="next";}
else{isprev="previous";}}
if(bolIPad==true){ReloadPage(isprev);}
BindUnBindPreviousNext(false);ResetZoomButton()
CloseIframe();bolZoomed=false;var SelectedScreen=Math.floor(selected/NoOfPagesPerScreen);if(SelectedScreen>=TotalNoOfScreens){selected=0;SelectedScreen=0;}
var $target=$('#divCatalogContent .glidecontent').eq(SelectedScreen);$target.css("visibility","visible");$target.css("background-color",CCWorking);var oneimagewidth=Math.floor(CatalogWidth*ImageSizeRatio*SizeCoefficient);var oneimageheight=Math.floor(CatalogHeight*ImageSizeRatio*SizeCoefficient);if(CatalogDisplayFormat==1){var intAdjustRate=1;if(bolIPad==true){intAdjustRate=0;}
oneimagewidth-=intSinglePageAjust*intAdjustRate;oneimageheight-=Math.floor(intSinglePageAjust*intAdjustRate*CatalogHeight/CatalogWidth);}
var strImageFileDirPreview=GetImageDir(true);var strImageFileDir=GetImageDir(false);var intCount=0;var strImagesToPreload="";var intCount=0;$target.children().each(function(){var strImageSrcPreview=GetImageSource(strImageFileDirPreview,$(this).attr("imageno"));var strImageSrc=GetImageSource(strImageFileDir,$(this).attr("imageno"));$(this).css("width",oneimagewidth+"px");$(this).css("height",oneimageheight+"px");$(this).css("visibility","visible");if(CatalogDisplayFormat!=2){var img=new Image();img.src=strImageSrc;if(img.complete==true){$(this).attr("src",strImageSrc);}
else{MM_preloadImages(strImageSrcPreview);$(this).attr("src",strImageSrcPreview);if(intCount>0){strImagesToPreload+=",";}
strImagesToPreload+="'"+ReplaceToRealImageSrc(strImageSrc)+"'";}}
else{MM_preloadImages(strImageSrc);SetImageDivLocationForThumbnail($(this).attr("id"),intCount,oneimagewidth,oneimageheight,strImageSrc);}
intCount++;});PreloadImages(strImagesToPreload,selected);var mylastselected=LastSelected;LastSelected=selected;var intSign=1;if(isprev=="previous"){intSign=-1;}
setTimeout(function(){PageTransition(SelectedScreen,intSign,mylastselected,selected)},500);}
function PageTransition(SelectedScreen,intSign,mylastselected,selected){var $target=$('#divCatalogContent .glidecontent').eq(SelectedScreen);if(IsSlide==true){var intWidth=$('#divCatalogContent').width();$target.css("width",intWidth+"px");intWidth*=intSign;CssZIndex+=1;$target.css("top","0px").css("left",intWidth+"px").css("zIndex",CssZIndex);var endpoint={left:0};$target.animate(endpoint,500,function(){ProcessingAfterAnimation(mylastselected,selected);});}
else{CssZIndex+=1;$target.css("left","0px").css("top","0px").css("zIndex",CssZIndex).hide().fadeIn(1000,function(){ProcessingAfterAnimation(mylastselected,selected);});}
LoadImageMapMouseoverEventLog();}
function PreloadImages(strImagesToPreload,selected)
{var intTotalLoaded=0;var strImageSrcList=strImagesToPreload.split(",");var intCount=0;while(intCount<strImageSrcList.length){var img=new Image();img.src=strImageSrcList[intCount];intCount++;}}
function UpdateImageSrc(currentScreenIndex){if(CatalogDisplayFormat!=2){var $current=$('#divCatalogContent .glidecontent').eq(currentScreenIndex);var intCount=0;var intCompleted=0;var strImageSrc="";$current.children().each(function(){if($(this).attr("src")!=null){var img=new Image();strImageSrc=ReplaceToRealImageSrc($(this).attr("src"));img.src=strImageSrc;if(img.complete==true){$(this).attr("src",strImageSrc);intCompleted++;}}
intCount++;});if(intCompleted!=intCount)setTimeout(function(){UpdateImageSrc(currentScreenIndex);},1000);}}
function SetImageDivLocationForThumbnail(divID,intCount,width,height,strImageSrc){if(divID!=""){if(strImageSrc!=""){$('#'+divID+' img').attr("src",strImageSrc);}
$('#'+divID+' img').css("visibility","visible").css("position","absolute").css("left","0px").css("top","0px");var intRow=Math.floor(intCount/6);var intCol=intCount%6;var intLeft=0;var intTop=VerticalInterval*SizeCoefficient;if((intCol%2==0)&&(OriTotalNoOfPages==TotalNoOfPages)){intLeft=HorizontalInterval*SizeCoefficient;}
else if(OriTotalNoOfPages!=TotalNoOfPages){intLeft=Math.floor(HorizontalInterval*SizeCoefficient/2);}
intLeft+=(width+HorizontalInterval*SizeCoefficient)*intCol;intTop+=(height+VerticalInterval*SizeCoefficient)*intRow;$('#'+divID).css("position","absolute").css("left",intLeft+"px").css("top",intTop+"px");}}
function ProcessingAfterAnimation(mylastselected,myselected){var lastScreenIndex=Math.floor(mylastselected/NoOfPagesPerScreen);var currentScreenIndex=Math.floor(myselected/NoOfPagesPerScreen);if(lastScreenIndex!=currentScreenIndex){$('#divCatalogContent .glidecontent').eq(lastScreenIndex).children().each(function(){$(this).css("visibility","hidden");if(CatalogDisplayFormat==2){$(this).children().css("visibility","hidden");}});$('#divCatalogContent .glidecontent').eq(lastScreenIndex).css("visibility","hidden");}
if(bolIPad==true){window.scrollTo(0,1);}
SetPageNoDisplay();HideTOC();UpdateImageSrc(currentScreenIndex);SetPreviousNext_PreloadImages(myselected);}
function SetPreviousNext_PreloadImages(myselected){var NextPageNo=GetNextPreviousPageNo(myselected,"next");var PreviousPageNo=GetNextPreviousPageNo(myselected,"previous");$('#imgNext').attr("loadpage",NextPageNo);$('#imgPrevious').attr("loadpage",PreviousPageNo);BindUnBindPreviousNext(true);var strImageFileDir=GetImageDir(false);var intNextScreenNo=Math.floor(NextPageNo/NoOfPagesPerScreen);PreloadAScreen(intNextScreenNo,strImageFileDir,true);PreloadAScreen(Math.floor(PreviousPageNo/NoOfPagesPerScreen),strImageFileDir,false);}
function PreloadAScreen(ScreenNo,strFolder,bolLoadPreview){var $Screen=$('#divCatalogContent .glidecontent').eq(ScreenNo);$Screen.children().each(function(){var strImageSrc=GetImageSource(strFolder,$(this).attr("imageno"));MM_preloadImages(strImageSrc);if(bolLoadPreview==true){var strFolderPreview=ReplaceToRealImageSrc(strFolder);var strImageSrcPreview=GetImageSource(strFolderPreview,$(this).attr("imageno"));MM_preloadImages(strImageSrcPreview);}});}
function ReplaceToRealImageSrc(strImageSrc){var strResult="";if(bolIPad==true){strResult=strImageSrc.replace("/SmallThumbnail/","/Magnified/");}
else{if(bolUseLargeImage==1){strResult=strImageSrc.replace("/LargeThumbnail/","/Large/");}
else{strResult=strImageSrc.replace("/LargeThumbnail/","/Medium/");}}
return strResult;}
function GetImageDir(bolPreview){var strImageFileDir="/Large/";if(bolUseLargeImage==0){strImageFileDir="/Medium/";}
else if(bolIPad==true){strImageFileDir="/Magnified/";}
if((CatalogDisplayFormat==2)||(bolPreview==true)){if(bolIPad==true){strImageFileDir="/SmallThumbnail/";}
else{strImageFileDir="/LargeThumbnail/";}}
return strImageFileDir;}
function GetImageSource(strImageFileDir,imageno){var strImageSrc="images/jpgs/"+CatalogOID+strImageFileDir+imageno+".jpg";if(imageno=="-2"){if(intBorder==0){strImageSrc="images/JQViewer/InstructionswLine.jpg";}
else{strImageSrc="images/JQViewer/Instructions.jpg";}}
if(imageno=="-1"){strImageSrc="images/shared/BigWhite.jpg";}
return strImageSrc;}
function SetPageNoDisplay(){var startingPageNo=LastSelected;startingPageNo+=1;var endingPageNo=startingPageNo;var intPageNoOffSet=PageNoOffSet;if(SearchCriteria!=""){intPageNoOffSet=0;}
if(NoOfPagesPerScreen>1){startingPageNo=Math.floor(LastSelected/NoOfPagesPerScreen)*NoOfPagesPerScreen;endingPageNo=startingPageNo+NoOfPagesPerScreen-1;if(intPageNoOffSet%2==1){startingPageNo+=1;endingPageNo+=1;}
if(SearchCriteria==""){if(startingPageNo==0){startingPageNo+=1;}}
else{startingPageNo+=1;endingPageNo+=1;}
if(endingPageNo>TotalNoOfPages){endingPageNo=TotalNoOfPages;}}
var strPageNos="Page:&nbsp;"+GetPageNoText(startingPageNo,intPageNoOffSet,true);if(startingPageNo!=endingPageNo){var strEndingPageNo=GetPageNoText(endingPageNo,intPageNoOffSet,true);strPageNos+="-"+strEndingPageNo;}
if(SearchCriteria==""){strPageNos+=" / "+GetPageNoText(TotalNoOfPages,intPageNoOffSet,true);$("#spGoToCaption").css("visibility","visible");$("#txtPageNo").css("visibility","visible");$("#btnGoToPageNo").attr("value",">").css("width","24px");$('#btnGoToPageNo').attr("rel","");$('#btnGoToPageNo').each(function(){$(this).css("cursor","pointer");SetQTip(this,1,170);});}
else{var strPageWord="page";if(TotalNoOfPages>1){strPageWord+="s";}
strPageNos+=" of "+TotalNoOfPages+" matching "+strPageWord+"."
$("#spGoToCaption").css("visibility","hidden");$("#txtPageNo").css("visibility","hidden");$("#btnGoToPageNo").attr("value","Clear Search").css("width","85px");$('#btnGoToPageNo').attr("rel","");$('#btnGoToPageNo').each(function(){$(this).css("cursor","pointer");SetQTip(this,1,170);});}
$("#spPageNos").html(strPageNos);}
function ValidatePageNo(){var intPageNoOffSet=PageNoOffSet;if(SearchCriteria!=""){intPageNoOffSet=0;}
var strEntry=$('#txtPageNo').attr("value");var intPageNo=1;try{intPageNo=parseInt(strEntry)+intPageNoOffSet;}
catch(e){if(PageNoOffSet>0){intPageNo=1;}
else{intPageNo=-1;}}
if((CatalogDisplayFormat==1)&&(intPageNo>0)){intPageNo-=1;}
return intPageNo;}
function GetLogicalNo(intPhysicalNo,intOffSet){var intResult=intPhysicalNo;if(intOffSet>0){intResult=intPhysicalNo-intOffSet;if(intResult<0){intResult=0;}}
return intResult;}
function GetPageNoText(intPhysicalNo,intOffSet,bolConsiderSearch){var strPageNo="";if((SearchCriteria=="")||(bolConsiderSearch==false)){var intLogicalNo=GetLogicalNo(intPhysicalNo,intOffSet);strPageNo=intLogicalNo.toString();if(intLogicalNo==0){if(intPhysicalNo==1){strPageNo="Cover";}
else{strPageNo=IntToRoman(intPhysicalNo-1);}}}
else{strPageNo=intPhysicalNo;}
return strPageNo;}
function IntToRoman(intLogicalPageNo){var strResult="";var intArabics=[1,4,5,9,10,40,50,90,100];var strRomans=['I','IV','V','IX','X','XL','L','XC','C'];var intCount=8;while(intCount>=0){while(intLogicalPageNo>=intArabics[intCount]){intLogicalPageNo=intLogicalPageNo-intArabics[intCount];strResult=strResult+strRomans[intCount];}
intCount=intCount-1;}
strResult=strResult.toLowerCase();return strResult;}
function ClearHotSpotDrawn(PageIndex)
{var ScreenNo=Math.floor(LastSelected/NoOfPagesPerScreen);var divID='div'+ScreenNo+'_'+PageIndex;var jg=new jsGraphics(divID);jg.clear();}
function ZoomInAndOut(e){bolDblClicked=true;HideTOC();HideLeadGenerator();var $current=$('#divCatalogContent .glidecontent').eq(LastSelected/NoOfPagesPerScreen);if(bolZoomed==false){bolZoomed=true;ClearHotSpotDrawn(0);ClearHotSpotDrawn(1);SetZoomButton();var areaWidth=CatalogWidth*2*2+4*intBorder;var areaHeight=CatalogHeight*2+2*intBorder;var imgPos=$current.offset();var imgWidth=CatalogWidth*2*SizeCoefficient+2*intBorder;var imgHeight=CatalogHeight*SizeCoefficient+2*intBorder;var X1=(imgPos.left-areaWidth)+imgWidth;var Y1=(imgPos.top-areaHeight)+imgHeight;var X2=imgPos.left;var Y2=imgPos.top;SetImageWidthHeight(2);$current.draggable({containment:[X1,Y1,X2,Y2]});var intPageX=300;var intPageY=75;if(e!=null){intPageX=e.pageX;intPageY=e.pageY;}
var orileft=intPageX-imgPos.left;var oritop=intPageY-imgPos.top;var myleft=orileft*(1.0-2.0/SizeCoefficient);var mytop=oritop*(1.0-2.0/SizeCoefficient);$current.css('left',myleft+'px').css('top',mytop+'px');InitMouseover("ZoomIn");}
else{SetImageWidthHeight(SizeCoefficient);$('#divCatalogContent .glidecontent').eq(LastSelected/NoOfPagesPerScreen).draggable('destroy');$current.css("position","absolute").css('left','1px').css('top','0px');ResetZoomButton();InitMouseover("ZoomOut");setTimeout(function(){bolZoomed=false;},intDoubleClickTimeLimit*3);}
setTimeout(function(){bolDblClicked=false;},intDoubleClickTimeLimit*3);}
function SetImageWidthHeight(myCoefficient){var $current=$('#divCatalogContent .glidecontent').eq(LastSelected/NoOfPagesPerScreen);var width=Math.floor(CatalogWidth*myCoefficient);var height=Math.floor(CatalogHeight*myCoefficient);var intcount=0;$current.css('width',width*2+4+"px").css('height',height+2+"px");$current.children().each(function(){$(this).css("width",width);$(this).css("height",height);intcount++;});}
function SetContentSize(){var windowwidth=$(window).width();var windowheight=$(window).height();HandleLogoName();if(windowwidth*0.20<200){$('#imgPoweredBy').css("width",(windowwidth*0.20)+"px");}
else{$('#imgPoweredBy').css("width","auto");}
if(windowwidth<800){windowwidth=800;}
if(windowheight<480){windowheight=480;}
var oriwidth=CatalogWidth*2+intBorder*4;var oriheight=CatalogHeight+intBorder*2;if(CatalogDisplayFormat==2){oriwidth=(CatalogWidth*ImageSizeRatio+intBorder*2)*6+HorizontalInterval*(6-intBorder);oriheight=(CatalogHeight*ImageSizeRatio+intBorder*2)*3+VerticalInterval*4;}
else if(CatalogDisplayFormat==1){dblRatio=2;var intAdjustRate=1;oriwidth=CatalogWidth*ImageSizeRatio+intBorder*2+intSinglePageAjust*intAdjustRate;oriheight=CatalogHeight+intBorder*2;}
var ratio=oriheight/oriwidth;var intHeightAdjust=104;var intWidthAdjust=136;if(((windowheight-intHeightAdjust)/(windowwidth-intWidthAdjust)>ratio)){SizeCoefficient=(windowwidth-intWidthAdjust)/oriwidth;}
else{SizeCoefficient=(windowheight-intHeightAdjust)/oriheight;}
var TotalContentWidth=Math.floor(CatalogWidth*SizeCoefficient)*2+intBorder*4;var TotalContentHeight=Math.floor(CatalogHeight*SizeCoefficient)+intBorder*2;if(CatalogDisplayFormat==2){TotalContentWidth=Math.ceil(oriwidth*SizeCoefficient);TotalContentHeight=Math.ceil(oriheight*SizeCoefficient);}
var OneImageWidth=Math.floor(CatalogWidth*ImageSizeRatio*SizeCoefficient);var OneImageHeight=Math.floor(CatalogHeight*ImageSizeRatio*SizeCoefficient);if(CatalogDisplayFormat==1){var intAdjustRate=1;if(bolIPad==true){intAdjustRate=0;}
OneImageWidth-=intSinglePageAjust*intAdjustRate;OneImageHeight-=Math.floor(intSinglePageAjust*intAdjustRate*CatalogHeight/CatalogWidth);if(bolIPad==true){TotalContentHeight*=2;}}
$('#tdCatalogContent').css("width",TotalContentWidth+'px').css("height",(TotalContentHeight+15)+'px');$('#divCatalogContent').css("width",TotalContentWidth+'px').css("height",TotalContentHeight+'px');$('#divCatalogContent .glidecontent').css("width",TotalContentWidth+'px').css("height",TotalContentHeight+'px');$('#divCatalogContent .glidecontent .pageimage').css("width",OneImageWidth+"px").css("height",OneImageHeight+"px");if(CatalogDisplayFormat==2){var intCount=0;var $target=$('#divCatalogContent .glidecontent').eq(Math.floor(LastSelected/NoOfPagesPerScreen));$target.children().each(function(){SetImageDivLocationForThumbnail($(this).attr("ID"),intCount,OneImageWidth,OneImageHeight,"")
intCount++;});}
if(CatalogDisplayFormat==1){$('#divCatalogContent .glidecontent').css("overflow","auto");;}
else{$('#divCatalogContent .glidecontent').css("overflow","hidden");}
var strtop=$('#divtoc').parent().css("top");$('#divtoc').css("position","absolute").css('top',strtop).css("height",(TotalContentHeight+15)+'px');if(bolZoomed==true){ZoomInAndOut(null);}
$('#divMoreStickyNotes').css("visibility","hidden");ResizeStickyNotes();strMouseOverInitialized=",";if(strVisited!=","){InitMouseover("setcontentsize");}
ResizeIframe();}
function ResizeStickyNotes(){if(CatalogDisplayFormat==2){$('#StickyNotesAdd').css("visibility","hidden");$('#divStickyNotes .StickyNotesX').css("visibility","hidden");$('#divStickyNotes').css("visibility","hidden");}
else{$('#StickyNotesAdd').css("visibility","visible");$('#divStickyNotes').css("visibility","visible");var windowwidth=$(window).width();var windowheight=$(window).height();if(windowwidth<600){windowwidth=600;}
if(windowheight<420){windowheight=420;}
var TotalContentWidth=Math.floor(CatalogWidth*SizeCoefficient)*2+intBorder*4;var TotalContentHeight=Math.floor(CatalogHeight*SizeCoefficient)+intBorder*2;var intStickyNoteRight=windowwidth-(windowwidth-TotalContentWidth-20)/2+5;$('#StickyNotesAdd').css("left",intStickyNoteRight+"px");$('#divStickyNotes').css("left",intStickyNoteRight+"px");$('#divStickyNotes').css("width","36px");bolMoreStickyNotes=false;var intmyHeight=intStickyNoteHeight;if(intStickyNoteHeight<TotalContentHeight/2-75){$('#divStickyNotes').css("height",intStickyNoteHeight).css("overflow","hidden");$('#divMoreStickyNotes').css("visibility","hidden");}
else if(bolIPad==false)
{intmyHeight=Math.floor((TotalContentHeight/2-75)/25)*25;$('#divStickyNotes').css("height",intmyHeight).css("overflow","hidden");$('#divMoreStickyNotes').css("left",intStickyNoteRight+"px").css("visibility","visible").css("top",intmyHeight+87+2+"px");$('#divMoreStickyNotes').unbind("click");$('#divMoreStickyNotes').bind("click",function(){if(bolMoreStickyNotes==false){$('#divStickyNotes').css("overflow","auto").css("width","56px");$(this).html('<img src="images/JQViewer/LessStickyNotes.png" border="0" />');bolMoreStickyNotes=true;}
else{$('#divStickyNotes').css("overflow","hidden").css("width","36px");$(this).html('<img src="images/JQViewer/MoreStickyNotes.png" border="0" />');bolMoreStickyNotes=false;}});}}}
function GetTop(intCount){var intTop=25*intCount;return intTop;}
function GetStickyNotesPageNosAndLoad(){var strURL="JQStickyNotesLoadList.aspx?CatalogOID="+CatalogOID+"&rand="+Math.random();$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Load Sticky Note PageNo List",ajaxrequest);},success:function(content){strStickyNotesPageNos=content;if(content!=""){StickyNotesPageNos=strStickyNotesPageNos.split(",");LoadStickyNotes();}
else{StickyNotesPageNos=null;}}});}
function ShowNormal(){$('#divStickyNotes .StickyNotesPageNo').css("font-size","8pt");$('#divStickyNotes .StickyNotesX').css("visibility","hidden");$('#divStickyNotes .StickyNotesPageNo').css("color","#333333");}
function LoadStickyNotes(){var intCount=0;var strHTML='';var intTop=0;if(StickyNotesPageNos!=null){while(intCount<StickyNotesPageNos.length){intTop=GetTop(intCount);var strCodeImage='<img class="StickyNotesImg" myIndex='+intCount+' style="top:'+intTop+'px" />';var intLeft=8;if((StickyNotesPageNos[intCount]-PageNoOffSet>=10)&&(StickyNotesPageNos[intCount]-PageNoOffSet<=99)){intLeft=5;}
else if(StickyNotesPageNos[intCount]-PageNoOffSet>=100){intLeft=1;}
var strPageNo=GetPageNoText(StickyNotesPageNos[intCount],PageNoOffSet,false);if(strPageNo=="Cover"){strPageNo="0";intLeft=8;}
var strCodePageNo='<span class="StickyNotesPageNo" myIndex='+intCount+' PageNo='+StickyNotesPageNos[intCount]+' style="top:'+(intTop+2)+'px; left: '+intLeft+'px" >'+strPageNo+'</span>';var strCodeX='<span class="StickyNotesX" myIndex='+intCount+' style="top:'+(intTop+2)+'px" >&nbsp;x&nbsp;</span>';strHTML+=strCodeImage;strHTML+=strCodePageNo;strHTML+=strCodeX;intCount++;}}
intStickyNoteHeight=intTop+25;$('#divStickyNotes').html(strHTML);$('#divStickyNotes .StickyNotesImg').attr("src","images/JQViewer/icon-sticky.png").css("cursor","pointer");$('#StickyNotesAdd').bind("mouseover",function(){ShowNormal();});$('#divStickyNotes .StickyNotesImg').bind("mouseover",function(){ShowNormal();$(this).next().css("font-size","10pt");$(this).next().css("color","#aa3333");$(this).next().next().css("visibility","visible");});$('#divStickyNotes .StickyNotesImg').bind("mouseout",function(){$(this).next().css("font-size","8pt");$(this).next().css("color","#333333");});$('#divStickyNotes .StickyNotesImg').bind("click",function(){GoToBookmarked($(this).attr("pageno"));});$('#divStickyNotes .StickyNotesPageNo').bind("click",function(){GoToBookmarked($(this).attr("pageno"));});$('#divStickyNotes .StickyNotesPageNo').bind("mouseover",function(){$(this).css("font-size","10pt");$(this).css("color","#aa3333");$(this).next().css("visibility","visible");});$('#divStickyNotes').bind("mouseleave",function(){ShowNormal();});$('#divStickyNotes .StickyNotesX').bind("click",function(){DeleteStickyNote($(this).prev().attr("PageNo"));});ResizeStickyNotes();}
function DeleteStickyNote(PageNo){strStickyNotesPageNos=","+strStickyNotesPageNos+",";strStickyNotesPageNos=strStickyNotesPageNos.replace(","+PageNo+",",",");strStickyNotesPageNos=strStickyNotesPageNos.substring(1,strStickyNotesPageNos.length);strStickyNotesPageNos=strStickyNotesPageNos.substring(0,strStickyNotesPageNos.length-1);if(strStickyNotesPageNos!=""){StickyNotesPageNos=strStickyNotesPageNos.split(",");}
else{StickyNotesPageNos=null;}
LoadStickyNotes();var strURL="JQStickyNotesDelete.aspx?CatalogOID="+CatalogOID+"&PageNo="+PageNo;$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Deleting Sticky Note",ajaxrequest);},success:function(){}});}
function AddStickyNote(){var intCount=1;var bolFound=false;var strBefore="";var strAfter="";var bolReloadAndSave=false;var selected=LastSelected;if((SearchCriteria=="")&&(CatalogDisplayFormat==1)&&(PageNoOffSet%2==0)){selected+=1;}
if(SearchCriteria!=""){selected=parseInt(arrImageFilenoList[selected]);}
if(selected==0)selected=1;if(StickyNotesPageNos==null){strStickyNotesPageNos=selected;StickyNotesPageNos=new Array();StickyNotesPageNos[0]=selected;bolReloadAndSave=true;}
else if(StickyNotesPageNos.length==1)
{if(StickyNotesPageNos[0]>selected){strBefore=","+StickyNotesPageNos[0]+",";strAfter=","+selected+","+StickyNotesPageNos[0]+",";}
else if(StickyNotesPageNos[0]<selected){strBefore=","+StickyNotesPageNos[0]+",";strAfter=","+StickyNotesPageNos[0]+","+selected+","}}
else
{while((intCount<StickyNotesPageNos.length)&&(bolFound==false)){if(intCount==1){if(StickyNotesPageNos[0]==selected){bolFound=true;}
else if(StickyNotesPageNos[0]>selected){strBefore=","+StickyNotesPageNos[intCount-1]+",";strAfter=","+selected+","+StickyNotesPageNos[intCount-1]+",";bolFound=true;}}
if(StickyNotesPageNos[intCount]==selected){bolFound=true;}
else if((StickyNotesPageNos[intCount-1]<selected)&&(StickyNotesPageNos[intCount]>selected)){strBefore=","+StickyNotesPageNos[intCount-1]+","+StickyNotesPageNos[intCount]+",";strAfter=","+StickyNotesPageNos[intCount-1]+","+selected+","+StickyNotesPageNos[intCount]+",";bolFound=true;}
else if((intCount==StickyNotesPageNos.length-1)&&(StickyNotesPageNos[intCount]<selected)){strBefore=","+StickyNotesPageNos[intCount]+",";strAfter=","+StickyNotesPageNos[intCount]+","+selected+",";bolFound=true;}
intCount++;}}
if((strBefore!="")&&(strAfter!="")){strStickyNotesPageNos=","+strStickyNotesPageNos+",";strStickyNotesPageNos=strStickyNotesPageNos.replace(strBefore,strAfter);strStickyNotesPageNos=strStickyNotesPageNos.substring(1,strStickyNotesPageNos.length);strStickyNotesPageNos=strStickyNotesPageNos.substring(0,strStickyNotesPageNos.length-1);StickyNotesPageNos=strStickyNotesPageNos.split(",");bolReloadAndSave=true;}
if(bolReloadAndSave==true){var strURL="JQStickyNotesAdd.aspx?CatalogOID="+CatalogOID+"&PageNo="+selected;$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Adding Sticky Notes",ajaxrequest);},success:function(){}});LoadStickyNotes();}}
function GoToBookmarked(pageno)
{var intPageNo=parseInt(pageno);if((CatalogDisplayFormat==1)&&(PageNoOffSet%2==0)){intPageNo-=1;}
JumpToPage(intPageNo);}
function AddOtherParameters(){var strResult="";var strEmbedded=getParameterByNameFromURL("Embedded","");if(strEmbedded!=""){strResult+="&Embedded=true";var strShowDetailInside=getIntParameterByNameFromURL("ShowDetailInside","");if(strShowDetailInside!=""){strResult+="&ShowDetailInside=true";}}
var strAMSITE=getParameterByNameFromURL("AMSITE","");if(strAMSITE!=""){strResult+="&AMSITE="+strAMSITE;}
var strIsLink=getParameterByNameFromURL("IsLink","");if(strIsLink!=""){strResult+="&IsLink=true";}
return strResult;}
function LoadImageMapMouseoverEventLog(){var strURL="JQCatalogImageMapMouseOverEventLog.aspx?CatalogOID="+CatalogOID+"&SupplierID="+SupplierID;strURL+="&PageNo="+LastSelected+"&Format="+CatalogDisplayFormat+"&IPad="+bolIPad;if(SearchCriteria!=""){strURL+="&SearchCriteria="+escape(SearchCriteria);}
if(strVisited.indexOf(","+LastSelected+",")!=-1){strURL+="&EventLogOnly=true";}
strURL+=AddOtherParameters();strURL+="&Rand="+Math.random();$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Loading Content 2, Logging Event",ajaxrequest);},success:function(content){if(strVisited.indexOf(","+LastSelected+",")==-1){strVisited+=LastSelected+",";HandleMouseoverContent(content);}}});if(strVisited.indexOf(","+LastSelected+",")!=-1){HandleSearchResult();InitMouseover("notloadmouseover");}}
function HandleMouseoverContent(content){var MapNo="";if(content.indexOf(':')!=-1){MapNo=content.substring(0,content.indexOf('::'));content=content.substring(content.indexOf('::')+2);if(content.indexOf('^')!=-1){var strImageMapContent=content.substring(0,content.indexOf('^||^'));$('#divCatalogContent .glidecontent').eq(Math.floor(LastSelected/NoOfPagesPerScreen)).append(strImageMapContent);HandleLeadGenerator();content=content.substring(content.indexOf('^||^')+4);if(content.indexOf('^')!=-1){var strMouseOver=content.substring(0,content.indexOf('^||^'));content=content.substring(content.indexOf('^||^')+4);try{HandleMouseOver(MapNo,strMouseOver);}
catch(e){alert("HandleMouseOver "+e);}
if(content.indexOf('^')!=-1){var strMouseOverCustom=content.substring(0,content.indexOf('^||^'));content=content.substring(content.indexOf('^||^')+4);try{HandleMouseOverCustom(MapNo,strMouseOverCustom);}
catch(e){alert("HandleMouseOverCustom "+e);}
if(content.indexOf('^')!=-1){var strLeadInfo=content.substring(0,content.indexOf('^||^'));$('#divCatalogContent .glidecontent').eq(Math.floor(LastSelected/NoOfPagesPerScreen)).append(strLeadInfo);var strDrawHotSpotInfo=content.substring(content.indexOf('^||^')+4);try{HandleDrawHotSpot(strDrawHotSpotInfo);}
catch(e){alert("HandleDrawHotSpot "+e);}}}}
else{HandleMouseOver(MapNo,content);}}}
InitMouseover("afterloadmouseover");}
function HandleLeadGenerator(){$('#divCatalogContent .glidecontent .pageimage').mouseleave(function(e){HideLeadGenerator();});if(bolShowLeadGenerator==true){$('#divCatalogContent .glidecontent .pageimage').click(function(){setTimeout("GoToLeadGenerator("+LastSelected+")",intDoubleClickTimeLimit);});}}
function GoToLeadGenerator(pageno){if((bolZoomed==false)&&(bolDblClicked==false)&&(bolHotSpotClicked==false)){var strPageURL="JQLead.aspx";var intContentWidth=SizeCoefficient*CatalogWidth*2;if(intContentWidth<900){strPageURL="JQLeadSmall.aspx";}
else if(intContentWidth>1200){strPageURL="JQLeadLarge.aspx";}
strPageURL+="?CatalogOID="+CatalogOID+"&pageno="+pageno+"&format="+CatalogDisplayFormat;HideTOC();ShowIframe(strPageURL);}}
function ShowLeadGenerator(bolIsLeft){if((bolZoomed==false)&&(bolMouseoverShown==false)){var intLeft=5;if(bolIsLeft==false){intLeft+=CatalogWidth*SizeCoefficient;}
$(".divLeadGenerator").css("position","absolute").css("Z-Index",10000).css("width","189px").css("left",intLeft+"px").css("top","5px").css("visibility","visible");}}
function HideLeadGenerator(){$(".divLeadGenerator").css("visibility","hidden");}
function HandleMouseOver(MapNo,stralt){while(stralt.indexOf('|')!=-1){var strMouseOverContent=stralt.substring(0,stralt.indexOf('||'));stralt=stralt.substring(stralt.indexOf('||')+2);PopulateDiv(MapNo,strMouseOverContent);}
if(stralt!=''){PopulateDiv(MapNo,stralt);}}
function HandleMouseOverCustom(MapNo,stralt){while(stralt.indexOf('|')!=-1){var strMouseOverContent=stralt.substring(0,stralt.indexOf('||'));stralt=stralt.substring(stralt.indexOf('||')+2);PopulateDivCustom(MapNo,strMouseOverContent);}
if(stralt!=''){PopulateDivCustom(MapNo,stralt);}}
function PopulateDiv(MapNo,strMouseOverContent){var strlinkto=strMouseOverContent.substring(0,strMouseOverContent.indexOf('::'));strMouseOverContent=strMouseOverContent.substring(strMouseOverContent.indexOf('::')+2);var strlinkto2=strlinkto.replace("/","_");var strlinkto3=strlinkto2.replace(" ","_SPACE_");var strlinkto4=strlinkto3.replace(" ","_SPACE_");strlinkto4=strlinkto4.toLowerCase();var strDivID="#div"+"Map"+MapNo+"_"+strlinkto4;var lbl=$(strDivID);if(lbl!=null){lbl.html(strMouseOverContent);}
for(i=1;i<20;i++){strDivID="#div"+"Map"+MapNo+"_"+strlinkto4+"__"+i;lbl=$(strDivID);if(lbl!=null){lbl.html(strMouseOverContent);}}}
function PopulateDivCustom(MapNo,strMouseOverContent){var strlinkto=strMouseOverContent.substring(0,strMouseOverContent.indexOf('::'));strMouseOverContent=strMouseOverContent.substring(strMouseOverContent.indexOf('::')+2);var lbl=$("#div"+"Map"+MapNo+"_"+"Custom"+strlinkto);if(lbl!=null){lbl.html(strMouseOverContent);}}
function InitMouseover(fromwhere){if(intShowMouseOver==1){if((strMouseOverInitialized.indexOf(","+LastSelected+",")==-1)||(fromwhere=="ZoomIn")||(fromwhere=="ZoomOut")){var currentDivID=$('#divCatalogContent .glidecontent').eq(Math.floor(LastSelected/NoOfPagesPerScreen)).attr("id");var dblratio=SizeCoefficient*ImageSizeRatio;if(fromwhere=="ZoomIn"){dblratio=2;}
var strMapID="";$('#'+currentDivID+' map').each(function(){var intAreaCount=0;strMapID=$(this).attr("id");$('#'+strMapID+" area").each(function(){intAreaCount+=1;BindUnbindMouseOverEvent(false);var newcoords=AdjustCoordsBasedOnRatio(dblratio,$(this).attr("oricoords"));$(this).attr("coords",newcoords);var myDivID=GetMouseOverDivID($(this).attr('id'));var myDiv=$(myDivID);var myCoords=newcoords.split(",");if(myCoords.length>1){var intMinX=parseInt(myCoords[0]);var intMinY=parseInt(myCoords[1]);var intMaxX=parseInt(myCoords[0]);var intMaxY=parseInt(myCoords[1]);var intCount=2;while(intCount<myCoords.length){var intCoord=parseInt(myCoords[intCount]);if(intCount%2==0){if(intCoord<intMinX){intMinX=intCoord;}
else if(intCoord>=intMaxX){intMaxX=intCoord;}}
else{if(intCoord<intMinY){intMinY=intCoord;}
else if(intCoord>=intMaxY){intMaxY=intCoord;}}
intCount++;}
var intMouseoverWidth=185;var intWidth=Math.floor(CatalogWidth*SizeCoefficient);if(fromwhere=="ZoomIn"){intWidth=Math.floor(CatalogWidth*2);}
myDiv.css("position","absolute").css("Z-Index",10000);if((CatalogDisplayFormat==1)&&(intMaxX>=CatalogWidth*SizeCoefficient*ImageSizeRatio-intMouseoverWidth-30)){if(intMinY>200){myDiv.css("left",intMinX+"px").css("top",(intMinY-120)+"px");}
else{myDiv.css("left",intMinX+"px").css("top",intMaxY+"px");}}
else
{if($(this).attr('page')=="left"){myDiv.css("left",intMaxX+"px").css("top",intMinY+"px");}
else{myDiv.css("left",intMinX-intMouseoverWidth+intWidth+"px").css("top",intMinY+"px");}}}
var strBackground='transparent';var intBorderWidth=0;var strBorderColor='transparent';myDiv.css("background-color",strBackground).css("border","solid "+intBorderWidth+"px "+strBorderColor).css("visibility","hidden").css("padding","0px").css("font-size","10pt");myDiv.css("z-index",10000);BindUnbindMouseOverEvent(this,true);});if((intAreaCount==0)&&(bolShowLeadGenerator==true)){$('#'+currentDivID+" .pageimage[useMap='#"+strMapID+"']").each(function(){$(this).bind("mouseover",function(){var intPageNo=parseInt($(this).attr("pageno"));var bolIsLeft=true;if((intPageNo%2==0)&&(CatalogDisplayFormat==0)){bolIsLeft=false;}
ShowLeadGenerator(bolIsLeft);});});}});strMouseOverInitialized+=LastSelected+",";}}}
function BindUnbindMouseOverEvent(obj,bolBind){if(bolBind==true){$(obj).bind("mouseover",function(e){ShowHideMouseOver($(this).attr('id'),"visible");});$(obj).bind("mouseout",function(e){ShowHideMouseOver($(this).attr('id'),"hidden");});}
else{$(obj).unbind("mouseover");$(obj).unbind("mouseout");}}
function GetMouseOverDivID(myAreaid){var myDivID="#div"+myAreaid;var myDiv=$(myDivID);if(myDiv==null){var intIndex=1;var bolFound=false;while((intIndex<200)&&(bolFound==false)){myDivID="#div"+myAreaid+"__"+i;myDiv=$(myDivID);if(myDiv!=null){bolFound=true;}
intIndex++;}}
return myDivID;}
function AddShadow(myDivID){if($(myDivID).attr("Shadow")==null){$(myDivID+" table .MOProductName").css("border-left","solid 1px "+CCMouseoverBody).css("border-right","solid 1px "+CCMouseoverBody);$(myDivID+" .Mouseover").css("background-color",CCMouseoverBody).css("border","solid 1px "+CCMouseoverBorder);$(myDivID+" table td div.divFirstRow").css("position","relative").css("top","0px").css("background-color",CCMouseoverHeader).css("padding","5px").css("border-bottom","solid 1px "+CCMouseoverBorder);cluezIndex=0;var $dropShadow=$([]);for(var i=0;i<5;i++){$dropShadow=$dropShadow.add($('<div></div>').css({zIndex:cluezIndex-1,opacity:.2,width:$(myDivID).width(),height:$(myDivID).height()+2,top:1+i,left:1+i}));}
$dropShadow.css("position","absolute").css("background-color","#000000");$(myDivID).append($dropShadow);$(myDivID).css("padding","0px").attr("Shadow","true");}}
function ShowHideMouseOver(myAreaid,visible){if((ShowMouseOver==1)){var myDivID=GetMouseOverDivID(myAreaid);var myDiv=$(myDivID);myDiv.css("visibility",visible);AddShadow(myDivID);}
if(visible=="visible"){bolMouseoverShown=true;HideLeadGenerator();}
else{bolMouseoverShown=false;var bolIsLeft=true;if($("#"+myAreaid).attr("page")=="right"){bolIsLeft=false;}
setTimeout(function(){ShowLeadGenerator(bolIsLeft);},intDoubleClickTimeLimit);}}
function JQEventLog(strURL){HideTOC();bolHotSpotClicked=true;$.ajax({url:strURL,error:function(ajaxrequest){HandleError("Logging Event",ajaxrequest);},success:function(strResponse){if(strResponse.indexOf("||")!=-1){var strCase=strResponse.substring(0,strResponse.indexOf("||"));var strRedirectURL=strResponse.substring(strResponse.indexOf("||")+2);HandleRedirect(strCase,strRedirectURL);}}})
var strEventName=getParameterByNameFromString("EventName",strURL);var strRedirectURL=getParameterByNameFromString("RedirectURL",strURL);if(strEventName.toLowerCase()=="pdfdownload"){HandleRedirect("4",strRedirectURL);}
else{if(strRedirectURL.indexOf("JQCatalogView.aspx")==-1){if(strRedirectURL.toLowerCase().indexOf("**page**")!=-1){HandleRedirect("3",strRedirectURL);}
else{}}
else{}}}
function CloseIframe(){$("#iframeDatail").attr("src","").css("visibility","hidden");}
function JumpToPage(PageNo){if(SearchCriteria!=""){ClearSearch();}
var intPageNo=parseInt(PageNo);PreloadAScreen(Math.floor(intPageNo/NoOfPagesPerScreen),GetImageDir(false),false);setTimeout(function(){GoToPage(intPageNo,"tbd");$("#txtPageNo").attr("value","");},1000);}
function ShowIframe(strRedirectURL){$("#iframeDatail").attr("src",strRedirectURL);ResizeIframe();$("#iframeDatail").css("visibility","visible");}
function ResizeIframe(){var TotalContentWidth=Math.floor(CatalogWidth*SizeCoefficient)*2+intBorder*4;var TotalContentHeight=Math.floor(CatalogHeight*SizeCoefficient)+intBorder*2;if((CatalogDisplayFormat==1)&&(bolIPad==true)){TotalContentHeight=Math.floor(CatalogHeight*SizeCoefficient)*2+intBorder*2;}
if($("#iframeDatail").attr("src")!=null){if(($("#iframeDatail").attr("src").indexOf("JQErrorNoMatch.htm")!=-1)&&(PreviousCatalogDisplayFormat==2)){TotalContentWidth=Math.ceil(((CatalogWidth*0.45+intBorder*2)*6+HorizontalInterval*(6-intBorder))*SizeCoefficient)-5;TotalContentHeight=Math.ceil(((CatalogHeight*0.45+intBorder*2)*3+VerticalInterval*4)*SizeCoefficient);}}
$("#iframeDatail").css("position","relative").css("overflow","auto");$("#iframeDatail").css("left","0px").css("top","0px").css("width",TotalContentWidth+"px").css("height",TotalContentHeight+"px");}
function HandleRedirect(strCase,strRedirectURL){if((strRedirectURL!=null)&&(strRedirectURL!="")){switch(strCase){case"0":{ShowIframe(strRedirectURL);break;}
case"1":{strRedirectURL=strRedirectURL.toLowerCase();if((strRedirectURL.indexOf("jqcatalogviewreturn.aspx")==-1)||(strRedirectURL.indexOf("backpage")!=-1)){if(window.parent!=null){window.parent.location=strRedirectURL;}}
break;}
case"2":{if(window.opener!=null){window.close();window.opener.location=strRedirectURL;}
else{ShowIframe(strRedirectURL);}
break;}
case"3":{var strPageNo=strRedirectURL.substring(strRedirectURL.toLowerCase().indexOf("**page**")+8);if(strPageNo.indexOf("_")!=-1)strPageNo=strPageNo.substring(0,strPageNo.indexOf("_"));JumpToPage(strPageNo);break;}
case"4":{break;}}}
setTimeout("ChangeHotSpotClicked()",intDoubleClickTimeLimit*2);}
function ChangeHotSpotClicked()
{bolHotSpotClicked=false;}
function showexternal(externalurl,eventlogurl){var property="resizable=1, width=800, height=600";if((externalurl.indexOf('http://')==-1)&&(externalurl.indexOf('https://')==-1)){externalurl='http://'+externalurl;}
var winExternalURL=window.open(externalurl,'External',property);try{winExternalURL.focus();}
catch(e){}
JQEventLog(eventlogurl);}
function AdjustCoordsBasedOnRatio(dblratio,coords){var newcoords='';var onecoord='';var intoneCoord=0;var intoneCoordNew=0;var intCount=0;while(coords.indexOf(',')!=-1){onecoord=coords.substring(0,coords.indexOf(','));coords=coords.substring(coords.indexOf(',')+1);intoneCoord=parseInt(onecoord);intoneCoordNew=Math.floor(intoneCoord*dblratio);newcoords+=intoneCoordNew+',';intCount++;}
if(coords!=''){intoneCoord=parseInt(coords);intoneCoordNew=Math.floor(intoneCoord*dblratio);newcoords+=intoneCoordNew;}
return newcoords;}
function HandleSearchResult(){if((SearchCriteria!="")&&(CatalogDisplayFormat==2)){DrawHotSpotsForAllPageOnScreen(strHotSpotForSearchResult);}}
function HandleDrawHotSpot(sethotspot){if((sethotspot==null)||(sethotspot=="")){return;}
if(strHotSpotForSearchResult!=""){strHotSpotForSearchResult+="||";}
strHotSpotForSearchResult+=sethotspot;DrawHotSpotsForAllPageOnScreen(sethotspot);}
function GetPageIndex(strPageNo){var intCount=0;var intPageNo=parseInt(strPageNo)
{while(intCount<arrImageFilenoList.length){if(arrImageFilenoList[intCount]==intPageNo){return intCount;}
intCount++;}}
return-1;}
function DrawHotSpotsForAllPageOnScreen(sethotspot){while(sethotspot.indexOf('||')!=-1){var strDrawHotSpots=sethotspot.substring(0,sethotspot.indexOf('||'));sethotspot=sethotspot.substring(sethotspot.indexOf('||')+2);DrawHotSpots(strDrawHotSpots);}
if(sethotspot!=''){DrawHotSpots(sethotspot);}}
function DrawHotSpots(strDrawHotSpots){var PageNo;var strhotspotcoordinates;if(strDrawHotSpots.indexOf(';')!=-1){PageNo=strDrawHotSpots.substring(0,strDrawHotSpots.indexOf(';'));strhotspotcoordinates=strDrawHotSpots.substring(strDrawHotSpots.indexOf(';')+1);}
PageIndex=GetPageIndex(PageNo);if((PageIndex!=-1)){var ScreenNo=Math.floor(LastSelected/NoOfPagesPerScreen);var divID='div'+ScreenNo+'_'+PageIndex;var intXAdjust=0;if(Math.floor(PageIndex/NoOfPagesPerScreen)==ScreenNo){PageIndex=PageIndex%NoOfPagesPerScreen;if(CatalogDisplayFormat!=2){var $current=$('#divCatalogContent .glidecontent').eq(ScreenNo);divID=$current.attr("id");intXAdjust=Math.floor(CatalogWidth*ImageSizeRatio*SizeCoefficient)*PageIndex;}
var jg=new jsGraphics(divID);jg.clear();jg.setColor('#666666');jg.setStroke(1);var hotspotcoordinates=strhotspotcoordinates.split(",");var intCount=0;var intX0,intY0,intX1,intY1;var intXs=new Array()
var intYs=new Array();while(intCount<hotspotcoordinates.length/2-1){intX0=parseInt(hotspotcoordinates[intCount*2])*ImageSizeRatio*SizeCoefficient+intXAdjust;intY0=parseInt(hotspotcoordinates[intCount*2+1])*ImageSizeRatio*SizeCoefficient;intX1=parseInt(hotspotcoordinates[intCount*2+2])*ImageSizeRatio*SizeCoefficient+intXAdjust;intY1=parseInt(hotspotcoordinates[intCount*2+3])*ImageSizeRatio*SizeCoefficient;intXs[intCount]=intX0;intYs[intCount]=intY0;jg.drawLine(intX0,intY0,intX1,intY1);intCount=intCount+1;}
intX0=parseInt(hotspotcoordinates[intCount*2])*ImageSizeRatio*SizeCoefficient+intXAdjust;intY0=parseInt(hotspotcoordinates[intCount*2+1])*ImageSizeRatio*SizeCoefficient;intX1=parseInt(hotspotcoordinates[0])*ImageSizeRatio*SizeCoefficient+intXAdjust;intY1=parseInt(hotspotcoordinates[1])*ImageSizeRatio*SizeCoefficient;intXs[intCount]=intX0;intYs[intCount]=intY0;jg.drawLine(intX0,intY0,intX1,intY1);jg.setColor('#666666');jg.paint();}}}
function InitMenuButton(){$('.ViewButton').bind("mouseover",function(){$(this).attr("src",$(this).attr("src").replace("_off","_on"));});$('.ViewButton').bind("mouseout",function(){$(this).attr("src",$(this).attr("src").replace("_on","_off"));});$('.ViewButton').each(function(){$(this).css("cursor","pointer");SetQTip(this,0,220);});$('.MenuButton').bind("mouseover",function(){SwapImage(this);});$('.MenuButton').bind("mouseout",function(){MM_swapImgRestore();});$('.MenuButtonBottom').bind("mouseover",function(){SwapImage(this);});$('.MenuButtonBottom').bind("mouseout",function(){MM_swapImgRestore();});$('.MenuButtonBottom').each(function(){$(this).css("cursor","pointer");SetQTip(this,4,170);});$('.PreviousNextButton').bind("mouseover",function(){SwapImage(this);});$('.PreviousNextButton').bind("mouseout",function(){MM_swapImgRestore();});$('#imgZoom').each(function(){$(this).css("cursor","pointer");SetQTip(this,0,300);});$('#imgPoweredBy').each(function(){$(this).css("cursor","pointer");SetQTip(this,5,240);});$('#imgPoweredBy').bind("click",function(){var property="resizable=1, width=1000, height=800";var strSiteURL=GetParameterFromHiddenVariable("hidSiteURL","https://www.activemerchandiser.com/");var winAM=window.open(strSiteURL,'ActiveMerchandiser',property);try{winAM.focus();}
catch(ex){}});$('.MenuButton').each(function(){$(this).css("cursor","pointer");SetQTip(this,0,170);});$('#imgPrevious').each(function(){$(this).css("cursor","pointer");SetQTip(this,3,125);});$('#imgNext').each(function(){$(this).css("cursor","pointer");SetQTip(this,2,125);});$('.Search').each(function(){$(this).css("cursor","pointer");});$('.ClearSearch').each(function(){$(this).css("cursor","pointer");SetQTip(this,0,170);});$('#txtSearch').each(function(){$(this).css("cursor","text");});$('#txtPageNo').each(function(){$(this).css("cursor","text");SetQTip(this,1,240);});$('#imgHelp').bind("mouseover",function(){SwapImage(this);});$('#imgHelp').bind("mouseout",function(){MM_swapImgRestore();});$('#imgHelp').each(function(){$(this).css("cursor","pointer");SetQTip(this,6,100);});}
function SwapImage(button){var strID=$(button).attr("ID");var strSource=$(button).attr("src").replace("_off","_on");MM_swapImage(strID,'',strSource,1);}
function SetQTip(menubutton,i,intwidth){if(bolIPad==false){var ContentText=$(menubutton).attr('rel');if(ContentText!=""){$(menubutton).attr('alt','');$(menubutton).qtip({content:{text:ContentText},position:{corner:{target:MyCorners[i],tooltip:MyOpposites[i]}},style:{width:intwidth,padding:5,background:'#ffffff',color:'black',textAlign:'left',border:{width:1,radius:1,color:'#bbbbbb'},tip:false,zIndex:12000,name:'light'}});}}}
function getIntParameterByNameFromURL(name,defaultvalue){var intvalue=defaultvalue;var strvalue=getParameterByNameFromURL(name,"");if(strvalue!=""){try{intvalue=parseInt(strvalue);}
catch(ex){}}
return intvalue;}
function getParameterByNameFromURL(name,defaultvalue){var strResult=getParameterByNameFromString(name,window.location.href);if(strResult=="NULL"){strResult=defaultvalue;}
return strResult;}
function getParameterByNameFromString(name,strURL){strURL=strURL.toLowerCase();name=name.toLowerCase().replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&]*)";var regex=new RegExp(regexS);var results=regex.exec(strURL);if(results==null){return"NULL";}
else{return results[1];}}
function GetParameterFromHiddenVariable(name){if($("#"+name)!=null){return $("#"+name).attr("value");}
else{return"";}}
function GetIntParameterFromHiddenVariable(name,defaultvalue){var intvalue=defaultvalue;var strvalue=GetParameterFromHiddenVariable(name);if(strvalue!=""){try{intvalue=parseInt(strvalue);}
catch(ex){}}
return intvalue;}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function mm_swapimgrestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function mm_preloadimages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=mm_preloadimages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function mm_swapimage(){var i,j=0,x,a=mm_swapimage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=mm_findobj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function mm_findobj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=mm_findobj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}