var userID = setGetUserId();

var currQuery = new Querystring();

var profile = currQuery.get("profile", "DDP");
var survey = currQuery.get("survey", "none");
var paramTabNumber = currQuery.get("tab", 0);
var currentTab = "";
var currentContentDiv;
var navLoaded = false;
var ignoreNavCallBack = false;

var surveyNames = Array();
surveyNames["surveyhowreal"] = "surveyHowReal.php";
surveyNames["surveywhatflavor"] = "surveyWhatFlavor.php";
surveyNames["surveyareyoucool"] = "surveyAreYouCool.php";
surveyNames["surveyspiritguide"] = "surveySpiritGuide.php";

var tabNames = Array("", "myBoard", "myLife", "myPics", "myClips", "weExist", "myCommercialClips");
var albumTitles = Array();
albumTitles["Alien"] = "Believe";
albumTitles["DDP"] = "On the Road";
albumTitles["EBunny"] = "Hanging with me";
albumTitles["Sasquatch"] = "Moments in Time";
albumTitles["SClaus"] = "Around the World";
albumTitles["Seamus"] = "PHOTOS";
albumTitles["ToothFairy"] = "Say Cheese";

var videoTitles = Array();
videoTitles["Alien"] = "Alien's";
videoTitles["DDP"] = "DDP's";
videoTitles["EBunny"] = "E. Bunny's";
videoTitles["Sasquatch"] = "Whittling";
videoTitles["SClaus"] = "\"A Few More Vacation Photos, Last Time, I swear\"";
videoTitles["Seamus"] = "Seamus'";
videoTitles["ToothFairy"] = "Tooth Fairy's";

var initialStatus = Array();
initialStatus["Alien"] = "is watching Sci-Fi movies and laughing.";
initialStatus["DDP"] = "is enjoying an ice cold Diet Dr Pepper.";
initialStatus["EBunny"] = "finds chocolate bunnies disturbing.";
initialStatus["Sasquatch"] = "is going for a walk in the woods.  Alone.";
initialStatus["SClaus"] = "is vacationing in the Maldives.";
initialStatus["Seamus"] = "is getting really sick of rainbows.";
initialStatus["ToothFairy"] = "is dreading her dentist appointment today.";

var varImageFile = "not set";
var cookieValue = ReadCookie("visitor_id");
if (cookieValue.length == 0)
{
	cookieValue = "anon";
}

// This is the function called from the flash nav bar when a user clicks the btn.
function myNavLocation(tabNumber) {  
	//alert ("Called from the nav: " + tabNumber + " " + ignoreNavCallBack);
	if (ignoreNavCallBack) {
		ignoreNavCallBack = false;
	}
	else {
	  if ((tabNumber > 0) && (tabNumber < 6)) {
	  	switchContent(tabNames[tabNumber]);
	  	currentTab = tabNames[tabNumber];
	  }		
	}
}

function setProfile (profileNameStr, startTab) {
	(startTab == null) ? startTab = 1 : null;
	var defaultStartTabNumber = (paramTabNumber == 0 ? startTab : paramTabNumber);
	paramTabNumber = 0;
	profile = profileNameStr;
	
	setProfileName(profile);
	setStatusSwf();
	updateStatus(initialStatus[profile]);
	setProfileImage(profile);
	setupMyPals(profile);
	
	if (currentTab != tabNames[defaultStartTabNumber]) { // Only reload the nav if we necessary.
		setNavBar (defaultStartTabNumber); //myBoard = 1, myLife = 2, myPics = 3, myClips = 4, weExist = 5.
	}
	var defaultToCommercial = currQuery.get("watchCommercial", false);
	if (defaultToCommercial) {
			switchContent("myCommercialClips");
	}
	else {
		switchContent(tabNames[defaultStartTabNumber]);
	}
	if ((survey == "surveyhowreal") || (survey == "surveywhatflavor") || (survey == "surveyareyoucool") || (survey == "surveyspiritguide")) {
		displaySurvey(surveyNames[survey]);	
	}
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window["flashNav3"];
	}
	else {
		return document["flashNav3"];
	}
}

