function resetTopLinks()
{
	document.getElementById("topHome").className='bluelinetop';
	document.getElementById("topHours").className='bluelinetop';
	document.getElementById("topPayment").className='bluelinetop';
	document.getElementById("topContact").className='bluelinetop';

	document.getElementById("bottomHome").className='bluelinetop';
	document.getElementById("bottomHours").className='bluelinetop';
	document.getElementById("bottomPayment").className='bluelinetop';
	document.getElementById("bottomContact").className='bluelinetop';
}
function setLinks(item)
{
	document.getElementById(item).className='whitelinetop';
}
function launchInRight(url, where)
{

	if (url=='Home')
	{
		document.getElementById("topHome").className='whitelinetop';
		document.getElementById("topHours").className='bluelinetop';
		document.getElementById("topPayment").className='bluelinetop';
		document.getElementById("topContact").className='bluelinetop';
		document.location="http://www.personalindulgence.net/php/BuildIndex.php";
	}
	if (url=='Login')
	{
		document.getElementById("topHome").className='bluelinetop';
		document.getElementById("topHours").className='bluelinetop';
		document.getElementById("topPayment").className='bluelinetop';
		document.getElementById("topContact").className='bluelinetop';
		document.location="http://www.personalindulgence.net/php/MenuLogin.php";
	}
	if (url=='Hours')
	{
		document.getElementById("topHome").className='bluelinetop';
		document.getElementById("topHours").className='whitelinetop';
		document.getElementById("topPayment").className='bluelinetop';
		document.getElementById("topContact").className='bluelinetop';
		document.location="http://www.personalindulgence.net/php/MenuHours.php";
	}
	if (url=='Payment')
	{
		document.getElementById("topHome").className='bluelinetop';
		document.getElementById("topHours").className='bluelinetop';
		document.getElementById("topPayment").className='whitelinetop';
		document.getElementById("topContact").className='bluelinetop';
		document.location="http://www.personalindulgence.net/php/MenuMethodOfPayment.php";
	}
	if (url=='Contact')
	{
		document.getElementById("topHome").className='bluelinetop';
		document.getElementById("topHours").className='bluelinetop';
		document.getElementById("topPayment").className='bluelinetop';
		document.getElementById("topContact").className='whitelinetop';
		window.open('mailto:Karen@personalindulgence.net','Contact','width=500,height=500');
	}
}
function showLongDesc(product)
{
	var url='http://www.personalindulgence.net/php/ProductLongDescPopup.php?Product='+product;
	window.open(url,'LongDesc','width=1000,height=500');
}
function checkIt(record)
{
	var box = eval("document.IndexForm.ItemId"+record);
	var count = eval("document.IndexForm.ItemAmt"+record);

	if (record==1)
	{
		document.location='https://www.personalindulgence.net/php/OrderGiftCertificate.php?List=Y';
		return;
	}
	
	if (box.checked == true)
	{
		count.disabled=false;
		count.value='1';
	}
	else
	{
		count.value='0';
		count.disabled=true;
	}				
}
function orderGift()
{
	window.open('https://www.personalindulgence.net/php/OrderGiftCertificate.php','Order','resizable=yes,toolbar=no,scrollbars=yes,location=yes,top=200,left=300,width=550,height=350');
}

