/**
*	akModal-  simplest alternative to thickbox
*	author: Amit Kumar Singh 
* 	project url : http://amiworks.co.in/talk/akmodal-simplest-alternative-to-thickbox/
 * 	inspired from early versions of thickbox
 *	
**/
/**
  * Version 2.0.0
  *  @param String  navurl             url to dispaly in the ifame
  *  @param String  title      title of the pop up box
  *  @param  Numeric  box_width	width of the box in pixels
  *  @param  Numeric  box_height	height of the box in pixels
  *   
 **/

jQuery.extend({
	
	showAkModal:function(navurl,title,box_width,box_height)
	{
	    var offset={};
	    var options ={
	    margin:1,
	    border:1,
	    padding:1,
	    scroll:0
	    };
		
	    var win_width =$(window).width();
	    var scrollToLeft=$(window).scrollLeft();
	    var win_height =$(window).height();
	    var scrollToBottom=$(window).scrollTop();
	   

	    $('body').append("<div id='ak_modal_div' style='background-color:#FFF;position:absolute;z-index:999999;padding-top:20px;display:none;'><a href='#' onclick='window.parent.$.akModalRemove(); return false;' style='text-decoration: none; color: #669; position: absolute; top: 2px; right: 10px;'>[ Close ]</a><iframe allowTransparency='true' width='"+box_width+"' height='"+box_height+"' frameborder=0 marginwidth='0' marginheight='0' scrolling='NO'  name='frmTest' src='"+navurl+"'></iframe></div>");

	    $('#ak_modal_div').css({left: '50%', marginLeft: -(box_width/2)+'px', top:(((win_height/2-box_height/2))+scrollToBottom)+'px'});
	  
	    $('#close').click( function() {
	       // 
	       $('#ak_modal_div').remove();
	       $("#overlay").hide();
	    });

	    $("#overlay").css({height: $(document).height()+'px', width: $(document).width()+'px'}).show();
            $('#ak_modal_div').fadeIn(500);
	},
	
	akModalRemove:function()
	{
	   $('#ak_modal_div').remove();
	   $('#overlay').hide();
	},
	
	akModalHideAndRedirect:function(redirect_url)
	{
	    $('#ak_modal_div').fadeOut(500);
	    $('#overlay').hide();
	    window.location=redirect_url;
	}
});	