function setStatusSwf() {
	/*
	var flashvars = {};
	var params = { scale:"noScale", align:"right", wmode:"transparent" };
	var attributes = {id: "flashStatus", name: "flashStatus" };
	swfobject.embedSWF("swfs/status.swf", "profileStatusTextDiv", "570", "20", "9.0.0", false, flashvars, params, attributes);
	*/
}

function updateStatus(statusStr) {
	//thisMovie("flashStatus").sendStatusToFlash(statusStr);	
	//alert("update status with: " + statusStr);
	$("#profileStatusTextDiv").html(statusStr);
}

function setNavHTML(tabNumber) {
	thisMovie("flashNav3").sendCmdToFlash(tabNumber);
} 

function rolloutNav (tabNumber) {
	//alert("rollover");
	thisMovie("flashNav3").sendCmdToFlash_rollout(tabNumber);	
}

function rolloverNav (tabNumber) {
	//alert("rollover!");
	thisMovie("flashNav3").sendCmdToFlash_rollover(tabNumber);	
}

function setNavBar (tabNumber, blockNavCallback) {
	(blockNavCallback == true) ? ignoreNavCallBack = blockNavCallback : null;
	//alert ("setNavBar " + blockNavCallback);
	if (navLoaded) {
		setNavHTML(tabNumber);
	}
	else {
		//alert ("setNavBar else");
		$('#weExistNav').html("");
		var flashvars = {startBtn:tabNumber};
		var params = { scale:"noScale", align:"right", wmode:"transparent" };
		var attributes = {id: "flashNav3", name: "flashNav3" };
		swfobject.embedSWF("swfs/weExist_navbar3.swf", "weExistNav", "543", "43", "9.0.0", false, flashvars, params, attributes);
		navLoaded = true;
	}
	//currentTab = tabNames[tabNumber];
}

function setProfileName (profileNameStr) {
	$("#profileHeaderNameDiv").html ("<img src=\"images/" + profileNameStr + "/ProfileHeaderName.png\" width=\"390\" height=\"25\" />");
}

function setProfileImage (profileNameStr) {
	var profileImageDiv = $("#ProfileImageDiv");
	profileImageDiv.html ("<img src='images/"+profileNameStr+"/ProfileImage.png' width='249' height='434' />");
	$(document).pngFix();
}

function setupMyPals (profileNameStr) {
	// Clear existing entries.
	$("#MyPals1").html("");
	$("#MyPals3").html("");
	$("#MyPals2").html("");
	$("#MyPals4").html("");
	$("#MyPals1").html("");
	$("#MyPals5").html("");
	// Set the new MyPals thumbnails and links.								
	switch (profileNameStr) {
		case "DDP" : $("#MyPals1").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\" alt=\"S. Claus\" /><br/>S. Claus</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\"  alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\"  alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\"  alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals6").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "Alien" : $("#MyPals2").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\"  alt=\"DDP\" /><br/>DDP</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\"  alt=\"S. Claus\" /><br/>S. Claus</a>");
									$("#MyPals6").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\"  alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\"  alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\"  alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "EBunny" : $("#MyPals6").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\"  alt=\"S. Claus\" /><br/>S. Claus</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\"  alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\"  alt=\"DDP\" /><br/>DDP</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\"  alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "Sasquatch" : $("#MyPals6").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\"  alt=\"S. Claus\" /><br/>S. Claus</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\"  alt=\"DDP\" /><br/>DDP</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\"  alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\"  alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "SClaus" : $("#MyPals6").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\"  alt=\"DDP\" /><br/>DDP</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\"  alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\"  alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\"  alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "Seamus" : $("#MyPals3").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\" alt=\"S. Claus\"  /><br/>S. Claus</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\" alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals6").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\" alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\" alt=\"DDP\"/><br/>DDP</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('ToothFairy');\"><img src=\"images/_global/MyPals/MyPals_ToothFairyPic.jpg\" width=\"55\" height=\"55\"  alt=\"Tooth Fairy\" /><br/>Tooth<br />Fairy</a>");
									break;
		case "ToothFairy" : $("#MyPals6").html("<a href=\"javascript:setProfile('Alien');\"><img src=\"images/_global/MyPals/MyPals_AlienPic.jpg\" width=\"55\" height=\"55\"  alt=\"Alien\" /><br/>Alien</a>");
									$("#MyPals2").html("<a href=\"javascript:setProfile('SClaus');\"><img src=\"images/_global/MyPals/MyPals_S.ClausPic.jpg\" width=\"55\" height=\"55\"  alt=\"S. Claus\" /><br/>S. Claus</a>");
									$("#MyPals1").html("<a href=\"javascript:setProfile('Sasquatch');\"><img src=\"images/_global/MyPals/MyPals_SasquatchPic.jpg\" width=\"55\" height=\"55\"  alt=\"Sasquatch\" /><br/>Sasquatch</a>");
									$("#MyPals3").html("<a href=\"javascript:setProfile('EBunny');\"><img src=\"images/_global/MyPals/MyPals_EasterBunnyPic.jpg\" width=\"55\" height=\"55\"  alt=\"E. Bunny\" /><br/>E. Bunny</a>");
									$("#MyPals5").html("<a href=\"javascript:setProfile('Seamus');\"><img src=\"images/_global/MyPals/MyPals_SeamusPic.jpg\" width=\"55\" height=\"55\" alt=\"Seamus\" /><br/>Seamus</a>");
									$("#MyPals4").html("<a href=\"javascript:setProfile('DDP');\"><img src=\"images/_global/MyPals/MyPals_DDPPic.jpg\" width=\"55\" height=\"55\" alt=\"DDP\" /><br/>DDP</a>");
									break;
		}
}

