jQuery.popup={show:function(title,message,options){settings=jQuery.extend({convertNLtoBR:true,postDOM:function(){},simpleAlert:false,main_class:"",main_id:"popup",bg_id:"popup_bg",title_id:"popup_title",msg_id:"popup_message",close_id:"popup_close"},options);if(!this.initialized){domElements='<div id="'+settings.bg_id+'"></div>';domElements+='<div id="'+settings.main_id+'" class="'+settings.main_class+'">';domElements+='<span id="'+settings.title_id+'"></span><a id="'+settings.close_id+'"> </a>';domElements+='<div id="'+settings.msg_id+'"></div>';domElements+='</div>';jQuery('body').append(domElements);settings.postDOM();jQuery('#'+settings.bg_id).click(function(){hidePopup();});jQuery('#'+settings.close_id).click(function(){hidePopup();});this.initialized=true;}
if(!isIPhone()&&!settings.simpleAlert){if(settings.convertNLtoBR){message=message.replace(/\n/g,"<br/>");}
jQuery('#'+settings.title_id).html(title);jQuery('#'+settings.msg_id).html(message);showPopup();}else{alert(message);}
function showPopup(){$('.search-bar').hide();if(!this.showing){centerPopup();jQuery('#'+settings.bg_id).css({"opacity":"0.6"});jQuery('#'+settings.bg_id).fadeIn("slow");jQuery('#'+settings.main_id).fadeIn("slow");this.showing=true;}}
function hidePopup(){if(this.showing){jQuery('#'+settings.bg_id).fadeOut("normal");jQuery('#'+settings.main_id).fadeOut("normal");this.showing=false;}
$('.search-bar').fadeIn('slow');}
function centerPopup(){var cWidth=document.documentElement.clientWidth;var cHeight=document.documentElement.clientHeight;var popupHeight=jQuery('#'+settings.main_id).height();var popupWidth=jQuery('#'+settings.main_id).width();jQuery('#'+settings.main_id).css({"top":cHeight/2-popupHeight/2,"left":cWidth/2-popupWidth/2});jQuery(settings.bg_id).css({"height":cHeight});}
function isIPhone(){if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){return true;}
return false;}
return jQuery;},initialized:false,showing:false};
