// image pre-load

image0 = new Image(); image0.src = "images/order_button_on.jpg";

// globals

function gObj(me) {
	if (document.getElementById) {
		return document.getElementById(me);
	}
}

function gImg(me) {
	if (document.images) {
		return document.images[me];
	}
}

function btnOn(a,typ) {		
	gImg(a).src = "images/" + typ + "_button_on.jpg";
}

function btnOff(b,typ) {
	gImg(b).src = "images/" + typ + "_button_off.jpg";
}

// EOLAS-safe SWF embed script

function embedSWF(divid,swfname,swfwidth,swfheight,swfbgcolor,swfloop) {
	var embedStr = '';
	embedStr += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+swfwidth+'" height="'+swfheight+'" id="'+swfname+'" align=""> ';
	embedStr += '<param name="movie" value="'+swfname+'.swf">';
	embedStr += '<param name="loop" value="'+swfloop+'"> <param name="quality" value="high">';
	embedStr += '<param name="bgcolor" value="#'+swfbgcolor+'">'; 
	embedStr += '<embed src="'+swfname+'.swf" loop="'+swfloop+'" quality="high" bgcolor="#'+swfbgcolor+'" width="'+swfwidth+'" height="'+swfheight+'" name="'+swfname+'" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	embedStr += '</object>';
	document.getElementById(divid).innerHTML = embedStr;
}

// open and play mp3 files

function playSound(theSong) {

	var winW = 350;
	var winH = 200;
	var winl = (screen.width / 10);
	var wint = (screen.height / 20);

	var c1 = "<html><head><title>Song Sample<\/title><\/head><body bgcolor='#BFCFD4'><div style='left:0; top:0; font-family:verdana, arial, sans-serif; font-size:11px; line-height: 14px; color:#7A8A6B; text-align:center; margin:6px;'><embed src='downloads\/";
	var c2 = theSong;
	var c3 = "' autostart='true' width='250' height='80' autoplay='true'><\/embed><noembed><bgsound src='downloads\/";
	var c4 = theSong;
	var c5 = "'><\/noembed><br /><i>NOTE: If you are on a dial-up connection,<br \/>please be patient while the selection loads.<\/i><br \/><br \/><a style='color:#698A95;' href='javascript:self.close()'>Close Window<\/a><\/div><\/body><\/html>";

	winProps=("width="+winW+",height="+winH+",top="+wint+",left="+winl+",toolbar=no,scrollbars=no,menubar=no");
	popupWin=window.open("","songsample",winProps);
	popupWin.document.write(c1,c2,c3,c4,c5);
	popupWin.document.close();
}

function valForm(){ 
	var frm = document.forms['form1'];
	var ckEmail = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
	var errMsg = "";
	var setfocus = "";
	
	if (frm['comments'].value.length > 600) {
		errMsg = "Please limit comments to 600 characters.";
		frm['comments'].value = frm['comments'].value.substring(0, 600);
		setfocus = "['comments']";
	}
	
	if (!ckEmail.test(frm['email'].value)) {
		errMsg = "Please insert a valid email address.";
		setfocus = "['email']";	
	}

	if (frm['fullname'].value == "") {
		errMsg = "Please insert your name.";
		setfocus = "['fullname']";
	}

	if (errMsg != ""){
		alert(errMsg);
		eval("frm" + setfocus + ".focus()");
	} else {
	frm.submit();
	}
}

function confMsg(msg) {
  document.retVal = confirm(msg);
}
