//******************************
//Incorrect Password Validation
//
//and
//
//Forgot Password scripts
//
//By: Kristopher Martel
//Date: 6-10-2011
//******************************

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}
var hash = getUrlVars();

var checker = hash['ckm_login_err'];

if(hash['ckm_login_err'] == 'Incorrect+Password'){
	var badPass = "Your password is incorrect";
}

//**********Below is the Forgot Password information

// This is our function that will get passed in the user’s email address
function sendLogin(email) {

	var url = 'http://partners.affiliatewise.com/login.ashx?fp=1&username=' + email + '&cb=showMessage';

	var script = document.createElement('script');

	script.setAttribute('src', url);

	document.getElementsByTagName('head')[0].appendChild(script);

}

// This is our function to be called with JSON data
function showMessage(data) {
	alert(data.message);
}

function notEmpty(){
	var myTextField = document.getElementById('emailAddr').value;

	if(myTextField != ""){

		sendLogin(myTextField);
	}

	else{
		alert("Please enter an email address");
	}
}

