// JavaScript Document for running the wedding reservation form
function getPhotoPkgPrice() 
{
    var PhotoPkgLevel 	= document.wedding.PhotoPkgLevel.value;
	var PhotoPrice		= 0;

	window.document.wedding.PhotoPrice.value=PhotoPrice;

	for (var i=0; i < document.wedding.PhotoPkg.length; i++)
   		if (document.wedding.PhotoPkg[i].checked && document.wedding.PhotoPkg[i].value!="")
	  		{
		  	var PhotoPkg = document.wedding.PhotoPkg[i].value;
	  		}

	if (PhotoPkg!="" && PhotoPkgLevel!="")
	{
		var LocationRequired = true
		switch  (PhotoPkg)
		{
			case	"quartzPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							var PhotoPrice = 299.00;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							var PhotoPrice = 599.00;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							var PhotoPrice = 799.00;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							var PhotoPrice = 999.00;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
				break;
			case	"crystalPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 399;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 699;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
								PhotoPrice = 999;
								window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
								PhotoPrice = 1199;
								window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							ShowDivs("PremierPlus");
							break;
				}	
				break;
			
			case	"topazPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 499;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 799;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							PhotoPrice = 1099;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							PhotoPrice = 1299;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
					break;
			
			case	"pearlPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 599;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 999;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							PhotoPrice = 1299;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							PhotoPrice = 1499;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
					break;

			case	"sapphirePhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 699;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 1199;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							PhotoPrice = 1499;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							PhotoPrice = 1699;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
				break;
				
		case	"emeraldPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 799;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 1399;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							PhotoPrice = 1799;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							var PhotoPrice = 1999;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
				break;
				
		case	"diamondPhoto":
				switch	(PhotoPkgLevel)
				{
					case	"Basic":
							PhotoPrice = 999;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Deluxe":
							PhotoPrice = 2499;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							break;
					case	"Premier":
							PhotoPrice = 2999;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("Premier");
							break;
					case	"PremierPlus":
							PhotoPrice = 3100;
							window.document.wedding.PhotoPrice.value="$ " + PhotoPrice.toFixed(2);
							HideDivs();
							ShowDivs("PremierPlus");
							break;
				}
				break;
		}
     }
	getPhotoCD();
	calcPmt();
}


<!-- ******************************************************************************************************** -->
function getVideoPkgPrice() 
{
    var VideoPkgLevel 		= document.wedding.VideoPkgLevel.value;
	var numVidCameras 		= document.wedding.numVidCameras.value;
	var VideoPrice			= 0;
	var VideoBasePrice		= 0;
	var VideoPremierAdd 	= 0;
	var ExtraCameraCharge	= 0;

	window.document.wedding.VideoPrice.value=VideoPrice;

	for (var i=0; i < document.wedding.videoPkg.length; i++)
   		if (document.wedding.videoPkg[i].checked && document.wedding.videoPkg[i].value!="")
	  		{
		  	var videoPkg = document.wedding.videoPkg[i].value;
	  		}
			
<!--	alert('VideoPkgLevel = ' + VideoPkgLevel + '\n VideoPremierAdd = ' + VideoPremierAdd + '\n numVidCameras = ' + numVidCameras  + '\n ExtraCameraCharge = ' + ExtraCameraCharge ); -->

	if (videoPkg!="" && numVidCameras!="0")
		{
		  var LocationRequired = true
		  
			if (VideoPkgLevel=="Premier") {
			VideoPremierAdd = 300;
		}
	
		ExtraCameraCharge = ((numVidCameras - 1) * 100);
	
		{
				switch  (videoPkg)
				{
					case	"quartzVideo":
					{
						var VideoBasePrice	= 299;
						var VideoHours		=	1;
						break;
					}

					case	"crystalVideo":
					{
						var VideoBasePrice	= 399;
						var VideoHours		=	2;
						break;
					}
				
					case	"topazVideo":
					{
						var VideoBasePrice	= 499;
						var VideoHours		=	3;
						break;
					}

					case	"pearlVideo":
					{
						var VideoBasePrice	= 599;
						var VideoHours		=	4;
						break;
					}
						
					case	"sapphireVideo":
					{
						var VideoBasePrice	= 699;
						var VideoHours		=	5;
						break;
					}
						
					case	"emeraldVideo":
						{
							var VideoBasePrice	= 799;
							var VideoHours		=	6;
							break;
						}
						
					case	"diamondVideo":
						{
							var VideoBasePrice	= 999;
							var VideoHours		=	8;
							break;
						}
						
		     }
			 VideoPrice = VideoBasePrice  + VideoPremierAdd + (VideoHours  * ExtraCameraCharge);
				window.document.wedding.VideoPrice.value="$ " + VideoPrice.toFixed(2);
		}
<!--alert('VideoPrice = ' + VideoPrice + '\n VideoBasePrice = ' + VideoBasePrice + '\n VideoPremierAdd = ' + VideoPremierAdd + '\n numVidCameras = ' + numVidCameras  + '\n ExtraCameraCharge = ' + ExtraCameraCharge );-->

		}
	calcPmt();
}

<!-- ******************************************************************************************************** -->







function getPhotoCD() 
{
	var wform = document.wedding;
	var price = 0;
	var qty	= wform.PhotoCD.value;

	for (var i=0; i < document.wedding.PhotoPkg.length; i++)
   		if (document.wedding.PhotoPkg[i].checked && document.wedding.PhotoPkg[i].value!="")
	  		{
		  	var PhotoPkg = document.wedding.PhotoPkg[i].value;
	  		}

	if (PhotoPkg!="" && PhotoPkg!="diamondPhoto")
	{
	switch  (PhotoPkg)
	{
		case	"quartzPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 250);
			break;
				
		case	"crystalPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 300);
			break;
			
		case	"topazPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 350);
			break;
			
		case	"pearlPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 400);
			break;

		case	"sapphirePhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 450);
			break;

		case	"emeraldPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 500);
			break;
				
		case	"diamondPhoto":
			wform.PhotoCDPrice.value = formatCurrency(Number(wform.PhotoCD.value) * 9999);
			break;
		}
     }
	  calcPmt();
}

