function lb(boxW,boxH,tip,code,scr,title){
	//$('.container').prepend($('h2'));
 	//$("body").after('<div id="bg"></div>');
	
	$("#popups").append('<div id="bg"></div>');
	//$("body").html('<div id="bg"></div>'+$("body").html());
	$("#bg").append('<div id="con"></div>');
	$("#bg").append('<div id="resim"></div>');
	$("#bg").append('<div id="mtn"></div>');
	$("#bg").append('<div id="kapat"><img src="js/close.png" border="0" alt="Test"/></div>');
	$('#bg').css({
		'opacity':0,
		'width':'1px',
		'height':'1px',
		'position':'absolute',
		'left':$(window).width()/2+'px',
		'top':$(window).height()/2+'px',
		'background-color':'#000'
	});
		
	$('#resim').css({
		'opacity':'0',
		'width':'1px',
		'height':'1px',
		'position':'absolute',
		'left':$(window).width()/2+'px',
		'top':$(window).height()/2+'px'
	});
	$('#mtn').css({
		'width':'1px',
		'height':'1px',
		'position':'absolute'
	});
	$('#kapat').css({
		'width':'auto',
		'height':'auto',
		'display':'block',
		'opacity': 0,
		'position':'absolute'
	});
	$("#bg").click(function(){
			$("#bg").remove();			
	});	
	
	$('#bg').animate({
		'opacity': 1,
		'width': $(window).width()+'px',
		'height': $(window).height()+'px',
		'left':($('#bg').width())*0.5+'px',
		'top':($('#bg').height())*0.5+'px'
  	}, 500, function() {
		
		switch (tip){
			case "image":
				var img = new Image();
				img.src = code;         
				img.onload  = function(){
				defaultW = img.width;
				defaultH = img.height;
				imgW = img.width;
				imgH = img.height;
				oran = imgW/imgH;
				if (defaultH > $(window).height()-50){
					imgH = $(window).height()-50;
					imgW = imgH * oran;
				}
				$('#resim').append('<img src="'+code+'" border="0" alt="Test"/>');
				$('#resim img').attr({width: imgW,height: imgH});
				$('#resim').animate({
					'opacity':'1',
					'width': imgW+'px',
					'height': imgH+'px',
					'top' :($(window).height()-imgH)*0.5+'px',
					'left' :($(window).width()-imgW)*0.5+'px'}, 1000,function(){
						
						
						$('#kapat').css({
							'left':($(window).width()-imgW)*0.5+imgW-21+'px',
							'top' :($(window).height()-imgH)*0.5-21+'px'
						})
						$('#kapat').animate({'opacity':'1'}, 1000, function(){});
						
						$('#mtn').html(title);
						$('#mtn').css({
							'width':imgW+'px',
							'height':'auto',
							'left':($(window).width()-imgW)*0.5+'px',
							'top' :($(window).height()-imgH)*0.5+imgH+'px',
							'color':'#FFF'
						})	
						
					});
				}
				
			break;
			case "iframe":
					$('#resim').css({'display':'none','overflow':'hidden'});
					$('#resim').append('<iframe src="'+code+'" frameborder="0" scrolling="'+scr+'" width="100%" height="100%" ></iframe>');
					$('#resim').animate({
					'opacity':'1',
					'width': boxW+'px',
					'height': boxH+'px',
					'top' :($(window).height()-boxH)*0.5+'px',
					'left' :($(window).width()-boxW)*0.5+'px'}, 1000, function(){
						
						$('#kapat').css({
							'left':($(window).width()-boxW)*0.5+boxW-21+'px',
							'top' :($(window).height()-boxH)*0.5-21+'px'
						})
						$('#kapat').animate({'opacity':'1'}, 1000, function(){});
					
						$('#mtn').html(title);
						$('#mtn').css({
							'width':boxW+'px',
							'height':'auto',
							'left':($(window).width()-boxW)*0.5+'px',
							'top' :($(window).height()-boxH)*0.5+boxH+'px',
							'color':'#FFF'
						})
						});
				break;
		}
  	});
	//alert(($(window).height()-boxH)*0.5+boxH+'px')
  	$(window).resize(function() {
		$('#bg').css({
			'width': $(window).width()+'px',
			'height': $(window).height()+'px',
			'left':0+'px',
			'top':0+'px'});
			
			switch (tip){
		case "image":
			if (defaultH>imgH){
				imgH = $(window).height()-50;
				imgW = imgH * oran;
			}
			coor = ($(window).width()-imgW)*0.5;
			$('#resim img').attr({width: imgW,height: imgH});
			$('#bg').css({'width': $(window).width()+'px','height': $(window).height()+'px','left':0+'px','top':0+'px'});
			$('#resim').css({'width': imgW+'px','height': imgH+'px','left':coor+'px'
			});
			break;
		case "iframe":
			coorX = ($(window).width()-boxW)*0.5;
			coorY = ($(window).height()-boxH)*0.5;
			$('#resim img').attr({width: boxW,height: boxH});
			$('#bg').css({'width': $(window).width()+'px','height': $(window).height()+'px','left':0+'px','top':0+'px'});
			$('#resim').css({'width': boxW+'px','height': boxH+'px','left':coorX+'px','top':coorY+'px'});
			break;
		}
		
		RW = $('#resim').width();
		RH = $('#resim').height();
		OutRW = $(window).width()-RW;
		OutRH = $(window).height()-RH;
		$('#mtn').css({
				'width':$('#resim').width()+'px',
				'height':'auto',
				'left':	OutRW*0.5+'px',
				'top' :	OutRH *0.5 + RH+'px',
				'color':'#FFF'
			});
		$('#kapat').css({
			'left':OutRW*0.5+RW-21+'px',
			'top' :OutRH*0.5-21+'px'
		});
		
		});
}

