// (c)2010 Personalised Plates Queensland

﻿
var Q='"';var sQ='\'';var selectedCategoryId=-1;var selectedBackgroundId=-1;var selectedForegroundId=-1;var selectedPlateSize1Id=-1;var selectedPlateSize2Id=-1;var selectedFrontPlateSizeName="";var selectedRearPlateSizeName="";var selectedCategoryName="";var selectedFormat="";var selectedBackgroundSizeHint=-1;var selectedCategorySuitsFormat="";var selectedCategoryTooltip="";var selectedPrice="0.00";var IsUpgrade=false;var IsRemake=false;var IsMonochrome=false;var IsFlexi=false;var TabsNeedRefresh=false;var MonochromeSessionId="new";var UpgradePrice=-1;var AccessoryRequired=false;var selectedSeparatorInDesign=false;var currentCombination="";var DefaultBackgroundId=1;var DefaultForegroundId=3;var DefaultCategoryId=27;var DefaultPlateSizeId=1;var FlipToSize=false;var DontOverwritebackground=false;var tickYes,tickNo;var ShownPlateSize;var CombinationLocked=false;var DesignLocked=false;$("#CAPcontent").ready(function(){InitialPageLoad();});function InitialPageLoad()
{setTimeout("DelayedPageLoad();",StartupDelay);}
function DelayedPageLoad()
{ShowBusy();LoadAllDesigns();tickYes=document.getElementById('separatorYes');tickNo=document.getElementById('separatorNo');tickYes.checked=selectedSeparatorInDesign;tickNo.checked=!selectedSeparatorInDesign;tickYes.onclick=function(){ChooseSeparatorOnOff();};tickNo.onclick=function(){ChooseSeparatorOnOff();};jQuery("#txtCombination").keypress(function(e){if(e.which==13){CheckCombination();return false;}
var v=document.getElementById('txtCombination').value;if(v.length>8)
return false;var l=v.replace(/ /g,"").length;var selectedTxt=(typeof(document.selection)!='undefined'&&document.selection.type.toLowerCase()=="text"||typeof(this.selectionStart)!="undefined"&&typeof(this.selectionEnd)!="undefined"&&this.selectionEnd>this.selectionStart)?true:false;if(l>=6&&!selectedTxt&&!(e.which==0||e.which==8||e.which==127||e.which==32))
return false;if(v.length==0&&e.which==32)
return false;if(e.which==0||e.which==8||e.which==127||e.which==32||(65<=e.which&&e.which<=65+25)||(97<=e.which&&e.which<=97+25)||(48<=e.which&&e.which<=48+9))
return true;else
return false;});if(UpgradeCombination!="")
CheckForUpgrade();else{HidePanel('#panelPresenting');ShowPanel('#CAPcontent');if(StartupCombination==""&&StartupDesign==""){SwitchToDesignPanel();pageTracker._trackPageview('/CreateAPlateDesign.aspx');}
if(StartupCombination!=""){SwitchToCombinationEntryPanel();SetCombo(StartupCombination);StartupCombination="";CheckCombination();}
if(StartupDesign=="monochrome")
GetMonoComboAndConfigForms();else
if(StartupDesign!=""){DontOverwritebackground=true;selectedTab='design';ShowTabsBar();panelMode_PlateDesign();HandleStartup(StartupDesign);}
ClearBusy();}}
function SwitchToCombinationEntryPanel()
{selectedTab='combo';ShowTabsBar();SetResultMessage('&nbsp;','messageUnavailable');if(selectedCategoryTooltip!=null&&selectedCategoryTooltip!=""&&selectedCategoryId!=-1){SetResultMessage(selectedCategoryTooltip,'messageComboFormat');}
panelMode_CheckCombination();}
function SwitchToDesignPanel()
{selectedTab='design';ShowTabsBar();panelMode_PlateDesign();if(selectedCategoryId==-1||TabsNeedRefresh){document.getElementById("divPlateTabSelect").innerHTML="";document.getElementById("divPlateDesignSelect").innerHTML="<div class='PlateTypeInstructions'>Please wait...</div>";jQuery.getJSON(baseWSurl()+"?o=tabs&c="+currentCombination,DisplayTabs);TempselectedBackgroundId=null;TempselectedForegroundId=null;TempselectedCategoryId=null;DrawCurrentDesign();}}
function SwitchToSizePanel(preselectVehicle)
{selectedTab='size';ShowTabsBar();panelMode_PlateSize();if(selectedPlateSize1Id==-1)
ClearSizeGrid();if(preselectVehicle=="MV")
SelectVehicleSize('MV','vehicleCar');else if(preselectVehicle=="LT")
SelectVehicleSize('LT','vehicleTrailer');}
function SwitchToPreviousDesignsPanel()
{selectedTab='previous';ShowTabsBar();panelMode_PreviousDesigns();DrawRecentDesigns();DontOverwritebackground=false;}
﻿
var cdBackgroundId;var cdForegroundId;var cdCategoryId;var cdSizeId;var cdCombination;var ClearDesignIfSelected;var ForcedSearch;function CheckCombination()
{var Combination=GetCombo();var ComboNoSpaceFormat=ComboFormat(Combination.replace(" ",""));ForcedSearch=false;if(Combination.indexOf("-")>0){ForcedSearch=true;SetCombo(Combination.replace("-","0").replace("-","0").replace("-","0"));}
if(ComboNoSpaceFormat=="3x2"||ComboNoSpaceFormat=="2x3"||ComboNoSpaceFormat=="3x3"||ComboNoSpaceFormat=="QLLNNZ"){Combination=Combination.replace(/ /g,"");SetCombo(Combination.replace("-","0"));}
cdCombination=Combination;SetResultMessage('&nbsp;','messageUnavailable');if(ForcedSearch==true)
SetCombo("");ShowBusy();if(CombinationIsValid(Combination))
jQuery.getJSON(baseWSurl()+"?o=availability&c="+Combination,DisplayAvailability);return false;}
function DisplayAvailability(jsonAvailability,status)
{if(status=='success')
{var Result=eval(jsonAvailability);if(Result.IsOutage==true){SetResultMessage(msgOutageShort,'messageUnavailable');}
else{IsUpgrade=false;IsRemake=false;cdBackgroundId=Result.BackgroundId;cdForegroundId=Result.ForegroundId;cdCategoryId=Result.CategoryId;cdSizeId=Result.SizeId;var btn=document.getElementById('btnCheckAvailability');if(Result.Available==true&&!ForcedSearch)
{SetResultMessage(msgCombinationIsAvailablePrefix+Result.Combination+msgCombinationIsAvailablePostfix,'messageAvailable');if(selectedFormat!=""&&(selectedFormat==ComboFormat(Result.Combination)||(selectedFormat=="3x2"&&ComboFormat(Result.Combination)=="3x3"&&(selectedCategoryId==32||selectedCategoryId==31))))
{var sid=selectedPlateSize1Id;if(sid==-1&&selectedBackgroundSizeHint!=-1)
sid=selectedBackgroundSizeHint;if(sid==-1)
sid=Result.SizeId;if(selectedFormat=="3x2"&&ComboFormat(Result.Combination)=="3x3"&&(selectedCategoryId==32||selectedCategoryId==31))
{if(selectedBackgroundId==133||selectedBackgroundId==137){selectedBackgroundId=137;selectedForegroundId=3;selectedCategoryId=32;sid=29;}
if(selectedBackgroundId==135||selectedBackgroundId==139){selectedBackgroundId=139;selectedForegroundId=3;selectedCategoryId=32;sid=29;}
if(selectedBackgroundId==120||selectedBackgroundId==119){selectedBackgroundId=119;selectedForegroundId=4;selectedCategoryId=32;sid=29;}}
DrawDesignToProceed(Result.Combination,selectedBackgroundId,selectedForegroundId,selectedCategoryId,sid,false);}
else{var Specialmatching=false;var Cat=Result.CategoryId;if(selectedCategoryId==27&&selectedCategorySuitsFormat=="3x2"&&ComboFormat(Result.Combination)=="3x3"){Cat=22;Specialmatching=true;}
else
if(selectedCategoryId==22&&selectedCategorySuitsFormat=="3x3"&&ComboFormat(Result.Combination)=="3x2"){Cat=27;Specialmatching=true;}
else
if(selectedCategoryId==13&&(selectedBackgroundId==25||selectedBackgroundId==105||selectedBackgroundId==103||selectedBackgroundId==104||selectedBackgroundId==116||selectedBackgroundId==115)||selectedCategoryId==18&&(selectedBackgroundId==25||selectedBackgroundId==52||selectedBackgroundId==78||selectedBackgroundId==76||selectedBackgroundId==77)||selectedCategoryId==17&&(selectedBackgroundId==114||selectedBackgroundId==105||selectedBackgroundId==117||selectedBackgroundId==100||selectedBackgroundId==37||selectedBackgroundId==59)){if(ComboFormat(Result.Combination)=="3x2"||ComboFormat(Result.Combination)=="3x3"){Cat=selectedCategoryId;Specialmatching=true;}}
if(Specialmatching==true)
DrawDesignToProceed(Result.Combination,selectedBackgroundId,selectedForegroundId,Cat,Result.SizeId,true);else{if(ComboFormat(Result.Combination)=="3x2"||ComboFormat(Result.Combination)=="2x3"){Result.BackgroundId=1;Result.ForegroundId=3;Result.CategoryId=27;Result.SizeId=6;}
if(ComboFormat(Result.Combination)=="3x3"){Result.BackgroundId=1;Result.ForegroundId=3;Result.CategoryId=22;Result.SizeId=6;}
DrawDesignToProceed(Result.Combination,Result.BackgroundId,Result.ForegroundId,Result.CategoryId,Result.SizeId,true);}}
btn.src=ControlPath()+"images/buttons/btn-check-availability-success.gif";}
else
{if(selectedFormat!=""&&(selectedFormat==ComboFormat(Result.Combination)||(selectedFormat=="3x2"&&ComboFormat(Result.Combination)=="3x3"&&(selectedCategoryId==32||selectedCategoryId==31))))
{var sid=selectedPlateSize1Id;if(sid==-1&&selectedBackgroundSizeHint!=-1)
sid=selectedBackgroundSizeHint;if(sid==-1)
sid=Result.SizeId;if(selectedFormat=="3x2"&&ComboFormat(Result.Combination)=="3x3"&&(selectedCategoryId==32||selectedCategoryId==31))
{if(selectedBackgroundId==133||selectedBackgroundId==137){selectedBackgroundId=137;selectedForegroundId=3;selectedCategoryId=32;sid=29;}
if(selectedBackgroundId==135||selectedBackgroundId==139){selectedBackgroundId=139;selectedForegroundId=3;selectedCategoryId=32;sid=29;}
if(selectedBackgroundId==120||selectedBackgroundId==119){selectedBackgroundId=119;selectedForegroundId=4;selectedCategoryId=32;sid=29;}}
cdBackgroundId=selectedBackgroundId;cdForegroundId=selectedForegroundId;cdCategoryId=selectedCategoryId;cdSizeId=sid;}
else{var Specialmatching=false;var Cat=Result.CategoryId;if(selectedCategoryId==27&&selectedCategorySuitsFormat=="3x2"&&ComboFormat(CheckedCombinationToProceedWith)=="3x3"){Cat=22;Specialmatching=true;}
else
if(selectedCategoryId==22&&selectedCategorySuitsFormat=="3x3"&&ComboFormat(CheckedCombinationToProceedWith)=="3x2"){Cat=27;Specialmatching=true;}
else
if(selectedCategoryId==13&&(selectedBackgroundId==25||selectedBackgroundId==105||selectedBackgroundId==103||selectedBackgroundId==104||selectedBackgroundId==116||selectedBackgroundId==115)||selectedCategoryId==18&&(selectedBackgroundId==25||selectedBackgroundId==52||selectedBackgroundId==78||selectedBackgroundId==76||selectedBackgroundId==77)||selectedCategoryId==17&&(selectedBackgroundId==114||selectedBackgroundId==105||selectedBackgroundId==117||selectedBackgroundId==100||selectedBackgroundId==37||selectedBackgroundId==59)){if(ComboFormat(CheckedCombinationToProceedWith)=="3x2"||ComboFormat(CheckedCombinationToProceedWith)=="3x3"){Cat=selectedCategoryId;Specialmatching=true;}}
if(Specialmatching==true){cdBackgroundId=selectedBackgroundId;cdForegroundId=selectedForegroundId;cdCategoryId=Cat;cdSizeId=Result.SizeId;}
else{DrawDesignToProceed(Result.Combination,Result.BackgroundId,Result.ForegroundId,Result.CategoryId,Result.SizeId,true);cdBackgroundId=Result.BackgroundId;cdForegroundId=Result.ForegroundId;cdCategoryId=Result.CategoryId;cdSizeId=Result.SizeId;}}
if(Result.Reason!=""&&Result.Reason!=null){SetResultMessage(Result.Reason,'messageUnavailable');DrawAlternatives(Result);btn.src=ControlPath()+"images/buttons/btn-check-availability.gif";}
else{if(!ForcedSearch)
SetResultMessage(msgCombinationNotAvailablePrefix+Result.Combination+msgCombinationNotAvailablePostfix,'messageUnavailable');cdCombination=cdCombination.replace("-","0").replace("-","0").replace("-","0");DrawAlternatives(Result);btn.src=ControlPath()+"images/buttons/btn-check-availability.gif";}}}}
else
{ShowServerError();}
ClearBusy();}
function DrawAlternatives(Result)
{HidePanel('#panelPreCombinationChecked');HidePanel('#panelApproveCombination');ShowPanel('#panelAlternativeCombinations');var divHTML,NumEntries;var ReverseAlternatives=false;var SuggestedComboLength=0;if(Result.ReverseSuggestions.length>0)
ReverseAlternatives=true;NumEntries=Result.Suggestions.length;divHTML="<div class='innerContent'>";divHTML+="<div class='contentLabel' style='color:black;'>"+msgPreferSuggestionBelow+"</div>";if(((ComboFormat(cdCombination)=="3x3")||Result.ReleasedAs3x3)&&ComboFormat(cdCombination)!="QLLNNZ"&&!Result.Hide3x3RangeSelector){divHTML+="<div class='contentLabel'>"+msgMoreAlternatives;var i;divHTML+="<span class='MoreAlternatives' style='float: right; top: 0px; right: 10px; position: relative; color: black;'>";for(i=0;i<10;i++){divHTML+="<a href='#' onclick='ChooseMoreAlternatives("+i+");'>";divHTML+=i;divHTML+="</a>";}
divHTML+="</span>";divHTML+="</div>";}
if(ReverseAlternatives)
divHTML+="<div class='contentLabel'>"+Result.CategoryName+"</div>";divHTML+="<ul class='suggestionList'>";for(i=0;i<NumEntries;i++){if(Result.Suggestions[i].AvailabilityUnknown==true)
divHTML+="<li><a href='#' onclick='CheckAlternativeCombination(\""+Result.Suggestions[i].Combination+"\");'>"+Result.Suggestions[i].Combination+"</a></li>";else if(Result.Suggestions[i].Available==true)
divHTML+="<li><a href='#' onclick='SelectAlternativeCombination(\""+Result.Suggestions[i].Combination+"\");'>"+Result.Suggestions[i].Combination+"</a></li>";else
divHTML+="<li>"+Result.Suggestions[i].Combination+"</li>";if(Result.Suggestions[i].Combination.length>SuggestedComboLength)
SuggestedComboLength=Result.Suggestions[i].Combination.length;}
divHTML+="</ul>";if(ReverseAlternatives){divHTML+="<div class='contentLabel'>"+Result.ReverseCategoryName+"</div>";divHTML+="<ul class='suggestionList'>";NumEntries=Result.ReverseSuggestions.length;for(i=0;i<NumEntries;i++)
if(Result.ReverseSuggestions[i].AvailabilityUnknown==true)
divHTML+="<li><a href='#' onclick='CheckAlternativeCombination(\""+Result.ReverseSuggestions[i].Combination+"\");'>"+Result.ReverseSuggestions[i].Combination+"</a></li>";else if(Result.ReverseSuggestions[i].Available==true)
divHTML+="<li><a href='#' onclick='SelectAlternativeCombination(\""+Result.ReverseSuggestions[i].Combination+"\");'>"+Result.ReverseSuggestions[i].Combination+"</a></li>";else
divHTML+="<li>"+Result.ReverseSuggestions[i].Combination+"</li>";divHTML+="</ul>";}
divHTML+="</div>";document.getElementById('panelAlternativeCombinations').innerHTML=divHTML;}
function ChooseMoreAlternatives(range)
{var TempCombo=cdCombination;if(IsNumbersFirstDesign(TempCombo))
TempCombo=range+"00"+Series(TempCombo);else
TempCombo=Series(TempCombo)+range+"00";ShowBusy();jQuery.getJSON(baseWSurl()+"?o=availability&c="+TempCombo+"&extraalts=1",DrawMoreAlternatives);return false;}
function DrawMoreAlternatives(Result)
{var divHTML,NumEntries;var i;NumEntries=Result.Suggestions.length;divHTML="<div class='innerContent'>";divHTML+="<div class='contentLabel' style='color:black;'>"+msgPreferSuggestionBelow+"</div>";divHTML+="<div class='contentLabel'>"+msgMoreAlternatives;divHTML+="<span class='MoreAlternatives' style='float: right; top: 0px; right: 10px; position: relative; color: black;'>";for(i=0;i<10;i++){divHTML+="<a href='#' onclick='ChooseMoreAlternatives("+i+");'>";divHTML+=i;divHTML+="</a>";}
divHTML+="</span>";divHTML+="</div>";divHTML+="<ul class='suggestionList'>";for(i=0;i<NumEntries;i++)
if(Result.Suggestions[i].Available==true)
divHTML+="<li><a href='#' onclick='SelectAlternativeCombination(\""+Result.Suggestions[i].Combination+"\");'>"+Result.Suggestions[i].Combination+"</a></li>";else
divHTML+="<li>"+Result.Suggestions[i].Combination+"</li>";divHTML+="</ul>";divHTML+="</div>";document.getElementById('panelAlternativeCombinations').innerHTML=divHTML;ClearBusy();}
function IsNumbersFirstDesign(Combination)
{return IsNumeric(Combination,1);}
function Series(Combination)
{var returnCombo="",i;for(i=1;i<=Combination.length;i++)
if(IsLetter(Combination,i))
returnCombo+=Combination.charAt(i-1);return returnCombo;}
function CheckAlternativeCombination(combo)
{SetCombo(combo);CheckCombination();}
function SelectAlternativeCombination(combo)
{document.getElementById('btnCheckAvailability').src=ControlPath()+"images/buttons/btn-check-availability-success.gif";SetCombo(combo);if(combo.length==6&&(cdCategoryId==27||cdCategoryId==25))
cdCategoryId=22;SetResultMessage(msgCombinationIsAvailablePrefix+combo+msgCombinationIsAvailablePostfix,'messageAvailable');DrawDesignToProceed(combo,cdBackgroundId,cdForegroundId,cdCategoryId,cdSizeId);}
var CheckedCombinationToProceedWith;function DrawDesignToProceed(combo,NewBackgroundId,NewForegroundId,NewCategoryId,NewSizeId,ClearDesignIfAccepted)
{HidePanel('#panelPreCombinationChecked');HidePanel('#panelAlternativeCombinations');ShowPanel('#panelApproveCombination');var PlateImage=document.getElementById('imgCheckedPlateImage');var Continue=document.getElementById('imgCheckedPlateContinue');var CategoryId,BackgroundId,ForegroundId,SizeId;if(ComboFormat(combo)!=ComboFormat(CheckedCombinationToProceedWith)){CategoryId=NewCategoryId;BackgroundId=NewBackgroundId;ForegroundId=NewForegroundId;SizeId=NewSizeId;}
else{if(selectedCategoryId!=-1&&ComboFormat(combo)!="QLLNNZ"&&ComboFormat(combo)!="5"&&ComboFormat(combo)!="3"&&ComboFormat(combo)!="1"){CategoryId=selectedCategoryId;BackgroundId=selectedBackgroundId;ForegroundId=selectedForegroundId;SizeId=selectedPlateSize1Id;if(SizeId==-1)
SizeId=NewSizeId;}
else{CategoryId=NewCategoryId;BackgroundId=NewBackgroundId;ForegroundId=NewForegroundId;SizeId=NewSizeId;}}
PlateImage.src=plateImageURL(combo,BackgroundId,ForegroundId,CategoryId,SizeId);PlateImage.onclick=function(){CheckedCombinationAcceptDesign(BackgroundId,ForegroundId,CategoryId,SizeId,ClearDesignIfAccepted);};Continue.onclick=function(){CheckedCombinationAcceptDesign(BackgroundId,ForegroundId,CategoryId,SizeId,ClearDesignIfAccepted);};CheckedCombinationToProceedWith=combo;}
function CheckedCombinationAcceptDesign(BackgroundId,ForegroundId,CategoryId,SizeId,ClearDesignIfAccepted)
{var Specialmatching=false;if(selectedCategoryId!=-1){if((selectedCategoryId==31||selectedCategoryId==32)&&selectedCategorySuitsFormat=="3x2"&&ComboFormat(CheckedCombinationToProceedWith)=="3x3"){selectedCategoryId=32;CategoryId=32;selectedCategoryName="Black on Euro Navy 3x3";Specialmatching=true;}
else
if((selectedCategoryId==33||selectedCategoryId==34)&&selectedCategorySuitsFormat=="3x2"&&ComboFormat(CheckedCombinationToProceedWith)=="3x3"){selectedCategoryId=32;CategoryId=32;if(selectedBackgroundId==137)
selectedCategoryName="White on Euro Silver 3x3";else
selectedCategoryName="White on Euro Gold 3x3";Specialmatching=true;}
else
if(selectedCategoryId==27&&selectedCategorySuitsFormat=="3x2"&&ComboFormat(CheckedCombinationToProceedWith)=="3x3"){selectedCategoryId=22;CategoryId=22;Specialmatching=true;}
else
if(selectedCategoryId==22&&selectedCategorySuitsFormat=="3x3"&&ComboFormat(CheckedCombinationToProceedWith)=="3x2"){selectedCategoryId=27;CategoryId=27;Specialmatching=true;}
else
if(selectedCategoryId==13&&(selectedBackgroundId==25||selectedBackgroundId==105||selectedBackgroundId==103||selectedBackgroundId==104||selectedBackgroundId==116||selectedBackgroundId==115)||selectedCategoryId==18&&(selectedBackgroundId==25||selectedBackgroundId==52||selectedBackgroundId==78||selectedBackgroundId==76||selectedBackgroundId==77)||selectedCategoryId==17&&(selectedBackgroundId==114||selectedBackgroundId==105||selectedBackgroundId==117||selectedBackgroundId==100||selectedBackgroundId==37||selectedBackgroundId==59)){if(ComboFormat(CheckedCombinationToProceedWith)=="3x2"||ComboFormat(CheckedCombinationToProceedWith)=="3x3")
Specialmatching=true;}}
if(Specialmatching==true){currentCombination=CheckedCombinationToProceedWith;TabsNeedRefresh=true;UpdateWhatsHot(currentCombination);if(selectedCategoryId!=-1)
AddToRecentDesigns(currentCombination,CategoryId,BackgroundId,ForegroundId,SizeId,SizeId,selectedSeparatorInDesign,selectedCategoryName,selectedPrice,null,null,null,selectedCategorySuitsFormat,selectedCategoryTooltip);ProceedToNextPage();}
else{if(selectedCategoryId!=-1&&!ComboFormatCompatible(selectedCategorySuitsFormat,CheckedCombinationToProceedWith)){var Answer=confirm(msgConfirmOverwriteDesign);if(Answer==1){selectedCategoryId=-1;selectedBackgroundId=-1;selectedForegroundId=-1;selectedPlateSize1Id=-1;selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;selectedFrontPlateSizeName="";selectedRearPlateSizeName="";selectedCategoryName="";selectedPrice="0.00";ClearDesignIfSelected=false;ClearDesignIfAccepted=false;currentCombination=CheckedCombinationToProceedWith;DontOverwritebackground=false;TabsNeedRefresh=true;UpdateWhatsHot(currentCombination);SelectTab('design');SwitchToDesignPanel();}
else{SetCombo("");CheckedCombinationToProceedWith="";SwitchToCombinationEntryPanel();}}
else{currentCombination=CheckedCombinationToProceedWith;TabsNeedRefresh=true;UpdateWhatsHot(currentCombination);ProceedToNextPage();if(selectedCategoryId!=-1)
AddToRecentDesigns(currentCombination,CategoryId,BackgroundId,ForegroundId,SizeId,SizeId,selectedSeparatorInDesign,selectedCategoryName,selectedPrice,null,null,null,selectedCategorySuitsFormat,selectedCategoryTooltip);else{var cccf=ComboFormat(currentCombination);DontOverwritebackground=true;TabsNeedRefresh=false;if(cccf=="3x2")
HandleStartup("whiteblack");if(cccf=="3x3")
HandleStartup("whiteblack3x3");if(cccf=="QLLNNZ")
HandleStartup("classiceuro");if(cccf=="1"||cccf=="2"||cccf=="3"||cccf=="4"||cccf=="5"||cccf=="6"||cccf=="7")
HandleStartup("whiteblackprestige");}}}}
function CombinationIsValid(Combination)
{var Result=checkCombo(Combination.replace(' ',''));if(Result=="")
return true;SetResultMessage(Result,'messageUnavailable');return false;}
function SetResultMessage(v,cls)
{var e=document.getElementById('lblCombinationSearchResultMessage');if(e!=null){e.innerHTML=v;e.className=cls;}}
function SetCombo(v){document.getElementById('txtCombination').value=v;}
function GetCombo(){return document.getElementById('txtCombination').value.toUpperCase();}
function UpdateWhatsHot(Combo)
{try
{WhatHotUpdateCombination(Combo);}
catch(e){}}
function UpdateWhatsHotFormat(Format)
{try
{WhatHotUpdateComboFormat(Format);}
catch(e){}}
function tryLLNNAsEuro()
{var c=GetCombo();if(c.length==4){SetCombo("Q"+c+"Z");CheckCombination();}}﻿
var frontImageLoaded=false;var rearImageLoaded=false;var AccessoryImageLoaded=false;var reProportionImages=null;var imgFrontCSSWidth=170;var largestImgs=new Array();var largestImgSize=0;function reSizeAndProportionImages(parentObj,imgSize){var allImagesLoaded=false;if(parentObj){var allObjImgs=parentObj.getElementsByTagName("img");if(allObjImgs.length>0){var numImgsLoaded=0;for(var i=0;i<allObjImgs.length;i++){if(allObjImgs[i].loaded&&typeof(allObjImgs[i].imgCounted)=="undefined"){if(allObjImgs[i].origWidth>largestImgSize)largestImgSize=allObjImgs[i].origWidth;allObjImgs[i].imgCounted=true;}
if(allObjImgs[i].loaded)numImgsLoaded++;}
if(numImgsLoaded==allObjImgs.length){clearInterval(reProportionImages);reProportionImages=null;if(!imgSize)
imgSize=imgFrontCSSWidth;var resizeProportion=imgSize/largestImgSize;for(var i=0;i<allObjImgs.length;i++){if(allObjImgs[i].origWidth<largestImgSize){allObjImgs[i].style.width=Math.round(allObjImgs[i].origWidth*resizeProportion)+"px";}
else
allObjImgs[i].style.width=imgSize+"px";allObjImgs[i].style.visibility="visible";}
largestImgSize=0;}}}else if(!parentObj&&frontImageLoaded&&rearImageLoaded&&AccessoryImageLoaded){clearInterval(reProportionImages);reProportionImages=null;var imgFront=document.getElementById('confirmFrontPlate');var imgRear=document.getElementById('confirmRearPlate');var imgAccessory=document.getElementById('imgAccessoryPlate');var ReduxRatio=1;var AccessoryWidth=0;if(imgRear.origWidth<imgFront.origWidth){ReduxRatio=imgFrontCSSWidth/imgFront.origWidth;jQuery("#"+imgRear.id).css("width",Math.round(imgRear.origWidth*ReduxRatio));jQuery("#"+imgFront.id).css("width",imgFrontCSSWidth);AccessoryWidth=Math.round(imgAccessory.origWidth*ReduxRatio);}else if(imgRear.origWidth>imgFront.origWidth){ReduxRatio=imgFrontCSSWidth/imgRear.origWidth;jQuery("#"+imgRear.id).css("width",imgFrontCSSWidth);jQuery("#"+imgFront.id).css("width",Math.round(imgFront.origWidth*ReduxRatio));AccessoryWidth=Math.round(imgAccessory.origWidth*ReduxRatio);}else{jQuery("#"+imgRear.id).css("width",imgFrontCSSWidth);jQuery("#"+imgFront.id).css("width",imgFrontCSSWidth);ReduxRatio=imgFrontCSSWidth/imgRear.origWidth;AccessoryWidth=Math.round(imgAccessory.origWidth*ReduxRatio);}
if(AccessoryWidth<105)
AccessoryWidth=105;jQuery("#"+imgAccessory.id).css("width",AccessoryWidth);jQuery("#"+imgFront.id).css("visibility","visible");jQuery("#"+imgRear.id).css("visibility","visible");jQuery("#"+imgAccessory.id).css("visibility","visible");}}
function ConfirmDesign()
{DrawCurrentDesignForConfirmation();if(IsRemake||IsUpgrade||IsMonochrome){HidePanel('#postCheckoutButtonLabel');HidePanel('#postCheckoutButtonImage');}
else{ShowPanel('#postCheckoutButtonLabel');ShowPanel('#postCheckoutButtonImage');}
if(IsMonochrome){HidePanel('#confirmRedoCombination');HidePanel('#confirmRedoDesign');HidePanel('#confirmRedoStartAgain');ShowPanel('#confirmMonoRedo');}
else{HidePanel('#confirmMonoRedo');ShowPanel('#confirmRedoCombination');ShowPanel('#confirmRedoDesign');ShowPanel('#confirmRedoStartAgain');}
if(IsRemake)
HidePanel('#ChangeOptions');if(IsUpgrade)
{ShowBusy();HidePanel('#CheckoutButton');HidePanel('#confirmRedoCombination');var URL=baseWSurl()+"?o=upgradeprice";URL+="&c="+currentCombination;URL+="&category="+selectedCategoryId;URL+="&bi="+selectedBackgroundId;URL+="&fi="+selectedForegroundId;URL+="&s1="+selectedPlateSize1Id;URL+="&s2="+selectedPlateSize2Id;URL+="&ar=0";if(IsRemake)
URL+="&remake=1";jQuery.getJSON(URL,DisplayUpgradePrice);}}
function DisplayUpgradePrice(jsonPrice,status)
{if(status=='success')
{var Result=eval(jsonPrice);UpgradePrice=-2;if(Result.Success==true)
UpgradePrice=Result.TotalFee;ShowPanel('#CheckoutButton');progressPanelUpdate();}
else
{ShowServerError();}
ClearBusy();}
function DrawCurrentDesignForConfirmation()
{var Combination=currentCombination;var imgLarge=document.getElementById('confirmLargeImage');var imgFront=document.getElementById('confirmFrontPlate');var imgRear=document.getElementById('confirmRearPlate');var imgAccessory=document.getElementById('imgAccessoryPlate');frontImageLoaded=false;rearImageLoaded=false;CheckFinalDesign();var BaseShareURL="http://ctp.www.ppq.com.au/desktopmodules/fbshare/share.aspx";var ShareURL=BaseShareURL+"?combo="+currentCombination+"&back="+selectedBackgroundId+"&fore="+selectedForegroundId+"&cat="+selectedCategoryId+"&size="+selectedPlateSize1Id;jQuery('#fb_share').attr('href','http://www.facebook.com/sharer.php?u='+escape(ShareURL)+'&t=My PPQ Plate Design');jQuery('#fb_share').hide();imgLarge.src=imageGenURL(currentCombination,selectedBackgroundId,selectedForegroundId,selectedCategoryId,selectedPlateSize1Id);imgLarge.alt=currentCombination;imgLarge.title=currentCombination;jQuery("#"+imgFront.id).css("visibility","hidden");jQuery("#"+imgFront.id).css("width","");imgAccessory.src=imageGenAccessoryURL(currentCombination)
imgAccessory.alt=currentCombination;jQuery("#"+imgAccessory.id).css("visibility","hidden");jQuery("#"+imgAccessory.id).css("width","");jQuery("#"+imgAccessory.id).load(function(){imgAccessory.origWidth=jQuery("#"+imgAccessory.id).width();AccessoryImageLoaded=true;});imgFront.src=imageGenURL(currentCombination,selectedBackgroundId,selectedForegroundId,selectedCategoryId,selectedPlateSize1Id)+"&uniqueVar="+(Math.round(Math.random()*150)+Math.random())+"&";imgFront.alt=Combination;imgFront.title=Combination;jQuery("#"+imgFront.id).load(function(){imgFront.origWidth=jQuery("#"+imgFront.id).width();frontImageLoaded=true;});document.getElementById('confirmFrontPlateDesc').innerHTML=selectedFrontPlateSizeName.replace("(","<br />(");if(selectedPlateSize2Id!=-1){jQuery("#"+imgRear.id).css("visibility","hidden");jQuery("#"+imgRear.id).css("width","");imgRear.src=imageGenURL(currentCombination,selectedBackgroundId,selectedForegroundId,selectedCategoryId,selectedPlateSize2Id)+"&uniqueVar="+(Math.round(Math.random()*150)+Math.random())+"&";imgRear.alt=Combination;imgRear.title=Combination;jQuery("#"+imgRear.id).load(function(){rearImageLoaded=true;imgRear.origWidth=jQuery("#"+imgRear.id).width();});document.getElementById('confirmRearPlateDesc').innerHTML=selectedRearPlateSizeName.replace("(","<br />(");ShowPanel('#SecondPlateDescription');}
else{HidePanel('#SecondPlateDescription');rearImageLoaded=true;}
reProportionImages=setInterval("reSizeAndProportionImages();",300);selectedTab='confirm';if(selectedVehicleSize=="MC"){HidePanel('#AccessoryPlateOption');ShowPanel('#NoAccessoryPlateOption');}
else{ShowPanel('#AccessoryPlateOption');HidePanel('#NoAccessoryPlateOption');}
if(IsMonochrome)
ShowPanel('#confirmMonochromeTC');else
HidePanel('#confirmMonochromeTC');if(IsFlexi)
ShowPanel('#confirmFlexiInformation');else
HidePanel('#confirmFlexiInformation');ShowTabsBar();progressPanelUpdate();}
var PurchaseTicketId="";function ConfirmDesignAccept()
{ShowBusy();var btn=document.getElementById('CheckoutButtonImg');btn.src=ControlPath()+"images/buttons/btn-please-wait.gif";btn.onclick=function(){};progressPanelUpdate();setTimeout("ConfirmDesignAccept2()",1000);}
function ConfirmDesignAccept2()
{var URL;URL="?o=ticket";URL+="&i=0";URL+="&category="+selectedCategoryId;URL+="&bi="+selectedBackgroundId;URL+="&fi="+selectedForegroundId;URL+="&s1="+selectedPlateSize1Id;URL+="&s1n="+escape(selectedFrontPlateSizeName);URL+="&s2="+selectedPlateSize2Id;URL+="&s2n="+escape(selectedRearPlateSizeName);URL+="&ss=0";URL+="&iu="+IsUpgrade;URL+="&ir="+IsRemake;if(IsUpgrade||IsRemake)
URL+="&p="+escape(UpgradePrice);else
URL+="&p="+escape(selectedPrice);URL+="&cn="+escape(selectedCategoryName);URL+="&c="+escape(currentCombination);if(AccessoryRequired==true)
URL+="&acc=yes";else
URL+="&acc=no";jQuery.getJSON(baseWSurl()+URL,GotTicket);}
function GotTicket(jsonTicket,status)
{if(status=='success')
location.href=secureUrl()+"?ticket="+jsonTicket;else
{ClearBusy();alert('Unable to get a ticket ??');}}﻿
var currentSizes;var currentSizesWith;var currentSizesWithout;var currentName;var currentPriceName;var TempselectedBackgroundId;var TempselectedForegroundId;var TempselectedCategoryId;var PlateSeparatorChanged;function DisplayTabs(jsonTabs,status)
{ClearBusy();PlateSeparatorChanged=null;if(status=='success')
{var tabs=eval(jsonTabs);var i,Cat,FirstCategoryId=-1,FirstTooltip="",FirstFormat="";var TabsHTML="<ul id='ptypeUL' style='left:5px;'>";var HasDefaultTab=false;for(i=0;i<tabs.length;i++)
if(tabs[i].DefaultTab==true&&tabs[i].Available==true)
HasDefaultTab=true;for(i=0;i<tabs.length;i++)
{Tab=tabs[i];if(Tab.Available==true){TabsHTML+="<li title='"+Tab.Tooltip+"' ";if(selectedCategoryId==-1)
if((FirstCategoryId==-1&&!HasDefaultTab&&Tab.CategoryId!=36)||(HasDefaultTab&&Tab.DefaultTab==true)){TabsHTML+=" class='selected' ";FirstCategoryId=Tab.CategoryId;FirstFormat=Tab.CombinationFormat;FirstTooltip=Tab.Tooltip;}
if(selectedCategoryId!=-1)
if(((selectedCategoryId==Tab.CategoryId||(selectedCategoryId==12&&Tab.CategoryId==31)))&&(Tab.CategoryId!=999)){TabsHTML+=" class='selected' ";FirstCategoryId=Tab.CategoryId;FirstFormat=Tab.CombinationFormat;FirstTooltip=Tab.Tooltip;}
TabsHTML+=" onclick='SelectPlateCategory("+Tab.CategoryId+", this, \""+Tab.CombinationFormat+"\",\""+Tab.Tooltip+"\");'>"+Tab.TabName.replace(" ","&nbsp;")+"</li>";}
else{TabsHTML+="<li class='disabled' title='"+Tab.Tooltip+"'>"+Tab.TabName.replace(" ","&nbsp;")+"</li>";}}
TabsHTML+="</ul>"
var tgt=document.getElementById("divPlateTabSelect");if(tgt!=null){tgt.innerHTML=TabsHTML;if(DontOverwritebackground!=true){if(selectedCategoryId==-1||selectedCategoryId==FirstCategoryId||selectedCategoryId==10||selectedCategoryId==8){if(currentCombination!=''){SelectPlateCategory(FirstCategoryId,null,FirstFormat,FirstTooltip);}
else{SelectPlateCategory(FirstCategoryId,null,FirstFormat,FirstTooltip);SelectDesign(1,3,27,true,"White on Black","415.00",",1,2,6,7,3,5,14,17,15,18,",",1,2,14,17,",",6,7,3,5,15,18,","This category is available for combinations featuring three letters and two numbers (or three numbers if design has no separator).");panelMode_PlateDesignSelected();}}
else
SelectPlateCategory(selectedCategoryId,null,selectedCategorySuitsFormat,selectedCategoryTooltip);ShowTabsBar();}
jQuery("#ptypeUL li[title]").tooltip({tip:'#designtip',offset:[13,0],delay:200});jQuery('.plateType').geeCarousel({wrapperID:'.plateType',prevBtnID:'.arrowSmallLeft',nextBtnID:'.arrowSmallRight',animateDuration:200});if(FlipToSize)
SelectTab('size');}}
else
{ShowServerError();}}
var localSuitsFormats;var localTooltip;var localPosition;function SelectPlateCategory(CategoryId,caller,SuitsFormats,Tooltip,Position)
{localPosition=Position;localSuitsFormats=SuitsFormats;localTooltip=Tooltip;if(caller!=null){jQuery("#divPlateTabSelect li").removeClass('selected');jQuery(caller).addClass('selected');}
ShowBusy();jQuery.getJSON(baseWSurl()+"?o=designs&category="+CategoryId+"&c="+currentCombination,DisplayDesigns);UpdateWhatsHotFormat(SuitsFormats);jQuery('.arrowLargeLeft').hide();jQuery('.arrowLargeRight').show();}
function DisplayDesigns(jsonDesigns,status)
{ClearBusy();if(status=='success')
{var designs=eval(jsonDesigns);var DesignsHTML,i,Design;var FirstDesignBackgroundId;var FirstDesignForegroundId;var FirstCategoryId=-1,FirstTooltip="",FirstFormat="";var da,db,dc,dd,de,df,dg,dh,dj,dk;DesignsHTML="<ul id='pbackUL'>";for(i=0;i<designs.length;i++)
{Design=designs[i];if(Design.Available==true)
{var c,OnClick;OnClick="onclick='SelectDesign("+Design.BackgroundId+","+Design.Foregrounds[0].ForegroundId+","+Design.CategoryId+","+Design.HasSeparator+","+Q+Design.Foregrounds[0].Name+' on '+Design.Name+Q+","+Q+Design.Price+Q+","+Q+","+Design.Foregrounds[0].Sizes+Q+","+Q+","+Design.Foregrounds[0].SizesWithSep+Q+","+Q+","+Design.Foregrounds[0].SizesWithoutSep+Q+","+Q+Design.__Tooltip+Q+"); return false;\' ";if(da==null){da=Design.BackgroundId;db=Design.Foregrounds[0].ForegroundId;dc=Design.CategoryId;dd=Design.HasSeparator;de=Design.Foregrounds[0].Name+' on '+Design.Name;df=Design.Price;dg=","+Design.Foregrounds[0].Sizes;dh=","+Design.Foregrounds[0].SizesWithSep;dj=","+Design.Foregrounds[0].SizesWithoutSep;dk=Design.__Tooltip;}
DesignsHTML+="<li>";DesignsHTML+="<div class='colourName'>"+Design.Name+"</div>";if(Design.URLToSampleImage!=null)
DesignsHTML+="<a href='#'><img src='"+Design.URLToSampleImage+"' class='plateBgColour' title='"+Design.Name+"' alt='"+Design.Name+"' "+OnClick+" ></a>";else
DesignsHTML+="<table "+OnClick+" class='plateBgColour' style='width:87px; height:31px; background-color: #"+Design.HexColor+"'><tr><td>&nbsp;</tr></td></table>";DesignsHTML+="<div class='charColours'>";for(c=0;c<Design.Foregrounds.length;c++)
{var DesignName=Design.Foregrounds[c].Name+' on '+Design.Name;DesignsHTML+=SampleSwatchHTML(Design.Foregrounds[c].SafeName,Design.BackgroundId,Design.Foregrounds[c].ForegroundId,Design.CategoryId,Design.HasSeparator,DesignName,Design.Price,","+Design.Foregrounds[c].Sizes,","+Design.Foregrounds[0].SizesWithSep,","+Design.Foregrounds[0].SizesWithoutSep,Design.__Tooltip);}
DesignsHTML+="</div>";DesignsHTML+="</li>";}
else
DesignsHTML+="<li>"+Design.Name+" not available</li>";}
DesignsHTML+="</ul>"
var tgt=document.getElementById("divPlateDesignSelect");if(tgt!=null){tgt.innerHTML=DesignsHTML;jQuery('.plateColour').geeCarousel({wrapperID:'.plateColour',prevBtnID:'.arrowLargeLeft',nextBtnID:'.arrowLargeRight',animateDuration:0});if(localPosition!=null){if(localPosition>8){var p=((localPosition-8)*98)*-1;jQuery('.plateColour').geeCarousel({wrapperID:'.plateColour',prevBtnID:'.arrowLargeLeft',nextBtnID:'.arrowLargeRight',animateDuration:10,startPos:p});jQuery("#btnScrollLeft").show();}}}
if(selectedCategoryId==-1)
SelectDesign(da,db,dc,dd,de,df,dg,dh,dj,dk);}
else
{ShowServerError();}}
function SelectDesign(BackgroundId,ForegroundId,CategoryId,HasSeparator,Name,PriceName,Sizes,SizesWith,SizesWithout,OverridingTooltip)
{if(CategoryId==12)localSuitsFormats="QLLNNZ";if(CategoryId==31)localSuitsFormats="3x2";if(OverridingTooltip!=null)
if(OverridingTooltip>"")
localTooltip=OverridingTooltip;IsFlexi=(BackgroundId==140&&ForegroundId==19&&(CategoryId==29||CategoryId==7||CategoryId==30));HasSeparator=HasSeparatorCategory(CategoryId);if(HasSeparator==true)
jQuery('#DesignShowSeparatorOption').removeClass('hidden');else
jQuery('#DesignShowSeparatorOption').addClass('hidden');var PlateSizeId;if(selectedPlateSize1Id!=-1)
PlateSizeId=selectedPlateSize1Id;else
PlateSizeId=1;var WhichSizes=Sizes;if(HasSeparator==true){if(selectedSeparatorInDesign)
WhichSizes=SizesWith;else
WhichSizes=SizesWithout;}
if(WhichSizes!=null)
if(WhichSizes.indexOf(","+PlateSizeId+",")==-1)
{var NewSize=WhichSizes.split(',')[1];if(NewSize!="")
PlateSizeId=NewSize;}
currentSizes=Sizes;currentSizesWith=SizesWith;currentSizesWithout=SizesWithout;currentName=Name;currentPriceName=PriceName;TempselectedBackgroundId=BackgroundId;TempselectedForegroundId=ForegroundId;TempselectedCategoryId=CategoryId;var Combination=currentCombination;var img=document.getElementById('PlateDesignSampleImage');var btn=document.getElementById('btnSelectThisDesign');var instructions=document.getElementById('designPlateInstructions');if(!IsUpgrade)
instructions.innerHTML=msgCheckedPlateInstructions.replace("[PRICE]",PriceName);else
instructions.innerHTML=msgCheckedPlateInstructionsUpgrade;img.src=imageGenURL(Combination,BackgroundId,ForegroundId,CategoryId,PlateSizeId);img.alt=Combination;img.title=Combination;img.onclick=function(){AcceptDesign(BackgroundId,ForegroundId,CategoryId,Name,PriceName,PlateSizeId);return false;};btn.onclick=function(){AcceptDesign(BackgroundId,ForegroundId,CategoryId,Name,PriceName,PlateSizeId);return false;};ShownPlateSize=PlateSizeId;panelMode_PlateDesignSelected();if(CategoryId==36){ShowPanel('#designMonochromeTC');ShowPanel('#designMonochromeTC2');}
else{HidePanel('#designMonochromeTC');HidePanel('#designMonochromeTC2');}
if(IsFlexi)
ShowPanel('#designFlexiInformation');else
HidePanel('#designFlexiInformation');}
function AcceptDesign(BackgroundId,ForegroundId,CategoryId,DesignName,PriceName,SampleSizeHint)
{selectedBackgroundId=BackgroundId;selectedForegroundId=ForegroundId;selectedBackgroundSizeHint=SampleSizeHint;if(currentCombination!=""&&ComboFormat(currentCombination)!="QLLNNZ")
if((selectedCategoryId!=CategoryId||(PlateSeparatorChanged==true&&HasSeparatorCategory(CategoryId)))&&!(selectedCategoryId==10&&CategoryId==7)){selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;selectedFrontPlateSizeName="";selectedRearPlateSizeName="";}
if((selectedCategoryId==10&&CategoryId==7)||(ComboFormat(currentCombination)=="QLLNNZ"&&currentCombination!=""))
CategoryId=selectedCategoryId;else
selectedCategoryId=CategoryId;if(ComboFormat(currentCombination)=="QLLNNZ")
CategoryId=12;selectedCategoryId=CategoryId;selectedCategoryName=DesignName;selectedPrice=PriceName;selectedFormat=localSuitsFormats;selectedCategorySuitsFormat=localSuitsFormats;selectedCategoryTooltip=localTooltip;PlateSeparatorChanged=false;if(currentCombination!=""&&selectedCategoryId!=36)
if(selectedPlateSize1Id==-1){if(ShownPlateSize!=null)
AddToRecentDesigns(currentCombination,CategoryId,BackgroundId,ForegroundId,ShownPlateSize,ShownPlateSize,selectedSeparatorInDesign,currentName,currentPriceName,currentSizes,currentSizesWith,currentSizesWithout,localSuitsFormats,localTooltip);else
AddToRecentDesigns(currentCombination,CategoryId,BackgroundId,ForegroundId,SampleSizeHint,SampleSizeHint,selectedSeparatorInDesign,currentName,currentPriceName,currentSizes,currentSizesWith,currentSizesWithout,localSuitsFormats,localTooltip);}
else
AddToRecentDesigns(currentCombination,CategoryId,BackgroundId,ForegroundId,selectedPlateSize1Id,selectedPlateSize2Id,selectedSeparatorInDesign,currentName,currentPriceName,currentSizes,currentSizesWith,currentSizesWithout,localSuitsFormats,localTooltip);if(selectedCategoryId==36)
GetMonoComboAndConfigForms();else
ProceedToNextPage();}
function DrawCurrentDesign()
{var BackgroundId=DefaultBackgroundId;var ForegroundId=DefaultForegroundId;var CategoryId=DefaultCategoryId;var PlateSizeId=DefaultPlateSizeId;if(TempselectedBackgroundId!=null)
BackgroundId=TempselectedBackgroundId;else if(selectedBackgroundId!=-1)
BackgroundId=selectedBackgroundId;if(TempselectedForegroundId!=null)
ForegroundId=TempselectedForegroundId;else if(selectedForegroundId!=-1)
ForegroundId=selectedForegroundId;if(TempselectedCategoryId!=null)
CategoryId=TempselectedCategoryId;else if(selectedCategoryId!=-1)
CategoryId=selectedCategoryId;Name=selectedCategoryName;if(Name=="")
Name=currentName;if(HasSeparatorCategory(CategoryId)){jQuery('#DesignShowSeparatorOption').removeClass('hidden');if(selectedSeparatorInDesign==true){tickYes.checked=true;tickNo.checked=false;}
else{tickYes.checked=false;tickNo.checked=true;}}
else
jQuery('#DesignShowSeparatorOption').addClass('hidden');if(selectedPlateSize1Id!=-1)
PlateSizeId=selectedPlateSize1Id;var WhichSizes=currentSizes;if(HasSeparatorCategory(CategoryId)){if(selectedSeparatorInDesign)
WhichSizes=currentSizesWith;else
WhichSizes=currentSizesWithout;}
if(WhichSizes!=null)
if(WhichSizes.indexOf(","+PlateSizeId+",")==-1)
{var NewSize=WhichSizes.split(',')[1];if(NewSize!="")
PlateSizeId=NewSize;}
var Combination=currentCombination;var img=document.getElementById('PlateDesignSampleImage');var btn=document.getElementById('btnSelectThisDesign');ShownPlateSize=PlateSizeId;img.src=imageGenURL(Combination,BackgroundId,ForegroundId,CategoryId,PlateSizeId);img.alt=Combination;img.title=Combination;img.onclick=function(){AcceptDesign(BackgroundId,ForegroundId,CategoryId,Name,currentPriceName,ShownPlateSize);return false;};btn.onclick=function(){AcceptDesign(BackgroundId,ForegroundId,CategoryId,Name,currentPriceName,ShownPlateSize);return false;};}
function ChooseSeparatorOnOff()
{selectedSeparatorInDesign=(tickYes.checked==true);PlateSeparatorChanged=true;DrawCurrentDesign();}
function UpdateAccessoryPlate()
{var AccYes=document.getElementById('rbAccessoryYes');AccessoryRequired=AccYes.checked;progressPanelUpdate();}
function HasSeparatorCategory(categoryid)
{if(categoryid==27||categoryid==36||categoryid==22||categoryid==25)
return true;else
return false;}
﻿
function GotoCheckCombination()
{ClearBusy();SelectTab('combo');}
function GotoPlateDesign()
{ClearBusy();SelectTab('design');}
function SwitchToUpgradeSelectPanel()
{HidePanel('#panelPresenting');HidePanel('#panelCheckYourCombination');HidePanel('#panelPreCombinationChecked');HidePanel('#panelAlternativeCombinations');HidePanel('#panelApproveCombination');HidePanel('#panelDesign');HidePanel('#panelSize');HidePanel('#panelConfirm');HidePanel('#panelPrevious');HidePanel('#panelCombinationEntry');HidePanel('#panelProgressDuringComboCheck');HidePanel('#submenu');ShowPanel('#panelUpgrade');}
function panelMode_CheckCombination()
{HidePanel('#panelPresenting');HidePanel('#panelDesign');HidePanel('#panelSize');HidePanel('#panelConfirm');HidePanel('#panelUpgrade');HidePanel('#panelPrevious');ShowPanel('#panelCheckYourCombination');ShowPanel('#submenu');ShowPanel('#panelPreCombinationChecked');HidePanel('#panelAlternativeCombinations');HidePanel('#panelApproveCombination');progressPanelUpdate();ShowPanel('#panelCombinationEntry');ShowPanel('#panelProgressDuringComboCheck');SetFocus('txtCombination');}
function GoBackToCombinationPanelToReDo()
{if(!IsUpgrade){SetCombo("");currentCombination="";var btn=document.getElementById('btnCheckAvailability');btn.src=ControlPath()+"images/buttons/btn-check-availability.gif";}
return SelectTab('combo');}
function GoBackToDesignPanelToReDo()
{selectedCategoryId=-1;selectedBackgroundId=-1;selectedForegroundId=-1;selectedCategoryName="";selectedPrice="0.00";selectedSeparatorInDesign=true;return SelectTab('design');}
function GoBackToSizePanelToReDo()
{selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;selectedFrontPlateSizeName="";selectedRearPlateSizeName="";if(currentVehicleSize=='MC'&&selectedCategoryId==10)
selectedCategoryId=7;if(currentVehicleSize=='MC'&&selectedCategoryId==8)
selectedCategoryId=27;return SelectTab('size');}
function RestartDesign()
{selectedCategoryId=-1;selectedBackgroundId=-1;selectedForegroundId=-1;selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;selectedFrontPlateSizeName="";selectedRearPlateSizeName="";currentCombination="";hasPreviousDesigns=-1;IsUpgrade=false;IsRemake=false;IsMonochrome=false;selectedPrice="0.0";UpgradePrice=-1;jQuery("#whatsHotMainDiv").css("display","");jQuery("#recentSalesMainDiv").css("display","");SetCombo("");SwitchToDesignPanel();}
function panelMode_PlateDesign()
{HidePanel('#panelPresenting');HidePanel('#panelCheckYourCombination');HidePanel('#panelSize');HidePanel('#panelConfirm');HidePanel('#panelUpgrade');HidePanel('#panelPrevious');ShowPanel('#panelDesign');ShowPanel('#submenu');progressPanelUpdate();if(selectedCategoryId!=-1)
panelMode_PlateDesignSelected();else
panelMode_PlateDesignBlank();DrawCurrentDesign();}
function panelMode_PlateDesignBlank()
{HidePanel('#selectedPlateDesign')
ShowPanel('#preSelectDesign');}
function panelMode_PlateDesignSelected()
{HidePanel('#preSelectDesign');ShowPanel('#selectedPlateDesign')}
function panelMode_PlateSize()
{HidePanel('#panelPresenting');HidePanel('#panelCheckYourCombination');HidePanel('#panelDesign');HidePanel('#panelConfirm');HidePanel('#panelUpgrade');HidePanel('#panelPrevious');ShowPanel('#panelSize');progressPanelUpdate();if(selectedPlateSize1Id!=-1)
panelMode_PlateSizeSelected();else
panelMode_PlateSizeBlank();}
function panelMode_PreviousDesigns()
{HidePanel('#panelPresenting');HidePanel('#panelCheckYourCombination');HidePanel('#panelDesign');HidePanel('#panelConfirm');HidePanel('#panelUpgrade');HidePanel('#panelSize');ShowPanel('#panelPrevious');}
function panelMode_PlateSizeBlank()
{ShowPanel('#plateSizeBlank');HidePanel('#plateSizeGrid');}
function panelMode_PlateSizeSelected()
{HidePanel('#plateSizeBlank');ShowPanel('#plateSizeGrid');}
function panelMode_PlateConfirmation()
{HidePanel('#panelPresenting');HidePanel('#panelCheckYourCombination');HidePanel('#panelDesign');HidePanel('#panelSize');HidePanel('#panelPrevious');ShowPanel('#panelConfirm');jQuery("#whatsHotMainDiv").css("display","none");jQuery("#recentSalesMainDiv").css("display","none");ConfirmDesign();}
function ShowPanel(n)
{jQuery(n).css("display","");}
function HidePanel(n)
{jQuery(n).css("display","none");}
function ShowBusy()
{jQuery('#wrapper').addClass('WrapperBusy');}
function ClearBusy()
{jQuery('#wrapper').removeClass('WrapperBusy');}
﻿
function CAPpopup(name)
{switch(name)
{case'InformationOnCombinations':PopupWindowScroll(ControlPath()+"dyntext.aspx?t=PlateInfoPopup",name,450,400);break;case'PlateSizes':PopupWindowScroll(ControlPath()+"dyntext.aspx?t=PlateSizePopup",name,450,400);break;case'AccessoryPlateInfo':PopupWindowScroll(ControlPath()+"dyntext.aspx?t=AccessoryPlateInfo",name,450,400);break;default:}
return false;}
function PopupWindow(mypage,myname,w,h){var LeftPosition=(screen.width-w)/2;var TopPosition=(screen.height-h)/2;settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';var win=window.open(mypage,myname,settings);}
function PopupWindowScroll(mypage,myname,w,h){var LeftPosition=(screen.width-w)/2;var TopPosition=(screen.height-h)/2;settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';var win=window.open(mypage,myname,settings);}
﻿
function progressPanelUpdate()
{CheckCurrentDesign();var ProgressHTML="";var calculatedPrice;if(!IsUpgrade){calculatedPrice=parseFloat(selectedPrice);if(AccessoryRequired==true)
calculatedPrice+=AccessoryPrice();calculatedPrice="$"+new Number(calculatedPrice).toFixed(2);}
else{UpgradePrice=parseFloat(UpgradePrice);if(UpgradePrice<1)
calculatedPrice="calculating";else{calculatedPrice=UpgradePrice;if(AccessoryRequired==true)
calculatedPrice+=AccessoryPrice();calculatedPrice="$"+new Number(calculatedPrice).toFixed(2);}}
ProgressHTML+="<h1 class='listHeading'>Your Current Plate</h1>";ProgressHTML+="<ul class='progressList'>";if(currentCombination!="")
ProgressHTML+="<li class='complete'>Plate Combination:<br />"+currentCombination+"</li>";else
ProgressHTML+="<li>Plate Combination:</li>";if(selectedForegroundId!=-1&&selectedBackgroundId!=-1)
ProgressHTML+="<li class='complete'>Plate Design:<br />"+selectedCategoryName+"</li>";else
ProgressHTML+="<li>Plate Design:</li>";if(selectedPlateSize1Id!=-1)
ProgressHTML+="<li class='complete'>Size / Vehicle Type:<br />"+CompoundPlateSizeName()+"</li>";else
ProgressHTML+="<li>Size / Vehicle Type:</li>";ProgressHTML+="</ul>";ProgressHTML+="<div class='contentLabel'>Price of your current plate as listed above:</div><br/>";var ReadyToProceed=true;if(currentCombination=="")
{ReadyToProceed=false;}
if(selectedPlateSize1Id==-1)
ReadyToProceed=false;if(selectedForegroundId==-1||selectedBackgroundId==-1){ReadyToProceed=false;ProgressHTML+="<div class='contentLabel tallLabel'>No plate has been selected yet.</div>";}
else{if(ReadyToProceed!=true&&!IsUpgrade)
ProgressHTML+="<div class='price'>"+calculatedPrice+"</div>";}
if(ReadyToProceed==true)
{if(selectedTab!="confirm"){ProgressHTML+="<div class='checkoutBox'>";if(calculatedPrice!="calculating")
ProgressHTML+="<div class='price'>"+calculatedPrice+"</div>";ProgressHTML+="<div class='contentLabel'><a href='#'><img style='padding-left:8px;' class='imgBtn' src='"+ControlPath()+"images/buttons/btn-continue.gif' alt='Continue' onclick='ProceedToConfirmationForm(); return false;' /></a></div>";ProgressHTML+="</div>";}
else
{ProgressHTML+="<div class='checkoutBox'>";if(calculatedPrice!="calculating")
ProgressHTML+="<div class='price'>"+calculatedPrice+"</div>";ProgressHTML+="</div>";ProgressHTML+="<img title='Visa, Mastercard and American Express accepted' alt='Visa, Mastercard and American Express accepted' src='"+ControlPath()+"images/logos/logo-accepted-cards.gif' style='margin-left: 10px; margin-top: 1px;' align='left' />";ProgressHTML+="<a href='#' onclick='popupThawte(); return false;'><img src='"+ControlPath()+"images/logos/thawte_seal.gif' alt='Information on Thawte Security' style='padding-left: 40px;' /></a>";ProgressHTML+=msgCAPConfirmationPageDisclaimer;ProgressHTML+="</div>";}}
if(selectedTab=="combo")
SetInnerHTML("panelProgressDuringComboCheck",ProgressHTML);else if(selectedTab=="design")
SetInnerHTML("panelProgressDuringDesign",ProgressHTML);else if(selectedTab=="size")
SetInnerHTML("panelProgressDuringSize",ProgressHTML);else if(selectedTab=="confirm")
SetInnerHTML("panelProgressDuringConfirmation",ProgressHTML);}
function popupThawte()
{Shadowbox.open({content:'https://secure.ppq.com.au/popupwindows/Thawte.html',player:"iframe",title:"Thawte Security",height:450,width:550});}
function CompoundPlateSizeName()
{if(selectedRearPlateSizeName!="")
return selectedFrontPlateSizeName+"<br />"+selectedRearPlateSizeName;else
return selectedFrontPlateSizeName;}
function ProceedToConfirmationForm()
{panelMode_PlateConfirmation();}
function ProceedToCheckoutForm()
{ConfirmDesignAccept();}
function ProceedToNextPage()
{if(currentCombination=="")
SwitchToCombinationEntryPanel();else if(selectedForegroundId==-1||selectedBackgroundId==-1)
SwitchToDesignPanel();else if(selectedPlateSize1Id==-1)
SwitchToSizePanel();else
ProceedToConfirmationForm();}﻿
var localSelectedFront="";var localSelectedRear="";var localFrontPlateSizeName="";var localRearPlateSizeName="";var localSelectedCategory=-1;var localVehicleSize="";var currentVehicleSize="";var selectedVehicleSize="";function SelectVehicleSize(vehicle,ClickedId)
{ShowBusy();if(currentCombination==""&&selectedCategoryId==-1){HidePanel('#plateSizeBlank');ShowPanel('#plateSizeGrid');HidePanel('#plateSizeAcceptButton');ClearBusy();var GridHTML="<p class='contentLabel black'>"+msgSelectDesignOrComboFirst+"</p>";if(vehicle=="MC")
GridHTML+=msgSizeMCExtraInfo;var tgt=document.getElementById("plateSizeGridBody");if(tgt!=null){tgt.innerHTML=GridHTML;}}
else{localVehicleSize=vehicle;if(IsRemake&&vehicle!=originalVehicleType){alert(msgCantChangeWhenRemake);ClearBusy();}
else{currentVehicleSize=vehicle;jQuery('.vehiclesList li').removeClass('selected');jQuery('#'+ClickedId).addClass('selected');if(vehicle=="MC"){var tgt=document.getElementById("plateSizeGridBody");if(tgt!=null&&(selectedCategoryId==29||selectedCategoryId==7)&&selectedBackgroundId==140){ClearBusy();HidePanel('#plateSizeBlank');ShowPanel('#plateSizeGrid');tgt.innerHTML="<p class='contentLabel black'>"+msgMotorCyclePlatesNoAvailableInFlexi+"</p>";}
else
if(selectedCategoryId==-1){var cf=ComboFormat(currentCombination);if(cf=="1"||cf=="2"||cf=="3"||cf=="4"||cf=="5"||cf=="6")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&c="+currentCombination+"&category=29",DisplayVehicleSizes);else
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&c="+currentCombination,DisplayVehicleSizes);}
else if(selectedCategoryId==22||selectedCategoryId==25||selectedCategoryId==27||selectedCategoryId==7||selectedCategoryId==29||selectedCategoryId==30)
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&c="+currentCombination,DisplayVehicleSizes);else if(selectedCategoryId==10||selectedCategoryId==8)
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&c="+currentCombination+"&category="+selectedCategoryId,DisplayVehicleSizes);else
{if(tgt!=null){ClearBusy();HidePanel('#plateSizeBlank');ShowPanel('#plateSizeGrid');tgt.innerHTML="<p class='contentLabel black'>"+msgMotorCyclePlatesNoAvailableInAllSizes+"</p>";}}}
else
{if(vehicle!="MC"&&(selectedCategoryId==8||selectedCategoryId==10)){selectedCategoryId=-1;}
if(currentCombination!=""||selectedCategoryId!=-1){if(selectedCategoryId!=-1)
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category="+selectedCategoryId+"&c="+currentCombination,DisplayVehicleSizes);else{var cf=ComboFormat(currentCombination);if(cf=="1"||cf=="2")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category=30&c="+currentCombination,DisplayVehicleSizes);else if(cf=="3"||cf=="4")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category=7&c="+currentCombination,DisplayVehicleSizes);else if(cf=="5"||cf=="6")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category=29&c="+currentCombination,DisplayVehicleSizes);else if(cf=="3x3")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category=22&c="+currentCombination,DisplayVehicleSizes);else if(cf=="QLLNNZ")
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category=12&c="+currentCombination,DisplayVehicleSizes);else
jQuery.getJSON(baseWSurl()+"?o=sizes&vt="+vehicle+"&category="+DefaultCategoryId+"&c="+currentCombination,DisplayVehicleSizes);}}}}}}
function DisplayVehicleSizes(jsonVehicleSizes,status)
{if(status=='success'){HidePanel('#plateSizeBlank');DrawPlateSizesGrid(eval(jsonVehicleSizes));ShowPanel('#plateSizeGrid');}
else
ShowServerError();ClearBusy();}
function ClearSizeGrid()
{var tgt=document.getElementById("plateSizeGridBody");if(tgt!=null){tgt.innerHTML="";}
HidePanel('#plateSizeAcceptButton');}
function DrawPlateSizesGrid(Sizes)
{var GridHTML="",i;var Combination="";var MyBackgroundId=DefaultBackgroundId;var MyForegroundId=DefaultForegroundId;var MyCategoryId=DefaultCategoryId;var MyPlateSizeId=DefaultPlateSizeId;var FrontName,RearName;var FrontURL,RearURL;var fnCall;if(currentCombination!="")
Combination=currentCombination;if(selectedBackgroundId!=-1)
MyBackgroundId=selectedBackgroundId;if(selectedForegroundId!=-1)
MyForegroundId=selectedForegroundId;if(Combination!="")
if(ComboFormat(Combination)=="QLLNNZ"){MyBackgroundId=72;MyForegroundId=4;MyCategoryId=12;MyPlateSizeId=8;}
GridHTML+="<p class='contentLabel black'>";if(localVehicleSize=="MC")
if(Sizes.length==0)
GridHTML+=msgMotorCyclePlatesNoAvailableInAllSizes;else
GridHTML+=msgPreSizeGridIntroMC;if(localVehicleSize=="LT")
GridHTML+=msgPreSizeGridIntroLT;if(localVehicleSize=="MV")
GridHTML+=msgPreSizeGridIntroMV;GridHTML+="</p><br />";GridHTML+="<ol>";if(Sizes.length==-1&&Sizes[0].RearPlateSizeId==4&&Sizes[0].PlateCategoryId==10){GridHTML="<p class='contentLabel black'>";GridHTML+=msgMotorCyclePlatesNoAvailableInAllSizes;GridHTML+="</p><br />";GridHTML+="<ol>";}
else
for(i=0;i<Sizes.length;i++){var thisRowIsDefault=false;if(Sizes[i].NoSeparator!=selectedSeparatorInDesign||localVehicleSize=="MC"||Sizes[i].PlateCategoryId==36||!HasSeparatorCategory(Sizes[i].PlateCategoryId)){MyCategoryId=Sizes[i].PlateCategoryId;if((Sizes[i].FrontPlateSizeId==selectedPlateSize1Id)&&(Sizes[i].RearPlateSizeId==selectedPlateSize2Id))
thisRowIsDefault=true;if(Sizes[i].FrontPlateName=="No Plate"){FrontName=Sizes[i].RearPlateName+" ("+Sizes[i].RearWidth+"mm x "+Sizes[i].RearHeight+"mm)";FrontURL=plateImageURL(Combination,MyBackgroundId,MyForegroundId,Sizes[i].PlateCategoryId,Sizes[i].RearPlateSizeId,true);RearURL=null;fnCall="SelectSizeFromGrid("+Sizes[i].RearPlateSizeId+",-1, "+Q+FrontName+Q+","+Q+Q+","+Sizes[i].PlateCategoryId+");";}
else{FrontName=Sizes[i].FrontPlateName+" ("+Sizes[i].FrontWidth+"mm x "+Sizes[i].FrontHeight+"mm)";FrontURL=plateImageURL(Combination,MyBackgroundId,MyForegroundId,Sizes[i].PlateCategoryId,Sizes[i].FrontPlateSizeId,true);if(Sizes[i].RearPlateName!="No Plate")
{RearName=Sizes[i].RearPlateName+" ("+Sizes[i].RearWidth+"mm x "+Sizes[i].RearHeight+"mm)";RearURL=plateImageURL(Combination,MyBackgroundId,MyForegroundId,Sizes[i].PlateCategoryId,Sizes[i].RearPlateSizeId,true);fnCall="SelectSizeFromGrid("+Sizes[i].FrontPlateSizeId+","+Sizes[i].RearPlateSizeId+","+Q+FrontName+Q+","+Q+RearName+Q+","+Sizes[i].PlateCategoryId+");";}
else
{RearURL=null;fnCall="SelectSizeFromGrid("+Sizes[i].FrontPlateSizeId+",-1, "+Q+FrontName+Q+","+Q+Q+","+Sizes[i].PlateCategoryId+");";}}
if(thisRowIsDefault)
eval(fnCall);GridHTML+="<li>";GridHTML+="<input type='radio' id='combo"+i+"' name='comboSelect' onclick='"+fnCall+"' ";if(thisRowIsDefault)GridHTML+=" checked='checked' ";GridHTML+=" />";GridHTML+="<label for='combo"+i+"'  onclick='"+fnCall+"'>";GridHTML+="<span class='plateComboPreview LeftPlate'><img src='"+FrontURL+"' alt='"+Combination+"' /></span>";if(RearURL!=null)
GridHTML+="<span class='plateComboPreview RightPlate'><img src='"+RearURL+"' alt='"+Combination+"' /></span>";GridHTML+="<span class='plateComboContent'>";GridHTML+="<span>"+FrontName+"</span>";if(RearURL!=null)
GridHTML+="<span>"+RearName+"</span>";GridHTML+="</span>";GridHTML+="</label>";GridHTML+="</li>";}}
GridHTML+="</ol>";if(localVehicleSize=="LT")
GridHTML+=msgPostSizeGridLT;if(!IsRemake){if(selectedSeparatorInDesign&&(MyCategoryId==22||MyCategoryId==25||MyCategoryId==27)){if(localVehicleSize=="MV")
GridHTML+=msgPostSizeGridColorSepMV;if(localVehicleSize=="LT")
GridHTML+=msgPostSizeGridColorSepLT;}
if(!selectedSeparatorInDesign&&(MyCategoryId==22||MyCategoryId==25||MyCategoryId==27)){if(localVehicleSize=="MV")
GridHTML+=msgPostSizeGridColorNoSepMV;if(localVehicleSize=="LT")
GridHTML+=msgPostSizeGridColorNoSepLT;}}
if(IsMonochrome)
GridHTML+=msgMonochromeTCLink+msgMonochromePostTCLink;if(IsFlexi)
GridHTML+=msgFlexiInformation;var tgt=document.getElementById("plateSizeGridBody");if(tgt!=null){tgt.innerHTML=GridHTML;}}
function SizeRemoveSep(vehicleType)
{selectedSeparatorInDesign=false;if(vehicleType=='MV')
SelectVehicleSize('MV','vehicleCar');if(vehicleType=='LT')
SelectVehicleSize('LT','vehicleTrailer');}
function SizeAddSep(vehicleType)
{selectedSeparatorInDesign=true;if(vehicleType=='MV')
SelectVehicleSize('MV','vehicleCar');if(vehicleType=='LT')
SelectVehicleSize('LT','vehicleTrailer');}
function SelectSizeFromGrid(FrontPlateSizeId,RearPlateSizeId,FrontPlateSizeName,RearPlateSizeName,CategoryId)
{localSelectedFront=FrontPlateSizeId;localSelectedRear=RearPlateSizeId;localFrontPlateSizeName=FrontPlateSizeName;localRearPlateSizeName=RearPlateSizeName;localSelectedCategory=CategoryId;selectedVehicleSize=currentVehicleSize;ShowPanel('#plateSizeAcceptButton');}
function AcceptSize(BackgroundId,ForegroundId,CategoryId,DesignName)
{selectedPlateSize1Id=localSelectedFront;selectedPlateSize2Id=localSelectedRear;selectedFrontPlateSizeName=localFrontPlateSizeName;selectedRearPlateSizeName=localRearPlateSizeName;selectedCategoryId=localSelectedCategory;if(CategoryId!=10&&CategoryId!=8&&selectedBackgroundId!=-1&&selectedForegroundId!=-1)
AddToRecentDesigns(currentCombination,selectedCategoryId,selectedBackgroundId,selectedForegroundId,selectedPlateSize1Id,selectedPlateSize2Id,selectedSeparatorInDesign,selectedCategoryName,currentPriceName,currentSizes,currentSizesWith,currentSizesWithout,localSuitsFormats,localTooltip);ShowTabsBar();progressPanelUpdate();if(localSelectedCategory==12&&selectedCategoryId!=12)
{selectedBackgroundId=72;selectedForegroundId=4;selectedSeparatorInDesign=false;PlateSeparatorChanged=false;selectedCategoryId=12;TabsNeedRefresh=false;SelectPlateCategory(12,this,"QLLNNZ","This category is available for combinations featuring Q followed by two letters, two numbers and Z.");SelectDesign(72,4,12,false,"Black on Euro","595.00",",8,16,",",8,16,",",");SwitchToDesignPanel();}
else
ProceedToNextPage();}
function mcSizeChooseColours()
{selectedCategoryId=27;SelectPlateCategory(27,this);SelectDesign(1,3,27,true,"White on Black","415.00",",1,2,6,7,3,5,14,17,15,18,",",1,2,14,17,",",6,7,3,5,15,18,");jQuery.getJSON(baseWSurl()+"?o=tabs&c="+currentCombination,DisplayTabs);SelectTab('design');}
function mcSizeChoosePrestige()
{selectedCategoryId=29;SelectPlateCategory(29,this);SelectDesign(1,3,29,false,"White on Black","2295.00",",19,20,25,28,",",",",19,20,25,28,");jQuery.getJSON(baseWSurl()+"?o=tabs&c="+currentCombination,DisplayTabs);SelectTab('design');}
﻿
var selectedTab='combo';function ShowTabsBar()
{var tabPreviousDesigns=document.getElementById('viewRecent');var tabHTML;if(selectedTab=='combo')
jQuery('#checkCombo').addClass('menuCurrent');else
jQuery('#checkCombo').removeClass('menuCurrent');if(currentCombination!='')
jQuery('#checkComboA').addClass('menuComplete');else
jQuery('#checkComboA').removeClass('menuComplete');if(selectedTab=='design')
jQuery('#chooseDesign').addClass('menuCurrent');else
jQuery('#chooseDesign').removeClass('menuCurrent');if(selectedBackgroundId!=-1&&selectedForegroundId!=-1)
jQuery('#chooseDesignA').addClass('menuComplete');else
jQuery('#chooseDesignA').removeClass('menuComplete');if(selectedTab=='size')
jQuery('#chooseVehicle').addClass('menuCurrent');else
jQuery('#chooseVehicle').removeClass('menuCurrent');if(selectedPlateSize1Id!=-1)
jQuery('#chooseVehicleA').addClass('menuComplete');else
jQuery('#chooseVehicleA').removeClass('menuComplete');if(hasPreviousDesigns>0){jQuery('#viewRecent').removeClass('hidden');if(selectedTab=='previous')
jQuery('#viewRecent').addClass('menuCurrent');else
jQuery('#viewRecent').removeClass('menuCurrent');}
else
jQuery('#viewRecent').addClass('hidden');}
function SelectTab(tab)
{selectedTab=tab;ShowTabsBar();CheckedCombinationToProceedWith="";jQuery("#whatsHotMainDiv").css("display","");jQuery("#recentSalesMainDiv").css("display","");switch(tab)
{case'combo':if(!IsRemake&&!IsUpgrade&&!IsMonochrome)
SwitchToCombinationEntryPanel();else
if(IsMonochrome)
alert(msgCantChangeComboWhileMonochrome);else
alert(msgCantChangeComboWhileUpgradeOrRemake);pageTracker._trackPageview('/CreateAPlateCombination.aspx');break;case'design':if(!IsRemake&&!IsMonochrome)
SwitchToDesignPanel();else
if(IsMonochrome)
alert(msgCantChangeDesignWhileMonochrome);else
alert(msgCantChangeDesignWhileRemake);pageTracker._trackPageview('/CreateAPlateDesign.aspx');break;case'size':SwitchToSizePanel();pageTracker._trackPageview('/CreateAPlateSize.aspx');break;case'previous':SwitchToPreviousDesignsPanel();pageTracker._trackPageview('/CreateAPlateRecent.aspx');break;}
return false;}﻿
function SamplePlateHTML(URLToSampleImage,HexColor)
{if(URLToSampleImage!=null)
return"<img border='0' src='"+URLToSampleImage+"' />"
else
return"<table class='DesignSamplePlate Normal' style='background-color: #"+HexColor+"'><tr><td>&nbsp;</tr></td></table>";}
function SampleSwatchHTML(SafeName,BackgroundId,ForegroundId,CategoryId,Separator,DesignName,PriceName,Sizes,SizesWith,SizesWithout,overridingTooltip)
{var SwatchHTML;DesignName=DesignName.replace(/\'/g,"");SwatchHTML="<img ";SwatchHTML+="onclick='SelectDesign("+BackgroundId+","+ForegroundId+","+CategoryId+","+Separator+","+Q+DesignName+Q+","+Q+PriceName+Q+","+Q+Sizes+Q+","+Q+SizesWith+Q+","+Q+SizesWithout+Q+","+Q+overridingTooltip+Q+"); return false;' ";SwatchHTML+="src='"+ControlPath()+"images/designpanel/char-colour-"+SafeName+".gif' alt="+Q+DesignName+Q+" title='"+DesignName+"' />";return SwatchHTML;}
function RemoveSingles(v)
{}
function plateImageURL(Combination,BackgroundId,ForegroundId,CategoryId,PlateSizeId,Thumbnail)
{if(BackgroundId==null){BackgroundId=DefaultBackgroundId;ForegroundId=DefaultForegroundId;CategoryId=DefaultCategoryId;PlateSizeId=DefaultPlateSizeId;if(selectedBackgroundId!=-1)
BackgroundId=selectedBackgroundId;if(selectedForegroundId!=-1)
ForegroundId=selectedForegroundId;if(selectedCategoryId!=-1)
CategoryId=selectedCategoryId;if(selectedPlateSize1Id!=-1)
PlateSizeId=selectedPlateSize1Id;Thumbnail=false;}
if(Combination==""){if(CategoryId==36)
Combination="ZAA001";else if(CategoryId==29)
Combination="";else if(CategoryId==12)
Combination="";else
Combination="";}
var URL=baseImageUrl()+"?combination="+Combination+"&backgroundid="+BackgroundId+"&foregroundid="+ForegroundId+"&categoryid="+CategoryId+"&platesizeid="+PlateSizeId+"&isSmallThumbnail=";if(Thumbnail==true)
URL+="true";else
URL+="false";if(Combination==""){URL+="&isDefaultImage=true";URL=URL.replace("combination=","Combination=AAA22");}
return URL;}
function imageGenAccessoryURL(Combination)
{var URL=baseImageUrl()+"?combination="+Combination+"&acc=true";if(Combination==""){URL+="&isDefaultImage=true";URL=URL.replace("combination=","Combination=AAA22");}
return URL;}
function ShowServerError()
{alert('server error');}
function SetFocus(n)
{var e=document.getElementById(n);if(e!=null)
e.focus();}
function SetInnerHTML(e,c)
{var tgt=document.getElementById(e);if(tgt!=null)
tgt.innerHTML=c;}
function ComboFormatCompatible(fmt1,combo2)
{var fmt2=ComboFormat(combo2);if((fmt1=="1"||fmt1=="2"||fmt1=="3"||fmt1=="4"||fmt1=="5"||fmt1=="6")&&(fmt2=="1"||fmt2=="2"||fmt2=="3"||fmt2=="4"||fmt2=="5"||fmt2=="6"))
return true;return(fmt1==fmt2);}
function ComboFormat(_Combination)
{var _CombinationFormat="";if(_Combination!=null){_Combination=_Combination.replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','').replace(' ','');if(_Combination.length==5){if((IsLetter(_Combination,1)&&IsLetter(_Combination,2)&&IsLetter(_Combination,3)&&IsNumeric(_Combination,4)&&IsNumeric(_Combination,5))||(IsNumeric(_Combination,1)&&IsNumeric(_Combination,2)&&IsLetter(_Combination,3)&&IsLetter(_Combination,4)&&IsLetter(_Combination,5)))
_CombinationFormat="3x2";else
_CombinationFormat="5";}
else if(_Combination.length==6)
if(IsQ(_Combination,1)&&IsLetter(_Combination,2)&&IsLetter(_Combination,3)&&IsNumeric(_Combination,4)&&IsNumeric(_Combination,5)&&IsZ(_Combination,6))
_CombinationFormat="QLLNNZ";else if((IsLetter(_Combination,1)&&IsLetter(_Combination,2)&&IsLetter(_Combination,3)&&IsNumeric(_Combination,4)&&IsNumeric(_Combination,5)&&IsNumeric(_Combination,6))||(IsNumeric(_Combination,1)&&IsNumeric(_Combination,2)&&IsNumeric(_Combination,3)&&IsLetter(_Combination,4)&&IsLetter(_Combination,5)&&IsLetter(_Combination,6)))
_CombinationFormat="3x3";else
_CombinationFormat="6";else if(_Combination.length==1)
_CombinationFormat="1";else if(_Combination.length==2)
_CombinationFormat="2";else if(_Combination.length==3)
_CombinationFormat="3";else if(_Combination.length==4)
_CombinationFormat="4";else if(_Combination.length==7)
_CombinationFormat="7";}
return _CombinationFormat;}
function IsLetter(t,o)
{var alpha="abcdefghijklmnopqrstuvwxyz";return alpha.indexOf(t.charAt(o-1).toLowerCase())>=0;}
function IsNumeric(t,o)
{var alpha="0123456789";return alpha.indexOf(t.charAt(o-1).toLowerCase())>=0;}
function IsQ(t,o)
{var alpha="q";return alpha.indexOf(t.charAt(o-1).toLowerCase())>=0;}
function IsZ(t,o)
{var alpha="zy";return alpha.indexOf(t.charAt(o-1).toLowerCase())>=0;}
function eraseCookie(name){createCookie(name,"",-1);}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function RecordException(e)
{jQuery.getJSON(baseWSurl()+"?o=el&ele="+Left(escape(e),8000),ELERecorded);}
function ELERecorded()
{}
function Left(str,n){if(n<=0)
return"";else if(n>String(str).length)
return str;else
return String(str).substring(0,n);}
﻿
var existingDesigns=new Array();function plateDesign(Combination,BackgroundId,ForegroundId,PlateSize1,PlateSize2)
{this.Combination=Combination;this.BackgroundId=BackgroundId;this.ForegroundId=ForegroundId;this.PlateSize1=PlateSize1;this.PlateSize2=PlateSize2;var d=new Date();this.UniqueKey=d.getDate()+""+d.getMonth()+1+""+d.getFullYear()+""+d.getHours()+""+d.getMinutes()+""+d.getSeconds();}
function saveDesign(Combination,BackgroundId,ForegroundId,PlateSize1,PlateSize2)
{var ThisDesign=new plateDesign(Combination,BackgroundId,ForegroundId,PlateSize1,PlateSize2);existingDesigns[existingDesigns.length]=ThisDesign;}
function getDesign(id)
{if(id<existingDesigns.length)
return existingDesigns[id];}
function countDesigns()
{return existingDesigns.length;}
function deleteDesign(id)
{var newDesigns=new Array();var iter;for(iter=0;iter<existingDesigns.length;iter++)
if(iter!=id)
newDesigns[newDesigns.length]=existingDesigns[iter];existingDesigns=newDesigns;}﻿
rules={"maxPlateLength":7,"minPlateLength":1,"invalidChars":/[^A-Z0-9]/,"invalidCombos":[{"rule":/^[A-P,R-Z]\d{2}$/,"reason":"Prestige plates cannot consist of one letter followed by 2 numbers; please try another combination."},{"rule":/^[A-P,R-Z]\d{3}$/,"reason":"Prestige plates cannot consist of one letter followed by 3 numbers; please try another combination."},{"rule":/^[A-P,R-Z]\d{4}$/,"reason":"Prestige plates cannot consist of one letter followed by 4 numbers; please try another combination."},{"rule":/^[A-P,R-Z]\d{5}$/,"reason":"Prestige plates cannot consist of one letter followed by 5 numbers; please try another combination."},{"rule":/^Q\d{2,5}$/,"reason":"Q Plates are not able to be checked or purchased online. Please visit <a href='http://www.ppq.com.au/InfoHub/QandCollectorPlates.aspx'>Q & Collector Plates</a> for more information or try another combination."},{"rule":/^QG[A-Z]{2}\d{2}$/,"reason":"Prestige plates cannot begin with the letters 'QG' followed by two letters and two numbers; please try another combination."},{"rule":/^[A-P,R-Z]\d{4}$/,"reason":"Prestige plates cannot consist of one letter followed by four numbers; please try another combination."},{"rule":/^(SL|QV|QX|QT)\d{2}[A-Z]{2}$/,"reason":"Prestige plates cannot begin with the letters 'SL', 'QV', 'QX' or 'QT' followed by two numbers and two letters; please try another combination."},{"rule":/^[A-Z]{2}\d{2}$/,"reason":"Prestige plates featuring two letters followed by two numbers are not able to be checked or purchased online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or <a href='#' onclick='tryLLNNAsEuro(); return false;' >click here</a> to try the combination in a Classic Euro format. "},{"rule":/^\d{2}[A-Z]{2}$/,"reason":"Prestige plates featuring two numbers followed by two letters are not able to be checked or purchased online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or try another combination."},{"rule":/^Q[A-Z]{2}\d{2}[A-X]$/,"reason":"Classic Euro plates feature the letter 'Q' followed by two letters, two numbers and the letter 'Z' or 'Y' (if sold out when ending with 'Z'). Please try another combination."},{"rule":/^[0-9]{3}[A-Z]{2}$/,"reason":"Personalised plates cannot feature three numbers followed by two letters; please try another combination."},{"rule":/^T\d{2}$/,"reason":"Prestige plates cannot feature the letter 'T' followed by two numbers; please try another combination."},{"rule":/^T\d{3}$/,"reason":"Prestige plates cannot feature the letter 'T' followed by three numbers; please try another combination."},{"rule":/^[A-Z]{2}[0-9]{4}$/,"reason":"Personalised plates cannot feature two letters followed by four numbers; please try another combination."},{"rule":/^[A-Z]{2}[0-9]{3}$/,"reason":"Personalised plates cannot feature two letters followed by three numbers; please try another combination."},{"rule":/^[A-Z][A-Z]$/,"reason":"Combinations featuring two characters are not able to be checked, purchased, upgraded or remade online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or try another combination."},{"rule":/^[A-Z]$/,"reason":"Combinations featuring one character are not able to be checked, purchased, upgraded or remade online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or try another combination."},{"rule":/^[A-Z][0-9]$/,"reason":"Combinations featuring two characters are not able to be checked, purchased, upgraded or remade online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or try another combination."},{"rule":/^[0-9][A-Z]$/,"reason":"Combinations featuring two characters are not able to be checked, purchased, upgraded or remade online. Please <a href='http://www.ppq.com.au/ContactUs.aspx'>Contact PPQ</a> for more information or try another combination."},{"rule":/^[0-9][0-9]$/,"reason":"Plate combinations must contain at least three characters including at least one letter; please try again."}],"specialCombos":[{"rule":/\bQ[A-Z]{2}\d{2}Z\b/,"style":"Euro Plate"}],"validCombos":[{"rule":/\b[A-Z0-9]{2,6}\b/,"style":"Prestige Plate"}]};function checkCombo(combo){combo=combo.toUpperCase();combo=combo.replace(/^\s+|\s+$/g,"");if(combo.replace(" ","").length>rules.maxPlateLength){return"Combination too long";}
for(var i=0;i<rules.invalidCombos.length;i++){result=isPlateInvalid(combo,rules.invalidCombos[i]);if(result){return result;}}
if(combo.length<rules.minPlateLength){return"Plate combinations must contain at least three characters; please try again.";}
var plateTypes=new Array;return plateTypes;}
function isPlateInvalid(combo,plateObj){var patt=new RegExp(plateObj.rule);var result=patt.exec(combo);if(result==null){return false;}else{return plateObj.reason;}}
function isPlateOfType(combo,plateObj){var patt=new RegExp(plateObj.rule);var result=patt.exec(combo);if(result!=null){return plateObj.style;}else{return false;}}
﻿
function GetMonoComboAndConfigForms()
{ShowBusy();var rc=readCookie("mono");if(rc!=null&&rc!="")
MonochromeSessionId=rc;jQuery.getJSON(baseWSurl()+"?o=nextmonochrome&si="+MonochromeSessionId,MonochromePlateSelected);}
function MonochromePlateSelected(jsonAvailability,status)
{if(status=='success')
{var Result=eval(jsonAvailability);if(Result.Available==true){IsMonochrome=true;IsUpgrade=false;IsRemake=false;MonochromeSessionId=Result.SessionId;currentCombination=Result.Combination;eraseCookie("mono");createCookie("mono",MonochromeSessionId,0);currentCombination=Result.Combination;selectedCategoryId=36;selectedCategoryName="Monochrome Series";selectedFormat="3x3";selectedBackgroundId=142;selectedForegroundId=4;selectedPrice="215.00";selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;SwitchToSizePanel('MV');}
else
alert('no more monochrome plates available');}
else
{ShowServerError();}
ClearBusy();}
function popupMonoTC()
{Shadowbox.open({content:'/desktopmodules/ppq_cap/dyntext.aspx?t=MonochromeTCs',player:"iframe",title:"MONOCHROME SERIES TERMS AND CONDITIONS",height:550,width:550});}
﻿
var originalPlateCategoryId=-1;var originalPlateBackgroundId=-1;var originalPlateForegroundId=-1;var originalPlateFrontSizeId=-1;var originalPlateFrontSizeName="";var originalPlateRearSizeId=-1;var originalPlateRearSizeName="";var originalVehicleType="";var RetrievedRemakeFee=-1;function CheckForUpgrade()
{if(UpgradeCombination!="")
jQuery.getJSON(baseWSurl()+"?o=canupgrade&c="+UpgradeCombination,DisplayCanUpgrade);}
function DisplayCanUpgrade(jsonCanUpgrade,status)
{if(status=='success')
{var Result=eval(jsonCanUpgrade);if(Result.CanUpgrade==true&&Result.currentCategoryId!=-1){HidePanel('#panelPresenting');ShowPanel('#CAPcontent');SwitchToUpgradeSelectPanel();currentCombination=Result.currentCombination;CombinationLocked=true;IsUpgrade=true;var UpgradeImage1=document.getElementById('upgradePlateImage1');var UpgradeImage2=document.getElementById('upgradePlateImage2');var UpgradePlateSize1=document.getElementById('UpgradePlateSize1');var UpgradePlateSize2=document.getElementById('UpgradePlateSize2');var UpgradeFromPrice=document.getElementById('UpgradeFromPrice');var RemakeFromPrice=document.getElementById('RemakeFromPrice');var DesignsList=document.getElementById('DesignsList');RemakeFromPrice.innerHTML="$"+CurrencyFormatted(Result.RemakeFee);RetrievedRemakeFee=Result.RemakeFee;UpgradeImage1.src=plateImageURL(Result.currentCombination,Result.currentBackgroundId,Result.currentForegroundId,Result.currentCategoryId,Result.FrontSizeId);UpgradePlateSize1.innerHTML=Result.FrontSizeName;originalPlateFrontSizeName=Result.FrontSizeName;UpgradeImage2.src=plateImageURL(Result.currentCombination,Result.currentBackgroundId,Result.currentForegroundId,Result.currentCategoryId,Result.RearSizeId);UpgradePlateSize2.innerHTML=Result.RearSizeName;originalPlateRearSizeName=Result.RearSizeName;if(Result.RearSizeName=="")
HidePanel("#PlateDetail2Panel");originalPlateCategoryId=Result.currentCategoryId;originalPlateCategoryName=Result.currentCategoryName;originalPlateBackgroundId=Result.currentBackgroundId;originalPlateForegroundId=Result.currentForegroundId;originalPlateFrontSizeId=Result.FrontSizeId;originalPlateRearSizeId=Result.RearSizeId;originalVehicleType=Result.currentVehicleType;var TabsHTML="";for(i=0;i<Result.Tabs.length;i++)
{Tab=Result.Tabs[i];if(Tab.Available==true){TabsHTML+="<li title='"+Tab.Tooltip+"'><a href='#' ";TabsHTML+=" onclick='SelectUpgradePlateCategory("+Tab.CategoryId+", this);'>"+Tab.TabName.replace(" ","&nbsp;")+"</a></li>";}}
DesignsList.innerHTML=TabsHTML;selectedSeparatorInDesign=Result.currentHasSeparator;tickYes.checked=Result.currentHasSeparator;tickNo.checked=!Result.currentHasSeparator;if(Result.ProductClass=="PRES"){if(Result.currentVehicleType=='LT')
UpgradeFromPrice.innerHTML="$310";if(Result.currentVehicleType=='MV')
UpgradeFromPrice.innerHTML="$440";if(Result.currentVehicleType=='MC')
UpgradeFromPrice.innerHTML="$195";}
else
UpgradeFromPrice.innerHTML="$195";if(Result.ProductClass=="STAN"){if(Result.currentHasCRN==false)
UpgradeFromPrice.innerHTML="$395";}
if((Result.ProductClass!="PRES"&&Result.ProductClass!="PERS"&&Result.ProductClass!="EURO")||(Result.RemakeFee==0))
{HidePanel('#RemakeFromPrice');HidePanel('#RemakeButton');ShowPanel('#ContactPPQForUpgrade');}
if(ComboFormat(Result.currentCombination)=="QLLNNZ")
{HidePanel('#DesignsList');HidePanel('#UpgradePriceBox');HidePanel('#UpgradeFrom');ShowPanel('#CantBeUpgraded');}
DrawWhatsHotUpgradeOptions(Result.currentCombination,Result.PlateSpecCode);}
else{var notIssued=false;if(Result.Reason!="available"){if(Result.Reason=="notissued"){ShowNotIssued();notIssued=true;}
else if(Result.Reason=="notready"){ShowNotReady();notIssued=true;}
else
alert('Not available for upgrade due to :'+Result.Reason);}
IsUpgrade=false;IsRemake=false;IsMonochrome=false;IsFlexi=false;HidePanel('#panelPresenting');ShowPanel('#CAPcontent');if(notIssued==false){SelectTab('combo');panelMode_CheckCombination();}
if(Result.Reason=="available"){SetCombo(UpgradeCombination);StartupCombination="";CheckCombination();}
if(notIssued==false)
UpdateWhatsHot(UpgradeCombination);else
UpdateWhatsHotFormat("3x2");}}
else
{ShowServerError();}
ClearBusy();}
function ShowNotIssued()
{SwitchToUpgradeSelectPanel();HidePanel('#panelUpgrade');HidePanel('#submenu');HidePanel('#panelCheckYourCombination');ShowPanel('#panelCantUpgradeNotIssued');}
function ShowNotReady()
{SwitchToUpgradeSelectPanel();HidePanel('#panelUpgrade');HidePanel('#submenu');HidePanel('#panelCheckYourCombination');ShowPanel('#panelCantUpgradeNotReady');}
function SelectUpgradePlateCategory(CategoryId)
{selectedCategoryId=CategoryId;SelectPlateCategory(CategoryId,this);DontOverwritebackground=true;selectedTab='design';ShowTabsBar();panelMode_PlateDesign();panelMode_PlateDesignBlank();HidePanel('#panelUpgrade');jQuery.getJSON(baseWSurl()+"?o=tabs&c="+currentCombination,DisplayTabs);}
function KickoffUpgrade()
{selectedCategoryId=originalPlateCategoryId;UpgradePrice=0.1;SelectUpgradePlateCategory(selectedCategoryId);}
function CurrencyFormatted(amount)
{var i=parseFloat(amount);if(isNaN(i)){i=0.00;}
var minus='';if(i<0){minus='-';}
i=Math.abs(i);i=parseInt((i+.005)*100);i=i/100;s=new String(i);if(s.indexOf('.')<0){s+='.00';}
if(s.indexOf('.')==(s.length-2)){s+='0';}
s=minus+s;return s;}
function KickoffRemake()
{selectedCategoryId=originalPlateCategoryId;selectedCategoryName=originalPlateCategoryName;selectedBackgroundId=originalPlateBackgroundId;selectedForegroundId=originalPlateForegroundId;selectedPlateSize1Id=originalPlateFrontSizeId;selectedFrontPlateSizeName=originalPlateFrontSizeName;selectedPlateSize2Id=originalPlateRearSizeId;selectedRearPlateSizeName=originalPlateRearSizeName;IsRemake=true;UpgradePrice=0.1;if(RetrievedRemakeFee>0)
UpgradePrice=RetrievedRemakeFee;DontOverwritebackground=true;selectedTab='design';ShowPanel('#submenu');ShowTabsBar();panelMode_PlateDesign();panelMode_PlateDesignBlank();HidePanel('#panelUpgrade');FlipToSize=true;SelectTab('size')
if(originalVehicleType=='MV')SelectVehicleSize('MV','vehicleCar');if(originalVehicleType=='LT')SelectVehicleSize('LT','vehicleTrailer');if(originalVehicleType=='MC')SelectVehicleSize('MC','vehicleMotorcycle');}
var uwh_Combination;function DrawWhatsHotUpgradeOptions(Combination,PlateSpecCode)
{UpdateWhatsHot(Combination);uwh_Combination=Combination;jQuery.getJSON(baseWSurl()+"?o=upgradecross&c="+Combination+"&psc="+PlateSpecCode,DisplayUpgradeHotness);}
function DisplayUpgradeHotness(jsonPlates,status)
{if(status=='success')
{var plates=eval(jsonPlates);var HotsHTML="";var plate;var theUL=document.getElementById("platesList");var theImg="";for(i=0;i<plates.length;i++){plate=plates[i];theImg+="<li><img src='";theImg+=plateImageURL(uwh_Combination,plate.BackgroundId,plate.ForegroundId,plate.CategoryId,plate.PlateSizeId,true);theImg+="' alt='"+plate.Tooltip+"' ";theImg+=" title='"+plate.Tooltip+"' ";theImg+=" onclick='selectWhatsHotDesign(\""+plate.DesignName+"\"); return false;' ";theImg+=" style='cursor:pointer;' /></li>";}
document.getElementById("platesList").innerHTML=theImg;}}﻿
var NextDesignId=0;var hasPreviousDesigns=-1;var currentDesignId=null;var currentDesigns=new Array();function Design(Combination,CategoryId,BackgroundId,ForegroundId,Size1Id,Size2Id,HasSeparator,DesignName,Price,Sizes,SizesWith,SizesWithout,SuitsFormats,Instructions,DesignId)
{this.Combination=Combination;this.CategoryId=CategoryId;this.BackgroundId=BackgroundId;this.ForegroundId=ForegroundId;this.Size1Id=Size1Id;this.Size2Id=Size2Id;this.FrontPlateSizeName="";this.RearPlateSizeName="";this.HasSeparator=HasSeparator;this.DesignName=DesignName;this.Price=Price;this.Sizes=Sizes;this.SizesWith=SizesWith;this.SizesWithout=SizesWithout;this.SuitsFormats=SuitsFormats;this.Instructions=Instructions;this.SizesSet=false
if(DesignId==null){DesignId=NextDesignId;NextDesignId+=1;}
this.DesignId=DesignId;}
var Sep="|";function DesignStore()
{var v="";v+=this.Combination+Sep;v+=this.CategoryId+Sep;v+=this.BackgroundId+Sep;v+=this.ForegroundId+Sep;v+=this.Size1Id+Sep;v+=this.Size2Id+Sep;v+=this.FrontPlateSizeName+Sep;v+=this.RearPlateSizeName+Sep;v+=this.HasSeparator+Sep;v+=this.DesignName+Sep;v+=this.Price+Sep;v+=this.Sizes+Sep;v+=this.SizesWith+Sep;v+=this.SizesWithout+Sep;v+=this.SuitsFormats+Sep;v+=this.Instructions+Sep;v+=this.SizesSet+Sep;v+=this.DesignId
createCookie("ppq_design_"+this.DesignId,v,0);}
Design.prototype.Store=DesignStore;function DesignRetrieve(i)
{var v=readCookie("ppq_design_"+i);var av=v.split(Sep);this.Combination=av[0];this.CategoryId=av[1];this.BackgroundId=av[2];this.ForegroundId=av[3];this.Size1Id=av[4];this.Size2Id=av[5];this.FrontPlateSizeName=av[6];this.RearPlateSizeName=av[7];this.HasSeparator=av[8];this.DesignName=av[9];this.Price=av[10];this.Sizes=av[11];this.SizesWith=av[12];this.SizesWithout=av[13];this.SuitsFormats=av[14];this.Instructions=av[15];this.SizesSet=av[16];this.DesignId=i;}
Design.prototype.Retrieve=DesignRetrieve;function StoreAllDesigns()
{var i;for(i=0;i<currentDesigns.length;i++)
currentDesigns[i].Store();createCookie("ppq_num_designs",currentDesigns.length,0);}
function LoadAllDesigns()
{var NumDesigns=0;var numCookie=readCookie("ppq_num_designs");if(numCookie!=null){NumDesigns=parseInt(numCookie,10);hasPreviousDesigns=NumDesigns;for(i=0;i<NumDesigns;i++){var d=new Design();d.Retrieve(i);currentDesigns[i]=d;}}
else
NumDesigns=0;}
function AddToRecentDesigns(Combination,CategoryId,BackgroundId,ForegroundId,PlateSize1Id,PlateSize2Id,HasSeparator,DesignName,Price,Sizes,SizesWith,SizesWithout,SuitsFormats,Instructions)
{if(CategoryId!=36&&Combination!=""){var d=new Design(Combination,CategoryId,BackgroundId,ForegroundId,PlateSize1Id,PlateSize2Id,HasSeparator,DesignName,Price,Sizes,SizesWith,SizesWithout,SuitsFormats,Instructions)
d.FrontPlateSizeName=selectedFrontPlateSizeName;d.RearPlateSizeName=selectedRearPlateSizeName;if(selectedPlateSize1Id!=-1)
d.SizesSet=true;else
d.SizesSet=false;var blnAdd=true;var blnOverwrite=false;var idxOverwrite=-1;for(i=0;i<currentDesigns.length;i++)
{var oldDesign=currentDesigns[i];if(oldDesign.Combination==d.Combination&&oldDesign.CategoryId==d.CategoryId&&oldDesign.BackgroundId==d.BackgroundId&&oldDesign.ForegroundId==d.ForegroundId){if(oldDesign.SizesSet==false){idxOverwrite=i;blnOverwrite=true;blnAdd=false;i=currentDesigns.length;}}}
currentDesignId=d.DesignId;if(blnOverwrite==true)
currentDesigns[idxOverwrite]=d;if(blnAdd==true){if(currentDesigns.length>=12)
currentDesigns.shift();currentDesigns.push(d);}
hasPreviousDesigns=currentDesigns.length;}
StoreAllDesigns();}
function DrawRecentDesigns()
{var HTML="";var i;for(i=0;i<currentDesigns.length;i++)
{var Design=currentDesigns[i];var OnClick=" onclick=\"selectRecentDesignFromArray("+i+"); return false;\" ";HTML+="<li>";HTML+="<input type='checkbox' id='shareRecent"+i+"' name='shareRecent"+i+"' class='recentListCheckBox' />";HTML+="<img style=\"cursor:pointer; visibility:hidden;\" alt=\""+Design.Combination+"\" title=\""+Design.Combination+"\" "+OnClick+" src=\""+imageGenURL(Design.Combination,Design.BackgroundId,Design.ForegroundId,Design.CategoryId,Design.Size1Id)+"\" onload=\"this.origWidth=jQuery(this).width(); this.loaded=true;\" />";HTML+="</li>";}
var tgt=document.getElementById("recentList");if(tgt!=null){tgt.innerHTML=HTML;reProportionImages=setInterval("reSizeAndProportionImages(document.getElementById(\"recentList\"), 220);",300);}}
function selectRecentDesignFromArray(idx)
{var Design=currentDesigns[idx];DontOverwritebackground=true;selectedTab='design';ShowTabsBar();selectedPrice=Design.Price;selectedCategoryId=Design.CategoryId;SelectPlateCategory(Design.CategoryId,this,Design.SuitsFormats,Design.Instructions);SelectDesign(Design.BackgroundId,Design.ForegroundId,Design.CategoryId,Design.HasSeparator,Design.DesignName,Design.Price,Design.Sizes,Design.SizesWith,Design.SizesWithout);selectedCategoryName=Design.DesignName;selectedBackgroundId=Design.BackgroundId;selectedForegroundId=Design.ForegroundId;selectedPrice=Design.Price;selectedFormat=Design.SuitsFormats;if(Design.SizesSet==true){selectedPlateSize1Id=Design.Size1Id;selectedPlateSize2Id=Design.Size2Id;selectedFrontPlateSizeName=Design.FrontPlateSizeName;selectedRearPlateSizeName=Design.RearPlateSizeName;}
else{selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;selectedFrontPlateSizeName="";selectedRearPlateSizeName="";}
currentCombination=Design.Combination;panelMode_PlateDesign();ProceedToNextPage();}
function selectRecentDesign(Combination,BackgroundId,ForegroundId,CategoryId,HasSeparator,DesignName,Price,Sizes,SizesWith,SizesWithout,SuitsFormats,Instructions)
{DontOverwritebackground=true;selectedTab='design';ShowTabsBar();panelMode_PlateDesign();currentCombination=Combination;selectedCategoryId=CategoryId;selectedCategoryName=DesignName;selectedBackgroundId=BackgroundId;selectedForegroundId=ForegroundId;selectedPrice=Price;if(selectedPlateSize1Id!=-1&&Sizes.indexOf(selectedPlateSize1Id)==-1){selectedPlateSize1Id=-1;selectedPlateSize2Id=-1;}
SelectPlateCategory(CategoryId,this,SuitsFormats,Instructions);SelectDesign(BackgroundId,ForegroundId,CategoryId,HasSeparator,DesignName,Price,Sizes,SizesWith,SizesWithout);ProceedToNextPage();}
var BatchId=1;var BatchItemsAdded=0;function RecentPrint()
{BatchId=1;BatchItemsAdded=0;ItemsToAdd=0;HidePanel('#RecentPleaseSelect');ClearBatch(SessionId);for(i=0;i<currentDesigns.length;i++)
{var designCheckBox=document.getElementById("shareRecent"+i);if(designCheckBox!=null){if(designCheckBox.checked){var Design=currentDesigns[i];AddToBatch(SessionId,BatchId,Design.CategoryId,Design.BackgroundId,Design.ForegroundId,Design.Size1Id,Design.Combination);BatchId+=1;ItemsToAdd+=1;}}}
setTimeout("WaitTillFinishedPrint();",1000);}
function WaitTillFinishedPrint()
{if(ItemsToAdd==0)
ShowNoItems();else
PopupWindowScroll(printUrl(),'CapPrintRecent',650,450);}
function RecentEmail()
{BatchId=1;BatchItemsAdded=0;ItemsToAdd=0;HidePanel('#RecentPleaseSelect');ClearBatch(SessionId);for(i=0;i<currentDesigns.length;i++)
{var designCheckBox=document.getElementById("shareRecent"+i);if(designCheckBox!=null){if(designCheckBox.checked){var Design=currentDesigns[i];AddToBatch(SessionId,BatchId,Design.CategoryId,Design.BackgroundId,Design.ForegroundId,Design.Size1Id,Design.Combination);BatchId+=1;ItemsToAdd+=1;}}}
setTimeout("WaitTillFinishedEmail();",1000);}
function WaitTillFinishedEmail()
{if(ItemsToAdd==0)
ShowNoItems();else
PopupWindowScroll(emailUrl(),'CapEmailRecent',720,800);}
function ShowNoItems()
{ShowPanel('#RecentPleaseSelect');}
function ClearBatch(SessionId)
{jQuery.getJSON(baseWSurl()+"?o=clearbatch&si="+SessionId);}
function AddToBatch(SessionId,BatchId,CategoryId,BackgroundId,ForegroundId,Size1Id,Combination)
{jQuery.getJSON(baseWSurl()+"?o=addbatchentry&si="+SessionId+"&batch="+BatchId+"&category="+CategoryId+"&bi="+BackgroundId+"&fi="+ForegroundId+"&s1="+Size1Id+"&c="+Combination);}
﻿
var validationExcludeCategoryCheck=false;function CheckCurrentDesign()
{var blnValid=true;if((IsUpgrade&&isNaN(UpgradePrice))||(!IsUpgrade&&isNaN(selectedPrice)))
{blnValid=false;RecordException('Price IsNan');}
if(IsUpgrade&&UpgradePrice<0){blnValid=false;RecordException('Upgrade Price < 0');}
if(!IsUpgrade){if(selectedCategoryId>0&&!validationExcludeCategoryCheck){var PriceForCategory=-1,i;for(i=0;i<categoryPricing.length;i+=1)
if(categoryPricing[i][0]==selectedCategoryId)
PriceForCategory=categoryPricing[i][1];if(selectedCategoryId==10&&ComboFormat(currentCombination)=="3x2")
PriceForCategory=415;if(PriceForCategory!=-1)
if(PriceForCategory!=selectedPrice&&selectedPrice!="0.00"){blnValid=false;RecordException("Price didn't match category price");}}}
if(blnValid==false){alert(msgRestart);RestartDesign();}
return blnValid;}
function CheckFinalDesign()
{var blnValid=true;if(!IsUpgrade&&!validationExcludeCategoryCheck){if(selectedFormat=="1"||selectedFormat=="2"||selectedFormat=="3"||selectedFormat=="4"||selectedFormat=="5"||selectedFormat=="6"){if(selectedPrice<2000)
blnValid=false;}
else
if(selectedPrice>2000)
blnValid=false;if(selectedFormat=="QLLNNZ"&&selectedCategoryId!=12)
blnValid=false;if(ComboFormat(currentCombination)=="3x2"||ComboFormat(currentCombination)=="3x3")
if(!(selectedFormat=="3x2"||selectedFormat=="3x3"))
blnValid=false;if(ComboFormat(currentCombination)=="QLLNNZ")
if(!(selectedFormat=="QLLNNZ"))
blnValid=false;if(ComboFormat(currentCombination)=="1"||ComboFormat(currentCombination)=="2"||ComboFormat(currentCombination)=="3"||ComboFormat(currentCombination)=="4"||ComboFormat(currentCombination)=="5"||ComboFormat(currentCombination)=="6")
if(!(selectedFormat=="1"||selectedFormat=="2"||selectedFormat=="3"||selectedFormat=="4"||selectedFormat=="5"||selectedFormat=="6"))
blnValid=false;}
if(selectedCategoryName==null)
blnValid=false;if(blnValid==false){alert(msgRestart);RestartDesign();}
return blnValid;}