/* Author: Flavia Nascimento   Date: March 13, 2002   Developed for: Photo Features & Icruz Design*///-------------  internegatives -------------------------------------// constants... price list... to facilitate the price list update...bw_neg1= 12.65bw_neg2to20 = 9.10bw_neg21to50 = 8.75col_neg1= 18.15col_neg2to20= 15.40col_neg21to50= 14.75	function 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 " + size + " to be processed")    	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 negatives to be processed")		}else{}		}// end function// ----------------------------------------------------------------------------//------------------------------------------// variables declaration to hold the totals ---------------------------theGrandTotal_intn= 0total1_intn_intn=0total2_intn=0// -------------------- FUNCTIONS -----------------------------function clearVariables_intn(){  // to empity the variables// it is called on reset and on calculatetheGrandTotal_intn= 0total1_intn=0total2_intn=0}// end func ---------------------------------------function getPrice_inten(Q, p1,p2,p3){  // gets the total of B&W negative// the conditional stmt is because the price depends on the quantity		if (Q >=0 && Q<2){ 			return (p1 * Q);		}else if (Q > 1 && Q < 21){			return (p2 * Q);		}else if (Q > 20 && Q < 51){			return (p3 * Q);		}else{		  return 0;		}// end if				} // end func ------------------------------------function getPrice1_intn(){  // gets the total of col negative	total1_intn= getPrice_inten(eval(document.frmInternegatives.txtQuant1.value), bw_neg1, 	bw_neg2to20, bw_neg21to50);			document.frmInternegatives.txtTotal1.value = formatCurrency(total1_intn);					} // end func ------------------------------------function getPrice2_intn(){  // gets the total of col negative	total2_intn= getPrice_inten(eval(document.frmInternegatives.txtQuant2.value), col_neg1, 	col_neg2to20, col_neg21to50);			document.frmInternegatives.txtTotal2.value = formatCurrency(total2_intn);					} // end func ------------------------------------function minimumValue(grandTo){	if (grandTo < 25.00){	alert ("The minimum Order for this services is $ 25.00");		}else{	// procede		}}// end funcfunction gettheGrandTotal_intn(){ // adds up all  totalstheGrandTotal_intn = total1_intn + total2_intn;document.frmInternegatives.txtGrandTotal.value = formatCurrency(theGrandTotal_intn);document.frmInternegatives.txtGrandTotal2d.value = formatCurrency(theGrandTotal_intn * 1.50);document.frmInternegatives.txtGrandTotal1d.value = formatCurrency(theGrandTotal_intn * 2);}// end func ---------------------------------------------------function getTotals_intn(){ // call the functions to get each total// it is called by the "calculate" Botton// validates the quantity entryclearVariables_intn() // clear old valuesif(isInt(document.frmInternegatives.txtQuant1, "B&W Negative ")==false|| isInt(document.frmInternegatives.txtQuant2, "Colour Negative ")==false){return false}else{getPrice1_intn();getPrice2_intn(); gettheGrandTotal_intn();minimumValue(theGrandTotal_intn);}//end if//validateQuant(theGrandTotal_intn)}// end func -----------------------------//--------------------------------------------------------------