// The Global Json Variable
var GLOBALS = {};

$(document).ready(function(){
	/// Dynamically Label Login & Password fields from inside
	// email field
	$("#login-username").focus(function(){
		
		if($(this).attr("value") == GLOBALS.TXT_USERNAME){
			$(this).attr("value", "").addClass("input");
		}
	}).blur(function(){
		
		if($(this).attr("value") == ""){
			$(this).attr("value", GLOBALS.TXT_USERNAME).removeClass("input");
		}
	});	
	// password field
	$("#login-pwd").focus(onPwdFocus).blur(onPwdBlur);

	fishEyeMenu();
	
	$(".signup").hover(
		function(){
			$(this).css("width", "75px").css("height", "75px").css("margin-top", "20px");
		},
		function(){
			$(this).css("width", "65px").css("height", "65px").css("margin-top", "25px");
		}
	);
});

function fishEyeMenu()
{
	if(!$('#dock2').exists()) {
		return;
	}
	// Setup the Fisheye menu on the bottom
	$('#dock2').Fisheye(
		{
			maxWidth: 80,
			items: 'a',
			itemsText: 'span',
			container: '.dock-container2',
			itemWidth: 80,
			proximity: 80,
			alignment : 'left',
			valign: 'bottom',
			halign : 'center'
		}
	);
}

function onPwdFocus(){
	var pwd = $("#login-pwd");
	
	if(pwd.attr("type") == "text" && pwd.attr("value") == GLOBALS.TXT_PASSWORD){
		pwd . replaceWith('<input name="password" type="password" id="login-pwd" value="" class="input" />');
		$("#login-pwd") . focus() . focus(onPwdFocus) . blur(onPwdBlur);
	}
}

function onPwdBlur(){
		
	var pwd = $("#login-pwd");
		
	if(pwd.attr("type") == 'password' && pwd.attr("value") == ""){
		pwd . replaceWith('<input name="password" type="text" id="login-pwd" value="'+GLOBALS.TXT_PASSWORD+'"/>');
		$("#login-pwd") . focus(onPwdFocus) . blur(onPwdBlur);
	}
}


jQuery.fn.exists = function() {
  return (this.length > 0);
};