function hyperlink(id)
{
	window.open(id,'site','resizable=yes,scrollbars=yes,location=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes,top=10,left=50');

}
function launchPDF(url)
{
	window.open(url,'Brochure','resizable=yes,width=800,height=500,,top=50,left=50');
}
function launch(url)
{
	url = 'http://'+url;
	window.open(url,'ProductSite','width=1000,height=500,resizable=1,scrollbars=1');
}	
function PlaceFooter(divname)
{
	var posTop = 0;
	var ContentSize= document.getElementById(divname).offsetHeight;
	var NavigationSize= document.getElementById('Navigation').offsetHeight;

	if (ContentSize > NavigationSize)
	{
		posTop = ContentSize + 248;
	}
	else
	{
		posTop = NavigationSize + 248;
	}

//Added the px after the numeric value because it is required for FireFox.
	posTop = posTop+"px";
	document.getElementById("Footer").style.top=posTop;
	document.getElementById("FooterImage").style.top=posTop;
	document.getElementById("Footer").style.visibility='visible';
	document.getElementById("FooterImage").style.visibility='visible';
}
function PlaceFooterExact(amt)
{
	var posTop = amt;
//Added the px after the numeric value because it is required for FireFox.
	posTop = posTop+"px";
	document.getElementById("Footer").style.top=posTop;
	document.getElementById("FooterImage").style.top=posTop;
	document.getElementById("Footer").style.visibility='visible';
	document.getElementById("FooterImage").style.visibility='visible';
}
function newsLetter(url)
{
	window.open(url,'NewsLetter','resizable=yes,width=1000,height=700,,top=0,left=10');
}
function order()
{
	document.location='http://www.personalindulgence.net/php/MenuOrderGiftCertificate.php';
}
function ProcessGift()
{
var totalPrice = document.GiftForm.TransactionCost.value;
totalPrice = parseInt(totalPrice);
var quantity = document.GiftForm.Quantity.value;
quantity = parseInt(quantity);

document.GiftForm.TransactionCost.value = totalPrice*quantity;
document.GiftForm.Quantity.value='001';

if (document.GiftForm.fromCheck.checked)
{
	document.GiftForm.SName.value = document.GiftForm.FromPerson.value;
}
else
{
	if (document.GiftForm.toCheck.checked)
	{
		document.GiftForm.SName.value = document.GiftForm.ToPerson.value;
	}
	else
	{
		document.GiftForm.SName.value = document.GiftForm.FromPerson.value;
	}
}
if (document.GiftForm.SAddress.value == "")
{
	document.GiftForm.SAddress.value = " ";
}
if (document.GiftForm.SCity.value == "")
{
	document.GiftForm.SCity.value = " ";
}
if (document.GiftForm.SZip.value == "")
{
	document.GiftForm.SZip.value = " ";
}

document.GiftForm.submit();

}
function checkGiftAmount()
{
	amountLen = document.GiftForm.Quantity.value.length;
	startLen = document.GiftForm.Quantity.value.length-1;
	if ((document.GiftForm.Quantity.value.substring(startLen,amountLen)<"0")||(document.GiftForm.Quantity.value.substring(startLen,amountLen)>"9"))
	{
		amountLen = amountLen - 1;
		document.GiftForm.Quantity.value = document.GiftForm.Quantity.value.substring(0,document.GiftForm.Quantity.value.length-1);
	}
}
function mailGiftTo()
{
	if (document.GiftForm.fromCheck.checked)
	{
		document.GiftForm.SName.value = document.GiftForm.FromPerson.value;
		document.getElementById('addressDiv').style.visibility='visible';
	}
	else
		if (document.GiftForm.toCheck.checked)
		{
			document.GiftForm.SName.value = document.GiftForm.ToPerson.value;
			document.getElementById('addressDiv').style.visibility='visible';
		}
		else
		{
			document.GiftForm.SName.value = document.GiftForm.FromPerson.value;
			document.getElementById('addressDiv').style.visibility='hidden';
		}
}
function countGiftNote()
{
	if (document.GiftForm.Note.value.length>40)
	{
		document.GiftForm.Note.value = document.GiftForm.Note.value.substring(0,40);
	}
	else
	{
		document.GiftForm.NoteCharLeft.value = 40 - document.GiftForm.Note.value.length; 
	}
	  
}
function checkPaymentType()
{
	var paymentType = document.OrderForm.PaymentType.value;
	if (paymentType=="COD")
	{
		document.all['CreditDiv'].style.visibility = 'hidden';
	}
	else
	{
		document.all['CreditDiv'].style.visibility = 'visible';
	}
}
function moveName()
{
	document.OrderForm.BName.value = document.OrderForm.NameOnCard.value;
}
function ProcessEntry()
{
	document.OrderForm.TransactionCost.value = document.OrderListForm.TotalCost.value;
	document.OrderForm.ExpireDate.value = document.OrderForm.ExpireMonth.value + document.OrderForm.ExpireYear.value;
	var paymentType = document.OrderForm.PaymentType.value;

	var error = "N";
	
	if (document.OrderForm.PaymentType[0].checked)
	{
		paymentType = document.OrderForm.PaymentType[0].value;
	}
	else
	{
		if (document.OrderForm.PaymentType[1].checked)
		{
			paymentType = document.OrderForm.PaymentType[1].value;
		}
		else
		{
			if (document.OrderForm.PaymentType[2].checked)
			{
				paymentType = document.OrderForm.PaymentType[2].value;
			}
			else
			{
				if (document.OrderForm.PaymentType[3].checked)
				{
					paymentType = document.OrderForm.PaymentType[3].value;
				}
				else
				{
					alert("You must select Payment Type");
					error = "Y";
				}
			}
		}
	}
		
	if (document.OrderForm.TransactionCost.value<1)
	{
		alert("You have no transaction to purchase");
		error = "Y";
	}
	
	if (paymentType!="COD")
	{
		if (error=="N")
		{
			temp1 = document.OrderForm.CardNumber.value;
			tempLength = temp1.length;
			if (tempLength<16)
			{
				alert("Please enter valid credit card number");
				error = "Y"
			}
			if (tempLength>16)
			{
				alert("Please enter valid credit card number");
				error = "Y"
			}
		}
	
		if (error=="N")
		{
			temp1 = document.OrderForm.NameOnCard.value;
			tempLength = temp1.length;
			if (tempLength<6)
			{
				alert("Please enter valid name on credit card");
				error = "Y"
			}
			document.OrderForm.BName.value = document.OrderForm.NameOnCard.value;
		}
	}
	else
	{
		if (error=="N")
		{
			temp1 = document.OrderForm.BName.value;
			tempLength = temp1.length;
			if (tempLength<6)
			{
				alert("Please enter valid name");
				error = "Y"
			}
		}
}
	
	if (error=="N")
	{
		temp1 = document.OrderForm.BAddress.value;
		tempLength = temp1.length;
		if (tempLength<6)
		{
			alert("Please enter valid Billing address");
			error = "Y"
		}
	}

	if (error=="N")
	{
		temp1 = document.OrderForm.BCity.value;
		tempLength = temp1.length;
		if (tempLength<4)
		{
			alert("Please enter valid City for Billing");
			error = "Y"
		}
	}

	if (error=="N")
	{
		temp1 = document.OrderForm.BZip.value;
		tempLength = temp1.length;
		if (tempLength<5)
		{
			alert("Please enter valid Zip code for Billing");
			error = "Y"
		}
	}

	if (error=="N")
	{
		document.OrderForm.submit();
	}
}
function removeItem(transaction, customer)
{
	url = "DeleteTransaction.php?RemoveItem="+transaction+"&CustomerNumber="+customer;
	document.location=url;
}
function showItemDetails(transaction, customer)
{
	url = "ViewTransaction.php?TransactionNumber="+transaction+"&CustomerNumber="+customer;
	window.open(url,'Details','resizable=yes,toolbar=no,scrollbars=no,location=no,top=200,left=300,width=450,height=250');
}
function showCredit()
{
		document.getElementById('CreditDiv').style.visibility = 'visible';
}
function hideCredit()
{
		document.getElementById('CreditDiv').style.visibility = 'hidden';
}
function webmaster()
{
	document.location="http://www.graphicdesignsunlimited.net";
}
function newCustomer()
{
	document.location='https://www.personalindulgence.net/php/MenuNewCustomer.php';
}
function processNewCust()
{
	document.form1.submit();
}
function getkey(e)
{
if (window.event)
   return window.event.keyCode;
else if (e)
   return e.which;
else
   return null;
}
function checkKey(e)
{
	var key = getkey(e);
	if (key == null) return true;

	var keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	
	if (key==32)
	{
		return false;
	}
	else
	{
		return true;
	}
}
function ShowType(type, typeId, typeNo)
{
	document.getElementById(typeId).className = 'goldline';
	var url = "ProductPage.php?Type="+type+"&TypeInList="+typeNo;
	document.location=url;
}

