// JavaScript Document

if (document.images)
{
	
	homeoff=new Image();
	homeoff.src="img/l-nav-home-on.gif";
	mktadoff=new Image();
	mktadoff.src="img/l-nav-mktad-on.gif";
	opservoff=new Image();
	opservoff.src="img/l-nav-opserv-on.gif";
	galleryoff=new Image();
	galleryoff.src="img/l-nav-gallery-on.gif";
	contactoff=new Image();
	contactoff.src="img/l-nav-contact-on.gif";
}
	

function isI(img_name) {
imgOff=eval(img_name + "off.src");
document[img_name].src=imgOff;
}

function isO(img_name) {
document[img_name].src="img/l-nav-"+img_name+"-off.gif";
}

function setCookie(cookieName,cookieValue,nHours) {
 var today = new Date();
 var expire = new Date();
 if (nHours==null || nHours==0) nHours=1;
 expire.setTime(today.getTime() + 3600000*nHours);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/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 (((sign)?'':'-') + '$' + num + '.' + cents);
}
function calculateTax(){
		$shirtQuan = parseInt(document.getElementById("shirtQuanW").value) ;
		$shirtQuan2 = parseInt(document.getElementById("shirtQuanN").value);
		$stickerQuan = parseInt(document.getElementById("stickerQuanW").value);
		$stickerQuan2 = parseInt(document.getElementById("stickerQuanN").value);
		$total = 0;
		
		if(!isNaN($shirtQuan)) $total += $shirtQuan*15;
		if(!isNaN($shirtQuan2)) $total += $shirtQuan2*15;
		if(!isNaN($stickerQuan)) $total += $stickerQuan*.5;
		if(!isNaN($stickerQuan2)) $total += $stickerQuan2*.5;
		
		
		$shirtSubtot = ($shirtQuan*15);
		$stickerSubtot = ($stickerQuan*.5);
		$subTot = $total; //($shirtSubtot + $stickerSubtot);
		$taxes = formatCurrency($subTot *.08);
		$total = formatCurrency($subTot *1.08);
		
		document.getElementById("subTotal").innerHTML = "Sub-total: "+formatCurrency($subTot);
		document.getElementById("taxes").innerHTML = "<u>Taxes:</u> "+$taxes;
		document.getElementById("total").innerHTML = "<strong>Total: </strong>"+$total;
}

function chHTML(element,txt){
	document.getElementById(element).innerHTML =txt;	
}
function disable(element){
	document.getElementById(element).disabled='disabled';	
}
function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete this?")) {
    document.location = delUrl;
  }
}