$(document).ready(function(){
	$("#LoginBox").hide();
	$("#create").click(function(){

	$("#LoginBox").show()

	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	var containerWidth = $('#LoginContainer').width();	

	
	$('#mask').css({'width':maskWidth,'height':maskHeight,backgroundColor:"#0c456d",'opacity':0.8});
	$('#LoginContainer').css({'margin-left':maskWidth/2-containerWidth/2-20, 'margin-top': '10px'});
	$("#mask").show()



});

});	


function closelogin()
{
	jQuery('#mask').hide();
	jQuery('#LoginBox').hide();
	jQuery("#RegisterBox").hide();
	jQuery("#ForgotPasswordBox").hide();
 }


function openlogin() {


	jQuery("#LoginBox").show()

	var maskHeight = jQuery(document).height();
	var maskWidth = jQuery(window).width();
	var containerWidth = jQuery('#LoginContainer').width();	

	
	jQuery('#mask').css({'width':maskWidth,'height':maskHeight,backgroundColor:"#0c456d",'opacity':0.8});
	jQuery('#LoginContainer').css({'margin-left':maskWidth/2-containerWidth/2-20, 'margin-top': '10px'});
	jQuery("#mask").show()


}

function openforgotpassword() {
    jQuery("#ForgotPasswordBox").show()

    var maskHeight = jQuery(document).height();
    var maskWidth = jQuery(window).width();
    var containerWidth = jQuery('#ForgotPasswordContainer').width();


    jQuery('#mask').css({ 'width': maskWidth, 'height': maskHeight, backgroundColor: "#0c456d", 'opacity': 0.8 });
    jQuery('#ForgotPasswordContainer').css({ 'margin-left': maskWidth / 2 - containerWidth / 2 - 20, 'margin-top': '10px' });
    jQuery("#mask").show()


}



 function Register() {
     jQuery("#RegisterBox").show()

     var maskHeight = jQuery(document).height();
     var maskWidth = jQuery(window).width();
     var containerWidth = jQuery('#RegisterContainer').width();


     jQuery('#mask').css({ 'width': maskWidth, 'height': maskHeight, backgroundColor: "#0c456d", 'opacity': 0.8 });
     jQuery('#RegisterContainer').css({ 'margin-left': maskWidth / 2 - containerWidth / 2 - 20, 'margin-top': '10px' });
     jQuery("#mask").show()


 }



 function BusinessRegistration() {
     jQuery("#RegisterBox").show()

     var maskHeight = jQuery(document).height();
     var maskWidth = jQuery(window).width();
     var containerWidth = jQuery('#RegisterContainer').width();


     jQuery('#mask').css({ 'width': maskWidth, 'height': maskHeight, backgroundColor: "#0c456d", 'opacity': 0.8 });
     jQuery('#RegisterContainer').css({ 'margin-left': maskWidth / 2 - containerWidth / 2 - 20, 'margin-top': '10px' });
     jQuery("#mask").show()



 }


 function closebusinessregistration() {
     jQuery('#mask').hide();
     jQuery('#BusinessRegistrationBox').hide();
 }


function terms() {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open('/account/terms.html', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=750,height=600');");
}


function WhereFrom() {

    if (!areCookiesEnabled()) {
    document.location="/cookiesrequired.aspx";
    }


     jQuery("#WhereFromBox").show()

     var maskHeight = jQuery(document).height();
     var maskWidth = jQuery(window).width();
     var containerWidth = jQuery('#WhereFromBox').width();


     jQuery('#WhereFromContainer').css({ 'margin-left': maskWidth / 2 - containerWidth / 2 - 20,'margin-top':100 });

     jQuery('#mask').css({ 'width': maskWidth, 'height': maskHeight, backgroundColor: "#0c456d", 'opacity': 0.8 });
	  jQuery("#mask").show()

}
 
 function CloseWhereFrom() {
     jQuery('#mask').hide();
     jQuery('#WhereFromBox').hide();
 }

 function ResetScrollPosition() {
    jQuery('#__SCROLLPOSITIONX, #__SCROLLPOSITIONY').val(0);
}



    function createCookie(name, value, days) {
        var expires;
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            expires = "; expires=" + date.toGMTString();
        }
        else expires = "";
        document.cookie = name + "=" + value + expires + "; path=/";
    }

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
        }
        return null;
    }

    function eraseCookie(name) {
        createCookie(name, "", -1);
    }

    function areCookiesEnabled() {
        var r = false;
        createCookie("CheckCookies", "Hello", 1);
        if (readCookie("CheckCookies") != null) {
            r = true;
            eraseCookie("CheckCookies");
        }
        return r;
    }

