//determine browser
var isMSIE;
var isNetscape;
var browserVer;
//get which browser
if(navigator.appName.indexOf("Microsoft") == 0){
	isMSIE = true;
}else if(navigator.appName.indexOf("Netscape") == 0){
	isNetscape = true;
}
//get browser version
browserVer = navigator.appVersion.charAt(0);

//cache pics
if(isMSIE || isNetscape){
	if(parseInt(browserVer) >= 4){
		/*	-taken out 5/27/99 dwr re:no intro right now.
		//intro graphic
		LDNamePic = new Image(524,124);
		LDNamePic.src = "pics/GoldName.gif";
	*/
	}
}

/*	-taken out 5/27/99 dwr Not using for now
function loadPage1(){
	var html1;
	html1 = "<HTML><HEAD><TITLE>Larry Dalton</TITLE><script language='JavaScript' src='myscript/javapics.js'></script" + "></head><body>";
	html1 += "<table width='100%' border='0' align='CENTER' valign='MIDDLE' height='95%'><tr><td align='center'><font face='Arial Black' size='+2' color='#006400'>";
	html1 += "P &nbsp; R &nbsp; E &nbsp; S &nbsp; E &nbsp; N &nbsp; T &nbsp; I &nbsp; N &nbsp; G &nbsp; . &nbsp; . &nbsp; . &nbsp;";
	html1 += "</font></td></tr></table>";
	html1 += "<script language='javascript'>setTimeout('javascript:loadPage2()',3000)</script" + "></BODY></HTML>";

	document.writeln(html1);
}
*/

/*	-taken out 5/27/99 dwr Not using for now
function loadPage2(){
	var html2;
	html2 = "<HTML><HEAD><TITLE>Larry Dalton</TITLE>";
	html2 += "<script language='JavaScript' src='myscript/javapics.js'></script" + "></head><body>";
	html2 += "<table width='100%' border='0' align='CENTER' valign='MIDDLE' height='95%'><tr><td align='center'>";
	html2 += "<img src=" + LDNamePic.src + " name=LDName width=524 height=124 border='0' alt='L a r r y &nbsp;&nbsp; D a l t o n'>";
	html2 += "</td></tr></table>";
	html2 += "<script language='javascript'>setTimeout('loadPage3()',4000)</script" + "></BODY></HTML>";

	document.writeln(html2);
}
*/

/*	-taken out 5/27/99 dwr Not using for now
function loadPage3(){
	location.replace('main.html');
}
*/

/* Not in use right now - dwr 5/13/99
//picture album kind of thing...
function showPic(img){
	if (img == "pics/ministry1.jpg"){
		img1 = new Image(150,156);
	}else if (img == "pics/silo1.jpg"){
		img1 = new Image(210,156);
	}else if (img == "pics/terryLaw1.jpg"){
		img1 = new Image(156,156);
	}else if (img == "pics/bluetopview.gif"){	
		img1 = new Image(156,156);				
	}else if (img == "pics/dancers1.jpg"){	
		img1 = new Image(210,115);
	}

	img1.src = img;
	document.bluepic.width = img1.width;
	document.bluepic.height = img1.height;
	document.bluepic.src = img1.src;
	return;
}
*/

/*	-taken out 5/27/99 dwr Not using for now
function showAlbumPic(img){
	img1 = new Image(218,220);
	img1.src = img + ".gif";
	document.albumpics.width = img1.width;
	document.albumpics.height = img1.height;
	document.albumpics.src = img1.src;
	
	//now load the correct song titles
	img2 = new Image();
	img2.src = img + "Titles.gif";
	document.albumtitles.width = img2.width;
	document.albumtitles.height = img2.height;
	document.albumtitles.src = img2.src;
	
	return;
}
*/

function calcOrder(form){
	doReminder = false;
	var qty1 = form.qty1;	//cassettes
	var qty2 = form.qty2;	//cd's
	var shpg = 1;	//shipping & handling
	var total = 0;
	form.shipping.value = "";
	form.totAmt.value = "";
	for(var i = 0; i < qty1.length; i++){
		if(qty1[i].value != ""){
			if(parseFloat(qty1[i].value) > 0){
				total += parseFloat(formatNum((parseInt(qty1[i].value) * 10),2));
				shpg += parseInt(qty1[i].value);	//counter for # items
				//doReminder = true;
			}else{
				alert("Please enter valid quantities.");
			}
		}
	}
	for(var i = 0; i < qty2.length; i++){
		if(qty2[i].value != ""){
			if(parseFloat(qty2[i].value) > 0){
				total += parseFloat(formatNum((parseInt(qty2[i].value) * 15),2));
				shpg += parseInt(qty2[i].value);	//counter for # items
				//doReminder = true;
			}else{
				alert("Please enter valid quantities.");
			}
		}
	}
	
	if(total > 0){	//added qualifier so that the shipping wont show up if no items ~dwr3/1/2000
		if(shpg > 0){
			total += parseFloat(formatNum(shpg,2));
			form.shipping.value = formatNum(shpg,2);
		}		

	}

	form.totAmt.value = formatNum(total,2);

	if(doReminder){
//5/25/99		launchRemindWindow();
	}
}
function formatNum(expr,decplaces) {
	var str = (Math.round(parseFloat(expr) * Math.pow(10,decplaces))).toString();
	while (str.length <= decplaces) {
		str = "0" + str;
	} 
	var decpoint = str.length - decplaces;
	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}

/*	-taken out 5/27/99 dwr Not using for now
function launchRemindWindow(){
	var h = screen.height / 2 - 50;
	var w = screen.width / 2 - 100;
	var remind = window.open("","","height = 100, width = 200,top="+h+"left="+w);
	remind.document.write("<html><head><title>Reminder!</title></head><body bgcolor=black text=white>");
	remind.document.write("<B>Don't forget to print out the ORDER FORM, and send it to the address at the bottom.</B>");
	remind.document.write("</body></html>");
	return;
}
*/

//date last modified
function modified(modif){
	update = new Date(document.lastModified);
	theMonth = update.getMonth() + 1;
	theDate = update.getDate();
	theYear = update.getYear();
	modif = "<p class='webmaster'>Copyright &copy; 1999 - 2001 AMC, All rights reserved - Last updated: " + theMonth + "/" + theDate + "/" + theYear;
	modif += ";  Web Site Definition and Design by <a href='webmaster.asp' style='color:navy;font-size:11px;' class='underline'>";
	modif += "D &amp; D</a></p>";
	return modif;
}

//Check All & UnCheck All boxes
function SetChecked(val) {
	dml=document.frmEmailSubscribers;
	len = dml.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (dml.elements[i].type=='checkbox') {
			dml.elements[i].checked=val;
		}
	}
}	

// Save a Cookie & Submit form	
function doSaveVisitorAndSubmit(frm){
	//alert(frm.name.value);
	saveCookie("visitor_name",frm.name.value,360);
	frm.submit();
}