function getTabName (imgObj) {
	return (imgObj.id.toString().substring(0,imgObj.id.toString().length - 6));	
}

function switchContent(tabName) {
	$("#myPicsShare").hide();
	$("#myClipsShare").hide();
	$("#myClipsShareSas").hide();
	$("#mypicsPicCaption").hide();
	currentContentDiv.css('overflow','hidden');
	//alert (tabName);
	showThumbs = true;
	/*if (profile == "Sasquatch") {
		showThumbs = true;
	}
	*/
	contentSelection = tabName;
	if (tabName == "myClips") {
		if (profile == "Sasquatch") {
			contentSelection = "SasquatchClips";
		}
		else {
			//contentSelection = "myCommercialClips";
			contentSelection = "myCommercialClips15";
		}
	}
	
	currentContentDiv.html("<br /><br />loading . . . .");
	switch (contentSelection) {
		case "myBoard" :	
			currentContentDiv.css('overflow-x','hidden').css('overflow-y','scroll');
			currentContentDiv.load("php/myBoard.php?profile=" + profile);
			sendTrackingForClick("my board");
			break;
		case "myLife" :	
			currentContentDiv.load('mylife/' + profile + '/mylife.html');
			sendTrackingForClick("my life");
			break;
		case "myPics": var divText = "<div id='albumTitle' style='position:relative; top:10px; left:-15px; text-align:center; font-weight:bold; width:520px;'>" + albumTitles[profile] + " Album</div>";
		    divText += "<div id='myPicsPlayerContainerDiv' style='position:relative; top:0px; left:0px;'><div id='myPicsPlayerDiv' style='width:520px; height:512px;'></div></div>";
		    divText += "<div id='my-pics-star-rating'></div>";
		    currentContentDiv.html(divText);
		    sendTrackingForClick("my pics");
		    //currentContentDiv.css('overflow', 'hidden');
		    var flashvars = { xml_url: 'data/' + profile + '.xml' };
		    var params = { scale: "noScale", align: "right", wmode: "transparent", base: "swfs" };
		    swfobject.embedSWF("swfs/weExist_ImageView.swf", "myPicsPlayerDiv", "520", "512", "9.0.0", false, flashvars, params);
		    $("#myPicsShare").show();
		    $("#mypicsPicCaption").show();
		    addthis.button('#add_this', {}, {url: getPicsURL(), title: "Share Pictures", content: "Additional content here."});
		    break;
		/* Begin Ramon */
		case "myCommercialClips15":  playVideo(baseURL + "/swfs/images/commercialStill15.jpg",  commercialVideo15, "I Exist support group - Session 2", "<br /><br /><br />Watch the latest commercial!", showThumbs);
			$("#myClipsShare").show();
			addthis.button('#add_this2', {}, {url: getClipsURL(), title: "Share Videos"});
			break;
		/* End Ramon  */
		case "myCommercialClips":  playVideo(baseURL + "/swfs/images/commercialStill.jpg",  commercialVideo, "I Exist support group - Session 1", "<br /><br /><br />Watch the commercial!", showThumbs);
			$("#myClipsShare").show();
			addthis.button('#add_this2', {}, {url: getClipsURL(), title: "Share Videos"});
			 break;
		case "SasquatchClips":  playVideo(baseURL + "/swfs/images/sasquatch/SasquatchStill.jpg", sasquatchPathAndVideo, videoTitles[profile], "<br /><br /><br />Just trying to enjoy a simple hobby, and failing.", showThumbs);
			$("#myClipsShareSas").show();
			addthis.button('#add_this3', {}, {url: getClipsURL(), title: "Share Videos"});
			break;
		// Added by Ramon 20091203
		case "ToothFairyClips":  playVideo(baseURL + "/swfs/images/toothfairy/TFairyStill.jpg", toothFairyVideo, videoTitles[profile], "<br /><br /><br />Just trying to enjoy a simple hobby, and failing.", showThumbs);
			$("#myClipsShareSas").show();
			addthis.button('#add_this3', {}, {url: getClipsURL(), title: "Share Videos"});
			break;
		// Added by Ramon 20091203
		case "SClausClips":  playVideo(baseURL + "/swfs/images/SClaus/SClausStill.jpg", sClauseVideo, videoTitles[profile], "<br /><br /><br />Just trying to enjoy a simple hobby, and failing.", showThumbs);
			$("#myClipsShareSas").show();
			addthis.button('#add_this3', {}, {url: getClipsURL(), title: "Share Videos"});
			break;
		case "weExist": 
			//alert('http://' + window.location.hostname + window.location.pathname.substr(0,window.location.pathname.lastIndexOf("/")));
			location.href = baseURL + "/weExist/";
			break;
	}
	currentTab = tabName;
}


