// JavaScript Document


// about BUTTON
abouton = new Image ();
abouton.src = "images/btn_about.jpg";
aboutoff = new Image ();
aboutoff.src = "images/btn_about_r.jpg";

// fleet BUTTON
fleeton = new Image ();
fleeton.src = "images/btn_fleet.jpg";
fleetoff = new Image ();
fleetoff.src = "images/btn_fleet_r.jpg";

// reservations BUTTON
reservationson = new Image ();
reservationson.src = "images/btn_reservations.jpg";
reservationsoff = new Image ();
reservationsoff.src = "images/btn_reservations_r.jpg";

// contact BUTTON
contacton = new Image ();
contacton.src = "images/btn_contact.jpg";
contactoff = new Image ();
contactoff.src = "images/btn_contact_r.jpg";

// music BUTTON
musicon = new Image ();
musicon.src = "images/btn_music.jpg";
musicoff = new Image ();
musicoff.src = "images/btn_music_r.jpg";

// promo BUTTON
promoon = new Image ();
promoon.src = "images/btn_promo.jpg";
promooff = new Image ();
promooff.src = "images/btn_promo_r.jpg";


// revolutiondj BUTTON
revolutiondjon = new Image ();
revolutiondjon.src = "images/btn_revolutiondj.jpg";
revolutiondjoff = new Image ();
revolutiondjoff.src = "images/btn_revolutiondj_r.jpg";

// timeline BUTTON
timelineon = new Image ();
timelineon.src = "images/btn_timeline.jpg";
timelineoff = new Image ();
timelineoff.src = "images/btn_timeline_r.jpg";





// weddings BUTTON
weddingson = new Image ();
weddingson.src = "images/weddings.jpg";
weddingsoff = new Image ();
weddingsoff.src = "images/weddings_r.jpg";

// grads BUTTON
gradson = new Image ();
gradson.src = "images/grads.jpg";
gradsoff = new Image ();
gradsoff.src = "images/grads_r.jpg";

// corporate BUTTON
corporateon = new Image ();
corporateon.src = "images/corporate.jpg";
corporateoff = new Image ();
corporateoff.src = "images/corporate_r.jpg";

// stag BUTTON
stagon = new Image ();
stagon.src = "images/stag.jpg";
stagoff = new Image ();
stagoff.src = "images/stag_r.jpg";

// party BUTTON
partyon = new Image ();
partyon.src = "images/party.jpg";
partyoff = new Image ();
partyoff.src = "images/party_r.jpg";





// ROLLOVER / ROLLOUT
function roll (vName, TF) { 
	if (document.images) {
		if (TF == true) {
			img = eval (vName + "off.src");
		} else {
			img = eval (vName + "on.src");
		}
		document[vName].src = img;
	}		
}

function setEvent (e) {
	document.cookie="revolution_event=" + e;
}


function showBanner () {
	document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="640px" height="275px" id="banner1" align="middle">\n');
	document.write ('<param name="allowScriptAccess" value="sameDomain" />\n');
	//document.write ('<param name="FlashVars" value="xmlFile=' + project + '.xml" />\n');
	document.write ('<param name="movie" value="flash/revolution1.swf?i=3" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />\n');	
	
	//document.write ('<embed swLiveConnect="true" src="flash/banner.swf?i=1" FlashVars="xmlFile=' + project + '.xml" quality="high" bgcolor="#000000" width="960px" height="275px" id="banner" name="banner" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write ('<embed swLiveConnect="true" src="flash/revolution1.swf?i=3" quality="high" bgcolor="#000000" width="640px" height="275px" id="banner1" name="banner1" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	
	document.write ('</object>\n');
}

function showBanner2 () {
	document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="320px" height="275px" id="banner2" align="middle">\n');
	document.write ('<param name="allowScriptAccess" value="sameDomain" />\n');
	//document.write ('<param name="FlashVars" value="xmlFile=' + project + '.xml" />\n');
	document.write ('<param name="movie" value="flash/revolution2.swf?i=1" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />\n');	
	
	//document.write ('<embed swLiveConnect="true" src="flash/banner.swf?i=1" FlashVars="xmlFile=' + project + '.xml" quality="high" bgcolor="#000000" width="960px" height="275px" id="banner" name="banner" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write ('<embed swLiveConnect="true" src="flash/revolution2.swf?i=1" quality="high" bgcolor="#000000" width="320px" height="275px" id="banner2" name="banner2" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	
	document.write ('</object>\n');
}



