$(document).ready(function() {
	/* Default pulldown menu functionality */
	$('ul#primary-nav > li').hover(function() {
		$(this).children('a:first-child').addClass('hover');
		$(this).children('.pulldown').addClass('hover');
	}, function() {
		$(this).children('a:first-child').removeClass('hover');
		$(this).children('.pulldown').removeClass('hover');
	});
	
	/* IE6 iFrame fix for DIV overlays on SELECT boxes */
	if($.browser.msie && $.browser.version == '6.0') {
		$('ul#primary-nav > li').each(function() {
			$(this).children('div.pulldown').before('<iframe class="pulldown"></iframe>');
		});
		$('ul#primary-nav > li').hover(function() {
			var y = $(this).children('div.hover').height();
			var x = $(this).children('div.hover').width();
			$(this).children('iframe.hover').css('height',y).css('width',x);
		}, function() {
		
		});
	}
});

/*** adding the email checking functions here as the modules that contains the 
	email address field as spead throughout the site and this file is needed on all pages
*/
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateFormEmail(formObj){
	var emailID=formObj.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }