//<![CDATA[
// Animation constants
var PROFILE_REQUEST_SAVED_LISTINGS_SENDHIGHLIGHTDURATION = 3.0;
var PROFILE_REQUEST_SAVED_LISTINGS_SENDFADEDURATION = 0.8;
var PROFILE_REQUEST_SAVED_LISTINGS_SENDAPPEARDURATION = 1.2;
var PROFILE_REQUEST_SAVED_LISTINGS_SENDTIMEOUTDURATION = 5000;
var PROFILE_REQUEST_SAVED_LISTINGS_INFOAPPEARDURATION = 1.2;
var PROFILE_REQUEST_SAVED_LISTINGS_CANCELFADEDURATION = 0.8;
var PROFILE_REQUEST_SAVED_LISTINGS_CANCELAPPEARDURATION = 1.2;
var PROFILE_EMAIL_SAVED_LISTINGSAPPEARDURATION = 1.2;
var PROFILE_EMAIL_SAVED_LISTINGS_SENDHIGHLIGHTDURATION = 3.0;
var PROFILE_EMAIL_SAVED_LISTINGS_SENDFADEDURATION = 0.8;
var PROFILE_EMAIL_SAVED_LISTINGS_SENDAPPEARDURATION = 1.2;
var PROFILE_EMAIL_SAVED_LISTINGS_SENDTIMEOUTDURATION = 5000;
var PROFILE_EMAIL_SAVED_LISTINGS_CANCELFADEDURATION = 0.8;
var PROFILE_EMAIL_SAVED_LISTINGS_CANCELAPPEARDURATION = 1.2;
var PROFILE_VIEW_SAVED_SEARCHESAPPEARDURATION = 0.8;
var PROFILE_DELETE_SAVED_SEARCHFADEDURATION = 1.2;
var PROFILE_DELETE_SAVED_SEARCHHIGHLIGHTDURATION = 3.0;
var PROFILE_DELETE_SAVED_SEARCHTIMEOUTDURATION = 5000;
var PROFILE_CLOSE_SAVED_SEARCHESFADEDURATION = 0.8;
var PROFILE_CLOSE_SAVED_SEARCHESAPPEARDURATION = 0.8;
var PROFILE_UPDATEAPPEARDURATION = 1.2;
var PROFILE_UPDATE_SENDHIGHLIGHTDURATION = 3.0;
var PROFILE_UPDATE_SENDFADEDURATION = 1.2;
var PROFILE_UPDATE_SENDAPPEARDURATION = 1.2;
var PROFILE_UPDATE_SENDTIMEOUTDURATION = 8000;
var PROFILE_UPDATE_CANCELFADEDURATION = 0.6;
var PROFILE_UPDATE_CANCELAPPEARDURATION = 1.0;

Event.observe( window, 'load', function() {	
	addClientOnLoad();
	addOnLoad();
} );

