function showMask()
{
	var viewed = cookie.findCookie('maskViewed');
	if (!viewed) {
		if(typeof isOldInternetExplorer !== 'undefined')
		{
			document.getElementById("mask").style.position = "absolute";
			document.getElementById("maskforeground").style.position = "absolute";
			window.onscroll = function()
			{
				var offset = 0;
				if(typeof(window.pageYOffset) == "number" )
					offset = window.pageYOffset;
				else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
					offset = document.body.scrollTop;
				else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
					offset = document.documentElement.scrollTop;
				document.getElementById("mask").style.top = offset + "px";
				document.getElementById("maskforeground").style.top = offset + "px";
			}
			window.onresize = function()
			{
				var height = 0;
				if(typeof(window.innerWidth) == "number")
					height = window.innerHeight;
				else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
					height = document.documentElement.clientHeight;
				else if(document.body && (document.body.clientWidth || document.body.clientHeight))
					height = document.body.clientHeight;
				document.getElementById("mask").style.height = height + "px";
				document.getElementById("maskforeground").style.height = height + "px";
			}
			window.onscroll();
			window.onresize();
		}
		document.getElementById("mask").style.display = "block";
		document.getElementById("maskforeground").style.display = "block";
	}
}

function hideMask()
{
	if(typeof isOldInternetExplorer !== 'undefined')
	{
		window.onscroll = null;
		window.onresize = null;
	}
	document.getElementById("mask").style.display = "none";
	document.getElementById("maskforeground").style.display = "none";
	
	var exp = new Date().getTime() + ( 2 * 24 * 60 * 60 * 1000);//Date is 2 days from now
	cookie.createCookie('maskViewed', 'true', exp);
}

var cookie = {
	createCookie : function(name,value,expiration,path,domain,secure) {
	    var data = name + "=" + escape(value);
	    if (expiration) { 
	        var expiresAt = new Date();
	        expiresAt.setTime(expiration);
	        data += "; expires=" + expiresAt.toGMTString();
	    }
	    if (path) { data += "; path=" + path; }
	    if (domain) { data += "; domain=" + domain; }
	    if (secure) { data += "; secure"; }
	    document.cookie = data;
	  },
	  
	  findCookie : function(name) {  
	    var query = name + "=";
	    var queryLength = query.length;
	    var cookieLength = document.cookie.length;
	    var i=0;
	    while (i<cookieLength) {
	      var position = i + queryLength;
	      if (document.cookie.substring(i,position) === query) {
	         return this.findCookieValue(position);
	      }
	      i = document.cookie.indexOf(" ", i) + 1;
	      if (i === 0) { break; }  
	    }
	    return null;  
	  },
	
	  findCookieValue : function(position) {
	    var endsAt = document.cookie.indexOf(";", position);
	    if (endsAt === -1) { endsAt = document.cookie.length; }
	    return unescape(document.cookie.substring(position,endsAt));
	  },
	
	  eraseCookie : function(name) {
	    if (this.findCookie(name)) {
	       var data = name + "=";
	       data += "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	       document.cookie = data;
	    }
	  }
  };