function send_registration () {
	var f 			= document.getElementById("reservation_form");
	
	var name 		= f.name.value;
	var lname 		= f.lname.value;
	var phone 		= f.phone.value;
	var email 		= f.email.value;
	var city 		= f.city.value;
	var month		= f.month[f.month.selectedIndex].value;
	var day			= f.day[f.day.selectedIndex].value;
	var year		= f.year[f.year.selectedIndex].value;
	
	var hours		= f.hours[f.hours.selectedIndex].value;
	var dj			= f.dj[f.dj.selectedIndex].value;
	var how			= f.how[f.how.selectedIndex].value;
	var limo		= f.limo[f.limo.selectedIndex].value;
	var eventType	= f.eventType[f.eventType.selectedIndex].value;
	
	
	var success = true;
	
	if (name == "" || lname == "" || email == "" || phone == "" || city == "" || month == "--" || day == "--" || year == "--" || hours == "--- Please Select ---" || dj == "--- Please Select ---" || how == "--- Please Select ---" || limo == "--- Please Select ---" || eventType == "--- Please Select ---") {
		success = false;
	}
	
	if (success) {
		f.submit();	
	} else {
		alert ("Please fill out all required fields.");	
	}
}


function send_timeline () {
	var f 			= document.getElementById("timeline_form");
	
	var name 		= f.name.value;
	var email 		= f.email.value;
	
	var success = true;
	
	if (name == "") {
		success = false;
	}
	
	if (email == "") {
		success = false;
	}
	
	if (success) {
		f.submit();	
	} else {
		alert ("Please fill out all required fields.");	
	}
}

function send_timeline2 () {
	var f 			= document.getElementById("timeline_form");
	var success = true;
	
	var name 		= f.name.value;
	var email 		= f.email.value;
	var minpop		= f.minpop.value;
	var qty19 = f.pop1_qty.options[f.pop1_qty.selectedIndex].value;
	var qty20 = f.pop2_qty.options[f.pop2_qty.selectedIndex].value;
	var qty21 = f.pop3_qty.options[f.pop3_qty.selectedIndex].value;
	var qty22 = f.pop4_qty.options[f.pop4_qty.selectedIndex].value;
	var qty23 = f.pop5_qty.options[f.pop5_qty.selectedIndex].value;
	var qty29 = f.cooler1_qty.options[f.cooler1_qty.selectedIndex].value;
	var qty30 = f.cooler2_qty.options[f.cooler2_qty.selectedIndex].value;
	var qty31 = f.cooler3_qty.options[f.cooler3_qty.selectedIndex].value;
	var qty32 = f.cooler4_qty.options[f.cooler4_qty.selectedIndex].value;
	var flavour29 = f.cooler1_flavour.value;
	var flavour30 = f.cooler2_flavour.value;
	var flavour31 = f.cooler3_flavour.value;
	var flavour32 = f.cooler4_flavour.value;
	
	
	
	//calculate total pop selected
	var totalPopSelected = parseInt(qty19)+parseInt(qty20)+parseInt(qty21)+parseInt(qty22)+parseInt(qty23);

	
	if (name == "" || email == "") {
		success = false;
		alert("Please fill out all the general information.");
		
	}else if (minpop != 0 && totalPopSelected < minpop) {
		success = false;
		alert("Please select the "+minpop+" pops included in your alcohol price.");
	
	}else if (qty29 > 0 && flavour29 == "") {
		success = false;
		alert("Please enter the flavour you would like for your coolers.");
	}else if (qty30 > 0 && flavour30 == "") {
		success = false;
		alert("Please enter the flavour you would like for your coolers.");
	}else if (qty31 > 0 && flavour31 == "") {
		success = false;
		alert("Please enter the flavour you would like for your coolers.");
	}else if (qty32 > 0 && flavour32 == "") {
		success = false;
		alert("Please enter the flavour you would like for your coolers.");
	}
	
	
	if (success) {
		f.submit();	
	}
}