function addOnLoad(){
	if (loggedin)
		loadHomePage();
	else 
		loadWelcomePage();
}
//
// Loads the welcome page
//
function loadWelcomePage() {
	
	var property_tracker_container = $('property_tracker_container_inner');
	property_tracker_container.innerHTML='<div style="margin-top: 20px; margin-bottom: 40px;  font-size: 12px; font-weight: bold;"><img src="/property-search/res/images/loading_big.gif" align="absmiddle"><strong> Loading Property Tracker....</strong></div>';

	
	// Set the bind arguments to retrieve map data
	var bindArgs = {	
	onFailure: function(){
		alert('An error occurred and we could not initiate the Property Tracker. \n\n Please make sure that you are using an up-to-date browser and that you have javascript and cookies fully enabled.');
		property_tracker_container.innerHTML='<div style="padding: 25px 0px 0px 15px; font: bold 12px tahoma;">Error: Could Not Load Page</div>';
	},
	onSuccess: function(t){
		property_tracker_container.innerHTML=t.responseText;		
	}
	};

	// Run the XHR Requests
	new Ajax.Request('/property-search/sist_ajax/welcome.asp', bindArgs);		
}
//
// Loads the home page
//
function loadHomePage() {
	
	var property_tracker_container = $('property_tracker_container_inner');
	property_tracker_container.innerHTML='<div style="margin-top: 20px; margin-bottom: 40px;  font-size: 12px; font-weight: bold;"><img src="/property-search/res/images/loading_big.gif" align="absmiddle"><strong> Loading....</strong></div>';
	
	// Set the bind arguments to retrieve map data
	var bindArgs = {
	method: 'post',
	parameters: 'userid=' + userid + '&siteid=' + siteid,	
	onFailure: function(){
		alert('An error occurred and we could not load your home page. \n\n Please make sure that you are using an up-to-date browser and that you have javascript and cookies fully enabled.');
		property_tracker_container.innerHTML='<div style="padding: 25px 0px 0px 15px; font: bold 12px tahoma;">Error: Could Not Load Page</div>';
	},
	onSuccess: function(t){
		property_tracker_container.innerHTML=t.responseText;
		
		// get the javascript to update the count of number of favorites and number of searches
		var script = property_tracker_container.getElementsByTagName('script')[0];
		eval(script.innerHTML);			
	}
	};

	// Run the XHR Requests
	new Ajax.Request('/property-search/sist_ajax/home.asp',bindArgs);			
}
//
// Logs the user out
//
function logout() {
	
	if (confirm('Are you sure you want to logout?')) {
		eraseCookie('siID');
		eraseCookie('siPW');
		eraseCookie('siUserID');
		eraseCookie('siLoggedIn');
		
		// clear user data from javascript variables
		userid = '';
		siusername = '';
		sipassword = '';
		
		// Also need to remove user id from search form hidden fields
		if ($('userid')) {
			$('userid').value = '';
		}
		
		if ($('searchid')) {
			$('searchid').value = '';
		}
		
		loggedin = false;
		
		// reload search results (if necessary) to remove saved listings
		loadWelcomePage();
	}
}
//
// Shows the save search box for new searches
//
function show_save_for_new_search() {
	$('userid').value = userid;
	$('searchid').value = '';
	$('favs').value = 'false';
	$('hidaction').value = 'newsavedsearch';
	full_search('1');
}
//
// Loads saved search for editing
//
function load_saved_search_for_edit(searchid, userid) {	
	$('userid').value = userid;
	$('searchid').value = searchid;
	$('favs').value = 'false';
	$('hidaction').value = 'editsavedsearch';
	full_search('1');
}
//
// Updates the saved lsitings text
//
function updateSavedListingText(num) {
	
	if (num == 1) {
		$('numSavedListings').innerHTML = 'You currently have 1 saved listing.';
		$('savedListingsActions').style.display = '';
	} else if (num >=2) {
		$('numSavedListings').innerHTML = 'You currently have ' + num + ' saved listings.';
		$('savedListingsActions').style.display = '';
	} else {
		$('numSavedListings').innerHTML = 'You do not currently have any saved listings. <a href="javascript:newSearch();">Click here to search the area listings</a>.<br /><br />Once you save listings, you can email or request more information on all of your saved listings at once.';
		$('savedListingsActions').style.display = 'none';
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
// PROFILE REQUEST SAVED LISTING FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////
//
// Gets the user's saved listings information
//
function profile_request_saved_listings_info(userid){
	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');
	
	new Effect.Opacity(savedListingsContainer);
	new Effect.Opacity(savedListingsRequest);		
	
	savedListingsRequest.innerHTML='<fieldset><legend>Request More Info about Your Saved Listings</legend><img src="/property-search/res/images/loading_big.gif" align="absmiddle"> <span style="font-size: 12px; font-weight: bold;">Loading Form...</span></fieldset>';

	var bindArgs = {
	method: 'get',
	parameters: 'requestuserid=' + userid,		
	onFailure: function(){
		alert('An error occurred and we could not retrieve the request more info form.  Please try again.');
	},
	onSuccess: function(t){
		savedListingsRequest.innerHTML=t.responseText;
		$(savedListingsContainer).hide();
		new Effect.BlindDown(savedListingsRequest, {duration: PROFILE_REQUEST_SAVED_LISTINGS_INFOAPPEARDURATION});		
	}
	};
	
	new Ajax.Request('/property-search/sist_ajax/request_more_info.asp',bindArgs);
}
//
// Sends the save listing request
//
function profile_request_saved_listings_send(){
		
	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');
	
	var params = Form.serialize($('requestmoreinfo'));
	
	var bindArgs = {
	method: 'post',
	parameters: params,
	onFailure: function(t){
		alert(t.responseText + ': An error occurred and we could not send your request.  Please try again.');
		$('requestsubmit').value = 'Submit';
	},
	onSuccess: function(t){
		savedListingsRequest.innerHTML='<fieldset><legend>Request More Info about Your Saved Listings</legend>' + t.responseText + '</fieldset>';			
		new Effect.Highlight(savedListingsRequest, {duration: PROFILE_REQUEST_SAVED_LISTINGS_SENDHIGHLIGHTDURATION, startcolor: highlight_startcolor, endcolor: highlight_endcolor});
		setTimeout(function(){
			new Effect.Fade(savedListingsRequest, {queue: 'end', duration: PROFILE_REQUEST_SAVED_LISTINGS_SENDFADEDURATION});
			new Effect.BlindDown(savedListingsContainer, {queue: 'end', duration: PROFILE_REQUEST_SAVED_LISTINGS_SENDAPPEARDURATION});
			}, PROFILE_REQUEST_SAVED_LISTINGS_SENDTIMEOUTDURATION);
	}
	};	
	
	// Validate the form contents before submitting
	var reqEmail = IsValidEmail($('requestEmail'));
	var reqName = IsEmpty($('requestName'));
	if (!reqName)
		// Caps first letter of each name, reset to lowercase if reqName is not empty
		$('requestName').value = ReadableName($('requestName'));

	// Check to see if this site wants phone number to be a required field (set in si_client.js)
	var phone = true;
	
	if (require_phone_number) {
		phone = IsValidPhoneNumber($('requestDayPhone'));
	}
		
	// if data is valid, send the request
	if (reqEmail && !reqName && phone){
		$('requestsubmit').value = 'Sending Data...';
		$('requestsubmit').style.width = '125px';	
		new Ajax.Request('/property-search/sist_ajax/request_more_info.asp',bindArgs);
	}
	// if name field is blank, return focus to field and display message
	else if (reqName){
			alert('Please enter your name.');
			$('requestName').focus();
	}
	// if email field is blank, return focus to field and display message
	else if (!reqEmail){
			alert('Please enter a valid email address.');
			$('requestEmail').focus();
	}	
	// if phone field is blank, return focus to field and display message
	else if (!phone){
			alert('Please enter a valid ten digit phone number.');
			$('requestDayPhone').focus();
	}
}
//
// Cancels any / all detail request forms
//
function profile_request_saved_listings_cancel(){
	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');
	
	new Effect.Fade(savedListingsRequest, {queue: 'end', duration: PROFILE_REQUEST_SAVED_LISTINGS_CANCELFADEDURATION});
	new Effect.BlindDown(savedListingsContainer, {queue: 'end', duration: PROFILE_REQUEST_SAVED_LISTINGS_CANCELAPPEARDURATION});
	 
}
////////////////////////////////////////////////////////////////////////////////////////////////
// PROFILE EMAIL TO FRIEND SAVED LISTING FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////
//
// Loads the user's profile to send friend email
//

function profile_email_saved_listings(userid){
	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');	
	
	savedListingsRequest.innerHTML='<fieldset><legend>Email Your Saved Listings</legend><img src="/property-search/res/images/loading_big.gif" align="absmiddle"> <span style="font-size: 12px; font-weight: bold;">Loading Form...</span></fieldset>';

	var bindArgs = {
	method: 'get',
	parameters: 'requestuserid=' + userid,		
	onFailure: function(){
		alert('An error occurred and we could not retrieve the email form.  Please try again.');
	},
	onSuccess: function(t){
		savedListingsRequest.innerHTML=t.responseText;
		$(savedListingsContainer).hide();
		new Effect.BlindDown(savedListingsRequest, {duration: PROFILE_EMAIL_SAVED_LISTINGSAPPEARDURATION});		
	}
	};
	
	new Ajax.Request('/property-search/sist_ajax/email_to_friend.asp',bindArgs);
}
//
// Sends an email of a listing to a friend
// ERROR won't send email????
//
function profile_email_saved_listings_send(){

	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');
	
	var params = Form.serialize($('emaillisting'));
	
	var bindArgs = {
	method: 'post',
	parameters: params,
	onFailure: function(){
		alert('An error occurred and we could not send your request.  Please try again.');
	},
	onSuccess: function(t){
		var responseText = t.responseText;
		savedListingsRequest.innerHTML='<fieldset><legend>Email Your Saved Listings</legend>' + responseText + '</fieldset>';			
		new Effect.Highlight(savedListingsRequest, {duration: PROFILE_EMAIL_SAVED_LISTINGS_SENDHIGHLIGHTDURATION, startcolor: highlight_startcolor, endcolor: highlight_endcolor});
		setTimeout(function(){
			new Effect.Fade(savedListingsRequest, {queue: 'end', duration: PROFILE_EMAIL_SAVED_LISTINGS_SENDFADEDURATION});
			new Effect.BlindDown(savedListingsContainer, {queue: 'end', duration: PROFILE_EMAIL_SAVED_LISTINGS_SENDAPPEARDURATION});
			}, PROFILE_EMAIL_SAVED_LISTINGS_SENDTIMEOUTDURATION);
	}
	};	

	// Validate the form contents before submitting
	var reqEmail = IsValidEmail($('requestEmail'));
	var recpEmail = IsValidEmail($('recipientEmail'));
	var reqName = IsEmpty($('requestName'));
	// if reqName field has data, capitalize first character in each word
	if (!reqName)
		$('requestName').value = ReadableName($('requestName'));
	var recpName = IsEmpty($('recipientName'));
	// if recpName field has data, capitalize first character in each word
	if (!recpName)
		$('recipientName').value = ReadableName($('recipientName'));		
		
	if (reqEmail && recpEmail && !reqName && !recpName){
		$('requestsubmit').value = 'Sending Data...';
		$('requestsubmit').style.width = '125px';	
		new Ajax.Request('/property-search/sist_ajax/email_to_friend.asp', bindArgs);
	}
	else if (reqName || recpName)
			alert('Please enter all of the required fields.'); 
	else if (!reqEmail){
			alert('Please enter a valid email address for yourself.');
			$('requestEmail').focus();
		 } 	
	else if (!recpEmail){
			alert('Please enter a valid email address for the recipient.');
			$('recipientEmail').focus();
		 }
}
//
// Cancels sending an email to a friend
//
function profile_email_saved_listings_cancel() {
	var savedListingsContainer = $('savedListingsContainer');
	var savedListingsRequest = $('savedListingsRequest');
	
	new Effect.Opacity(savedListingsContainer);
	new Effect.Opacity(savedListingsRequest);
	
	new Effect.Fade(savedListingsRequest, {queue: 'end', duration: PROFILE_EMAIL_SAVED_LISTINGS_CANCELFADEDURATION});
	new Effect.BlindDown(savedListingsContainer, {queue: 'end', duration: PROFILE_EMAIL_SAVED_LISTINGS_CANCELAPPEARDURATION}); 
}
////////////////////////////////////////////////////////////////////////////////////////////////
// PROFILE SAVED SEARCH FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////
//
// Shows the user their saved searched
//
function profile_view_saved_searches(userid) {
	
	var savedSearchesContainer = $('savedSearchesContainer');
	var savedSearchesView = $('savedSearchesView');
	
	savedSearchesView.innerHTML='<fieldset><legend>View Your Saved Searches</legend><img src="/property-search/res/images/loading.gif" align="absmiddle"> <span style="font-size: 12px; font-weight: bold;">Loading Form...</span></fieldset>';

	var bindArgs = {
	method: 'get',
	parameters: 'requestuserid=' + userid,		
	onFailure: function(){
		alert('An error occurred and we could not retrieve your saved searches.  Please try again.');
	},
	onSuccess: function(t){
		savedSearchesView.innerHTML=t.responseText;	
		$(savedSearchesContainer).hide();
		new Effect.BlindDown(savedSearchesView, {duration: PROFILE_VIEW_SAVED_SEARCHESAPPEARDURATION});		
	}
	};

	new Ajax.Request('/property-search/sist_ajax/saved_searches.asp',bindArgs);
	
}
//
// Deletes a saved search from the user's profile
//
function profile_delete_saved_search(searchid, userid) {
	
	var savedSearchesView = $('savedSearchesView');
	var savedSearchesMessage = $('savedSearchesMessage');	
	
	new Effect.Opacity(savedSearchesView);
	new Effect.Opacity(savedSearchesMessage);	
	
	var bindArgs = {
	method: 'post',
	parameters: 'requestuserid=' + userid + '&searchid=' + searchid + '&action=delete',	
	onFailure: function(){
		alert('An error occurred and we could not delete the saved search.  Please try again.');
	},
	onSuccess: function(t){
		var returnVal = parseFloat(t.responseText);
		
		if (returnVal >= 1) {
			// Updated the saved listings text in the main saved searches container div.
			numSearches = numSearches - 1;
			if (numSearches <= -1) {numSearches = 0};
				updateSavedSearchesText(numSearches);
			
			//Remove the deleted search row from the table
			var deletedSearch = $('savedSearch'+searchid);
			new Effect.BlindUp(deletedSearch, {queue: 'end', duration: PROFILE_DELETE_SAVED_SEARCHFADEDURATION});
			
			// set the message that the search was deleted successfully.
			savedSearchesMessage.innerHTML='The search was deleted successfully.';
		} 
		else 
			savedSearchesMessage.innerHTML='An error occurred (' + returnVal + ') and the search could not be deleted.';	
		
		// display savedSearchesMessage
		savedSearchesMessage.style.display = '';
		new Effect.Highlight(savedSearchesMessage, {queue: 'end', duration: PROFILE_DELETE_SAVED_SEARCHHIGHLIGHTDURATION, startcolor: highlight_startcolor, endcolor: highlight_endcolor});
		setTimeout(function(){
			new Effect.BlindUp(savedSearchesMessage, {duration: PROFILE_DELETE_SAVED_SEARCHFADEDURATION});
			}, PROFILE_DELETE_SAVED_SEARCHTIMEOUTDURATION);	
	}
	};	
	
	new Ajax.Request('/property-search/sist_ajax/saved_searches.asp',bindArgs);
}
//
// Closes the saved searches view under the profile
//
function profile_close_saved_searches() {

	new Effect.Opacity($('savedSearchesContainer'));
	new Effect.Opacity($('savedSearchesView'));
	
	new Effect.Fade($('savedSearchesView'), {queue: 'end', duration: PROFILE_CLOSE_SAVED_SEARCHESFADEDURATION});
	new Effect.BlindDown($('savedSearchesContainer'), {queue: 'end', duration: PROFILE_CLOSE_SAVED_SEARCHESAPPEARDURATION});	 
}
//
// Displays the number of saved searches the user currently has
//
function updateSavedSearchesText(num) {

	// Displays if user has one search
	if (num == 1) {
		$('numSavedSearches').innerHTML = 'You currently have 1 saved search.';
		$('savedSearchesActions').style.display = '';
	} 
	
	// Displays if user has more than one search
	else if (num >=2) {
		$('numSavedSearches').innerHTML = 'You currently have ' + num + ' saved searches.';
		$('savedSearchesActions').style.display = '';
	} 
	
	// displays if user has no searches
	else {
		$('numSavedSearches').innerHTML = 'You do not currently have any saved searches. <a href="javascript:newSavedSearch();">Click here to add one</a>.';
		$('savedSearchesActions').style.display = 'none';
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////
// PROFILE UPDATE PROFILE FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////
//
// Loads information to be updated by user
//
function profile_update(userid) {
	var profileContainer = $('profileContainer');
	var profileUpdate = $('profileUpdate');
	
	new Effect.Opacity(profileContainer);
	new Effect.Opacity(profileUpdate);
	
	profileUpdate.innerHTML='<fieldset><legend>Update Your Profile</legend><img src="/property-search/res/images/loading_big.gif" align="absmiddle"> <span style="font-size: 12px; font-weight: bold;">Loading Profile...</span></fieldset>';

	var bindArgs = {
	method: 'get',
	parameters: 'requestuserid=' + userid + '&action=edit',		
	onFailure: function(){
		alert('An error occurred and we could not retrieve your profile information.  Please try again.');
	},
	onSuccess: function(t){
		profileUpdate.innerHTML=t.responseText;
		$(profileContainer).hide();
		new Effect.BlindDown(profileUpdate, {duration: PROFILE_UPDATEAPPEARDURATION});		
	}
	};
	
	new Ajax.Request('/property-search/sist_ajax/register.asp', bindArgs);
}
//
// Sends the profile to be updated if the data is valid
//
function profile_update_send(){
		
	var profileContainer = $('profileContainer');
	var profileUpdate = $('profileUpdate');
	
	new Effect.Opacity(profileContainer);
	new Effect.Opacity(profileUpdate);
	
	var bindArgs = {
	method: 'post',
	parameters: Form.serialize($('frmRegister')),
	onFailure: function(){
		alert(t.responseText);
		alert('An error occurred and we could not complete your registration.  Please try again.');
		$('registersubmit').value = 'Submit';
		$('registersubmit').style.width = '80px';	
	},
	onSuccess: function(t){
		var returnVal = parseFloat(t.responseText);

		if (returnVal == -2) {
			$('register_already_taken').style.display = '';
			$('registersubmit').value = 'Submit';
			$('registersubmit').style.width = '80px';				
		} 
		else if (returnVal <= 0) {
			$('register_error').style.display = '';
			$('registersubmit').value = 'Submit';
			$('registersubmit').style.width = '80px';				
		} 
		else {
			siusername = $('registeremail').value;
			sipassword = $('registerpassword').value;
		
			// Update cookies
			createCookie('ckUsername',siusername,365);
			createCookie('ckPassword',sipassword,365);
			
			profileUpdate.innerHTML='<fieldset><legend>Update Your Profile</legend><strong>Success!  Your profile was updated successfully.</strong><br><br><a href="javascript: profile_update_cancel();">Close</a></fieldset>';
			new Effect.Highlight(profileUpdate, {duration: PROFILE_UPDATE_SENDHIGHLIGHTDURATION, startcolor: highlight_startcolor, endcolor: highlight_endcolor});
			setTimeout(function(){
				new Effect.Fade(profileUpdate, {queue: 'end', duration: PROFILE_UPDATE_SENDFADEDURATION});
				new Effect.BlindDown(profileContainer, {queue: 'end', duration: PROFILE_UPDATE_SENDAPPEARDURATION});
				}, PROFILE_UPDATE_SENDTIMEOUTDURATION);
		}
	}
	};	
	// Validate the form contents before submitting

	var email = IsValidEmail($('registeremail'));

	var first = IsEmpty($('registerfirstname'));
	if (!first) { $('registerfirstname').value = ucFirst($('registerfirstname')); }
	
	var last = IsEmpty($('registerlastname'));
	if (!last) { $('registerlastname').value = ucFirst($('registerlastname')); }
	
	var pass = IsEmpty($('registerpassword'));		
	var passconf = IsEmpty($('registerpasswordconfirm'));
	var passequal = ($F('registerpassword') == $F('registerpasswordconfirm'));
	
	// Check to see if this site wants phone number to be a required field (set in si_client.js)
	var phone = true;
	if (require_phone_number) { phone = IsValidPhoneNumber($('registerphone')); }

	if (email && (!(first)) && (!(last)) && (!(pass)) && (!(passconf)) && passequal) {
		$('registersubmit').value = 'Processing Info...';
		$('registersubmit').style.width = '145px';	
		new Ajax.Request('/property-search/sist_ajax/register_process.asp', bindArgs);
	} else if (first || last || pass || passconf) {
		alert('Please enter all of the required fields.');
	} else if ($('registerpassword').value != $('registerpasswordconfirm').value){
		alert('The passwords did not match.');
		$('registerpasswordconfirm').focus()
	} else if (!email){
		alert('Please enter a valid email address.');
		$('registeremail').focus();
	}
	
}
//
// Cancels the update to the profile
//
function profile_update_cancel() {	
	new Effect.Opacity($('profileContainer'));
	new Effect.Opacity($('profileUpdate'));
	
	new Effect.Fade($('profileUpdate'), {queue: 'end', duration: PROFILE_UPDATE_CANCELFADEDURATION});
	new Effect.BlindDown($('profileContainer'), {queue: 'end', duration: PROFILE_UPDATE_CANCELAPPEARDURATION});
}
//]]>