function getParentAlbumPrice()
{
	var wform = document.wedding;
	var WhiteGoldAlbum 	=  wform.WhiteGoldAlbum.value;
	var BlackGoldAlbum	=  wform.BlackGoldAlbum.value;

	if (WhiteGoldAlbum=='0' || WhiteGoldAlbum=='')
	{
		price = 0;
		wform.WhiteGoldAlbumPrice.value = formatCurrency(price);
	}
	else if (WhiteGoldAlbum!='0')
	{
		price = 150;
		wform.WhiteGoldAlbumPrice.value = formatCurrency(wform.WhiteGoldAlbum.value * price);
	}
	
	if (BlackGoldAlbum=='0' || BlackGoldAlbum=='')
	{
		price = 0;
		wform.BlackGoldAlbumPrice.value = formatCurrency(price);
	}
	else if (BlackGoldAlbum!='0')
	{
		price = 150;
		wform.BlackGoldAlbumPrice.value = formatCurrency(wform.BlackGoldAlbum.value * price);
	}
	calcPmt();
}

function getPhotoDVDPrice() 
{
	var wform = document.wedding;
	wform.PhotoDVDAlbumPrice.value = formatCurrency(Number(wform.PhotoDVDAlbum.value) * 10);
	calcPmt();
}
function getTravelPrice() 
{
	var wform = document.wedding;
	
	if (wform.TravelFee.value == "0")
	{
	wform.TravelFeePrice.value = 0;
	}
	
	if (wform.TravelFee.value == "1")
	{
	wform.TravelFeePrice.value = formatCurrency(50);
	}
	if (wform.TravelFee.value == "2")
	{
	wform.TravelFeePrice.value = formatCurrency(100);
	}
	if (wform.TravelFee.value == "3")
	{
	wform.TravelFeePrice.value = formatCurrency(150);
	}
	calcPmt();
}
function formatCurrency(input) {
	return "$" + Number(clean(input)).toFixed(2);
}	// 

function clean(strng) {
	strng=String(strng);
	return strng.replace("\$", "");
	
}
function calcTax(taxable){
var wform = document.wedding;
var rate = .0775;
var taxamt = taxable * rate;

return taxamt;
}
function calcDeposit(OrderTotal){
var wform = document.wedding;
var rate = .333;
var DepositAmount = OrderTotal * rate;

return DepositAmount;
}
function calcBalance(OrderTotal, DepositAmount){
var wform = document.wedding;
var BalanceAmount = OrderTotal - DepositAmount;

return BalanceAmount;
}

function calcPmt() {
	var wform = document.wedding;
	
	var VideoPrice = new Number(clean(wform.VideoPrice.value));
	var PhotoPrice = new Number(clean(wform.PhotoPrice.value));
	var PhotoCDPrice = new Number(clean(wform.PhotoCDPrice.value));
	var WhiteGoldAlbumPrice = new Number(clean(wform.WhiteGoldAlbumPrice.value));
	var BlackGoldAlbumPrice = new Number(clean(wform.BlackGoldAlbumPrice.value));
	var PhotoDVDAlbumPrice = new Number(clean(wform.PhotoDVDAlbumPrice.value));
	var TravelFeePrice = new Number(clean(wform.TravelFeePrice.value));
	var TotalPrice	= (PhotoPrice + VideoPrice + PhotoCDPrice + WhiteGoldAlbumPrice + BlackGoldAlbumPrice + PhotoDVDAlbumPrice + TravelFeePrice);
	wform.TotalPrice.value = formatCurrency(TotalPrice);

	var SalesTax = calcTax(TotalPrice);
	wform.SalesTax.value = formatCurrency(SalesTax);
	var OrderTotal = (TotalPrice + SalesTax);
	
	var DepositAmount = calcDeposit(OrderTotal);
	var BalanceAmount = calcBalance(OrderTotal, DepositAmount);
	wform.OrderTotal.value = formatCurrency(OrderTotal);
	wform.DepositAmount.value = formatCurrency(DepositAmount);
	wform.BalanceAmount.value = formatCurrency(BalanceAmount);
}
function clearTotals() {
	var wform = document.wedding;
	
	wform.TotalPrice.value = 0;
	wform.SalesTax.value = 0;
	wform.OrderTotal.value = 0;
	wform.DepositAmount.value = 0;	
}

function HideDivs() {
var wform = document.wedding;

document.getElementById("DisplayPremierInfo").style.display = "none";
document.getElementById("DisplayPremierPlusInfo").style.display = "none";

wform.BrideGroomAlbumStyle.value = "0";
wform.AlbumCatalogNumber.value = "";
wform.BrideGroomAlbumStylePlus.value = "0";
wform.AlbumCatalogNumberPlus.value = "";
wform.ParentAlbumStyle1.value = "0";
wform.ParentAlbumStyle2.value = "0";

} //end function
function ShowDivs(PhotoPkgLevel) {
var wform = document.wedding;

switch (PhotoPkgLevel) 
	{
	case	"Premier":
            {
			document.getElementById('DisplayPremierInfo').style.display = "block";
			document.getElementById('DisplayPremierPlusInfo').style.display = "none";
			break;
			}
	case	"PremierPlus":
			{
			document.getElementById('DisplayPremierPlusInfo').style.display = "block";
			document.getElementById('DisplayPremierInfo').style.display = "none";
			break;
			}
	break;
	}
} //end function
