<!--

// if (top.frames.length!=0) { top.location=self.document.location; }

function ValidateFeed(){
	var msg=document.feedform.feedbox
	
	if ((msg.value==null)||(msg.value=="")){
		alert("No message entered...")
		msg.focus()
		return false
	}
	return true
 }

function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	var errmsg = " Please try again.\n\nIf you're having trouble please send an email directly to info@mukuna.co.nz asking to sign up for the newsletter.";
	if (str.indexOf(at)==-1){
	   alert("Entered email address is invalid." + errmsg)
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Entered email address is invalid." + errmsg)
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Entered email address is invalid." + errmsg)
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Entered email address is invalid." + errmsg)
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Entered email address is invalid." + errmsg)
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Entered email address is invalid." + errmsg)
	    return false
	 }
		
	 if (str.indexOf(" ")!=-1){
	    alert("Entered email address is invalid." + errmsg)
	    return false
	 }
 	 return true					
}

function ValidateForm(){

	var err = ''
	var locpick = null
	var emailID=document.frmSample.txtEmail

	for (i=0;i<document.frmSample.loc.length;i++)
	{
		if (document.frmSample.loc[i].checked)
		{
			var locpick = document.frmSample.loc[i].value;
		}
	} 

	if (locpick==null){
		err = err + "\n- Please select either Auckland or Wellington."
	}
	if ((emailID.value==null) || (emailID.value=="") || (emailID.value=="your email address")) {
		err = err + "\n- Please enter your email address."
	}
	
	if (err != '') {
		alert(err)
		if (emailID.value=="") {
			emailID.focus()
		}
		return false

	} else if (echeck(emailID.value)==false) {
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

function handleOver() {
	if (document.images) document.nzmm.src=img_on.src;
}

function handleOut() {
	if (document.images) document.nzmm.src=img_off.src;
}

// -->

