function fl(boxW,boxH,tip,code,class1){

	kapatBtn = "js/close.png"
	kapatBtnW = 42;
	kapatBtnH = 42;
		
	if (boxW == "") { boxW = 800;}else{boxW = boxW + 20} 
	if (boxH == "") {boxH = 600;} else{boxH = boxH + 20} 
	var bg = document.createElement('div');
	var dv = document.createElement('div');
	var kpt = document.createElement('div');
	if (class1 == ""){class1="block"} 
	bg.setAttribute('class', "f_bg");
	dv.setAttribute('class', class1);
	kpt.setAttribute('class', "kapat"); 
	document.body.appendChild(bg);
	document.body.appendChild(dv);
	document.body.appendChild(kpt);
	
	$('.f_bg').css({
			width: 1+"px",
			height: 1+"px",
			padding:10 +"px",
			overflow :"hidden",
			visibility:"hidden",
			
	});

	$('.'+class1).css({
			width: 1+"px",
			height: 1+"px",
			padding:10 +"px",
			overflow :"hidden",
			visibility:"hidden",
			"z-index" : 9005
	});
	$('.kapat').css({
			width: 1+"px",
			height: 1+"px",
			visibility:"hidden",
			"z-index" : 9009
	});
	$(".kapat").append('<img src="'+kapatBtn+'" border="0" style="margin:0px auto; border="none" />')
	if (tip == "iframe"){
		dv.innerHTML = '<iframe src="'+code+'" frameborder="0" scrolling="no" width="100%" height="100%" ></iframe>'
	}else if (tip == "image"){
		dv.innerHTML = '<img src="'+code+'" border="0" />';
	}else{
		dv.innerHTML = code;
	}
	
	$(function(){
		var LW = ($(window).width() - boxW);
		var TH = ($(window).height() - boxH);
		var Wt = 1024;
		var Wh = 768;
		Wt = $(window).width();
		Wh = $(window).height();
		$('.f_bg').css({
			position: 'absolute',
			background: '#000000',
			width: $(window).width()+"px",
			height: $(window).height()+"px",
			visibility:'visible',
			"z-index" : 9000,
			opacity:0
			}).animate( {opacity:.7}, 2000,function() {
			$('.'+class1).css({
				position :"absolute",
				background :"#000",
				visibility:'visible',
				top : (Wh - $('.'+class1).height())*0.5 +"px" ,
				left :(Wt - $('.'+class1).width())*0.5 +"px"
			}).animate({
				left: LW * 0.5+ 'px',
				top: TH* 0.5+ 'px',
				width: boxW +"px",
				height: boxH +"px"
				}, "slow", function() {
					$('.kapat').css({
						top : (Wh - $('.'+class1).height())*0.5 +"px" ,
						left :(Wt + $('.'+class1).width())*0.5 +"px",
						position :"absolute",
						visibility:"visible",
						cursor:"pointer"
					}).animate({
						width: kapatBtnW+"px",
						height: kapatBtnH+"px",
						top : ($(window).height() - $('.'+class1).height())*0.5 - kapatBtnH*0.5 +"px"	,
						left : ($(window).width() + $('.'+class1).width())*0.5 +"px"}
						, "fast");	
					});
				});
			});
			$(window).resize(function() {
				$('.'+class1).animate({"left": ($(window).width() - $('.'+class1).width()) * 0.5+ "px","top": ($(window).height() - $('.'+class1).height())* 0.5+ "px"}, "slow");
				$('.kapat').animate({"left": ($(window).width() + $('.'+class1).width())*0.5 +"px","top":($(window).height() - $('.'+class1).height())*0.5 - kapatBtnH*0.5 +"px"}, "slow");
				$('.f_bg').css({
				width :$(window).width(),
				height :$(window).height()
			})
			});
			$(".kapat").click(function(){
  				$('.'+class1).animate({opacity:0}, 1000,function() {
						$('.f_bg').animate({opacity:0}, 1000)
						document.body.removeChild(dv);
						document.body.removeChild(bg);
						document.body.removeChild(kpt);
						document.body.style.cursor = "auto";
					})
				$('.kapat').animate({opacity:0}, 1000)
			});
			$(".f_bg").click(function(){
  				$('.'+class1).animate({opacity:0}, 1000,function() {
						$('.f_bg').animate({opacity:0}, 1000)
						document.body.removeChild(dv);
						document.body.removeChild(bg);
						document.body.removeChild(kpt);
						document.body.style.cursor = "auto";
					})
				$('.kapat').animate({opacity:0}, 1000)
			});
			
			
		}
