function activateA(cur) {
	var t = cur;
	if (t) {
		t=t.firstChild;
		if (t) {
			var pos = t.className.indexOf('firstlevellink');
			if (pos>=0) {
				t.className += ' hoveratag';
			}
		}
	}
}

function deActivateA(cur) {
	var t = cur;
	if (t) {
		t=t.firstChild;
		if (t) {
			var pos = t.className.indexOf('firstlevellink');
			if (pos>=0) {
				t.className=t.className.replace(" hoveratag", "");
			}
		}
	}
}

// IE only makes :hover work on LI tags
activateMenu = function(nav) {
	/* Get all the list items within the menu */
	var navroot = document.getElementById(nav);
	var lis=navroot.getElementsByTagName("LI");  
	for (i=0; i<lis.length; i++) {
		/* If the LI has another menu level */
		if(lis[i].lastChild.tagName=="UL"){
			/* assign the function to the LI */
			lis[i].onmouseover=function() {		
				/* display the inner menu */
				this.lastChild.style.display="block";
				activateA(this);
			}
			lis[i].onmouseout=function() {                       
				this.lastChild.style.display="none";
				deActivateA(this);
			}
		}
	}
}

//window.onload= function(){
    /* pass the function the id of the top level UL */
    /* remove one, when only using one menu */
//	activateMenu('yacbddm'); 
//	fillup;
//}

function startonloadnow()
{
	if(document.getElementById("ticker"))
	{
		fillup();
	}
	activateMenu('yacbddm'); 
}

window.onload = startonloadnow;




/**********************Function for Contact Form Validation *********/


function trim (strVar) { 
     if(strVar.length >0)
	 {
	        while(strVar.charAt(0)==" ") 
			strVar=strVar.substring(1,strVar.length); 
			while(strVar.charAt(strVar.length-1)==" ") 
			strVar=strVar.substring(0,strVar.length-1); 			
	 }
	 return strVar; 
}

//Not an Alphabet
function isNotAlphabets(str){
		for (var i = 0; i < str.length; i++)
		{
				re = / /gi				//Replace the space between words with no space
				str = str.replace(re,"");
			
				var ch = str.substring(i, i + 1);
				if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
				{
					return true;
				}
		}
		return false;
}
//Not a number
function isNotNumeric(str){
		for (var i = 0; i < str.length; i++)
		{
				var ch = str.substring(i, i + 1);
				if((ch < '0' || '9' < ch)) 
				{
					if((ch == " ") || (ch == "_")  || (ch == ".") || (ch == "-") || (ch == "+")  || (ch == "(") || (ch == ")")) continue;
					return true;
				}
		}
		return false;
}
function isNotID(str){
		for (var i = 0; i < str.length; i++)
		{
				var ch = str.substring(i, i + 1);
				if((ch < '0' || '9' < ch) && ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch))) 
				{
					if(((ch == " ") || ch == "_") || (ch == "-") || (ch == "+")  || (ch == "(") || (ch == ")")) continue;
					return true;
				}
		}
		return false;
}

//Email Function
		function checkEmail(email)
		{
		 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		 {
			return (true)
		 }
			return (false)
		}

//Landing Page
function check_form(chk)
{
		var first_name 	= trim(chk.first_name.value);
		var last_name  	= trim(chk.last_name.value);
		var title  	  	= trim(chk.title.value);
		var company 	= trim(chk.company.value);
		var phone 		= trim(chk.phone.value);
		var email		= trim(chk.email.value);
		var state		= trim(chk.state.value);
		var country 	= trim(chk.country.value);
		var budget  	= document.getElementById("00N40000001R5QR").value;	
		var timeframe  	= document.getElementById("00N300000017Ozu").value;	
		var users		= document.getElementById("00N40000001R5QM").value;	

		if(first_name == "")
		 {
			alert("Please enter your first name.");
			chk.first_name.focus();
			return false;
		}
		if(isNotAlphabets(first_name))
		 {
			alert("Invalid characters in first name.");
			chk.first_name.focus();
			return false;		  
		 }
		 
		if(last_name == "")
		 {
			alert("Please enter your last name.");
			chk.last_name.focus();
			return false;
		}
		if(isNotAlphabets(last_name))
		 {
			alert("Invalid characters in last name.");
			chk.last_name.focus();
			return false;		  
		 }
		 		 
		 if(title == "")
		 {
			alert("Please enter your title.");
			chk.title.focus();
			return false;
		 }		
		 
		if(company == "")
		{
			alert("Please enter your company name.");
			chk.company.focus();
			return false;
		}

		 if(phone == "")
		 {
			alert("Please enter your phone.");
			chk.phone.focus();
			return false;
		 }
		 				
		 if(isNotNumeric(phone))
		 {
			alert("Invalid characters in phone.");
			chk.phone.focus();
			return false;		  
		 }
		 
		 if(email == "")
		 {
			alert("Please enter your email address.");
			chk.email.focus();
			return false;
		 }
		 				
		 if(!checkEmail(email))
		 {
			alert("Please enter valid email address.");
			chk.email.focus();
			return false;		  
		 }

		 if(state == "")
		 {
			alert("Please enter your state.");
			chk.state.focus();
			return false;
		 }

		 if(country == "")
		 {
			alert("Please enter your country.");
			chk.country.focus();
			return false;
		 }
		 	
		if(budget == "")
		 {
			alert("Please select:\n\nDo you have a budgeted active project?");
			document.getElementById("00N40000001R5QR").focus();
			return false;
		}
		if(timeframe == "")
		 {
			alert("Please select:\n\nWhat is your product selection timeframe?");
			document.getElementById("00N300000017Ozu").focus();
			return false;
		}
		if(users == "")
		 {
			alert("Please select:\n\nHow many users do you have?");
			document.getElementById("00N40000001R5QM").focus();
			return false;
		}						 
		 
		 	 		 		 
}				 		