var $ = jQuery.noConflict();

var ajaxurl = "/wp-admin/admin-ajax.php";

(function($){
	var wayne = function () {
			var 
			
			clear_txt = function ()
			{
					
				switch ($(this).attr("id"))
				{
					case "form_name":
							if ($(this).val() == "Name:")
								$(this).val("");
						break;
						
					case "form_email":
							if ($(this).val() == "Email:")
								$(this).val("");
						break;
						
					case "form_phone":
							if ($(this).val() == "Phone:")
								$(this).val("");
						break;
						
					case "form_msg":
							if ($(this).val() == "Message:")
								$(this).val("");
						break;
				}
			},
			
			default_txt = function ()
			{
				switch ($(this).attr("id"))
				{
					case "form_name":
							if ($(this).val() == "")
								$(this).val("Name:");
						break;
					
					case "form_email":
							if ($(this).val() == "")
								$(this).val("Email:");
						break;
						
					case "form_phone":
							if ($(this).val() == "")
								$(this).val("Phone:");
						break;
						
					case "form_msg":
							if ($(this).val() == "")
								$(this).val("Message:");
						break;
				}
			}
			;
			
		
		return { 
			init : function (){
				/* menu */
				$(".menu .txt").mouseover(function(e){
					if ($(this).find("ul").html() != null)
						$(this).find("ul").show();
				});
				
				$(".menu .txt").mouseout(function(e){
					if ($(this).find("ul").html() != null)
						$(this).find("ul").hide();
				});
				
				$(".submenu li").mouseover(function(e){
														
				});
				
				/* --------------- free evaluation case */
				$(".free_evaluation_form input").bind("focus", clear_txt);
				$(".free_evaluation_form input").bind("blur", default_txt);
				$(".free_evaluation_form textarea").bind("focus", clear_txt);
				$(".free_evaluation_form textarea").bind("blur", default_txt);
				
				
				/*------------ file evaluation case ---------------*/
				$("#file_evaluation_case").click(function(e){
														  
					if ($("#form_name").val() == "Name:")
					{
						alert ("Please enter your name");
						return;
					}
					
					if ($("#form_email").val() == "Email:")
					{
						alert ("Please enter your email address ");
						return;
					}
					
					if ($("#form_phone").val() == "Phone:")
					{
						alert ("Please enter phone number");
						return;
					}
					
					var check = false;
					$(".free_evaluation_form input:radio").each(function(e){
						if ($(this).attr("checked"))
						{
							check = true;		
							return;
						}
					});
					
					if (!check)
					{
						alert ("Have you or a loved one been injured in the last 2 years?");
						return;
					}
					
					if ($("#form_state").val() == "State:")
					{
						alert ("Please select state");
						return;
					}
					
					if ($("#form_msg").val() == "Message:")
					{
						alert ("Please enter your message");
						return;
					}
				});
			}
		}; /* end return */
		
	}(); /* end wayne*/
	
	
	$.fn.extend({
		wayneinit : wayne.init			
	});
	
	
})(jQuery);

$(document).ready(function (){	
	
	$(this).wayneinit();
});

function redirect (url)
{
	window.location.href = url;
}
