function SelectedVideoChanged(e,opts,ctrl){
	var videoURL,fullVideoURL;
	var eventType=e.type;
	var aURL;
	var flashVars,flashDiv;
	var optsArrayIndex;videoURL='/tipsvideos/video.aspx?v='+opts.videoId;fullVideoURL="http://"+opts.siteURL+videoURL;
	
	switch(eventType){
		case"mouseover":
			$("#FeaturedVideos img").removeClass("opaque").addClass("opaque");
			$(ctrl).removeClass("opaque");
			$("#FeaturedVideoTitle").attr({href:videoURL}).html(opts.videoTitle);
			$("#FeaturedVideoAuthor a").remove();$("#FeaturedVideoAuthor").html("");
			if(opts.authorURL.substring(0,1)=="/"){
				$("#FeaturedVideoAuthor").html("by: "+opts.videoAuthor);
			} else {
				aURL=document.createElement("a");
				$(aURL).attr({href:"/instructor/"+opts.authorURL}).html(opts.videoAuthor);
				$("#FeaturedVideoAuthor").append("<span class=\"hilight6\">by: </span>").append(aURL);
			}
			break;
		case"click":
			RenderVideo(opts);
			$("#NowPlayingVideoTitle").attr({href:videoURL}).html(opts.videoTitle);
			$("#NowPlayingVideoAuthor a").remove();
			$("#NowPlayingVideoAuthor").html("");
			if(opts.authorURL.substring(0,1)=="/") { 
				$("#NowPlayingVideoAuthor").html("by: "+opts.videoAuthor);
			} else {
				aURL=document.createElement("a");
				$(aURL).attr({href:"/instructor/"+opts.authorURL}).html(opts.videoAuthor);
				$("#NowPlayingVideoAuthor").append("<span class=\"hilight6\">by: </span>").append(aURL);
			}
			optsArrayIndex=ctrl.id.replace("FeaturedVideoThumbnail","");
			$(ctrl).attr({src:Akamai+"FLVPlayer/images/"+selectedVideoOpts.videoFile+"-daily-small.jpg"});
			optsArray[optsArrayIndex-1]=selectedVideoOpts;selectedVideoOpts=opts;
			$("#FeaturedVideos img").removeClass("opaque").addClass("opaque");
			$("#FeaturedVideoThumbnail1").removeClass("opaque");
			ChangeShareLinks(fullVideoURL,opts.videoTitle,opts.videoDesc,'ctl00_MainContentPlaceHolder_ucHomepageShareLinksVOD');
			break;
	}
}

function SelectedTipChanged(e,opts,ctrl){
	var tipURL,fullTipURL;
	var eventType=e.type;
	var aURL;
	var optsArrayIndex;
	tipDetailURL='/tipsvideos/tip.aspx?t='+opts.tipId;
	tipURL='/tipsvideos/viewtip.aspx?t='+opts.tipId+"&e=.swf";
	fullTipURL="http://"+opts.siteURL+tipDetailURL;
	switch(eventType){
		case"mouseover":
			$("#FeaturedTips img").removeClass("opaque").addClass("opaque");
			$(ctrl).removeClass("opaque");
			$("#FeaturedTipTitle").attr({href:tipDetailURL}).html(opts.tipTitle);
			$("#FeaturedTipAuthor").html(opts.tipAuthor);
			break;
		case"click":
			$("#SelectedTipTitle").attr({href:tipDetailURL});
			$("#SelectedTipTitle div.tip_title").html(opts.tipTitle);
			$("#SelectedTipAuthor").html(opts.tipAuthor);
			if(opts.tipPages<=1){
				$("#SelectedTipImage").attr({src:Akamai+"img/tips/"+opts.tipFile+"-daily-large-0.jpg",style:"margin:auto;display:block;"});
				$("#SelectedTipImage2").attr({style:"display:none;"});
			} else {
				$("#SelectedTipImage").attr({src:Akamai+"img/tips/"+opts.tipFile+"-daily-large-0.jpg",style:"margin-auto;"});
				$("#SelectedTipImage2").attr({src:Akamai+"img/tips/"+opts.tipFile+"-daily-large-1.jpg",style:"margin-auto;"});
			}
			$("#SelectedTipDesc").html(opts.tipDesc);
			$("#SelectedTipURL").attr({href:tipURL});
			$("#SelectedTipImageURL").attr({href:tipDetailURL});
			optsArrayIndex=ctrl.id.replace("FeaturedTipThumbnail","");
			$(ctrl).attr({src:Akamai+"img/tips/"+selectedTipOpts.tipFile+"-daily-small-0.jpg"});
			tipOptsArray[optsArrayIndex-1]=selectedTipOpts;
			selectedTipOpts=opts;
			$("#FeaturedTips img").removeClass("opaque").addClass("opaque");
			$("#FeaturedTipThumbnail1").removeClass("opaque");
			ChangeShareLinks(fullTipURL,opts.tipTitle,opts.tipDesc,'ctl00_MainContentPlaceHolder_ucHomepageShareLinksTOD');
			break;
	}
}

