// JavaScript Document

// will add target to external links
function externalLinks() {
	if (!document.getElementsByTagName){
		return;
	}
	var myanchors = document.getElementsByTagName("a"); 
	for (var i=0; i<myanchors.length; i++) { 
		var thisanchor = myanchors[i]; 
		if (thisanchor.getAttribute("href") &&  thisanchor.getAttribute("rel") == "external"){
			thisanchor.target = "_blank"; 
		}
	}
}

//Set the s.prop for advertisers on information page
function track_advertisers(advertiser) {
	s=s_gi(s_account);
	s.linkTrackVars = "prop29";
	s.prop29 = advertiser;
	s.tl(this,'o',"Advertiser");
}
window.onload = externalLinks;

// popup function for the tee times system
function openit(UID,SiteID,PID,RedLine,urlCourseID,showRates){
	myhandle=window.open('https://secure.guestdesk.com/reservations/?UID='+UID+'&SiteID='+SiteID+'&PID='+PID+'&SystemType='+RedLine+'&urlCourseID='+urlCourseID+'&showRates='+showRates,'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');
}

// used on accommodations.cfm for image rollovers
function showImg(imgName,theImageWidth,theImageHeight){
	document.getElementById('roomImageDisplay').src = imgName;
	document.getElementById('roomImageDisplay').width = theImageWidth;	
	//document.getElementById('roomImageDisplay').height = theImageHeight;	
}
// Show a DIV
function show(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		obj.style.display = "";
	}	
}
// Hide a DIV
function hide(id){
	if (document.getElementById){
		obj = document.getElementById(id);
		obj.style.display = "none";
	}	
}


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");
}

// -------------------------------------------
// coupons page popup
// -------------------------------------------
function setUpCouponPopup(){
	$('a.couponPic').click(function(){
		var dimensions = new Array();
		dimensions = $(this).attr('rel').split('-');
		window.open(this.href,'viewer','width='+dimensions[0]+',height='+dimensions[0]);
		return false;
	});
}
// -------------------------------------------

function toggleDesc(id){
		$('#longDesc' + id).toggle('slow');
		if($('#longDesc' + id).css('display') != 'none'){
			$('#readmore' + id).html("Read More");
		}
		else{
			$('#readmore' + id).html("Read More");
		}
		return false;
}
