// JavaScript Document

// -------------------------------------------
// will add target to external links (jQuery)
// -------------------------------------------
function externalLinks(){
	$('a[@rel^="external"]').attr('target', '_blank').click(function(){
		hideAmbassador();
	});
}
// -------------------------------------------

// -------------------------------------------
// coupons page popup
// -------------------------------------------
function setUpCouponPopup(){
	$('a.coupon').click(function(){
		var dimensions = new Array();
		dimensions = $(this).attr('rel').split('-');
		window.open(this.href,'viewer','width='+dimensions[0]+',height='+dimensions[0]);
		return false;
	});
}
// -------------------------------------------

// -------------------------------------------
// will close the "talking head" online ambassador (jQuery)
// -------------------------------------------
function hideAmbassador(){
	$("#onlineAmbassador_wrap").slideUp("slow");
}
// -------------------------------------------

// -------------------------------------------
// functions to launch MULTICAST Player
// -------------------------------------------
function launchPlayer(hashCode) {
	playerwin = window.open("http://vidego.multicastmedia.com/player.php?v=" + hashCode, "newwindow", "height=504,width=869", "toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no");
}

// -------------------------------------------

// -------------------------------------------
// functions to launch tee times app
// -------------------------------------------
var myhandle=null;

function checkit(UID,SiteID,PID,RedLine) {
// This function is used to close any open tee time windows, then open a new window for the tee time app to prevent application var problems
	if(myhandle && !(myhandle.closed)) {
 		//alert('Window is open - closing');
 		myhandle.close();
 		openit(UID,SiteID,PID,RedLine);
	} else {
 		//alert('Window is closed - opening');
 		openit(UID,SiteID,PID,RedLine);
	}
}
// -------------------------------------------
function openit(UID,SiteID,PID,RedLine,urlCourseID){
	var urlVars = 'https://secure.guestdesk.com/teetimes/?UID='+UID+'&SiteID='+SiteID+'&PID='+PID+'&ShowRedLine='+RedLine;
	if(urlCourseID != undefined){ urlVars += '&urlCourseID='+urlCourseID; }
	myhandle=window.open(urlVars,'windowName','toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=yes,menubar=no,width=800,height=505,titlebar=TeeTimes,left=2,top=2')
	//var urlVars = 'http://secure.guestdesk.com/reservations/?systemType=3&UID='+UID+'&SiteID='+SiteID+'&PID='+PID;
	//if(urlCourseID != undefined){ urlVars += '&courseID='+urlCourseID; }
	//myhandle=window.open(urlVars,'windowName','scrollbars=yes,toolbar=yes,location=no,directories=no,status=yes,width=1000,height=800,titlebar=TeeTimes,left=2,top=2')

}

function openNew(url){
	myhandle=window.open(url,'windowName','toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=yes,menubar=no,width=800,height=505,titlebar=TeeTimes,left=2,top=2');
}

// -------------------------------------------
// functions to launch golf packages app
// -------------------------------------------
function openGolfPackageSystem(ID,siteID,systemType,packageURLID){
	var urlVars = 'https://secure.guestdesk.com/golf/main.cfm?ID='+ID+'&siteID='+siteID+'&systemType='+systemType+'&packageURLID='+packageURLID;
	myhandle=window.open(urlVars,'windowName','toolbar=no,scrollbars=no,location=no,resizable=no,directories=no,status=yes,menubar=no,width=800,height=505,titlebar=GolfPackages,left=2,top=2')
}
$(document).ready(function() {
		$('#s2').cycle({
			fx:     'fade',
			speed:  'normal',
			timeout: 10000,
			next:   '#next2',
			prev:   '#prev2'
		});
	});