function RenderVideo(id, opts){

	flashVars="omniture=0&demand_report_url=http://" + opts.siteURL +
		"/mygame/favorites/_updatecustomerlist.aspx?oid=" + opts.videoId +
		"%26lt=2%26ot=2%26active=1%26"+(opts.li?"":"&adPartner=DoubleClick")+"&adTagUrl=http%3A%2F%2Fad.doubleclick.net%2Fpfadx%2Ftgc.golflink%2Fvideos%3Bpage%3D10050%3Bsel%3D350%3Bsel2%3D11133%3Bsz%3D440x330%3Btile%3D1%3Bord%3D1234564654987979846545654" +
		"&KEY=golflink&CATEGORIES=" + encodeURIComponent(opts.videoCat) +
		"&DESC=" + encodeURIComponent(opts.videoDesc) + 
		"&KEYWORDS=" + encodeURIComponent(opts.videoKeywords) + 
		"&demand_preroll=true&demand_preroll_source=http://" + opts.siteURL + 
		"/flvplayer/images/" + opts.videoFile + 
		"-medium.jpg&demand_autoplay="+opts.play+"&demand_content_id=" + opts.videoId + 
		"&ID=" + opts.videoId + 
		"&demand_content_sourcekey=golflink.com&demand_page_url=http://" + opts.siteURL+opts.relativeURL + 
		"&sitename=" + opts.siteName + 
		"&video_title=" + encodeURIComponent(opts.videoTitle) + 
		"&source=rtmp://cp38416.edgefcs.net/ondemand/GolfLink/" + opts.videoFile + 
		"-medium.flv&skin=http://cdn-i.dmdentertainment.com/DMVideoPlayer/playerskin_gl.swf";
		
	flashDiv=document.getElementById(id);
	flashDiv.innerHTML="<object type=\"application/x-shockwave-flash\"" + 
		" data=\"http://cdn-i.dmdentertainment.com/DMVideoPlayer/player.swf\"" + 
		" width=\"100%\" height=\"100%\" id=\"mymovie\">"+"<param name=\"movie\" value=\"http://cdn-i.dmdentertainment.com/DMVideoPlayer/player.swf\">" + 
		"<param name=\"quality\" value=\"high\">"+"<param name=\"wmode\" value=\"opaque\">" + 
		"<param name=\"bgcolor\" value=\"#FFFFFF\">"+"<param name=\"allowScriptAccess\" value=\"always\">" + 
		"<param name=\"allowFullScreen\" value=\"true\">"+"<param id=\"flashVars\" name=\"flashVars\" value=\"" + 
		flashVars + "\">" + "</object>";
}

function ChangeShareLinks(purl,ptitle,pdesc,pctrlPrefix){
	$("#"+pctrlPrefix+"_pnlShareFacebook a").attr({href:'http://www.facebook.com/sharer.php?u='+encodeURIComponent(purl)+'&t='+encodeURIComponent(ptitle)});
	$("#"+pctrlPrefix+"_pnlShareDigg a").attr({href:'http://digg.com/submit?url='+encodeURIComponent(purl)+'&title='+encodeURIComponent(ptitle)+'&bodytext='+encodeURIComponent(pdesc)+'&media=video&topic=golf'});$("#"+pctrlPrefix+"_pnlShareMySpace a").attr({href:'http://www.myspace.com/index.cfm?fuseaction=postto&t='+encodeURIComponent(ptitle)+'&c=&u='+encodeURIComponent(purl)+'&l='});
	$("#"+pctrlPrefix+"_pnlShareDelicious a").attr({href:'http://del.icio.us/post?url='+encodeURIComponent(purl)+'&title='+encodeURIComponent(ptitle)});
	$("#"+pctrlPrefix+"_pnlShareReddit a").attr({href:'http://www.reddit.com/submit?url='+encodeURIComponent(purl)+'&title='+encodeURIComponent(ptitle)});
	$("#"+pctrlPrefix+"_pnlShareBebo a").attr({href:'http://www.bebo.com/c/share?Url='+encodeURIComponent(purl)+'&Title='+encodeURIComponent(ptitle)});
	$("#"+pctrlPrefix+"_pnlShareStumbleUpon a").attr({href:'http://www.stumbleupon.com/submit?url='+encodeURIComponent(purl)+'&title='+encodeURIComponent(ptitle)});
	$("#"+pctrlPrefix+"_pnlShareLiveSpaces a").attr({href:'http://spaces.live.com/BlogIt.aspx?Title='+encodeURIComponent(ptitle)+'&SourceURL='+encodeURIComponent(purl)+'&description='+encodeURIComponent(pdesc)});
	$("#"+pctrlPrefix+"_pnlShareOrkut a").attr({href:'http://www.orkut.com/FavoriteVideos.aspx?u='+encodeURIComponent(purl)});
}

function multiTagSyncRoadBlock(param1, param2) {
	var id = null;
	var width = 0;
	var height = 0;

	switch (param1) {
		case 'myAd1':
			id = 'TGCAdUnit728x90';
			width = "728";
			height = "90";
			break;

		case 'myAd2':
			id = 'TGCAdUnit300x250';
			width = "300";
			height = "250";
			break;

		//	case 'myAd3': 
		//		id = ''; 
		//	break; 
		//				 
		//	case 'myAd4': 
		//		id = ''; 
		//	break; 
	}

	if (id != null) {
		$("#" + id).html('<iframe src="' + param2 + '" WIDTH="' + width + '" HEIGHT="' + height + '" MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 scrolling=no style="margin: 0px auto;">' + '</iframe>');
	}
}