function ViewMaskWindow(){
		jQuery(".BlockDiv").css("height",jQuery(document).height());
		jQuery(".BlockDiv").css("width",jQuery(document).width()-2);

		jQuery(".BlockDiv").css("top","0px");
		jQuery(".BlockDiv").css("left","0px");
		jQuery(".BlockDiv").css("display","block");	
	

}
  
function UnViewMaskWindow(){
	jQuery(".BlockDiv").css("display","none");	
}  


function ViewText(){
		var top = jQuery(window).height()/2 - jQuery("#AlertWindow").height()/2+jQuery(window).scrollTop();
		var left = jQuery(window).width()/2 - jQuery("#AlertWindow").width()/2;

		
		jQuery("#AlertWindow").css("top",top);
		jQuery("#AlertWindow").css("left",left);	
		jQuery("#AlertWindow").css("display","block");
		jQuery("#flashcontent").each(function(){
			jQuery(this).css("display","none");
		});
}  

function UnViewText(){
		jQuery("#AlertWindow").css("display","none");
		jQuery("#flashcontent").each(function(){
			jQuery(this).css("display","block");
		});		
}

function CloseText(){
	jQuery("#AlertWindow").css("display","none");
	UnViewMaskWindow();
}

function base64_decode( data ) {    // Decodes data encoded with MIME base64
 
 
    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc='';
 
    do {  
        h1 = b64.indexOf(data.charAt(i++));
        h2 = b64.indexOf(data.charAt(i++));
        h3 = b64.indexOf(data.charAt(i++));
        h4 = b64.indexOf(data.charAt(i++));
 
        bits = h1<<18 | h2<<12 | h3<<6 | h4;
 
        o1 = bits>>16 & 0xff;
        o2 = bits>>8 & 0xff;
        o3 = bits & 0xff;
 
        if (h3 == 64)      enc += String.fromCharCode(o1);
        else if (h4 == 64) enc += String.fromCharCode(o1, o2);
        else               enc += String.fromCharCode(o1, o2, o3);
    } while (i < data.length);
 
    return enc;
}


WorkWithData = {
	setCookie:function(name, value, expires, path, domain, secure){
	    document.cookie = name + "=" + escape(value) +
	        ((expires) ? "; expires=" + expires : "") +
	        ((path) ? "; path=" + path : "") +
	        ((domain) ? "; domain=" + domain : "") +
	        ((secure) ? "; secure" : "");	
	},
	getCookie:function(name){
		var cookie = " " + document.cookie;
		var search = " " + name + "=";
		var setStr = null;
		var offset = 0;
		var end = 0;
		if (cookie.length > 0) {
			offset = cookie.indexOf(search);
			if (offset != -1) {
				offset += search.length;
				end = cookie.indexOf(";", offset)
				if (end == -1) {
					end = cookie.length;
				}
				setStr = unescape(cookie.substring(offset, end));
			}
		}
		return(setStr);	
	}
}


function EnableAccess(){
		UnViewMaskWindow();
		UnViewText();
		WorkWithData.setCookie("enable_7s","1");
}

function DisableAccess(){
	var url = base64_decode(RedirectPage);
	document.location.href = url;
}

$(document).ready(function(){
	var cookie = WorkWithData.getCookie("enable_7s");
	if(!cookie){
		cookie = '';
	}
	if(cookie == ''){
		ViewMaskWindow();
		ViewText();
	}
});

