function showLightBox(){
		page_size = getPageSize();
		$('LB_overlay').style.width=page_size[0]+'px';
		$('LB_overlay').style.height=page_size[1]+'px';
    $('LB_overlay').show();
		//$('LB_loading').style.display='none';
		centerLightBox('LB');
		//alert(page_size[0]+"px\n"+page_size[1]+"px\n"+page_size[2]+"px\n"+page_size[3]+"px\n");
    return false;
}

function showLightBoxLoading(){
		page_size = getPageSize();
		$('LB_overlay').style.width=page_size[0]+'px';
		$('LB_overlay').style.height=page_size[1]+'px';
    $('LB_overlay').show();
		//$('LB_loading').style.display='none';
		centerLightBox('LB_loading');
		//alert(page_size[0]+"px\n"+page_size[1]+"px\n"+page_size[2]+"px\n"+page_size[3]+"px\n");
		hideAds();
    return false;
}

function hideLightBox(){
		showAds();
    setTimeout('$("LB").hide()', 250);
    setTimeout('$("LB_overlay").hide();', 250);
//		$('LB_body').innerHTML="";
//    return false;
}

function hideAds() {
	toggleAds(false);
}

function showAds() {
	toggleAds(true);
}

function toggleAds(show) {
	if (show) {
		displaytype = 'block';
		visibilitytype = 'visible';
	} else {
		displaytype = 'none';
		visibilitytype = 'hidden';
	}
	
	i = 1;
	do {
		object = document.getElementById("adunit_"+i);
		if (object != null) {
			object.style.display = displaytype;
		}
		i++;
	} while (object != null)
	//objects = document.getElementsByName("adunit");
	//alert("Objects: "+objects.length);
	//for( i=0; i<objects.length; i++) {
	//	objects[i].style.display=displaytype;
	//}
	
	//Remove embedded videos
	var all_divs = document.getElementsByTagName("div");
	for(var i = 0; i < all_divs.length; i++) {
		if(all_divs[i].getAttribute("name")=="videoembedblock") {
			all_divs[i].style.visibility = visibilitytype;
		}
	}
	
}

function centerLightBox(element){
    try{
        element = $(element);
    }catch(e){
        return;
    }

    var my_width  = 0;
    var my_height = 0;

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement && 
             ( document.documentElement.clientWidth ||
               document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body && 
            ( document.body.clientWidth || document.body.clientHeight ) ){
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }

    element.style.position = 'absolute';
    element.style.zIndex   = 1345;

    var scrollY = 0;

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }

    var elementDimensions = Element.getDimensions(element);

    var setX = ( my_width  - elementDimensions.width  ) / 2;
    var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

    element.style.left = setX + "px";
    element.style.top  = setY + "px";

    element.style.display  = 'block';
}

// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	//if(yScroll < windowHeight){
	//	pageHeight = windowHeight;
	//} else { 
		pageHeight = yScroll;
	//}

	// for small pages with total width less then width of the viewport
	//if(xScroll < windowWidth){	
	//	pageWidth = windowWidth;
	//} else {
		pageWidth = xScroll;
	//}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}