function radiochange1(){

	document.getElementById('webname1').style.display='none';
	document.getElementById('webname2').style.display='none';
	document.getElementById('webname3').style.display='none';
	document.getElementById('webname4').style.display='none';
	document.getElementById('status').value='no';
}

function radiochange2(){

	document.getElementById('webname1').style.display='';
	document.getElementById('webname2').style.display='';
	document.getElementById('webname3').style.display='';
	document.getElementById('webname4').style.display='';
	document.getElementById('status').value='yes';
}


function validateAdvertise(){

	if(document.getElementById('Url').value=='' || document.getElementById('Url').value=='http://' || document.getElementById('Url').value==null){
		alert("Website must be filled");
		document.getElementById('Url').focus();
		return false;
	}
	
	if(document.getElementById('firstname').value=='' || document.getElementById('firstname').value==null){
		alert("Name must filled");
		document.getElementById('firstname').focus();
		return false;
	}
	
	if(document.getElementById('lastname').value=='' || document.getElementById('lastname').value==null){
		alert("Lastname must filled");
		document.getElementById('lastname').focus();
		return false;
	}
	
	if(document.getElementById('email').value=='' || document.getElementById('email').value==null){
		alert("email must filled");
		document.getElementById('email').focus();
		return false;
	}
	else{
		return true;
	}


}


function advertising(){

	if(validateAdvertise()){
		document.getElementById('advertise').submit();
	}	
}


function validate_notNull(field,alerttxt){
	with (field)
	{

		if (value==null|| value=="" || value==false){
			alert(alerttxt);return false;
		}
		else{
		return true
		}
	}
}

function validate_notNullP(field,alerttxt){
	with (field)
	{

		if (value==null|| value=="" || value==false){
			return false;
		}
		else{
		return true
		}
	}
}


function validate_email(field,alerttxt){
	with (field){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
			if (apos<1||dotpos-apos<2) {
				alert(alerttxt);return false;
			}
			else{
			return true;
			}
	}
}

function weblinks(){

	window.open('index.php?page=webmasterlink','_parent');

}

var bcrWindow;

function popup(url,name){
	if (url=='popUpHome.php') {
		bcrWindow=window.open('popUpHome.php','TheBrainChemicalsPhasesofRomance','height=750px, width=550px, toolbar=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no');		
		bcrWindow.focus(); 
	}
	else
		window.open(url,name);
}

function contactus(){


	if(document.getElementById("select").value=='' || document.getElementById("select").value==null){
		alert ("You must select a category");
		return false;
	}
	
	
	if(document.getElementById("text").value=='' || document.getElementById("text").value==null){
	alert ("Message is empty");
	return false;
	}
	else{
	
	document.getElementById("contact").submit();
		
	}
			
	
}

function webmaster(){


with (document.getElementById("main")){

		
		if(validate_notNull(name,"Name must not be empty")==false){
			name.focus();
			return false;
		}
		if(validate_notNull(company,"Company Name must not be empty")==false){
			company.focus();
			return false;
		}
		if(validate_notNull(title,"Title must not be empty")==false){
			title.focus();
			return false;
		}
		if(validate_notNull(email1,"Email must not be empty")==false){
			email1.focus();
			return false;
		}
		else{
		
			if(validate_email(email1,"Invalid Email")==false){
			email1.focus();
			return false;
			}
		}
		
		if(validate_notNull(email2,"Email must not be empty")==false){
			email2.focus();
			return false;
		}
		else{
		
			if(validate_email(email2,"Invalid Email")==false){
			email2.focus();
			return false;
			}
			else{
			
			
				if(email2.value!=email1.value){
				email2.focus();
				alert("Emails are not the same")
				return false;
				}
					
			}
		}
		
		if(validate_notNull(URL,"Url must not be empty")==false){
			URL.focus();
			return false;
		}
		
		if(validate_notNullP(choice1,"You must select at least 1 category")==false){
			
			if(validate_notNullP(choice2,"You must select at least 1 category")==false){
		
				if(validate_notNull(choice3,"You must select at least 1 category")==false){
						
					choice1.focus();
					return false;
				}
			}
		}
		
		if(validate_notNull(text,"Message must not be empty")==false){
			text.focus();
			return false;
		}
		else{
			return true;
		}
		
	}
}


function webvalidate(){

	if(webmaster()){
	
		document.getElementById("main").submit();
	}

}


