


function BlockAll(){
	
	Block();
	ShowLoading();
}


function UnblockAll(){
	
	Unblock();
	HideLoading();
}

function Block()
{
	var d = document.getElementById('blocker');
	var hider = document.getElementById( 'hider' );
	var size = getPageSizeWithScroll();
		
	if ( d ) {
		
		SetTransperancy( d, 70 );
		
		d.style.width = parseInt(size[0]) + "px";
		d.style.height = parseInt(size[1]) + "px";	
		d.style.display = 'block';
		
		
	}
	
	if( hider ){

		SetTransperancy( hider, 0 );
		
		hider.style.width = parseInt(size[0]) + "px";
		hider.style.height = parseInt(size[1]) + "px";
		hider.style.display = 'block';		
		
	}
		
}

function Unblock()
{
	var d = document.getElementById('blocker');
	var hider = document.getElementById( 'hider' );
	
	if ( d )
	{
		d.style.display = 'none';
	}
	
	if( hider ){

		hider.style.display = 'none';

	}	
}


function ShowLoading(){
	
	SetElementDisplay( 'loading', 'block' );
}

function HideLoading(){
	
	SetElementDisplay( 'loading', 'none' );
}


//function getPageSizeWithScroll(){
//	
//	// buggy in FF
//	if (window.innerHeight && window.scrollMaxY) {// Firefox
//			
//		yWithScroll = window.innerHeight + window.scrollMaxY;
//		
//		// do not include scrollbar width, must be
//		// document.body.scrollWidth OR document.body.offsetWidth
//		xWithScroll = window.innerWidth + window.scrollMaxX;
//		
//	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
//	
//		yWithScroll = document.body.scrollHeight;
//		xWithScroll = document.body.scrollWidth;
//		
////  not needed		
////	}else if( navigator.userAgent.indexOf('Opera') >= 0 ) {//Opera
////
////		alert(3);
////		yWithScroll = window.innerHeight;
////		xWithScroll = window.innerWidth;	
//
//	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari, IE and Opera
//		
//		yWithScroll = document.body.offsetHeight;
//		xWithScroll = document.body.offsetWidth;
//  	}
//  	
//	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
//	
//	return arrayPageSizeWithScroll;
//}

// cleaner 
function getPageSizeWithScroll() {
	
    var dimensions = new Array(2);

    if ( window.innerHeight && window.scrollMaxY ) {// Firefox
    	
        dimensions[0] = document.body.scrollWidth;
        dimensions[1] = window.innerHeight + window.scrollMaxY;
    } 
    else {
    	
        if ( document.body.scrollHeight > document.body.offsetHeight ) { // all but Explorer Mac
            
        	dimensions[0] = document.body.scrollWidth;
            dimensions[1] = document.body.scrollHeight;
        } 
        else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari, IE and Opera
            
        	dimensions[0] = document.body.clientWidth;
            dimensions[1] = document.body.clientHeight;
        }
    }
    	
    return (dimensions);
}


//does the same as the 2 function upper, not sure only for Mac
function getClientBodySize() {
	
	var dimensions = new Array(2);
	
	dimensions[0] = document.body.offsetWidth;
    dimensions[1] = document.body.offsetHeight;
	
	return (dimensions);
}


function SetTransperancy( oe, value ) {
	
	var filter_value = "alpha(opacity="+value+")";
	var opacity_value = ( value / 100 );
	
	if ( oe && oe.style ) {
		
		oe.style.filter = filter_value;
		oe.style.opacity = opacity_value;
	
	}	
}
