/***********************************************
* Email Validation script- &copy; Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Please enter a valid email address.")
e.select()
}
return returnval
}

<!--
/***********************************************
* Required field(s) validation v1.10- By NavSurf
* Visit Nav Surf at http://navsurf.com
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("Name", "Phone", "Email", "Address", "Avg Investment", "Time Frame");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("Name", "Phone", "Email", "Address (City, State,Zip)", "What cash do you have to invest?", "What is your time frame?") ;
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "Child Grade Level"){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined || obj.value == "Full Name" || obj.value == "Phone Number" || obj.value == "Move Date") { 
				var blnchecked = false;

				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


function dropdown1(sel){
   if(sel.options.selectedIndex == 0 || sel.options.selectedIndex == 1){
      alert('Please choose an option');
      return false;
   }	   
   else{
      document.contact.mto.options.selectedIndex = 1; 
   }
}

function dropdown2(sel){
   if(sel.options.selectedIndex == 0){
      alert('Please choose an option');
      return false;
   }    
   else{
      document.contact.mfrom.options.selectedIndex = 13; 
   }
}


// -->


function startEfffects(){
var n = $(".mainNav ul li").length;
var onPage = $("body").attr("id");
onLink = 1;
	
	if(onPage == "on1"){ $(".mainNav ul").find(".n1").addClass("current");}
	if(onPage == "on2") {$(".mainNav ul").find(".n2").addClass("current");}	
	if(onPage == "on3"){ $(".mainNav ul").find(".n3").addClass("current");}
	if(onPage == "on4") {$(".mainNav ul").find(".n4").addClass("current");}	
	if(onPage == "on5"){ $(".mainNav ul").find(".n5").addClass("current");}
	if(onPage == "on6") {$(".mainNav ul").find(".n6").addClass("current");}	
	if(onPage == "on7") {$(".mainNav ul").find(".n7").addClass("current");}	

	$(".title h1, .maintxt p").hide();
	$(".title h1").fadeIn(2000);
	$(".maintxt p").fadeIn(1000);
}

function checkHieghtMaintxt(){
	var divHeightMaintxt = $('.maintxt').height();
	if(divHeightMaintxt < 224){
		$('.maintxt').height(224);
		$('.ctaFooter').css("display", "block");
	}
}

jQuery(document).ready(function($){
	checkHieghtMaintxt();
	if(typeof document.body.style.maxHeight === "undefined") {
	
		$('.maincnt ul li').css({
			"list-style": "disc outside none",
			"padding" : "0 0 0 0",
			"background" : "none"
		});
		
		} 	else {	
										
			startEfffects();
			
			$(".mainNav").lavaLamp({
			fx: "backout",
			speed: 1200
			});
			$(".mainNav li a").addClass("offSubNav"); /* add class to main nav */
			$(".subNav").animate({opacity: 1}); /* set opacity on subnav */ 
			
			$(".offSubNav").hover(function() { /* hide subNav when hover on offSubNav */
			$(".subNav").hide();
			
			});
			
			$(".subNav").hover(function() {
			$(this).show();
			
			} , function() {
			$(this).hide();
			
			
			});
			
			$(".servicesBtn").hover(function() {
			$(".subNav").hide(); 							   
			$(".servicesNavDrop").show(); 
			$(".mainNav li a").addClass("offSubNav");
			setCurr(this);
			$(this).removeClass("offSubNav"); /* remove offSubNav */
			
			});
			
			$(".productsBtn").hover(function() {
			$(".subNav").hide(); 							   
			$(".productsNavDrop").show(); 
			$(".mainNav li a").addClass("offSubNav");
			$(this).removeClass("offSubNav");  /* remove offSubNav */
			
			});
			
			$(".clickForSound").click(function(event) {
			event.preventDefault();
			$(".clickForSound").hide();
			flashvars.videoLoop			=	"false";
			flashvars.videoAutoPlay = "true";
			flashvars.soundVolume		=	"0.8";
			flashvars.videoPath = "../vid/vid1.flv";
			swfobject.embedSWF("vid/video-player.swf", "vid1", stageW, stageH, "9.0.0", false, flashvars, params, attributes);
			});
	}
});

