$(document).ready(function() {
				
	$('input').keydown(function(e){
        if (e.keyCode == 13) {
           $('form.formValidate').submit();
            return false;
        }
    });
	/******************* Login ********************/
	$("span.right-arrow-submit").click(function() {
		
		username= $('.username').val();
		password= $('.password').val();
		
		if (username == 'username' || password == 'password' || username == '' || password == '') {
			alert('Please enter a valid username and password');
		} else {
			href = "http://www.workerbee.ca/webpsw/htm/webpsw.html?TOT,6000,TR,DSK0:,50,306,CTL1=,USERID=" + username + ",PASSWORD=" + password;
			document.location.href = href;
		}
	});
	// Reset value
	$('.username').focus(function() {
		if($(this).val()== 'username') {
			$(this).attr('value','');
		}
	});
	$('.username').blur(function() {
		if($(this).val()== '') {
			$(this).attr('value','username');
		}
	});
	$('.password').focus(function() {
		if($(this).val()== 'password') {
			$(this).attr('value','');
		}
	});
	$('.password').blur(function() {
		if($(this).val()== '') {
			$(this).attr('value','password');
		}
	});
	/******************* Pars Tracker ********************/
	// Reset value
	$('#parstracker').focus(function() {
		if($(this).val()== 'Pars Tracker') {
			$(this).attr('value','');
		}
	});
	$('#parstracker').blur(function() {
		if($(this).val()== '') {
			$(this).attr('value','Pars Tracker');
		}
	});
	//Pars Tracker
	$("a.submit-link").click(function() {
		
		value= $(this).parent().find('input').val().toUpperCase();
		href="http://www.workerbee.ca/webpsw/htm/webpsw.html?TOT,6000,TR,DSK0:,50,306,CTL1="+ value + ",USERID=,PASSWORD=";
		if(value == "Pars Tracker" || value == '') {
			alert("Please enter a valid Pars Tracker #");
		} else {
			document.location.href = href;
		}
	});
});
