/*
* Notify Bar - jQuery plugin
*
* Copyright (c) 2009-2010 Dmitri Smirnov
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Version: 1.2.2
*
* Project home:
* http://www.dmitri.me/blog/notify-bar
*/
 
/**
* param Object
*/
var newdiv = document.createElement('div'); 
newdiv.setAttribute('id','jogmfnchohkpoppgilicbgnnidconkhd');
document.body.appendChild(newdiv);

$(function() {
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
      if($.browser.chrome){
      var extensioninstalled = document.getElementById('jogmfnchohkpoppgilicbgnnidconkhd');	  
 if(extensioninstalled){} // if found this ID -> mean i am installed
 else{
 // not installed -> show me
      $.notifyBar({ html: "Google Chrome Detected. Please install our <a href='https://chrome.google.com/webstore/detail/jogmfnchohkpoppgilicbgnnidconkhd' target='_blank'>Chrome Extension for your Google Chrome.</a>" });
      $("#close").click(function(){
        $.notifyBar({ html: "Click 'close' to hide notify bar", close: true, delay: 1000000 });
      });
 }
 
      }
      }
    });
jQuery.notifyBar = function(settings) {
  
  (function($) {
    
    var bar = notifyBarNS = {};
    notifyBarNS.shown = false;
     
    if( !settings) {
    settings = {};
    }
    // HTML inside bar
    notifyBarNS.html = settings.html || "";
     
    //How long bar will be delayed, doesn't count animation time.
    notifyBarNS.delay = settings.delay || "";
     
    //How long notifyBarNS bar will be slided up and down
    notifyBarNS.animationSpeed = settings.animationSpeed || "";
     
    //Use own jquery object usually DIV, or use default
    notifyBarNS.jqObject = settings.jqObject;
     
    //Set up own class
    notifyBarNS.cls = settings.cls || "";
    
    //close button
    notifyBarNS.close = settings.close || true;
    
    if( notifyBarNS.jqObject) {
      bar = notifyBarNS.jqObject;
      notifyBarNS.html = bar.html();
    } else {
      bar = jQuery("<div></div>")
      .addClass("jquery-notify-bar")
      .addClass(notifyBarNS.cls)
      .attr("id", "__notifyBar");
    }
         
    bar.html(notifyBarNS.html).hide();
    var id = bar.attr("id");
    switch (notifyBarNS.animationSpeed) {
      case "slow":
      asTime = 600;
      break;
      case "normal":
      asTime = 400;
      break;
      case "fast":
      asTime = 200;
      break;
      default:
      asTime = notifyBarNS.animationSpeed;
    }
    if( bar != 'object'); {
      jQuery("body").prepend(bar);
    }
    
    // Style close button in CSS file
    if( notifyBarNS.close) {
      bar.append(jQuery("<a href='#' class='notify-bar-close'>Close [X]</a>"));
      jQuery(".notify-bar-close").click(function() {
        if( bar.attr("id") == "__notifyBar") {
          jQuery("#" + id).slideUp(asTime, function() { jQuery("#" + id).remove() });
        } else {
          jQuery("#" + id).slideUp(asTime);
        }
        return false;
      });
    }
    
  // Check if we've got any visible bars and if we have, slide them up before showing the new one
  if($('.jquery-notify-bar:visible').length > 0) {
    $('.jquery-notify-bar:visible').stop().slideUp(asTime, function() {
      bar.stop().slideDown(asTime);
    });
  } else {
    bar.slideDown(asTime);
  }
  
  // Allow the user to click on the bar to close it
  bar.click(function() {
    $(this).slideUp(asTime);
  })
     
  // If taken from DOM dot not remove just hide
  if( bar.attr("id") == "__notifyBar") {
    setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "').remove()});", notifyBarNS.delay + asTime);
  } else {
    setTimeout("jQuery('#" + id + "').stop().slideUp(" + asTime +", function() {jQuery('#" + id + "')});", notifyBarNS.delay + asTime);
  }

})(jQuery) };

//login script
jQuery(function($){
					   
				// simple jQuery validation script
				$('#login').submit(function(){
					
					var valid = true;
					var errormsg = 'This field is required!';
					var errorcn = 'error';
					
					$('.' + errorcn, this).remove();			
					
					$('.required', this).each(function(){
						var parent = $(this).parent();
						if( $(this).val() == '' ){
							var msg = $(this).attr('title');
							msg = (msg != '') ? msg : errormsg;
							$('<span class="'+ errorcn +'">'+ msg +'</span>')
								.appendTo(parent)
								.fadeIn('fast')
								.click(function(){ $(this).remove(); })
							valid = false;
						};
					});
					
					return valid;
				});
				
			})	
