//define universal reference to "staticcontent"
var crossobj=document.all? document.all.staticcontent : document.getElementById("staticcontent")

//define reference to the body object in IE
var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body

function show_modal(windowId)
{
	//define universal dsoc left point
    var dsocleft=document.all? iebody.scrollLeft : pageXOffset

    //define universal dsoc top point
    var dsoctop=document.all? iebody.scrollTop : pageYOffset

	$("#mask2").fadeIn("200");

	//$("#mask2").css({width:'957px'});

	var newTop = dsoctop+200;

	var modalWindow = document.getElementById(windowId);

	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();

	$(modalWindow).css('position', 'fixed' );
	//if(windowId=="membershipAgreementDiv" || windowId=="modal-menu" || windowId=='postal-code-modal')
	//{
		dsoctop = winH/2-$(modalWindow).height()/2-100;
	//}

	//alert(dsoctop);
	$(modalWindow).css('top',  dsoctop+100);
	$(modalWindow).css('left', winW/2-$(modalWindow).width()/2);

	$(modalWindow).fadeIn("200");

	//$(modalWindow).offset({ top: newTop});
	//alert(newTop);
	//modalWindow.style.top = newTop + 'px';
}

function close_modal(modal_id){
        //hide the mask
        document.getElementById("mask2").style.display="none";
		//$("#mask").fadeOut("500");
        //hide modal window
		document.getElementById(modal_id).style.display="none";
		//$("#"+modal_id).fadeOut("500");

        document.getElementById("forgotDiv").style.display="block";
        document.getElementById("messageDiv").style.display="none";
		$("#enterEmailText").show();

        if(modal_id=="invalidLoginDiv")
		{
			document.getElementById("emailTextBox").value="";
			document.getElementById("cmsPassword").value="";
			showDefaultText(document.getElementById("cmsPassword"));
			document.getElementById("emailTextBox").focus();
		}
        if(modal_id=="tellAFriendDiv"||modal_id=="sendMessageDiv"||modal_id=="paymentDoneDiv")
		{
			window.location="postalCodeLoggedInFinal.php";
		}
		if(modal_id=="dialogForgotPassword")
		{
			document.getElementById("cover").style.display="none";
		}
	if(modal_id == 'sendMessageDiv') {
            window.location.href="index.php";
        }
    }
