
  	
	$(document).ready(function(){
		
	 switch(window.location.pathname)
	 {
		case '/login.php':
		 if(window.location.search.indexOf('type=1')!=-1)
			 {
				jQuery('input[name="email_address"]').ajaxSend(function()
				{
					jQuery('<div id="login_loader"></div>').insertAfter( jQuery('input[name="email_address"]') );
				});
				
				
				jQuery('input[name="email_address"]').bind('blur', function()
				{
					
					
					jQuery.ajax({
					   type: "POST",
					   url: "chains-check.php",
					   data: "email="+jQuery('input[name="email_address"]').val(),
					   dataType:'json',
					   success: function(data){
						
						 if(data.msg=="chain")
						 {
							 if(jQuery('#store-no').length==0)
							 {
								 jQuery('<tr id="store-greeting"><td>Store No.</td><td><input type="text" name="store_no"/></td></tr>').insertAfter( jQuery('td input[name="email_address"]').closest('tr'));
								 jQuery('<tr id="store-no" style="height:40px;color:#FFCC00;font-weight:bolder;"><td colspan=2>'+data.greeting+'</td></tr>').insertAfter( jQuery('td input[name="email_address"]').closest('tr'));
							 }
							
						 }
						 else
						 {
							 jQuery('#store-greeting').remove();
							 jQuery('#store-no').remove();
						 }
						 
					   },		   
					   complete: function(msg){
						 jQuery('#login_loader').remove();
					   }
					 });
					 
					
				});
						 
			 }
		break;
		  
	 }
	});
	

