function processCampaign(obj){
	
	document.getElementById("success_message").style.display = "none";	
	document.getElementById("error_message").style.display = "none";	
	
	var name = obj.name;
	var surname = obj.surname;
	var email = obj.email;
	var gender = obj.gender;
	var occupation = obj.occupation;
	var address = obj.address;
	var postcode = obj.postcode;
	var telephone = obj.telephone;
	var comments = obj.comments;
    
    var postdata = "name="+name.value;
	postdata += "&surname="+surname.value;
	postdata += "&email="+email.value;
	postdata += "&gender="+gender.value;
	postdata += "&occupation="+occupation.value;
	postdata += "&address="+address.value;
	postdata += "&postcode="+postcode.value;
	postdata += "&telephone="+telephone.value;
	postdata += "&comments="+comments.value;
	
	doRequest("http://www.unstunnedhalal.com/index.php?action=campaign","POST",postdata,_contact_handle);
}

function _contact_handle(){

	 if((http.readyState == 4)&&(http.status == 200)){
		var response = http.responseText;	
		if(response == 1){
			document.getElementById("success_message").style.display = "";	
			document.getElementById("campaignForm").style.display = "none";	
			
		}else if(response == 2){
			document.getElementById("error_message").style.display = "";	
		}
	 }
}


function emailAddresscheck(str) {

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

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ 
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		
		return false
	 }

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

	 return true					
}

function errhideDiv(divid){
	document.getElementById("sp_"+divid).style.display = "none";
}

function errshowDiv(divid){
	document.getElementById("sp_"+divid).style.display = "";
}