//calculate liquor
function calculateTotal(){
	
	var f = document.getElementById("timeline_form");
	
	//get quantities
	var qty1 = f.vodka1_qty.options[f.vodka1_qty.selectedIndex].value;
	var qty2 = f.vodka2_qty.options[f.vodka2_qty.selectedIndex].value;
	var qty3 = f.vodka3_qty.options[f.vodka3_qty.selectedIndex].value;
	var qty4 = f.vodka4_qty.options[f.vodka4_qty.selectedIndex].value;
	var qty5 = f.rye1_qty.options[f.rye1_qty.selectedIndex].value;
	var qty6 = f.rye2_qty.options[f.rye2_qty.selectedIndex].value;
	var qty7 = f.rye3_qty.options[f.rye3_qty.selectedIndex].value;
	var qty8 = f.rye4_qty.options[f.rye4_qty.selectedIndex].value;
	var qty9 = f.scotch1_qty.options[f.scotch1_qty.selectedIndex].value;
	var qty10 = f.scotch2_qty.options[f.scotch2_qty.selectedIndex].value;
	var qty11 = f.scotch3_qty.options[f.scotch3_qty.selectedIndex].value;
	var qty12 = f.scotch4_qty.options[f.scotch4_qty.selectedIndex].value;
	var qty13 = f.rum1_qty.options[f.rum1_qty.selectedIndex].value;
	var qty14 = f.rum2_qty.options[f.rum2_qty.selectedIndex].value;
	var qty15 = f.rum3_qty.options[f.rum3_qty.selectedIndex].value;
	var qty16 = f.rum4_qty.options[f.rum4_qty.selectedIndex].value;
	var qty17 = f.rum5_qty.options[f.rum5_qty.selectedIndex].value;
	var qty18 = f.rum6_qty.options[f.rum6_qty.selectedIndex].value;
	
	var qty19 = f.pop1_qty.options[f.pop1_qty.selectedIndex].value;
	var qty20 = f.pop2_qty.options[f.pop2_qty.selectedIndex].value;
	var qty21 = f.pop3_qty.options[f.pop3_qty.selectedIndex].value;
	var qty22 = f.pop4_qty.options[f.pop4_qty.selectedIndex].value;
	var qty23 = f.pop5_qty.options[f.pop5_qty.selectedIndex].value;
	
	var qty24 = f.beer1_qty.options[f.beer1_qty.selectedIndex].value;
	var qty25 = f.beer2_qty.options[f.beer2_qty.selectedIndex].value;
	var qty26 = f.beer3_qty.options[f.beer3_qty.selectedIndex].value;
	var qty27 = f.beer4_qty.options[f.beer4_qty.selectedIndex].value;
	var qty28 = f.beer5_qty.options[f.beer5_qty.selectedIndex].value;
	
	var qty29 = f.cooler1_qty.options[f.cooler1_qty.selectedIndex].value;
	var qty30 = f.cooler2_qty.options[f.cooler2_qty.selectedIndex].value;
	var qty31 = f.cooler3_qty.options[f.cooler3_qty.selectedIndex].value;
	var qty32 = f.cooler4_qty.options[f.cooler4_qty.selectedIndex].value;
	
	var qty33 = f.champagne1_qty.options[f.champagne1_qty.selectedIndex].value;
	var qty34 = f.champagne2_qty.options[f.champagne2_qty.selectedIndex].value;
	var qty35 = f.champagne3_qty.options[f.champagne3_qty.selectedIndex].value;
	
	var qty36 = f.wine1_qty.options[f.wine1_qty.selectedIndex].value;
	var qty37 = f.wine2_qty.options[f.wine2_qty.selectedIndex].value;
	
	
	
	//calculate total prices for each
	var total1 = (f.vodka1_price.value)*qty1;
	var total2 = (f.vodka2_price.value)*qty2;
	var total3 = (f.vodka3_price.value)*qty3;
	var total4 = (f.vodka4_price.value)*qty4;
	var total5 = (f.rye1_price.value)*qty5;
	var total6 = (f.rye2_price.value)*qty6;
	var total7 = (f.rye3_price.value)*qty7;
	var total8 = (f.rye4_price.value)*qty8;
	var total9 = (f.scotch1_price.value)*qty9;
	var total10 = (f.scotch2_price.value)*qty10;
	var total11 = (f.scotch3_price.value)*qty11;
	var total12 = (f.scotch4_price.value)*qty12;
	var total13 = (f.rum1_price.value)*qty13;
	var total14 = (f.rum2_price.value)*qty14;
	var total15 = (f.rum3_price.value)*qty15;
	var total16 = (f.rum4_price.value)*qty16;
	var total17 = (f.rum5_price.value)*qty17;
	var total18 = (f.rum6_price.value)*qty18;
	
	var total19 = (f.pop1_price.value)*qty19;
	var total20 = (f.pop2_price.value)*qty20;
	var total21 = (f.pop3_price.value)*qty21;
	var total22 = (f.pop4_price.value)*qty22;
	var total23 = (f.pop5_price.value)*qty23;
	
	var total24 = (f.beer1_price.value)*qty24;
	var total25 = (f.beer2_price.value)*qty25;
	var total26 = (f.beer3_price.value)*qty26;
	var total27 = (f.beer4_price.value)*qty27;
	var total28 = (f.beer5_price.value)*qty28;
	
	var total29 = (f.cooler1_price.value)*qty29;
	var total30 = (f.cooler1_price.value)*qty30;
	var total31 = (f.cooler1_price.value)*qty31;
	var total32 = (f.cooler1_price.value)*qty32;
	
	var total33 = (f.champagne1_price.value)*qty33;
	var total34 = (f.champagne2_price.value)*qty34;
	var total35 = (f.champagne3_price.value)*qty35;
	
	var total36 = (f.wine1_price.value)*qty36;
	var total37 = (f.wine2_price.value)*qty37;

	
	//calculate total cans of pop included
	var popTotal = 0;
	
	var qtyArray = new Array();
	qtyArray[0] = qty1*6.5;
	qtyArray[1] = qty2*13;
	qtyArray[2] = qty3*6.5;
	qtyArray[3] = qty4*13;
	qtyArray[4] = qty5*6.5;
	qtyArray[5] = qty6*13;
	qtyArray[6] = qty7*6.5;
	qtyArray[7] = qty8*13;
	qtyArray[8] = qty9*6.5;
	qtyArray[9] = qty10*13;
	qtyArray[10] = qty11*6.5;
	qtyArray[11] = qty12*13;
	qtyArray[12] = qty13*6.5;
	qtyArray[13] = qty14*13;
	qtyArray[14] = qty15*6.5;
	qtyArray[15] = qty16*13;
	qtyArray[16] = qty17*6.5;
	qtyArray[17] = qty18*13;
	
	for(i=0; i<qtyArray.length; i++){
		popTotal += Math.round(parseFloat(qtyArray[i]))
	}
	
	if(popTotal > 0){
		document.getElementById("totalpop").innerHTML="<p style='padding:10px 0;'><b style='color:#fff;'>You have "+popTotal+" cans included in your alcohol price.</b> Any additional pop will be charged at the price listed below.</p>";
		f.minpop.value=popTotal;
	}else{
		document.getElementById("totalpop").innerHTML="";
		f.minpop.value=0;
	}
	
	
	//calculate the grand total
	var grandTotal = 0;
	var totalsArray = new Array();
	totalsArray[0] = total1;
	totalsArray[1] = total2;
	totalsArray[2] = total3;
	totalsArray[3] = total4;
	totalsArray[4] = total5;
	totalsArray[5] = total6;
	totalsArray[6] = total7;
	totalsArray[7] = total8;
	totalsArray[8] = total9;
	totalsArray[9] = total10;
	totalsArray[10] = total11;
	totalsArray[11] = total12;
	totalsArray[12] = total13;
	totalsArray[13] = total14;
	totalsArray[14] = total15;
	totalsArray[15] = total16;
	totalsArray[16] = total17;
	totalsArray[17] = total18;
	totalsArray[18] = total19;
	totalsArray[19] = total20;
	totalsArray[20] = total21;
	totalsArray[21] = total22;
	totalsArray[22] = total23;
	totalsArray[23] = total24;
	totalsArray[24] = total25;
	totalsArray[25] = total26;
	totalsArray[26] = total27;
	totalsArray[27] = total28;
	totalsArray[28] = total29;
	totalsArray[29] = total30;
	totalsArray[30] = total31;
	totalsArray[31] = total32;
	totalsArray[32] = total33;
	totalsArray[33] = total34;
	totalsArray[34] = total35;
	totalsArray[35] = total36;
	totalsArray[36] = total37;
	
	for(i=0; i<totalsArray.length; i++){
		grandTotal += parseFloat(totalsArray[i]);
	}
	
	//calculate total pop selected
	var totalPopSelected = parseInt(qty19)+parseInt(qty20)+parseInt(qty21)+parseInt(qty22)+parseInt(qty23);
	
	if(totalPopSelected <= popTotal){
		grandTotal = grandTotal - (totalPopSelected*1.50); //discount the included pop
	}else{
		grandTotal = grandTotal - (popTotal*1.50); //discount the included pop
	}
	
	//the grand total
	grandTotal = grandTotal.toFixed(2);
	
	if(grandTotal > 0){
		document.getElementById("grandtotal").innerHTML="<br /><h2>LIQUOR MENU GRAND TOTAL: $"+grandTotal+"</h2>";
		f.thetotal.value=grandTotal;
	}else{
		document.getElementById("grandtotal").innerHTML="";
		f.thetotal.value=0.00;
	}
	
	
	
}
