//ID NOOB SCRIPTING XB

function pagesetup(){
	
	//SETTING UP FLB
	//0 means disabled; 1 means enabled;
	var flbStatus = 0;
	
	//loading flb with jQuery
	function loadFLB(){
		//loads popup only if it is disabled
		if(flbStatus==0){
			$("#flb_overlay").css({"opacity": "0.7"}).css('height',$(document).height()).fadeIn("fast");
			$("#flb_content").fadeIn("fast").find('input:first').trigger('focus');
			flbStatus = 1;
		}
	}
	
	//disabling flb with jQuery
	function disablePopup(){
		//disables flb only if it is enabled
		if(flbStatus==1){
			$("#flb_overlay").fadeOut("fast");
			$("#flb_content").fadeOut("fast");
			flbStatus = 0;
		}
	}
	
	//centering popup
	function centerFLB(){
		//request data for centering
		var windowWidth = $(window).width();
		var windowHeight = $(window).height();
		var flbHeight = $("#flb_content").height();
		var flbWidth = $("#flb_content").width();
		//centering
		$("#flb_content").css({
			"top": windowHeight/2-flbHeight/2,
			"top": $(window).scrollTop()+50,
			"left": windowWidth/2-flbWidth/2
		});
		//only need force for IE6
		$("#flb_overlay").css({
			"height": windowHeight
		});
		
	}
	
	
	//CONTROLLING EVENTS IN jQuery
		
		//LOADING POPUP
		//Click the button event!
		$(".flb_show").click(function(){
			//centering with css
			centerFLB();
			//load popup
			loadFLB();
		});
					
		//CLOSING POPUP
		//Click the x event!
		$(".flb_close").click(function(){
			disablePopup();
		});
		//Click out event!
		$("#flb_overlay").click(function(){
			disablePopup();
		});
		//Press Escape event!
		$(document).keypress(function(e){
			if(e.keyCode==27 && flbStatus==1){
				disablePopup();
			}
		});
	
	
	
	
	
	//SETTING UP FLB
	//0 means disabled; 1 means enabled;
	var flb2Status = 0;
	
	//loading flb with jQuery
	function loadFLB2(){
		//loads popup only if it is disabled
		if(flb2Status==0){
			$("#flb2_overlay").css({"opacity": "0.7"}).css('height',$(document).height()).fadeIn("fast");
			$("#flb2_content").fadeIn("fast").find('input:first').trigger('focus');
			flb2Status = 1;
		}
	}
	
	//disabling flb with jQuery
	function disablePopup2(){
		//disables flb only if it is enabled
		if(flb2Status==1){
			$("#flb2_overlay").fadeOut("fast");
			$("#flb2_content").fadeOut("fast");
			flb2Status = 0;
		}
	}
	
	//centering popup
	function centerFLB2(){
		//request data for centering
		var windowWidth = $(window).width();
		var windowHeight = $(window).height();
		var flbHeight = $("#flb2_content").height();
		var flbWidth = $("#flb2_content").width();
		//centering
		$("#flb2_content").css({
			"top": windowHeight/2-flbHeight/2,
			"top": $(window).scrollTop()+50,
			"left": windowWidth/2-flbWidth/2
		});
		//only need force for IE6
		$("#flb2_overlay").css({
			"height": windowHeight
		});
		
	}
	
	
	//CONTROLLING EVENTS IN jQuery
		
		//LOADING POPUP
		//Click the button event!
		$(".flb2_show").click(function(){
			//centering with css
			centerFLB2();
			//load popup
			loadFLB2();
		});
					
		//CLOSING POPUP
		//Click the x event!
		$(".flb2_close").click(function(){
			disablePopup2();
		});
		//Click out event!
		$("#flb2_overlay").click(function(){
			disablePopup2();
		});
		//Press Escape event!
		$(document).keypress(function(e){
			if(e.keyCode==27 && flb2Status==1){
				disablePopup();
			}
		});
	
	
	
	
	
	
	
	
	
		
}