$.fn.jModalFrame=function(closeText){
	var target = $(this).attr('href');
	var mWidth = $(this).attr('width');
	var mHeight = $(this).attr('height');
	var half = 0-(mWidth/2);
	var scrolled = Number($(window).scrollTop()+100);
	var wHeight= $(document).height();
	var wWidth = $(window).width();

	if(typeof closeText == "string"){
		closeText = closeText;
	}
	else if(typeof closeText == "number"){
		fadeInTime = closeText;
		closeText = '<div class="modal_closebox" style="position:absolute;bottom:-20px;right:2px;cursor:pointer;color:black;background-color:white;">Close</div>';
	}
	else{
		closeText = '<div class="modal_closebox" style="position:absolute;bottom:-20px;right:2px;cursor:pointer;color:black;background-color:white;">Close</div>';
		fadeInTime = 800;
	}
	
	$.fn.modalShow=function(){
		$('body').append('<div class="modal_veil"></div><div class="modal"></div>');
		var cssStyle = {
			'width':mWidth+'px',
			'height':mHeight+'px',
			'display':'none',
			'position':'absolute',
			'top':scrolled+'px',
			'left':'50%',
			'margin-left':half+'px',
			'border':'1px solid black',
			'z-index':'1000',
			'background-color':'white'
		}
		var veilStyle={
			'position':'absolute',
			'top':'0px',
			'left':'0px',
			'width':wWidth,
			'height':wHeight,
			'background-color':'black',
			'opacity':'.1',
			'filter':'alpha(opacity=10)'
		}
		$('.modal').css(cssStyle).fadeIn(800);
		$('.modal_veil').css(veilStyle).fadeTo(fadeInTime, 0.7);
		var iFrame='<iframe width="100%" height="100%" frameborder="0" src="'+target+'" id="frame"></iframe>';
		var closeBox = closeText;
		$('.modal').html(iFrame+closeBox);
		
	};
	
	$.fn.modalHide=function(){
		$('.modal,.veil').fadeOut(500,function()
			{
				$('.modal,.modal_veil').remove();
			});
	};
	
	if ($('.modal').length == 0){
		$(this).modalShow();
	}
	
	$('.modal_closebox').click(function(){
		$(this).modalHide();
	});
	
};
