// JavaScript Document
function searchFor() {
	var x=document.getElementById("cse-search-box");
	/*if(x) {
		location.href = "/search/node/" + x.elements[0].value;
	}*/
	x.submit();
	return false;
}

/*
function hide(div1,div2) {
	x=document.getElementById(div1);
	y=document.getElementById(div2);
	x.style.display = "none";
	y.style.display = "none";
	//x.style.setProperty("display","none","");
	//y.style.setProperty("display","none","");
}

function show(div) {
	x=document.getElementById(div);
	x.style.display = "block";
	//x.style.setProperty("display","block","");
}
*/
function test() {
	alert("test");
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com 
(http://www.smartwebby.com/dhtml/)
 */

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("You have entered an invalid email address. \n\n Please try again.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("You have entered an invalid email address. \n\n Please try again.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("You have entered an invalid email address. \n\n Please try again.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("You have entered an invalid email address. \n\n Please try again.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("You have entered an invalid email address. \n\n Please try again.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("You have entered an invalid email address. \n\n Please try again.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("You have entered an invalid email address. \n\n Please try again.")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.getElementById('email-inp')
	var yesorno=document.getElementById('newsletter-inp')
	var agreement=document.getElementById('agreement-inp')   
        var city=document.getElementById('city-inp')

        if(!agreement.checked) {              
                alert("You must agree to all of the rules and regulations in order to continue");
                return false;
        }

	if(!yesorno.checked) {
		//return true
	}
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address.")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	if((city.value==null) || (city.value=="")) {
                alert("Please enter your city.") 
                city.focus();
                return false 
        }

	return true
 }

<!-- Idea by:  Nic Wolfe -->                  
<!-- This script and many more are available free online at -->   
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=500,left = 440,top = 150');");
}
// End -->

function newPopUp(URL,w,h) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=' + w + ',height=' + h + ',left = 240,top = 150');");
}


