/*
Add this funciont to the String prototype to remove space 
at either the start or the end
*/
String.prototype.trim = function()
{
	return   this.replace(/^\s+|\s+$/g,"");
};

/*
Doing some preparation when the page is loaded
*/
$(document).ready(function() 
{
	$(".box").fancybox(	
	{
		'zoomOpacity'			: true,
		'overlayShow'			: true,
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'			: 500
	});	
});


/*
Adjust the facebox position when it is loaded
*/
$(document).bind('reveal.facebox', function()
{
	//alert($('#facebox').height());
	//alert($('#facebox').offset().top);
	//alert(document.body.scrollTop);
	//alert(screen.availHeight);
	if($('#facebox').height() + $('#facebox').offset().top > screen.availHeight)
	{
		window.scrollbars=true;
		// set the scroll bar position
		window.scrollTo(0, $('#facebox').offset().top);
		//$('#facebox').css('top', 0);
		//window.scrollTo(0, 0);			
		
		// set the left position of the facebox	
		$('#facebox').css('left', Math.abs(($(window).width() - $('#facebox').width()) / 2));
	}

});

// WildFire parameters
var pconf={
	useFacebookMystuff: 'false', 
	defaultContent: 'TEXTAREA_ID', 
	advancedTracking: 'true',
	UIConfig: '<config baseTheme="v2"><display showPost="false" showEmail="true" showBookmark="true" showCodeBox="false" showCloseButton="true"></display><body font="Verdana"><controls><snbuttons iconsOnly="true"></snbuttons></controls></body></config>'
};
pconf['onClose']= hideWildFire;

function showWildFire() {
	document.getElementById("divWildfirePost").style.display="block";
	return false;
}

function hideWildFire() {
	document.getElementById("divWildfirePost").style.display="none";
	return false;
}
