/*
 * 	Inner Popup Keren v 1.6 - jQuery plugin
 *	written by David Wijaya - Trilogicsoft Indonesia
 *
 *	Copyright (c) 2011 David Wijaya (http://www.trilogicsoft.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 */
 
(function ($) {$.fn.innerPopup = function(settings) {/*Defaults are below*/var options = $.extend(false, $.fn.innerPopup.defaults, settings);var _self = this, _parent = _self.parent();if(options.followObject) {_self.bind('click', function() {if(options.isbackground) createBg();createPopup($(this));return false;});} else {if(options.isbackground) createBg();createPopup($(this));return false;}function createBg() {$('body').append('<div id="_t_bgpopup" class="popupback"></div>');$('#_t_bgpopup').css({'width' :  $(document).width() + 'px', 'height' : $(document).height() + 'px', 'z-index' : '999998', 'position' : 'absolute', 'top' : '0', 'left' : '0', 'background' : '#454545', 'opacity' : '0.5'}).fadeIn(500);}function createPopup($obj) {var popWidth = 0, popHeight = 0, posX = 0, posY = 0, _title = options.title;if(_title == '') _title = $obj.attr('title');if(_title == '') _title = '&nbsp;';if(options.mode == 'url') {var _link = options.links;if(_link == '') _link = $obj.attr('href');var popupcontent = '<div id="_popup" class="popup"><div id="_popup_t" class="popuptop"><ul><li class="poptitle">'+ _title +'</li><li class="close"><a class="popup_close" ></a></li></ul></div><div id="_popup_m" class="popupmid"><iframe name="_frame_c" id="_frame_c" frameborder="0" src="'+ _link +'"></iframe></div></div>';} else if(options.mode == 'text') {var _text = options.text;if(_text == '') _text = $obj.html();var popupcontent = '<div id="_popup" class="popup"><div id="_popup_t" class="popuptop"><ul><li class="poptitle">'+ _title +'</li><li class="close"><a class="popup_close"></a></li></ul></div><div id="_popup_m" class="popupmid">' + _text + '</div></div>';}popWidth = options.width;popHeight = options.height;$('body').append('<div id="_panel_popup" class="popup_panel"></div>');$('#_panel_popup').css('visibility', 'hidden');$('#_panel_popup').html(popupcontent);var titleheight = $('#_popup_t').outerHeight();$('#_panel_popup').css({'width':popWidth +'px', 'height':popHeight +'px'});$('#_popup_t').css({'width': (popWidth - 20) +'px'});$('#_popup_t').find('.poptitle').css({'width':(popWidth - 40) +'px'});$('#_panel_popup').css({'visibility':'visible', 'display':'none'});$('#_popup_m').css({'width':(popWidth - 10) +'px', 'height':((popHeight - titleheight) - 10) + 'px', 'padding':'5px'});$('#_frame_c').css({'width':(popWidth - 10) +'px', 'height':((popHeight - titleheight) - 10) + 'px'});$('#_panel_popup').fadeIn(50);$('a.popup_close').click(function(){	$('#_t_bgpopup').each(function(){$(this).remove();});$('#_panel_popup').each(function(){$(this).remove();});});if(options.posBy == null) {posX = (($(window).width() - (popWidth + 30)) / 2);posY = Math.round(($(window).height() - (popHeight + 30)) / 2) + $(document).scrollTop();} else {posX = options.posBy.offset().left + ((options.posBy.width() - (popWidth + 30)) / 2);posY = options.posBy.offset().top + ((options.posBy.height() - (popHeight + 30)) / 2);}$('#_panel_popup').css({'top':posY+'px', 'left': posX+'px'});}};/*Default settings*/$.fn.innerPopup.defaults = {mode : 'url', /* url, text*/followObject : true,posBy : null,links : '',text : '',title : '',isbackground : true,width : 300,height : 300,onLoad : ''};$.fn.reverse = [].reverse;})(jQuery); 
