/* Author: Flavia Nascimento   Date: March 06, 2002   Developed for: Photo Features & Icruz Design*/// --------------------- inkJet Prints from Digital files ------------------------// PRICE LIST (1 to 5 cpies)// 6 to 10 copies is 10% less// 10 + copies is an extra 10% less// 5X7m5x7 = 7.50 // Mattew5x7 = 7.50 // water coloursg5x7 = 10.50 // Semi Glossyg5x7 = 12.75 // Glossy// 8x10m8x10 = 12.75 // Mattew8x10 = 12.75 // water coloursg8x10 = 15.00 // Semi Glossyg8x10 = 18.00 // Glossy// 11x14m11x14 = 25.00 // Mattew11x14 = 25.00 // water coloursg11x14 = 31.50 // Semi Glossyg11x14 = 35.00 // Glossy// 13x19m13x19 = 40.00 // Mattew13x19 = 40.00 // water coloursg13x19 = 45.50 // Semi Glossyg13x19 = 55.00 // Glossy// ------------------------------functionsfunction formatCurrency(num) {num = num.toString().replace(/\$|\,/g,'');if(isNaN(num)) num = "0";cents = Math.floor((num*100+0.5)%100);num = Math.floor((num*100+0.5)/100).toString();if(cents < 10) cents = "0" + cents;for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));return ("$" + num + "." + cents);}// end function ---------------------------// ------------------------------------ Is it A positive integer?function isInt(elm, size) {    if (elm.value >= 0 && elm.value <51 && elm.value !=""){    	return true    } else if (elm.value > 50){    	alert("For this amount, please contact us at (613) 729-9076, for a volume discount.")			elm.value = 0			elm.focus()		return false	}else{    	elm.focus();    	alert ("Please enter a numeric value for the quantity of digital files to be printed at " + size)    	elm.value = 0;    	elm.select();    	return false    }   } // end func ----------------------------------function validateQuant(total){ // prompt the user a message if all quantities is Zero 	if (total =="0" ){		alert("Please enter the number of digital files to be printed")		}else{}		}// end function// variables to hold the totaltotalInk1 = 0totalInk2 = 0totalInk3 = 0totalInk4 = 0theGrandTotalInk=0function clearVariablesInk(){totalInk1 = 0totalInk2 = 0totalInk3 = 0totalInk4 = 0theGrandTotalInk=0}// end funcfunction getPeparTypePrice(dropDown,pm,pw, psg, pg){var paperType = 0var uPrice = 0	//fras = -1	for (i=0; i<dropDown.length; i++){		if (dropDown.options[i].selected==true){		paperType= dropDown.options[i].value		}// end if							}// end loop			if (paperType=="m"){uPrice = pm;}			else if (paperType=="w"){uPrice = pw;}			else if (paperType=="sg"){uPrice = psg;}			else if (paperType=="g"){uPrice = pg;}	return uPrice;}// end funcfunction getPrice_ink(uPrice, quant){			if (quant >0 && quant < 6){		return (uPrice*quant);	}else if (quant >5 && quant < 11){		return ((uPrice*quant)*0.90);	}else if (quant >10 && quant < 51){		return (((uPrice*quant)*0.9)*0.9);	}else{		return 0;		}}// end func ---------------------function getPrice1_ink(){totalInk1 = getPrice_ink(getPeparTypePrice(document.frmInkjetPrints.ddmPaper1, m5x7, w5x7,sg5x7, g5x7), document.frmInkjetPrints.txtQuant1_ink.value)document.frmInkjetPrints.txtTotal1_ink.value = formatCurrency(totalInk1)}// end funcfunction getPrice2_ink(){totalInk2 = getPrice_ink(getPeparTypePrice(document.frmInkjetPrints.ddmPaper2, m8x10, w8x10,sg8x10, g8x10), document.frmInkjetPrints.txtQuant2_ink.value)document.frmInkjetPrints.txtTotal2_ink.value = formatCurrency(totalInk2)}// end funcfunction getPrice3_ink(){totalInk3 = getPrice_ink(getPeparTypePrice(document.frmInkjetPrints.ddmPaper3, m11x14, w11x14,sg11x14, g11x14), document.frmInkjetPrints.txtQuant3_ink.value)document.frmInkjetPrints.txtTotal3_ink.value = formatCurrency(totalInk3)}// end funcfunction getPrice4_ink(){totalInk4 = getPrice_ink(getPeparTypePrice(document.frmInkjetPrints.ddmPaper4,m13x19, w13x19, sg13x19, g13x19), document.frmInkjetPrints.txtQuant4_ink.value)document.frmInkjetPrints.txtTotal4_ink.value = formatCurrency(totalInk4)}// end funcfunction getGrandTotalInk(){theGrandTotalInk = totalInk1 + totalInk2 + totalInk3 + totalInk4;document.frmInkjetPrints.txtGrandTotal_ink.value = formatCurrency(theGrandTotalInk);document.frmInkjetPrints.txtGrandTotal3d_ink.value = formatCurrency(theGrandTotalInk*1.5);document.frmInkjetPrints.txtGrandTotal1d_ink.value = formatCurrency(theGrandTotalInk*2);}// end funcfunction getTotalsInk(){	clearVariablesInk();	if(isInt(document.frmInkjetPrints.txtQuant1_ink, "5x7 ")==false	|| isInt(document.frmInkjetPrints.txtQuant2_ink, "8x10 ")==false	|| isInt(document.frmInkjetPrints.txtQuant3_ink, "11x14 ")==false	|| isInt(document.frmInkjetPrints.txtQuant4_ink, "13x19 ")==false){	return false	}else{			getPrice1_ink();	getPrice2_ink();	getPrice3_ink();	getPrice4_ink();	getGrandTotalInk();	validateQuant(theGrandTotalInk);	}//end if}// end funct -----------------------