function playVideo(stillImage, videoFile, videoTitle, videoSummary, showThumbs) {
	var divText = "<div id='albumTitle' style='position:relative; top:15px; left:-95px; text-align:center; font-weight:bold; width:710px;'>" + videoTitle + "</div>";
	divText += "<div id='myClipsPlayerContainerDiv' style='position:relative; top:20px; left:0px;'><div id='myClipsPlayerDiv' style='width:526px; height:120px;'></div></div>";
	
	// Set up the div for displaying the video summary information.
	divText += "<div id='vidSummary' style='background-color:#d5d5d5; position:relative; top:15px; left:0px; width:526px; height:120px;'>";
	divText += "	<div id='vidSummaryTitleDiv' style='float:left;width:150px;'><br /><br /><br /><img src='swfs/images/videoTitle.gif' width='81' height='30' alt='Video Summary' /></div>";
	divText += "	<div id='vidSummaryCopyDiv' style='float:right;width:326px;text-align:left;'>"+ videoSummary +"</div>";
	divText += "</div>";
	
	// Set up the thumbnails for the video clips.
	if (showThumbs) {
		divText += "<div id='vidThumnails' style='position:relative; top:25px; left:0px; width:400px; text-align:left;'><a href='javascript:switchContent(\"myCommercialClips15\");'><img src='swfs/images/myclips_commercial_thumbnail_15sec.png' /></a>&nbsp;<a href='javascript:switchContent(\"myCommercialClips\");'><img src='swfs/images/myclips_commercial_thumbnail.png' /></a>&nbsp;";
		if (profile == "Sasquatch")	{
			divText += "<a href='javascript:switchContent(\"SasquatchClips\");'><img src='swfs/images/" + profile.toLowerCase() + "/myclips_thumbnail.png' /></a>";
		}
		if (profile == "ToothFairy") {
			divText += "<a href='javascript:switchContent(\"ToothFairyClips\");'><img src='swfs/images/toothfairy/thmb_ToothFairy.png' /></a>";
		}
		if (profile == "SClaus") {
			divText += "<a href='javascript:switchContent(\"SClausClips\");'><img src='swfs/images/SClaus/thmb_SClaus.png' /></a>";
		}
		divText += "</div>";	
	}

	currentContentDiv.html(divText);
	sendTrackingForClick("my clips");

	var flashvars = {still:stillImage, video:videoFile, title:videoTitle, id: "dpvideo", name:"dpvideo"};
	var params = { scale:"noScale", align:"right", wmode:"transparent", quality:"high", menu:"false", allowFullScreen:"true" };
	swfobject.embedSWF("http://www.drpepper.com/swf/com/drpepper/videoplayer/DrPepperVideoPlayer.swf", "myClipsPlayerDiv", "526", "360", "9.0.0", false, flashvars, params);	
}

