//Light-box 1.01

	
	
function EalightBox(forId,id,closeBtn) {
	var bodyHeight;
	var browserHeight;
	var maskHeight;
	var isopen=false;
	var addTop;
	var offsetY =16;
	var top;

	function resize(){
		if($('.eaMask').html()!=null) {
			bodyHeight=document.body.clientHeight;
			browserHeight=$(window).height();
			if (browserHeight > bodyHeight) {
				maskHeight=browserHeight;
			}else{
				maskHeight=bodyHeight;
			}
			$('.eaMask').css({height:maskHeight+'px'});
			if($.browser.version!=6.0){
				$(forId).css({top:browserHeight/2-offsetY + addTop +'px'});
			}
			else {
				top = jQuery(window).scrollTop()+browserHeight/2-offsetY;
				$(forId).css({top: top});
			}
		}
	}
	
	
	$(id).click(function(){
		if (isopen==false) {
			addTop=$(document).scrollTop();
			isopen=true;
			$('body').css({position:'relative','z-index':'888'});
			$('body').append("<div class='eaMask'></div>");
			$('.eaMask').click(closes);
			bodyHeight=document.body.clientHeight;
			browserHeight=$(window).height();
			if (browserHeight > bodyHeight) {
				maskHeight=browserHeight;
			}else{
				maskHeight=bodyHeight;
			}
			
			if($.browser.version==6.0) {
				$(forId).css({position:'absolute'});
			}else{
				addTop=0;
				$(forId).css({position:'fixed'});
			}
			
			$(forId).css({
				top:browserHeight/2 - offsetY + addTop + 'px',
				left:'50%',
				'z-index':'99999',
				'margin-left':-$(forId).width()/2+'px',
				'margin-top':-$(forId).height()/2+'px'
			});
			$('.eaMask').css({
				background:'#202020',
				position:'absolute',
				cursor:'wait',
				left:'0',
				top:'0',
				filter:'alpha(opacity=75)',
				'-moz-opacity':'0.75',
				opacity:'0.75',
				width:'100%',
				'z-index':'9999',
				height:maskHeight+'px',
				display:'none'
			});
			$(window).bind("resize",resize);
			$('.eaMask').fadeIn(200);
			$(forId).fadeIn(200);
			if($.browser.version==6.0)
			{
				$('select').css({visibility:"hidden"});
				$('.lightbox select').css({visibility:"visible"});
				$(window).bind("scroll",scrollHandle);
				top = jQuery(window).scrollTop()+browserHeight/2-offsetY;
				$(forId).css({top: top});
			};
		};
	});
	$(closeBtn).click(closes);
	function closes(){
		isopen=false;
		$(window).unbind("resize");
		$('.eaMask').fadeOut(200);
		$(forId).fadeOut(200);
		setTimeout("$('.eaMask').remove();",200);
		setTimeout("$('select').css({visibility:'visible'})",200);
	}
	function scrollHandle() {
		top = jQuery(window).scrollTop()+browserHeight/2-offsetY;
		$(forId).css({top: top});
	}
};



