/*	Author : Stuart Grant */

Cufon.replace('.cufon');
Cufon.replace('ul#primary li a', { hover: true });


$(document).ready(function(){
	//search clear
	$("#siteSearch, .empty_me").not('input[type=submit]').focus(function() {
		$(this).addClass("focus")
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		$(this	).removeClass("focus")
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
});

/* $(document).ready(function(){
	//search clear
	$("#topSearch, .txt, .txtarea, input").not('input[type=submit]').focus(function() {
		$(this).addClass("focus")
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		$(this).removeClass("focus")
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	})  
	

if ( $('#secondary').length > 0 ) {
			$("#secondary li").not('#secondary li li').addClass('closed');
			$("#secondary li.closed ul").hide();
			$("#secondary li a").not('#secondary li li a').click(function () { 
					 $('#secondary li a.active').removeClass('active').parent('li').toggleClass('closed').find('ul').hide();	
					 $(this).stop().addClass('active').parent('li').toggleClass('closed');						  
					 $("#secondary li ul").show();
					 $("#secondary li.closed ul").hide();
					return false; 
			});
		}
}); */

//*inline validation*//
$(document).ready(function(){
	  
    $("#reg_form").validate({
		rules: {
			first_name: { required: true},
			last_name: { required: true},
			email: {
				required: true,
				email: true
			},
			confirm_email: {
				required: true,
				equalTo: "#email"
			}
		},
		messages: {
			first_name: "Please enter your First Name",
			last_name: "Please enter your First Name",
			email: "Please enter a valid email address",
			confirm_email: {
				required: "Please repeat your email address",
				equalTo: "Please enter the same email as above"
			}
		}
	});	
	
	$("form .required").blur(
		function(event){
			 $(this).siblings('.msg').remove();
			 $(this).valid();
			 if ( $(this).hasClass('valid')) {
				$(this).parents('.row').append('<span class="msg win">win</span>');
			   } else{
				$(this).parents('.row').append('<span class="msg fail">fail</span>');
			 }
	});	
	
		$("form .required").keyup(
		function(event){
			 $(this).siblings('.msg').remove();
			 if ( $(this).hasClass('valid')) {
				$(this).parents('.row').append('<span class="msg win">win</span>');
			   } else{
				$(this).parents('.row').append('<span class="msg fail">fail</span>');
			 }
	});	
	
});
