jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

jQuery.fn.centerright = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("right", "250px");
    return this;
}

jQuery.fn.right = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("right", "0px");
    return this;
}

jQuery.fn.left = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", "0px");
    return this;
}

jQuery.fn.topright = function () {
    this.css("position","absolute");
	if( ($(window).scrollTop()) < 50 ){
		this.css("top", (50-$(window).scrollTop())+($(window).scrollTop())+"px");
	}else{
		this.css("top", $(window).scrollTop() + "px");
	}
    this.css("right", "0px");
    return this;
}

function showLogin(loc){
	$('#floatLoginForm').fadeOut('fast', 
		function(){
			if(loc=='centerright'){
				$('#floatLoginForm').centerright();
			}
			if(loc=='center'){
				$('#floatLoginForm').center();
			}
		}
		);
	$('#floatLoginForm').attr("className", "floatLogin")
	$('#floatLoginForm').fadeIn('fast', 
		function(){
			$('#username').focus();
		}
	);
}
function hideLogin(key){
	$('#floatLoginForm').fadeOut('fast');
	$("#"+key+"Title").css("color","#666666");
	$("#"+key+"Title").html("Please sign in");
}