function suggests(){

	window.open('index.php?page=suggestlink','_parent');

}




function suggestlink(){
		
		
with (document.getElementById("suggestlinking"))
	{
		if(validate_notNull(newcat,"Category Name must not be empty")==false){
		
			newcat.focus();	
			return false;
		
		}
		
		
		
		if(status.value=='yes'){
				
			if(validate_notNull(webname3,"Give at least one Url (if only 1 url put it in the first box)")==false){
				
				webname3.focus();	
				return false;
			}
			else{
				return true;
				
			}
		}
		else{
		
			return true;
		}
	}
}

function suggestvalidate(){

	if(suggestlink()){
		document.getElementById("suggestlinking").submit();
	}
}


function confirmcontact(){

	window.open('index.php?page=contact&amp;task=confirm','_parent');
}



function confirmwebmaster(){

	window.open('index.php?page=webmasterlink&amp;task=confirm','_parent');
}

function exampage2(){

	var i;
	var x=0;
	
	for(i=0;i<document.getElementById('page2').choice1.length;i++){
	
		if(document.getElementById('page2').choice1[i].checked){
			x=1;
		}
		
	}
	
	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	
	x=0;	
	for(i=0;i<document.getElementById('page2').choice2.length;i++){
	
		if(document.getElementById('page2').choice2[i].checked){
			x=1;
		}
		
	}

	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	else{
		return true;
	}
	

	
	
}

function page2validate(){

	if(exampage2()){
		document.getElementById('page2').submit();
	
	}
}

function exampage3(){

	var i;
	var x=0;
	
	for(i=0;i<document.getElementById('page3').choice3.length;i++){
	
		if(document.getElementById('page3').choice3[i].checked){
			x=1;
		}
		
	}
	
	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	
	x=0;	
	for(i=0;i<document.getElementById('page3').choice4.length;i++){
	
		if(document.getElementById('page3').choice4[i].checked){
			x=1;
		}
		
	}

	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	
	
	x=0;	
	for(i=0;i<document.getElementById('page3').choice5.length;i++){
	
		if(document.getElementById('page3').choice5[i].checked){
			x=1;
		}
		
	}

	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	else{
		return true;
	}
	
}

function page3validate(){

	if(exampage3()){
		document.getElementById('page3').submit();
	
	}
}

function exampage4(){

	var i;
	var x=0;
	var choice6, choice7;
	
	choice6=document.getElementsByName("choice6");
	for(i=0;i<choice6.length;i++) {
	
		if(choice6[i].checked){
			x=1;
		}
		
	}
	
	if(x==0) {
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	
	x=0;	
	choice7=document.getElementsByName("choice7");
	for(i=0;i<choice7.length;i++){
	
		if(choice7[i].checked){
			x=1;
		}
		
	}

	if(x==0){
		alert("You must answer all questions in order to proceed");
		return false;
	
	}
	else{
		return true;
	}
}

function page4validate(){

	var formPage4=document.getElementById("formPage4");

	if(exampage4()) {
		formPage4.submit();
	
	}
}

function secondtaker() {

	form=document.getElementById("formId");
	form.submit();
}

function exampage7(){


	with(document.getElementById('page7')){
	
		if(validate_email(to,"Invalid email")==false){
			to.focus();
			return false;
		}
		
		if(validate_notNull(partnername,"Fill your partner's name")==false){
			partnername.focus();
			return false;
		}
		
		if(validate_notNull(yourname,"Fill your name")==false){
			yourname.focus();
			return false;
		}
		else{
			return true;
		}
		
	}
}


function page7validate(){

	if(exampage7()){
		
		document.getElementById('page7').submit();
	}
	
}


function examcontact(thisform){

		with (thisform){
		
			if(validate_notNull(os1,"Please provide your first name")==false){
			os1.focus();
			return false;
			}
			
			if(validate_notNull(Lastname,"Please provide your last name")==false){
			Lastname.focus();
			return false;
			}
			
			if(validate_email(os0,"Invalid Email")==false){
			os0.focus();
			return false;
			}
			
			if(validate_email(Email2,"Invalid Email")==false){
			Email2.focus();
			return false;
			}
			
			else{
			
				
				if(os0.value!=Email2.value){
				alert("Emails are not the same");
				Email2.focus();
				return false;
				}
				else{
				
					return true;
				}
			}
		}
}








