/*LIVE VALIDATION*/
var areacode = new LiveValidation('area_code',{ onValid:validValue, onInvalid:invalidValue });
var phone1 = new LiveValidation('phone_1', { onValid:validValue, onInvalid:invalidValue });
var phone2 = new LiveValidation('phone_2', { onValid:validValue, onInvalid:invalidValue });
var email = new LiveValidation('email', { onValid:validEmailValue, onInvalid:invalidEmailValue });

areacode.add(Validate.Numericality);
phone1.add(Validate.Numericality);
phone2.add(Validate.Numericality);
email.add(Validate.Email);

function invalidValue(){
	document.getElementById('error-phone').style.display = 'inline';
	 this.addFieldClass();
}

function validValue(){
	document.getElementById('error-phone').style.display = 'none';
	this.addFieldClass();
}

function invalidEmailValue(){
	document.getElementById('error-email').style.display = 'inline';
	 this.addFieldClass();
}

function validEmailValue(){
	document.getElementById('error-email').style.display = 'none';
	this.addFieldClass();
}

/*END OF LIVE VALIDATION*/

$(document).ready(function(){
	$('#state-seleciton').change(function () {
		evalSelect();
	}).blur(function () { 
		evalSelect();
	});
});

function evalSelect(){
	if(document.getElementById('state-seleciton').selectedIndex == 0){
		document.getElementById('error-state').style.display = 'block';
	}else{
		document.getElementById('error-state').style.display = 'none';
	}	
}
