$(function() {
	$('#turningStoneLogo').hover(function(){
		$(this).attr('src','img/h_turning_stone_on.gif')} 
		,function(){
		$(this).attr('src','img/h_turning_stone.gif')}
	);
	$('#oneidaLogo').hover(function(){
		$(this).attr('src','img/img_oneida_on.gif')}
		,function(){
		$(this).attr('src','img/img_oneida.gif')}
	);
});

function fContactForm(strName, strEmail, strFeedback) {
	$.get("dbContactUs.php", { txtName: strName, txtEmail: strEmail, txtFeedback: strFeedback});
}

function fSignupForm(strFirstName, strLastName, strEmail, strStreet, strCity, strState, strCountry, strZipcode, strPhone, strDiamondCard, strDOB, strCarrier) {
	$.get("dbSignup.php", { rdoOver18: "on", txtFirstName:strFirstName, txtLastName:strLastName, txtEmail:strEmail, txtStreet:strStreet, txtCity:strCity, txtState:strState, txtCountry:strCountry, txtZipcode:strZipcode, txtPhone:strPhone, txtDiamondCard:strDiamondCard, txtDOB:strDOB, txtCarrier:strCarrier});
}

function f_display_flash() {
	/*document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="994" height="600" id="lava_main" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	if(strSchedule != "") {
		document.write('<PARAM NAME="FlashVars" VALUE="showSched=1&sNum=' + strSchedule + '">');
		//alert(strSchedule);
	}
	document.write('<param name="movie" value="flash/lava_main.swf?cacheBust='+ strRandNum +'" /><param name="quality" value="high" /><param wmode="transparent" /><embed src="flash/lava_main.swf?cacheBust='+ strRandNum +'" quality="high" wmode="transparent" width="994" height="600" name="lava_main" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
	if(strSchedule != "") {
		document.write(' FlashVars="showSched=1&sNum=' + strSchedule + '" ');
	}
	document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');*/
	var strFlashvars = undefined;
	if(strSchedule != "") {
		strFlashvars = "showSched=1&sNum=" + strSchedule;
	}
	fWriteFlash("flash/lava_main.swf", "lava_main", 994, 660, strFlashvars, "middle");
}
	
function fRequestForm(strSong, strArtist, strDate) {
	$.get("dbRequestASong.php", { txtSong: strSong, txtArtist: strArtist, txtDate: strDate});
}

function fReservationForm(strFirstName, strLastName, strEmail, strZip, strCell, strNightPhone, strDOB, strGroup, strTime, strDate, strGender) {
	$.get("dbMakeAReservation.php", { txtFirstName: strFirstName, txtLastName: strLastName, txtEmail: strEmail, txtZip: strZip, txtCell: strCell, txtNightPhone: strNightPhone, txtDOB: strDOB, txtGroup: strGroup, txtTime: strTime, txtDate: strDate, txtGender: strGender });
}



function goRSS() {
	 win = window.open ("http://www.turningstone.com/rss/","rssWindow");
	 win.focus();
}

/*
	Return a random integer from a starting integer to an ending integer, inclusive.
	@param aMinimum the minimum value
	@param aMaximum the maximum value
*/
function fGetRandomInteger(aMinimum, aMaximum) {
	return Math.floor(Math.random() * aMaximum + aMinimum);
}

/*
	Embed an SWF, utilizing a cachebuster to prevent it from getting cached.
	@param aPath the path and filename of the Flash
	@param anID an ID to assign to the HTML object/embed tags
	@param aWidth the width of the Flash
	@param aHeight the height of the Flash
	@param strFlashvars the Flashvars
	@param anAlignment where to align the flash
	@param aQuality the quality, defaults to "high"
	@param aWMode the wmode, defaults to "transparent"
	@param aBgColor the background color, defaults to "ffffff"
*/
function fWriteFlash(aPath, anID, aWidth, aHeight, strFlashvars, anAlignment, aQuality, aWMode, aBgColor) {
	var boolID = !(anID == undefined || anID == null || anID == "");
	var boolFlashvars = !(strFlashvars == undefined || strFlashvars == null || strFlashvars == "");
	var boolAlignment = !(anAlignment == undefined || anAlignment == null || anAlignment == "");
	if(aQuality == undefined || aQuality == null || aQuality == "") {
		aQuality = "high";
	}
	if(aWMode == undefined || aWMode == null || aWMode == "") {
		aWMode = "transparent";
	}
	if(aBgColor == undefined || aBgColor == null || aBgColor == "") {
		aBgColor = "ffffff";
	}
	if(aBgColor.substr(0, 1) != "#") {
		aBgColor = "#" + aBgColor;
	}
	var strCacheBuster = "?cacheBuster=" + fGetRandomInteger(0, 999);
	var strPath = aPath + strCacheBuster;
	
	//	Assemble the HTML string.
	var strFlash = "";
	strFlash += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + aWidth + "\" height=\"" + aHeight + "\"";
	if(boolID) {
		strFlash += " id=\"" + anID + "\"";
	}
	if(boolAlignment) {
		strFlash += " align=\"" + anAlignment + "\"";
	}
	strFlash += " />\n";
	strFlash += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
	strFlash += "<param name=\"Movie\" value=\"" + strPath + "\" />\n";
	strFlash += "<param name=\"quality\" value=\"" + aQuality + "\" />\n";
	strFlash += "<param name=\"wmode\" value=\"" + aWMode + "\" />\n";
	strFlash += "<param name=\"bgcolor\" value=\"" + aBgColor + "\">\n";
	if(boolFlashvars) {
		strFlash += "<param name=\"Flashvars\" value=\"" + strFlashvars + "\" />\n";
	}
	strFlash += "<embed src=\"" + strPath + "\"";
	if(boolFlashvars) {
		strFlash += " flashvars=\"" + strFlashvars + "\"";
	}
	strFlash += " wmode=\"" + aWMode + "\" bgcolor=\"" + aBgColor + "\" quality=\"" + aQuality + "\" width=\"" + aWidth + "\" height=\"" + aHeight + "\"";
	if(boolID) {
		strFlash += " name=\"" + anID + "\"";
	}
	if(boolAlignment) {
		strFlash += " align=\"" + anAlignment + "\"";
	}
	strFlash += " allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n";
	strFlash += "</object>";
	
	document.writeln(strFlash);
}

function fWriteNoFlash(anImgPath, aWidth, aHeight, anAlt) {
	document.writeln("<a href=\"http://www.adobe.com/products/flashplayer/\" target=\"_blank\"><img src=\"" + anImgPath + "\" height=\"" + aHeight + "\" width=\"" + aWidth + "\" alt=\"" + anAlt + "\" border=\"0\" /></a>");
}