function displaySurvey(surveyName) {
	fb_show('', surveyName + '?KeepThis=true&FB_iframe=true&height=648&width=964&modal=true','');
}

function setGetUserId() {
	
}

function updateImageCaption(imageCaptionStr) {
	$("#mypicsPicCaption").html(imageCaptionStr);
}

function rate_star(imageFile, imageCaption)
{
	varImageFile = imageFile;
	updateImageCaption(imageCaption);
	$('#my-pics-star-rating').html('');
	$('#my-pics-star-rating').append('<form><input name="rating" value="1" type="radio" class="star" /><input name="rating" value="2" type="radio" class="star" /><input name="rating" value="3" type="radio" class="star" /><input name="rating" value="4" type="radio" class="star" /><input name="rating" value="5" type="radio" class="star" /></form>');
	$('#my-pics-star-rating').append('<script type="text/javascript" language="JavaScript" src="js/jquery.rating.js"></script>');
	$('div.rating-cancel').css('display','none');
	$('#my-pics-star-rating').click(function() {
				var str = $('#my-pics-star-rating form').serialize();
				var querystr = 'source=myboard&source_id=' + varImageFile + '&cookie_id=' + cookieValue + '&' + str;
				// Send Ajax request to database
				$.ajax({type: "GET", url: "php/starRating.php", data: querystr});
				//alert('star rated');
				$('#my-pics-star-rating').unbind('click');
				$('#my-pics-star-rating input').rating('disable');
			}
		);
	
	// Query database
	var querystr2 = 'cookie_id=' + cookieValue + '&source_id=' + varImageFile;
	var currentValue = "";
	$.ajax({
		type: "GET",
		url: "php/getImageRating.php",
		data: querystr2,
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: function(msg) {
			// Hide the fake progress indicator graphic.
			// Insert the returned HTML into the <div>.
			currentValue = msg.objValue.toString();
			$('#my-pics-star-rating input').rating('select', currentValue);
		}
	});
}

function ReadCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function getPicsURL() {
	return baseURL +'?profile='+profile+'&tab=3&source=share';
}
function getClipsURL() {

	return baseURL +'?profile='+profile+'&tab=4&source=share';
}

function sendTrackingForClick(section) {
		var l_aSpecificTrackingVars = {
		"pageName" : "entertainment: weexist: " + section + " " + profile + " - Dr Pepper",
		"eVar12" : "entertainment: weexist: " + section + " " + profile + " - Dr Pepper",
		"channel" : "entertainment",
		"eVar13" : "entertainment",
		"prop5" : "Dr Pepper",
		"eVar8" : "South West",
		"prop8" : "South West",
		"prop9" : "Dr Pepper",
		"eVar9" : "Dr Pepper",
		"prop10" : "CSDs",
		"eVar10" : "CSDs",
		"eVar14" : "Non Flash",
		"prop11" : "Non Flash",
		"prop28" : "weexist",
		"prop24" : section + " " + profile,
		"events" : "event12"
		};
		DrPepper.Tracking.track(l_aSpecificTrackingVars);
	}
