/**
 * @author markhowes
 */
$(document).ready(function(){
	$("#popupLoginClose").click(function(){  
		loginPopupClose();  
	});
	$("#backgroundPopup").click(function(){  
		loginPopupClose();  
	});
	$("#sN").click(function(){  
		loginPopupClose();  
	});
	$("#sG").click(function(){  
		window.location = "http://www.howescycles.co.uk/survey";
	});
});
var popupStatus = 0;
function loginPopupLoad(){
 	if(popupStatus == 0){
		$('#backgroundPopup').css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupLogin").fadeIn("slow");
		popupStatus = 1;
	}
 }
function loginPopupClose(){
 	if(popupStatus == 1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupLogin").fadeOut("slow");
		popupStatus = 0;	
	}
 }
function centrePopUp(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupWidth = $("#popupLogin").width();
	var popupHeight = $("#popupLogin").height();
	$("#popupLogin").css({
		"position":"absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	$("#backgroundPopup").css({  
		"height": windowHeight
	});
}
function showPopup(){
	loginPopupLoad();
	centrePopUp();
}
