// JavaScript Document

$(document).ready(function() {
	$('#side-nav > ul > li').hover(
		function() {
			$(this).find('ul:eq(0)').show();
			$(this).find('a:eq(0)').addClass('active');
		},
		function() {
			$(this).find('ul:eq(0)').hide();
			$(this).find('a:eq(0)').removeClass('active');
		}
	);
	
	$('.blink').focus(function() {
		if($(this).attr("value") == $(this).attr("title")) {
			$(this).attr("value", "");
		}
	}).blur(function() {
		if($(this).attr("value") == "") {
			$(this).attr("value", $(this).attr("title"));
		}	
	});
});



<!--
function addIEFavorite(firmname) {
	if (window.external) {
           var title
           var firm_name = firmname
           var meta = document.getElementsByTagName('meta')
           for(var i=0; i<meta.length; i++) {
                       var meta_name = meta[i].getAttribute('name').toLowerCase()
                       if (meta_name == 'title') title = meta[i].getAttribute('content')
           }
           if (title == null) {
                       external.AddFavorite(location.href, firm_name)
           }
           else {
                       external.AddFavorite(location.href, firm_name+' - '+title)
           }
	}
	else {
           alert("This feature is not supported in your browser. Please use your regular bookmarks menu.");

	}
}
// -->

// Add bookmark script
// -----------------------------------------------------------------
function addBookmark(title,url) {   
     if (window.sidebar) {   //firefox
          window.sidebar.addPanel(title, url,"");   
     } else if( document.all ) {  //MSIE 
          window.external.AddFavorite( url, title);   
     } else if( window.opera && window.print ) {   
          return true;   
     }   
}





// JavaScript Document

// clears and replaces text in form input fields and textareas
// -----------------------------------------------------------------
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}



function verify(fields)
{
    var msg;
    var empty_fields = "";
    var errors = "";
	var thePosition;
	var email;
   
	
    for(var i = 0; i < fields.length; i++) 
	{
        var formver = fields.elements[i];
				
		//thePosition=formver.name.indexOf("_");
		//if(-1==thePosition)
		//{
			//thePosition=formver.name.length;
		//}
			
//////////////////////////////////////////////////////////////////////////////////////////////////		
		//Checks for blank required fields
        if (formver.id== 'text') //checks for required fields
		{
            //check if the field is empty
            if ((formver.value == null) || (formver.value == "") || (formver.value == " name") || (formver.value == " phone")) 
			{
                empty_fields += "\n          " + formver.name
                continue;
            }
        }

//////////////////////////////////////////////////////////////////////////////////////////////////		
		//Phone
		
		if (formver.id == 'phone')
		{
			var error = "";
			var stripped = formver.value.replace(/[\(\)\.\-\ ]/g, '');    
	
			if (isNaN(parseInt(stripped))) 
			{
				errors = "The phone number contains invalid characters.\n";
				//fld.style.background = 'Yellow';
				continue;
			} else if (!(stripped.length == 10)) 
			{
				errors = "The phone number is the wrong length. Make sure you included an area code.\n";
				//fld.style.background = 'Yellow';
				continue;
			}
			//return error;
		}
		

////////////////////////////////////////////////////////////////////////////////////////////////////	
		// check to see if email address field is of valid syntax 
  
    if (formver.id == 'email')//Checks for an email field
	{
	  substremail = formver.value.split("@")   
      if (substremail.length > 1)//makes sure the email address has an @ symbol   
      {   
          index = substremail[1].indexOf(".") 
		     
           if (index == -1)   //makes sure there is a dot (.) in the address
           { 
		    
           errors = "Please enter a valid e-mail address";               
		   continue; 
           }   
      } 
  
      else 
	  	{  
           errors = "Please enter a valid e-mail address";     
           continue;  
      	}
	  }
	if (formver.id == 'number')//checks for a number field
	 {	 
	 if (IsNumeric(formver.value)==false)//checks for a non numeric value
		{			
			errors = "Please enter a numeric value";
			continue;	
			
		}
		//if (formver.value.length != formverid[1])//checks to see if the value length matches the perameters
		//	{
		//	errors = "Please enter a 5 digit zip code";
		//	continue;
		//	}	
		
	}
	
	 
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////	
    // if there were any errors, display the messages, and
    // return false to prevent the form from being submitted. 
    
	if (!empty_fields && !errors) return true;
    
	msg  = "______________________________________________________\n\n"
    msg += "The form was not submitted because of the following error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"
    
	if (empty_fields) 
	{
        msg += "The following required field(s) are empty:"
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    	msg += errors;
    	alert(msg);
    	return false;  
	
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// this function is called to check if a value is numberic
function IsNumeric(sText)
{

	   var ValidChars = "0123456789.";
	   var IsNumber=true;
	   var Char;
	
	 
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
		  { 
		  Char = sText.charAt(i); 
		  if (ValidChars.indexOf(Char) == -1) 
			 {
			 IsNumber = false;
			 }
		  }
	   return IsNumber;
}	 


function checkCheckBoxes(theForm) {
var themessage = "Have you read the disclaimer? If so, please check the disclaimer box.' \n\n";

	if (theForm.Read_disclaimer.checked==false) 
	{
		alert(themessage);
		return false;
	}
	else
	{
		return true;
	}
	


/*if (myOption == -1) {
themessage = themessage + " -  Have you read the disclaimer? If so, please check the disclaimer box. \n";
}*/
/*if(theForm.Name)
{
	if (theForm.Name.value=="") 
	{
		themessage = themessage + " -  Name \n";
	}
}
if(theForm.First_Name)
{
	if (theForm.First_Name.value=="")
	{
		themessage = themessage + " -  First Name \n";
	}
}
if(theForm.Phone){	
	if ((theForm.Phone.value==null)||(theForm.Phone.value==""))
	{
		themessage = themessage + " -  Phone \n";
	}	
}
if (theForm.Email.value=="")
{
	themessage = themessage + " -  Email \n";
}*/


//alert if fields are empty and cancel form submit
if (themessage != "You are required to complete the following fields: \n\n") {
alert(themessage);
return false;
}
return true;
}




