// JavaScript Document

// Keep form input fields from being yellow with Google Toolbar

 if(window.attachEvent)
    {//Attach to onload event in IE
        window.attachEvent("onload",resetStyles);
    }
    else
    {//Attach to load event in Other Browser
        window.addEventListener("load",resetStyles,false);
     //Attach to focus event in other browsers to disable
     //background color change in tabbed browsing 
        window.addEventListener("focus",resetStyles,false);  
    }

    function resetStyles()
    {
        resetStyle('input');
        resetStyle('select');
    }

    function resetStyle(inputType)
    {
        var count=document.getElementsByTagName(inputType);
        for(var i=0;i<count.length;i++)
        {
            if(window.attachEvent)
            {//Attach to onpropertychange event in IE
                count[i].attachEvent('onpropertychange',resetBC);
            }
            else
            {//Apply the style reset onload
                resetOther(count[i]);
            }
        }
    }
   
    function resetOther(El)
    {
        if(El.style.backgroundColor!='')
            El.style.backgroundColor='';
    }
    function resetBC()
    {
        if(event.srcElement.style.backgroundColor!='')
            event.srcElement.style.backgroundColor='';
    }
	
	
// Form feild styling


 // <![CDATA[
/* $(document).ready(function(){
 var value;

 $("input").focus(function () {
 if(!$(this).parent().hasClass('submit')) {
 onfocus($(this));
 }

 });

 $("input").blur(function () {
 if(!$(this).parent().hasClass('submit')) {
 onblur($(this));
 }
 });



 $('.jNiceSelectWrapper').focus(function() {
 onfocus($(this));
 });

 $('.jNiceSelectWrapper').blur(function() {
 onblur($(this));
 });


 function onfocus(element_name) {
 value = $(element_name).attr('value');
 $(element_name).click(function() {
 $(element_name).attr('value', '');
 });

 $(element_name).closest('p').addClass('focus');
 $(element_name).css('background-color','#FEFDEA');
 $(element_name).css('color','#333');
 }

 function onblur(element_name) {
 $(element_name).closest('p').removeClass('focus');
 $(element_name).css('background-color','#fff');
 $(element_name).css('color','#999');
 if(!$(element_name).attr('value')) {
 $(element_name).attr('value', value);
 }

 }


 }); */

 // ]]>
 
 
 // Form validation
 
 $(document).ready(function(){

	
 /* jQuery.validator.addMethod("defaultInvalid", function(value, element) {
		return value != element.defaultValue;
	}, "");
    $("form").validate({invalidHandler : function(){
	$("#requiredfields").slideDown("slow");
	}}); */
	
 });
