(function($){$.fn.spotlight=function(options){settings=$.extend({},{opacity:.5,speed:400,color:'#000',animate:true,easing:'',exitEvent:'click',onShow:function(){},onHide:function(){}},options);if($('#spotlight').size()==0){$('body').append('<div id="spotlight"></div>');var element=$(this);var spotlight=$('#spotlight');var element_was_hidden=false;if(!element.is(":visible")){element_was_hidden=true;}
if(element_was_hidden)element.prepend('<div style="float:right; cursor:pointer" id="close_element"><img src="compress.php?file=images/popup_close.gif"></div>');var close_element=$('#close_element');spotlight.css({'position':'fixed','background':settings.color,'opacity':'0','top':'0px','left':'0px','height':'100%','width':'100%','z-index':'9998'});var currentPos=element.css('position');if(currentPos=='static'){element.css({'position':'relative','z-index':'9999'});}else{element.css('z-index','9999');}
if(settings.animate){if(element_was_hidden){element.fadeIn(settings.speed);}
spotlight.animate({opacity:settings.opacity},settings.speed,settings.easing,function(){settings.onShow.call(this);});}else{spotlight.css('opacity',settings.opacity);settings.onShow.call(this);}
close_element.click(function(){if(settings.animate){if(element_was_hidden)element.fadeOut(settings.speed);spotlight.animate({opacity:0},settings.speed,settings.easing,function(){if(currentPos=='static')element.css('position','static');element.css('z-index','1');spotlight.remove();close_element.remove();settings.onHide.call(spotlight);});}else{spotlight.css('opacity','0');if(currentPos=='static')element.css('position','static');element.css('z-index','1');spotlight.remove();if(element_was_hidden)close_element.remove();if(element_was_hidden)element.hide();settings.onHide.call(spotlight);}});spotlight.live(settings.exitEvent,function(){if(settings.animate){if(element_was_hidden)element.fadeOut(settings.speed);spotlight.animate({opacity:0},settings.speed,settings.easing,function(){if(currentPos=='static')element.css('position','static');element.css('z-index','1');$(this).remove();close_element.remove();settings.onHide.call(this);});}else{if(element_was_hidden)element.hide();spotlight.css('opacity','0');if(currentPos=='static')element.css('position','static');element.css('z-index','1');$(this).remove();if(element_was_hidden)close_element.remove();settings.onHide.call(this);}});}
return this;};})(jQuery);function checkLogin(){var username=$('#login_username').val();var password=$('#login_pass').val();var value;$.ajax({url:"scripts/ajax_checklogin.php",type:'post',async:false,data:({'login_user':username,'login_pwd':password,'remember':$('#remember').attr('checked')}),success:function(msg){value=msg;}});if(value=='true')return true;else{$('#login_status').html(value);return false;}}
$(document).ready(function(){var popup_shown=false;$('#show_login_popup').click(function(){$('#login_popup').spotlight({speed:200});});$('#login_username').click(function(){if($(this).val()=='email of nickname')$(this).val('');});$('#login_pass_text').click(function(){$(this).hide();$('#login_pass').show();$('#login_pass').focus();});$('#login_pass_text').focus(function(){$(this).hide();$('#login_pass').show();$('#login_pass').focus();});});