/** iPageOpen_2 - Fri 06/04/2010 16:24:04.45 */
var iIEModalAdder=20;var sPanel8="";jQuery.fn.cpToggle=function(speed,h,easing,callback){if(h==-1){h=this.height()+parseInt(this.css("paddingTop"))+parseInt(this.css("paddingBottom"));return this.animate({marginTop:parseInt(this.css("marginTop"))<0?0:-h},speed,easing,callback)}else{if(bShowOnLoad==false){this.css("marginTop",-270)}if(bHideADDALL==false){$("#CP_CL").toggle();$("#controlPanel").toggle()}return true}};jQuery.fn.cpToggle2=function(speed,h,easing,callback){h=this.height()+parseInt(this.css("paddingTop"))+parseInt(this.css("paddingBottom"));return this.animate({marginTop:parseInt(this.css("marginTop"))<0?0:-h},speed,easing,callback)};var myClose=function(hash){hash.w.fadeOut("3000",function(){hash.o.remove()})};var openInIframe=function(hash){var newWidth=0,newHeight=0,newLeft=0,newTop=0;var $trigger=$(hash.t);var $modal=$(hash.w);var myUrl=$trigger.attr("href");var $modalContent=$("iframe",$modal);$modalContent.html("").attr("src",myUrl);if(($.browser.msie)&&($.browser.version==7||$.browser.version==8)){$(".jqmOverlay").toggle()}myUrl=(myUrl.lastIndexOf("#")>-1)?myUrl.slice(0,myUrl.lastIndexOf("#")):myUrl;var queryString=(myUrl.indexOf("?")>-1)?myUrl.substr(myUrl.indexOf("?")+1):null;if(queryString!=null&&typeof queryString!="undefined"){var queryVarsArray=queryString.split("&");for(var i=0;i<queryVarsArray.length;i++){if(unescape(queryVarsArray[i].split("=")[0])=="width"){var newWidth=queryVarsArray[i].split("=")[1]}if(escape(unescape(queryVarsArray[i].split("=")[0]))=="height"){var newHeight=queryVarsArray[i].split("=")[1]}}if(newHeight!=0){if(newHeight.indexOf("%")>-1){newHeight=Math.floor(parseInt($(window).height())*(parseInt(newHeight)/100))}if($.browser.msie){newHeight=eval(newHeight)+iIEModalAdder}var newTop=Math.floor(parseInt($(window).height()-newHeight)/2)}else{newHeight=$modal.height()}if(newWidth!=0){if(newWidth.indexOf("%")>-1){newWidth=Math.floor(parseInt($(window).width()/100)*parseInt(newWidth))}if($.browser.msie){newWidth=eval(newWidth)+iIEModalAdder}var newLeft=Math.floor(parseInt($(window).width()/2)-parseInt(newWidth)/2)}else{newWidth=$modal.width()}if($.browser.msie){var pos=$modal.position();newTop=newTop+pos.top-(newHeight/2)+200}$modal.jqmShow().animate({width:newWidth,height:newHeight,top:newTop,left:newLeft,marginLeft:0},1)}else{$modal.jqmShow()}};var GLOBAL_Fail=function(sMsg,iTime,sSet){if(!sSet){sSet=""}$("#GError"+sSet).show().html(sMsg).addClass("GError");$("#GError"+sSet).animate({opacity:1},iTime).fadeOut("slow",function(){$(this).html("").removeClass("GError").show()})};var GLOBAL_Success=function(sMsg,iTime,sSet){if(!sSet){sSet=""}$("#GError"+sSet,"#GSuccess"+sSet).html("").hide();$("#GSuccess"+sSet).html(sMsg).addClass("GSuccess");window.setTimeout("$('#GSuccess"+sSet+"').fadeOut('slow', function() {$(this).html('').removeClass('GSuccess').show();});",iTime)};function wordCount(field,countfield,maxlimit){var theString=field.value;var char_count=theString.length;var fullStr=theString+" ";var initial_whitespace_rExp=/^[^A-Za-z0-9]+/gi;var left_trimmedStr=fullStr.replace(initial_whitespace_rExp,"");var non_alphanumerics_rExp=rExp=/[^A-Za-z0-9]+/gi;var cleanedStr=left_trimmedStr.replace(non_alphanumerics_rExp," ");var splitString=cleanedStr.split(" ");var word_count=splitString.length-1;if(fullStr.length<2){word_count=0}if(word_count>maxlimit){var stemp="";for(iX=0;iX<maxlimit;iX++){stemp=stemp+splitString[iX]+" "}field.value=theString.substring(0,stemp.length)}else{countfield.value=word_count}}$(document).ready(function(){if($.browser.msie){$("#bodyWrapper").css("height","100%");if(subNav==C_NAV_COLLECTIONGRAPH){$("#CGraphContent").css("width",eval($("#CGraphContent").css("width").replace("px",""))+iIEModalAdder);$("#CGraphContent").css("height",eval($("#CGraphContent").css("height").replace("px",""))+iIEModalAdder)}$("#wideContent").css("width",eval($("#wideContent").css("width").replace("px",""))+iIEModalAdder);$("#wideContent").css("height",eval($("#wideContent").css("height").replace("px",""))+iIEModalAdder);$("#printContent").css("width",eval($("#printContent").css("width").replace("px",""))+iIEModalAdder);$("#printContent").css("height",eval($("#printContent").css("height").replace("px",""))+iIEModalAdder);$("#medContent").css("width",eval($("#medContent").css("width").replace("px",""))+iIEModalAdder);$("#medContent").css("height",eval($("#medContent").css("height").replace("px",""))+iIEModalAdder)}else{$("#bodyWrapper").css("height","auto")}var $innerBody=$("#innerBody");var $controlPanel=$("#controlPanel").wrap('<div id="cp-outer" style="z-index: 2;"></div>');$("#CP_CL").click(function(){$controlPanel.cpToggle("slow",-1);$controlPanel2.cpToggle2("slow",-1);$controlPanel3.cpToggle2("slow",-1);$innerBody.animate({top:29},"slow")});$controlPanel.cpToggle(0,0);var $controlPanel2=$("#controlPanel2").wrap('<div id="cp-outer2" style="z-index: 3;"></div>');$("#CP2").click(function(){$controlPanel2.cpToggle2("slow",-1);$controlPanel3.cpToggle2("slow",-1);$controlPanel.cpToggle("slow",-1);$innerBody.animate({top:-15},"slow");document.formPanelSearch.sCPSearch.focus()});var $controlPanel3=$("#controlPanel3").wrap('<div id="cp-outer3" style="z-index: 1;"></div>');$("#CP3").click(function(){$controlPanel2.cpToggle2("slow",-1);$controlPanel3.cpToggle2("slow",-1);$controlPanel.cpToggle("slow",-1)});if(bShowOnLoad==true){$controlPanel2.cpToggle2("slow",-1);$controlPanel3.cpToggle2("slow",-1)}$("a.IP").cluetip({showTitle:false,cursor:"pointer",width:"440px",arrows:true,clickThrough:true});$("span.RATE").cluetip({showTitle:false,cursor:"pointer",width:"225px",arrows:false});$("#CP2img").mouseover(function(){$(this).attr({src:IMG_DIR+"images/addItemT2.gif"})}).mouseout(function(){$(this).attr({src:IMG_DIR+"images/addItemT.gif"})});if(subNav==C_NAV_COLLECTIONGRAPH){$("#CGraphModalW").jqm({modal:true,trigger:"a.CGraphModal",target:"#CGraphContent",onHide:myClose,onShow:openInIframe})}$("#wideModalW").jqm({modal:true,trigger:"a.wideModal",target:"#wideContent",onHide:myClose,onShow:openInIframe});$("#printModalW").jqm({modal:true,trigger:"a.printModal",target:"#printContent",onHide:myClose,onShow:openInIframe});$("#medModalW").jqm({modal:true,trigger:"a.medModal",target:"#medContent",onHide:myClose,onShow:openInIframe});$("#CPQMark").cluetip({activation:"click",showTitle:false,cursor:"pointer",width:"700px",arrows:true,closePosition:"top",sticky:true,cluezIndex:3000,closeText:'<img src="'+IMG_DIR+'images/blank.gif" />',onShow:function(ct,c){$(".QMarkClose").click(function(){$("#cluetip-close").click()})}});$("#quantityForm").numeric();$(".iSTypeW").click(function(){$("#titleSearchDiv").toggle("slow");if($("input[name=iWineGP]").attr("checked")){$("input[name=iWineGP]").attr("checked",false)}else{$("input[name=iWineGP]").attr("checked",true)}});$(".iSTypeW2").click(function(){$("#titleSearchDiv").toggle("slow")});$(".iSTypeQ").click(function(){makeRequest("/ap/update_inputstyle.php","sDispMethod=Q","AJAXPopulateForm");document.formPanelSearch.iSType[0].checked=true});$(".iSTypeD").click(function(){makeRequest("/ap/update_inputstyle.php","sDispMethod=D","AJAXPopulateForm");document.formPanelSearch.iSType[1].checked=true});jQuery.fn.sendAddItem=function(iProductUnq,sP8){var $sValue="";var sCPSearch="";var bP8=0;document.formPanelSearch.sCPSearch.value=translate(document.formPanelSearch.sCPSearch.value);if(sP8!=""){sCPSearch=sP8;bP8=1;document.formPanelSearch.sCPSearch.value=sPanel8}else{sCPSearch=document.formPanelSearch.sCPSearch.value}$.ajax({type:"POST",dataType:"xml",url:"/ap/CP/addfromupc.php",data:"bP8="+bP8+"&iProductUnq="+iProductUnq+"&sCPSearch="+encodeURIComponent(sCPSearch)+"&sDispMethod="+$("input[name=iSType]:checked").val()+"&iPanelGP="+document.formPanelSearch.iPanelGP.value+"&iWineGP="+$("input[name=iWineGP]:checked").val()+"&iquantityForm="+document.formPanelSearch.quantityForm.value,success:function(xml){$("response>sData>datanode",xml).each(function(){$sValue=$("value",this).text();$sValue2=$("value2",this).text();$sValue3=$("value3",this).text();$sValue4=$("value4",this).text();if($sValue2=="4"){}else{obj=document.getElementById("divPanelResults");try{obj.innerHTML=$sValue}catch(e){}if($sValue2=="1"){document.formPanelSearch.sCPSearch.value=""}if($sValue2=="2"){sPanel8=document.formPanelSearch.sCPSearch.value;document.formPanelSearch.sCPSearch.value="";if($sValue3!=""){var aTemp=$sValue3.split(",");$.each(aTemp,function(k,iAU){if(iAU!="0"){jQuery.noticeAdd({iAU:iAU})}})}}if($sValue2=="3"){document.formPanelSearch.sCPSearch.value=""}if($sValue2=="5"){document.formPanelSearch.sCPSearch.focus();document.formPanelSearch.sCPSearch.select()}}})},beforeSend:function(xml){$("#panelStat").attr({src:IMG_DIR+"images/statDK.gif"})},complete:function(xml){$("#panelStat").attr({src:IMG_DIR+"images/blank.gif"});$("#divPanelResults").css("backgroundImage",'url("'+IMG_DIR+'images/CPResults.png")');if(($sValue.length<10)&&($sValue!="")){if($.browser.msie){sTemp="height: 157px; width: 310px;"}else{sTemp="height: 154px; width: 300px;"}obj=document.getElementById("divPanelResults");try{obj.innerHTML="<br><br>&nbsp;&nbsp;<span class='whiteText'>"+$sValue3+"</span><span class='divPanelResults2' style='"+sTemp+"margin-top:-1px;'>"+$sValue4+"</span>"}catch(e){}$(".multiResult").bind("click",function(e){$iProductUnq=$(this).attr("iProductUnq");$(document).sendAddItem($iProductUnq,"")})}else{if($("input[name=iSType]:checked").val()=="D"){$("#panelYourPrice").maskMoney();$("#panelQuantity").numeric();$("#panelDetailSave").click(function(){if($("input[name=bHide]:checked").length==1){$bHide="1"}else{$bHide="0"}var $sData="iProductUnq="+$("#panelProductUnq").val()+"&iRate="+$("#panelRate").val()+"&bHide="+$bHide+"&sYourPrice="+$("#panelYourPrice").val()+"&iQuantity="+$("#panelQuantity").val()+"&sPersonalID="+encodeURIComponent($("#panelPersonalID").val())+"&iGStoreUnq="+$("#panelGStoreUnq option:selected").val()+"&sNote="+encodeURIComponent($("#panelNote").val())+"&iVintage="+encodeURIComponent($("#panelVintage").val())+"&sUserStore="+encodeURIComponent($("#panelUserStore").val())+"&iBookStatus="+$("#panelBookStatus option:selected").val()+"&iOwnershipStatus="+$("#panelOwnershipStatus option:selected").val()+"&iMusicStatus="+$("#panelMusicStatus option:selected").val()+"&iMovieStatus="+$("#panelMovieStatus option:selected").val()+"&iWineStatus="+$("#panelWineStatus option:selected").val()+"&iSoftwareStatus="+$("#panelSoftwareStatus option:selected").val();$.ajax({type:"POST",dataType:"xml",url:"/ap/CP/savedetail.php",data:$sData,success:function(xml){$("response>sData>datanode",xml).each(function(){obj=document.getElementById("divPanelResults");try{obj.innerHTML=$("value",this).text();$sValue2=$("value2",this).text();if($sValue2!=""){var aTemp=$sValue2.split(",");$.each(aTemp,function(k,iAU){if(iAU!="0"){jQuery.noticeAdd({iAU:iAU})}})}}catch(e){}document.formPanelSearch.sCPSearch.focus()})},beforeSend:function(xml){$("#panelDetailStat").attr({src:IMG_DIR+"images/statDK.gif"})},complete:function(xml){$("#panelDetailStat").attr({src:IMG_DIR+"images/blank.gif"})}})})}}}})};$("input#addItem").keydown(function(e){if(e.keyCode==13){$(this).sendAddItem(0,"");return false}});$("#divPanelSearch").click(function(){$(this).sendAddItem(0,"")});$("#panel8").live("click",function(){$(this).sendAddItem(0,sPanel8)})});jQuery.fn.oI=function(iP,sMod,iA){$("#ipb"+sMod+iP).attr({rel:"/ap/itempopup.php?iProductUnq="+iP+"&iVAU="+iA});$("#ipb"+sMod+iP).bgiframe().cluetip({activation:"focus",showTitle:false,width:"440px",dropShadow:false,leftOffset:"100px"});if($.browser.msie){var ipb=document.getElementById("ipb"+sMod+iP);ipb.focus()}else{$("#ipb"+sMod+iP).focus()}};jQuery.fn.oImo=function(iP,sMod){$("#ipb"+sMod+iP).blur()};