//<![CDATA[
// set document.domain needed for Pluck 
document.domain="tahoe.com";
var currentHost = window.location.host;
var serverUrl = "";
if (currentHost.indexOf("dev.") > -1 || currentHost.indexOf("local.") > -1 || currentHost.indexOf("stage.") > -1) {
	serverUrl = "http://sitelifestage.tahoe.com/ver1.0/Direct/Process";
} else {
	serverUrl = "http://sitelife.tahoe.com/ver1.0/Direct/Process";
}
var CurrentUser = retrieveSSOCookieUserId();
if (CurrentUser !='' && CurrentUser !='undefined') {
	CurrentUser = hex_md5(CurrentUser);
}
function requestPluckUserAvatar() {
	// create a request batch  
	var requestBatch = new RequestBatch();

	// add the userKey to the request
	var userKey = new UserKey(CurrentUser);
	requestBatch.AddToRequest(userKey); 

	// initiate the request.  The response will be passed to the renderUserAvatar() method.  
	requestBatch.BeginRequest(serverUrl, renderUserAvatar);
}

// writes the user data into a <div> tag on the page
function renderUserAvatar(responseBatch) {
	if (responseBatch.Responses.length == 0) {
		// ignore error
	} else {
		// get the user object out of the response  
		var user = responseBatch.Responses[0].User;
		document.getElementById("avatar").src = user.AvatarPhotoUrl;
	}
}

function goToSomeOneElsesProfile(otherEmailAddress) {
	var otherEncodedEmail = hex_md5(otherEmailAddress);
	window.location.href = pluckPath + '/index.php?userId='+otherEncodedEmail+'&plckUserId='+otherEncodedEmail+'&plckPersonaPage=PersonaPhotos';
}
//]]>