// JavaScript Document

$(document).ready(function() {
	$('.javascriptwarning').css('display','none');
/*$(".unselectedtab a").mouseover(function() {
		$(this).parent().css('background-color','aqua').css('backgroung-image','none');
	});*/
	/*$(".unselectedtab a").mouseout(function() {
	//alert($(this).parent().css('background-color'));
		$(this).parent().removeAttr('style').css('backgroung-image','url("gradient-DQBMR.png")');//.css('background-color','#C4C3E8');
	});*/
	$(".content tr").mouseout(function () 
	{
		$(this).css("background-color","yellow")
	}).mouseover(function () 
	{
		if($("input",this).size() >0 ||  $("textarea",this).size()>0 ) 
		{
			$(this).css("background-color","#F3F84F")
		}
	}).click(function (){
		$("input[type=radio]",this).click();
		//console.log("All "+$(this).children("input").size()+" inner html"+$(this).html());
		//console.log("radio"+$(this).children("input[type=radio]").size());
		//console.log("radio2"+$("input[type=radio]",this).size());
		$("input[type=text]:first",this).focus();
		$("textarea",this).focus();
		//console.log("text"+$(this).children("input[type=radio]").size());
	});

	$("#contactformnavbar").validate({
            errorClass: "formerror",
			onsubmit:true,
			groups: {
			    phonenumber: "phone1 phone2 phone3"
			  },
			errorPlacement: function(error, element) {
		     if (element.attr("name") == "phone1" 
		                 || element.attr("name") == "phone2" || element.attr("name") == "phone3")
		       error.insertAfter("#phoneendnavbar");
		     else
		       error.insertAfter(element);
		   },
            rules: {
                // simple rule, converted to {required:true}
                name:{
                    required: true
                },
				comment:{
                    required: true
                },
                emailaddress: {
                    required: function(element){
						return $("#emailprefnav:checked").size() > 0;
					},
                    email: true
                },
				phone1: {
					required: function(element){
						return $("#phoneprefnav:checked").size() > 0;
					}
				},
				phone2: {
					required: function(element){
						return $("#phonepref:checked").size() > 0;
					}
				},
				phone3: {
					required: function(element){
						return $("#phonepref:checked").size() > 0;
					}
				}
            }
        });
});
$(window).load(function() {
	
	$('.javascriptwarning').css('display','none');
						});