email1="Motown Sound <";
email2="info";
email3="rmat";
email4="ion@";
email5="motownsound.co.uk";
email6=">";
// *****************************************************************************************************
// **************************************** Postage Calculations *****************************************
// *****************************************************************************************************
var contactName = "Mick Holdsworth"; var contactdetailsTXT = contactName + "\n" + "76 The Lindens" + "\n" + "Wolverhampton" + "\n" + "West Midlands" + "\n" + "WV6 0LS" + "\n" + "United Kingdom" + "\n" + "Tel: 01902 744457";
var contactdetailsHTML = contactName + "
" + "76 The Lindens" + "
" + "Wolverhampton" + "
" + "West Midlands" + "
" + "WV6 0LS" + "
" + "United Kingdom" + "
" + "Tel: 01902 744457";
function InitialSelection() {
FullOrderDescriptionTXT="";
FullOrderDescriptionHTML="";
FullItemNumber="";
ExtraItemNumber="None";
ExtraItemNumberHeader = "Additional Item Numbers";
var sel = document.getElementById("InitialSelect").value;
coccod="";
if (sel=="None") { SelctdCountry="None";SelctdService="None";FullItemNumber=FullOrderDescriptionTXT=FullOrderDescriptionHTML="";}
if (sel=="UK1") { SelctdCountry="UK";SelctdService="Standard"; }
if (sel=="UK2") { SelctdCountry="UK";SelctdService="Signed For"; }
if (sel=="UK3") { SelctdCountry="UK";SelctdService="Special Delivery"; }
if (sel=="UK4") { SelctdCountry="UK";SelctdService="Collect In Person"; coccod="COD";}
if (sel=="EU1") { SelctdCountry="EU";SelctdService="Standard"; }
if (sel=="EU2") { SelctdCountry="EU";SelctdService="Tracked and Signed"; }
if (sel=="USA1") { SelctdCountry="USA";SelctdService="Standard"; }
if (sel=="USA2") { SelctdCountry="USA";SelctdService="Tracked and Signed"; }
if (sel=="AUS1") { SelctdCountry="AUS";SelctdService="Standard"; }
if (sel=="AUS2") { SelctdCountry="AUS";SelctdService="Tracked and Signed"; }
if (sel=="WW1") { SelctdCountry="WW";SelctdService="Standard"; }
if (sel=="WW2") { SelctdCountry="WW";SelctdService="Tracked and Signed"; }
if (SelctdCountry=="UK") { SelctdCountryDesc="Delivery within the United Kingdom"; }
if (SelctdCountry=="EU") { SelctdCountryDesc="Delivery within the European Union"; }
if (SelctdCountry=="USA") { SelctdCountryDesc="Delivery within the United States"; }
if (SelctdCountry=="AUS") { SelctdCountryDesc="Delivery within Australasia"; }
if (SelctdCountry=="WW") { SelctdCountryDesc="Delivery to a Worldwide Destination"; }
document.getElementById("Postage").innerHTML ="";
if(SelctdCountry!="None") {
getcartdata(SelctdCountry, SelctdService);
if(itemtext != undefined || itemtext != null) {
document.getElementById("Postage").innerHTML = startspan + SelctdCountryDesc + " - " + SelctdService + " - £" + PostValue + "
" + "Order Total (Including Postage As Above) - £" + TotalCost + "";
if(SelctdService=="Collect In Person") {
document.getElementById("Postage").innerHTML = startspan + "Order Total - £" + TotalCost + "
" + "Collect in Person from the following address ..." + "
" + contactdetailsHTML + "
" + "email: " + email2 + email3 + email4 + email5 + "";
}
}
}
} // end of function InitialSelection()
function calculateformattotals() {
if (ThisFormt == "7 Inch" || ThisFormt == "EP") {Total7Inch = eval(Total7Inch)+eval(ThisQty);}
if (ThisFormt == "Double 7" || ThisFormt == "Double EP") {Total7Inch = eval(Total7Inch)+eval(ThisQty*2);}
if (ThisFormt == "Triple 7" || ThisFormt == "EPx3") {Total7Inch = eval(Total7Inch)+eval(ThisQty*3);}
if (ThisFormt == "7x4" || ThisFormt == "EPx4") {Total7Inch = eval(Total7Inch)+eval(ThisQty*4);}
if (ThisFormt == "Box Set A") {Total7Inch = eval(Total7Inch)+eval(ThisQty*5);} // Box Set A is about 5 discs
if (ThisFormt == "Box Set B") {Total7Inch = eval(Total7Inch)+eval(ThisQty*10);} // Box Set B is about 10 discs
if (ThisFormt == "Box Set C") {Total7Inch = eval(Total7Inch)+eval(ThisQty*15);} // Box Set C is about 15 discs
if (ThisFormt == "Box Set D") {Total7Inch = eval(Total7Inch)+eval(ThisQty*20);} // Box Set D is about 20 discs
if (ThisFormt == "CDA" || ThisFormt == "CDS") {TotalCD = eval(TotalCD)+eval(ThisQty);}
if (ThisFormt == "Double CD") {TotalCD = eval(TotalCD)+eval(ThisQty);}
if (ThisFormt == "Triple CD") {TotalCD = eval(TotalCD)+eval(ThisQty*2);}
if (ThisFormt == "CDx4" || ThisFormt == "CDx4") {TotalCD = eval(TotalCD)+eval(ThisQty*4);}
if (ThisFormt == "CD Box Set") {TotalCD = eval(TotalCD)+eval(ThisQty*5);}
if (ThisFormt == "8 Inch" || ThisFormt == "10 Inch" || ThisFormt == "12 Inch" || ThisFormt == "LP") {Total12Inch = eval(Total12Inch)+eval(ThisQty);}
if (ThisFormt == "Double 12" || ThisFormt == "Double LP") {Total12Inch = eval(Total12Inch)+eval(ThisQty*2);}
if (ThisFormt == "Triple 12" || ThisFormt == "Triple LP") {Total12Inch = eval(Total12Inch)+eval(ThisQty*3);}
if (ThisFormt == "12x4" || ThisFormt == "LPx4") {Total12Inch = eval(Total12Inch)+eval(ThisQty*4);}
if (ThisFormt == "12 Box Set" || ThisFormt == "LP Box Set") {Total12Inch = eval(Total12Inch)+eval(ThisQty*5);}
} // end of function calculateformattotals()
function calculateprimaryitem() {
if(PostCountry=="UK")
{
Allowance12Inch = AllowanceUK10;
AllowanceCD = AllowanceUK06;
Allowance7Inch = AllowanceUK04;
}
if(PostCountry=="EU")
{
Allowance12Inch = AllowanceEU10;
AllowanceCD = AllowanceEU06;
Allowance7Inch = AllowanceEU04;
}
if(PostCountry=="USA")
{
Allowance12Inch = AllowanceUSA10;
AllowanceCD = AllowanceUSA06;
Allowance7Inch = AllowanceUSA04;
}
if(PostCountry=="AUS")
{
Allowance12Inch = AllowanceAUS10;
AllowanceCD = AllowanceAUS06;
Allowance7Inch = AllowanceAUS04;
}
if(PostCountry=="WW")
{
Allowance12Inch = AllowanceWW10;
AllowanceCD = AllowanceWW06;
Allowance7Inch = AllowanceWW04;
}
Remaining12=Remaining7=RemainingCD=RemainingAllowance12=RemainingAllowance7=RemainingAllowanceCD=0;
PrimaryItem="None";
if(Total7Inch>0) { PrimaryItem="Seven"; }
if(TotalCD>0) { PrimaryItem="CD"; }
if(Total12Inch>0) { PrimaryItem="Twelve"; }
if(PrimaryItem=="Twelve") {
Remaining12 = eval(Total12Inch) - eval(Allowance12Inch);
RemainingAllowance12 = eval(Allowance12Inch) - eval(Total12Inch);
if(RemainingAllowance12<0) { RemainingAllowance12=0;}
if(Remaining12<0) { Remaining12=0;}
Remaining7=0;
Total7Inch = eval(Total7Inch) + eval(TotalCD); TotalCD=0;
if(Total7Inch>0 && RemainingAllowance12>0) {
Remaining7 = eval(Total7Inch)-eval(RemainingAllowance12);
if(Remaining7<0) { Remaining7=0;}
}
else {
Remaining7=eval(Total7Inch);
}
}
if(PrimaryItem=="CD") {
RemainingCD = eval(TotalCD) - eval(AllowanceCD);
RemainingAllowanceCD = eval(AllowanceCD) - eval(TotalCD);
if(RemainingAllowanceCD<0) { RemainingAllowanceCD=0;}
if(RemainingCD<0) { RemainingCD=0;}
Remaining7=0;
if(Total7Inch>0 && RemainingAllowanceCD>0) {
Remaining7 = eval(Total7Inch)-eval(RemainingAllowanceCD);
if(Remaining7<0) { Remaining7=0;}
}
else {
Remaining7=eval(Total7Inch);
}
}
if(PrimaryItem=="Seven") {
Remaining7 = eval(Total7Inch) - eval(Allowance7Inch);
if(Remaining7<0) { Remaining7=0;}
}
} // end of function calculateprimaryitem()
function calculatepost() {
if(PostCountry=="UK") {
PostValuePrimary04=PostValuePrimaryUK04;
PostValueSecondary04=PostValueSecondaryUK04;
GroupRange04=GroupRangeUK04;
GroupRangeStart04=GroupRangeStartUK04;
GroupRangeEnd04=GroupRangeEndUK04;
GroupRangeValue04=GroupRangeValueUK04 ;
PostValuePrimary06=PostValuePrimaryUK06;
PostValueSecondary06=PostValueSecondaryUK06;
GroupRange06=GroupRangeUK06;
GroupRangeStart06=GroupRangeStartUK06;
GroupRangeEnd06=GroupRangeEndUK06;
GroupRangeValue06=GroupRangeValueUK06 ;
PostValuePrimary10=PostValuePrimaryUK10;
PostValueSecondary10=PostValueSecondaryUK10;
GroupRange10=GroupRangeUK10;
GroupRangeStart10=GroupRangeStartUK10;
GroupRangeEnd10=GroupRangeEndUK10;
GroupRangeValue10=GroupRangeValueUK10 ;
}
if(PostCountry=="EU") {
PostValuePrimary04=PostValuePrimaryEU04;
PostValueSecondary04=PostValueSecondaryEU04;
GroupRange04=GroupRangeEU04;
GroupRangeStart04=GroupRangeStartEU04;
GroupRangeEnd04=GroupRangeEndEU04;
GroupRangeValue04=GroupRangeValueEU04 ;
PostValuePrimary06=PostValuePrimaryEU06;
PostValueSecondary06=PostValueSecondaryEU06;
GroupRange06=GroupRangeEU06;
GroupRangeStart06=GroupRangeStartEU06;
GroupRangeEnd06=GroupRangeEndEU06;
GroupRangeValue06=GroupRangeValueEU06 ;
PostValuePrimary10=PostValuePrimaryEU10;
PostValueSecondary10=PostValueSecondaryEU10;
GroupRange10=GroupRangeEU10;
GroupRangeStart10=GroupRangeStartEU10;
GroupRangeEnd10=GroupRangeEndEU10;
GroupRangeValue10=GroupRangeValueEU10 ;
}
if(PostCountry=="WW") {
PostValuePrimary04=PostValuePrimaryWW04;
PostValueSecondary04=PostValueSecondaryWW04;
GroupRange04=GroupRangeWW04;
GroupRangeStart04=GroupRangeStartWW04;
GroupRangeEnd04=GroupRangeEndWW04;
GroupRangeValue04=GroupRangeValueWW04 ;
PostValuePrimary06=PostValuePrimaryWW06;
PostValueSecondary06=PostValueSecondaryWW06;
GroupRange06=GroupRangeWW06;
GroupRangeStart06=GroupRangeStartWW06;
GroupRangeEnd06=GroupRangeEndWW06;
GroupRangeValue06=GroupRangeValueWW06 ;
PostValuePrimary10=PostValuePrimaryWW10;
PostValueSecondary10=PostValueSecondaryWW10;
GroupRange10=GroupRangeWW10;
GroupRangeStart10=GroupRangeStartWW10;
GroupRangeEnd10=GroupRangeEndWW10;
GroupRangeValue10=GroupRangeValueWW10 ;
}
if(PostCountry=="USA") {
PostValuePrimary04=PostValuePrimaryUSA04;
PostValueSecondary04=PostValueSecondaryUSA04;
GroupRange04=GroupRangeUSA04;
GroupRangeStart04=GroupRangeStartUSA04;
GroupRangeEnd04=GroupRangeEndUSA04;
GroupRangeValue04=GroupRangeValueUSA04 ;
PostValuePrimary06=PostValuePrimaryUSA06;
PostValueSecondary06=PostValueSecondaryUSA06;
GroupRange06=GroupRangeUSA06;
GroupRangeStart06=GroupRangeStartUSA06;
GroupRangeEnd06=GroupRangeEndUSA06;
GroupRangeValue06=GroupRangeValueUSA06 ;
PostValuePrimary10=PostValuePrimaryUSA10;
PostValueSecondary10=PostValueSecondaryUSA10;
GroupRange10=GroupRangeUSA10;
GroupRangeStart10=GroupRangeStartUSA10;
GroupRangeEnd10=GroupRangeEndUSA10;
GroupRangeValue10=GroupRangeValueUSA10 ;
}
if(PostCountry=="AUS") {
PostValuePrimary04=PostValuePrimaryAUS04;
PostValueSecondary04=PostValueSecondaryAUS04;
GroupRange04=GroupRangeAUS04;
GroupRangeStart04=GroupRangeStartAUS04;
GroupRangeEnd04=GroupRangeEndAUS04;
GroupRangeValue04=GroupRangeValueAUS04 ;
PostValuePrimary06=PostValuePrimaryAUS06;
PostValueSecondary06=PostValueSecondaryAUS06;
GroupRange06=GroupRangeAUS06;
GroupRangeStart06=GroupRangeStartAUS06;
GroupRangeEnd06=GroupRangeEndAUS06;
GroupRangeValue06=GroupRangeValueAUS06 ;
PostValuePrimary10=PostValuePrimaryAUS10;
PostValueSecondary10=PostValueSecondaryAUS10;
GroupRange10=GroupRangeAUS10;
GroupRangeStart10=GroupRangeStartAUS10;
GroupRangeEnd10=GroupRangeEndAUS10;
GroupRangeValue10=GroupRangeValueAUS10 ;
}
if(PrimaryItem=="Twelve") {
PostValue = eval(PostValuePrimary10) + (eval(PostValueSecondary10)*eval(Remaining12)) + (eval(PostValueSecondary06)*eval(RemainingCD)) + (eval(PostValueSecondary04)*eval(Remaining7));
if(GroupRange10=="Y") {
Total12CD7 = eval(Total12Inch) + eval(Total7Inch) + eval(TotalCD);
Total12CD7Modified = Math.round( eval(Total7Inch) / 3 ) + Math.round( eval(TotalCD) / 2 ) + eval(Total12Inch);
if(Total12CD7>=GroupRangeStart10) {
PostValue=GroupRangeValue10;
NewRemaining12CD7=0;
NewRemaining12CD7=eval(Total12CD7Modified)-eval(GroupRangeEnd10);
if(NewRemaining12CD7<0) { NewRemaining12CD7=0;}
PostValue=eval(PostValue) + ( eval(NewRemaining12CD7)*eval(PostValueSecondary10) );
}
}
}
if(PrimaryItem=="CD") {
PostValue = eval(PostValuePrimary06) + (eval(PostValueSecondary06)*eval(RemainingCD)) + (eval(PostValueSecondary04)*eval(Remaining7));
if(GroupRange06=="Y") {
TotalCD7 = eval(Total7Inch) + eval(TotalCD);
TotalCD7Modified = Math.round( eval(Total7Inch) / 2 ) + eval(TotalCD);
if(TotalCD7>=GroupRangeStart06) {
PostValue=GroupRangeValue06;
NewRemainingCD7=0;
NewRemainingCD7=eval(TotalCD7Modified)-eval(GroupRangeEnd06);
if(NewRemainingCD7<0) { NewRemainingCD7=0;}
PostValue=eval(PostValue) + ( eval(NewRemainingCD7)*eval(PostValueSecondary06) );
}
}
}
if(PrimaryItem=="Seven") {
PostValue = eval(PostValuePrimary04) + (eval(PostValueSecondary04)*eval(Remaining7));
if(GroupRange04=="Y") {
if(Total7Inch>=GroupRangeStart04) {
PostValue=GroupRangeValue04;
NewRemaining7=0;
NewRemaining7=eval(Total7Inch)-eval(GroupRangeEnd04);
if(NewRemaining7<0) { NewRemaining7=0;}
PostValue=eval(PostValue) + ( eval(NewRemaining7)*eval(PostValueSecondary04) );
}
}
}
} // end of function calculatepost()
function calculateordervalues() {
OrderValue = eval(OrderValue)+(eval(ThisPric)*eval(ThisQty));
} // end of function calculateordervalues()
function calculateorderdescription() {
if(ThisQty<=1)
{
OrderDescriptionTXT = OrderDescriptionTXT + ThisItmNo + ": " + ThisDesc + " - " + ThisFormt + " - £" + ThisPric + " \n";
OrderDescriptionHTML = OrderDescriptionHTML + "" + ThisItmNo + ": " + ThisDesc + " - " + ThisFormt + " £" + ThisPric + "
";
if(Items<=8) {
FullItemNumber=FullItemNumber + ThisItmNo + " / ";
}
else
{
if(Items==9) { ExtraItemNumber=""; }
ExtraItemNumber=ExtraItemNumber + ThisItmNo + " / ";
}
}
else
{
ThisPricXQty=ThisPricXQty.toFixed(2) // converts to 2 decimal places
OrderDescriptionTXT = OrderDescriptionTXT + ThisItmNo + ": " + ThisDesc + " - " + ThisFormt + " - £" + ThisPric + " (x " + ThisQty + ") = £" + ThisPricXQty + " \n";
OrderDescriptionHTML = OrderDescriptionHTML + "" + ThisItmNo + ": " + ThisDesc + " - " + ThisFormt + " £" + ThisPric + " (x " + ThisQty + ") = £" + ThisPricXQty + "
";
if(Items<=8) {
FullItemNumber=FullItemNumber + ThisItmNo + " x " + ThisQty + " / ";
}
else
{
if(Items==9) { ExtraItemNumber=""; }
ExtraItemNumber=ExtraItemNumber + ThisItmNo + " x " + ThisQty + " / ";
}
}
} // end of function calculateorderdescription()
function calculatepackageweight() {
ItemsWeight=eval(Total12Inch*ItemWeight10)+eval(TotalCD*ItemWeight06)+eval(Total7Inch*ItemWeight04);
if(PrimaryItem=="Twelve") { TotalWeight=eval(ItemsWeight)+eval(PackageWeight10); }
if(PrimaryItem=="CD") { TotalWeight=eval(ItemsWeight)+eval(PackageWeight06); }
if(PrimaryItem=="Seven") { TotalWeight=eval(ItemsWeight)+eval(PackageWeight04); }
} // end of function calculatepackageweight()
function calculateinsuranceUKSD() {
PostValueSpecialDeliveryUKCat=PostValueSpecialDeliveryUKCat5;
if(TotalWeight<=ItemWeightValueSpecialDeliveryCat4) { PostValueSpecialDeliveryUKCat=PostValueSpecialDeliveryUKCat4; }
if(TotalWeight<=ItemWeightValueSpecialDeliveryCat3) { PostValueSpecialDeliveryUKCat=PostValueSpecialDeliveryUKCat3; }
if(TotalWeight<=ItemWeightValueSpecialDeliveryCat2) { PostValueSpecialDeliveryUKCat=PostValueSpecialDeliveryUKCat2; }
PostValue=PostValueSpecialDeliveryUKCat;
if (OrderValue<=UKSDValue1) { PostValue = eval(PostValue)+eval(UKSDExtra1); }
if (OrderValue>UKSDValue1 && OrderValue<=UKSDValue2) { PostValue = eval(PostValue)+eval(UKSDExtra2); }
if (OrderValue>UKSDValue2) { PostValue = eval(PostValue)+eval(UKSDExtra3); }
} // end of function calculateinsuranceUKSD()
function calculateinsuranceITS() {
if (OrderValue<=InternationalSIV) { PostValue = eval(PostValue)+eval(PostValueITS1); }
if (OrderValue>InternationalSIV) { PostValue = eval(PostValue)+eval(PostValueITS2); }
} // end of function calculateinsuranceITS()
function getcartdata(selectedcountry, selectedservice) {
PostCountry=selectedcountry;
PostService=selectedservice;
itemtext="";
PrimaryItem="";
OrderDescriptionTXT="";
OrderDescriptionHTML="";
FullItemNumber="";
OrderValue=0;PostValue=0;
Secondary12Inch=SecondaryCD=Secondary7Inch=Total7Inch=TotalCD=Total12Inch=0;
TotalWeight=0;
var str = document.getElementById("justcartdata").innerHTML;
var res = str.replace('|||