//set user info
function imCSetUserData() {
var sUserData = "";
for(var i = 0;i < document.imFormTableDat.elements.length; i++)
if (document.imFormTableDat.elements[i].name == "imTxtDat") {
var sItem = document.imFormTableDat.elements[i].value;
if(sItem == "")
sItem = " ";
sItem = sItem.split('"');
sItem = sItem.join('\'');
if(sUserData != "")
sUserData += "|" + sItem;
else
sUserData += sItem;
}
imSetCookie("imData",sUserData,imExpireDays);
imOpenLocation("imreport.html");
}
//get order info
function imCGetOrderData() {
var iTotal = 0;
var sCart = imGetCookie("imOrder");
var aCart = sCart.split("|");
var iShipmentType = imGetCookie("imShipment");
for(var i = 0;i < aCart.length;i++) {
aCartProd = aCart[i].split(":");
aProd = imCGetProduct(aCartProd[0],aCartProd[1]);
aCart[i] = aProd[2] + "::" + aProd[3] + (aProd[5] != 0 ? "::" + aProd[5][aCartProd[2]-1] : "") + "::" + imCFormat(aProd[4],true) + "::" + aCartProd[3] + "::" + imCFormat(aProd[4]*aCartProd[3],true);
iTotal += aProd[4]*aCartProd[3];
}
aCart[i] = imCShipment[iShipmentType][0] + "::" + imCFormat(imCShipment[iShipmentType][2],true);
aCart[i+1] = imLocale["Total"] + "::" + imCFormat(iTotal+Number(imCShipment[iShipmentType][2]),true);
if (imVAT != 0)
aCart[i+2] = imLocale["TotalVAT"] + " (" + imVAT + ")::" + imCFormat((iTotal+Number(imCShipment[iShipmentType][2]))*(1+(imVAT/100)),true);
sCart = aCart.join("||");
return sCart;
}
//get mail text
function imCGetOrderNo() {
var dToday = new Date(); //today
var sOrderNumber = (dToday.getFullYear() + "").substring(2,4) + (1+dToday.getMonth()) + dToday.getDate() + "-" + dToday.getHours() + dToday.getMinutes() + dToday.getSeconds();
imSetCookie("imOrderNumber",sOrderNumber,imExpireD ays);
sOrderNumber = imLocale["Order_No"] + ": " + sOrderNumber;
return sOrderNumber;
}
//Show order number
function imCShowOrderNo() {
var sBuf = "";
var sOrderNumber = imGetCookie("imOrderNumber");
sBuf = "<div id=\"imOrderID\">" + imLocale["Order_No"] + ": <b>" + sOrderNumber + "</b></div>";
document.write(sBuf);
}
//Show PayNow Button
function imCShowPayButton() {
//Show PayNow
var iTotal = 0;
var sCart = imGetCookie("imOrder");
var aCart = sCart.split("|");
var iShipmentType = imGetCookie("imShipment");
var sOrderNumber = imGetCookie("imOrderNumber");
for(var i = 0;i < aCart.length;i++) {
aCartProd = aCart[i].split(":");
aProd = imCGetProduct(aCartProd[0],aCartProd[1]);
iTotal += aProd[4]*aCartProd[3];
}
if (imPayLink != "" && imCShipment[iShipmentType][3] == 1) {
var sBuf = "";
var sPrice = "";
//Format total
sPrice = imCFormatVal((iTotal+Number(imCShipment[iShipmentType][2]))*(1+(imVAT/100)));
if (imPayMode == 0)
sPrice = escape(sPrice);
sBuf = imPayLink.replace(/\[PRICE]/, sPrice);
sBuf = sBuf.replace(/\[ORDER_NO]/, sOrderNumber);
if (imPayMode == 0) {
//Pay Pal
sBuf = "<p class=\"imAlign_center\"><input class=\"imCartButton\" type=\"button\" value=\""+imLocale["PayNow_Button"]+"\" onclick=\"imOpenLocation('" + sBuf + "')\" /></p>";
sBuf = imLocale["PayNow"] + sBuf + "<br />";
}
document.write(sBuf);
}
//Empty cookie
imSetCookie("imOrder","");
}
[/JS]
|