/********************\
 )		nav.js		(
<					 >
 )	::jack	11/2006	(
\********************/

  image1= new Image(); 
  image1.src="/images/nav_who.jpg"; 
	
  image2= new Image(); 
  image2.src="/images/nav_who_ro.jpg"; 
  
  image3= new Image(); 
  image3.src="/images/nav_contact.jpg"; 
  
  image4= new Image(); 
  image4.src="/images/nav_contact_ro.jpg"; 
  
  image5= new Image(); 
  image5.src="/images/nav_testimonials.jpg"; 
  
  image6= new Image(); 
  image6.src="/images/nav_testimonials_ro.jpg"; 
  
  image7= new Image(); 
  image7.src="/images/nav_portfolio.jpg"; 

  image8= new Image(); 
  image8.src="/images/nav_portfolio_ro.jpg"; 
  
  image9= new Image(); 
  image9.src="/images/nav_services.jpg"; 

  image10= new Image(); 
  image10.src="/images/nav_services_ro.jpg";

function toggle(id,type) {	
	//safe function to show an element with a specified id
	
	var x=document.getElementById(id+"_dd")
	if(type == 1) var left_px = '194px';
	else if(type == 2) var left_px = '-3000px'; 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
			x.style.left = left_px;
		} else {
			if (document.layers) { // Netscape 4

				document.id.left = left_px;
			}
			else { // IE 4
				document.all.id.style.left = left_px;
			}
		}
	toggleRO(id,type);
}


function toggleRO(imageName,type){
		if (type == 1) document.images[imageName].src= "/images/"+imageName+"_ro.jpg";
   else if (type == 2) document.images[imageName].src= "/images/"+imageName+".jpg";
}






/******************* Subpage Image Rotation **************************/
/*************************************    ***************************/
/*************************************    **************************/
/*************************************    *************************/

function getRandomSubImageTop(){
			var randomNumber = Math.floor(Math.random()*10);
			document.write('<img src="/images/randoms_top/subpage_top_'+(randomNumber+1)+'.jpg" alt=""/>');
		}
function getRandomSubImageSide(){
			var randomNumber = Math.floor(Math.random()*11);
			document.write('<img src="/images/side/subpage_side'+(randomNumber+1)+'.jpg"alt=""/>');
		}

function getRandomChurch(){
	
	var churchArray = new Array();
	churchArray[0] = '<img src="/images/randoms_top/subpage_top_7.jpg" alt=""/>';
	churchArray[1] = '<img src="/images/randoms_top/subpage_top_8.jpg" alt=""/>';
	churchArray[2] = '<img src="/images/randoms_top/subpage_top_9.jpg" alt=""/>';
	churchArray[3] = '<img src="/images/randoms_top/subpage_top_11.jpg" alt=""/>';
	
	var randomNumber = Math.floor(Math.random()*churchArray.length);
	
	document.write(churchArray[randomNumber]);
	
}
function setPortfolioImage(page,name,number){
	
	document.images["large_image"].src= "/images/portfolio/"+page+"_"+name+"_large_"+number+".jpg";
}










/******************* Homepage Image Rotation *************************/
/*************************************    ***************************/
/*************************************    **************************/
/*************************************    *************************/


var numImages = 6;
var imageNum = 1;

function changeHomepage(){
	
	document.images["homepage_image"].src= "/images/homepage/homepage_"+imageNum+".jpg";
	window.setTimeout("changeHomepage()",8000);
	
	if(imageNum == numImages) imageNum = 1;
	else imageNum++;
}


function getFeatured() {
	var rand = Math.floor(Math.random()*4)+1;

	if(rand == 1){
		document.write("<a href='/portfolio/vernonnazarene.asp'><img src='/images/featured/featured1.jpg' alt='Featured'/></a><p><strong>Mount Vernon Nazarene University</strong><br/>Mount Vernon, Ohio</p>");
	}
	if(rand == 2){
		document.write("<a href='/portfolio/galion.asp'><img src='/images/featured/featured2.jpg' alt='Featured'/></a><p><strong>First Presbyterian Church of Galion</strong><br/>Galion, Ohio</p>");
	}
	if(rand == 3){
		document.write("<a href='/portfolio/clearfork.asp'><img src='/images/featured/featured3.jpg' alt='Featured'/></a><p><strong>Clear Fork High School</strong><br/>Bellville, Ohio</p>");
	}
	if(rand == 4){
		document.write("<a href='/portfolio/elyria.asp'><img src='/images/featured/featured4.jpg' alt='Featured'/></a><p><strong>Elyria First Baptist Church</strong><br/>Elyria, Ohio</p>");
	}
}







/******************* Home Form Validation *************************/
/*************************************    *************************/
/*************************************    *************************/
/*************************************    *************************/

function valid_homepage_form(){

	var firstname = document.contact_form.fullname;
	var phone = document.contact_form.phone;
	var outline = document.contact_form.outline;
	
	if(firstname.value==""){
			alert("Please Enter A Name");
			return false
		} 
	if(phone.value==""){
			alert("Please Enter A Phone Number");
			return false
	} 
	if(outline.value==""){
			alert("Please Enter a Project Outline");
			return false
		} 
		return true;
		alert("Thank You, Your Information Has Been Submitted");
};

function valid_form_full(){
	
	var firstname = document.contact_form.fullname;
	var phone = document.contact_form.phone;
	var outline = document.contact_form.outline;
	var company = document.contact_form.company;
	var email = document.contact_form.email;
	
	if(firstname.value==""){
			alert("Please Enter A Name");
			return false
		} 
	if(phone.value==""){
			alert("Please Enter A Phone Number");
			return false
	} 
	
	if(company.value==""){
			alert("Please Enter a Company Name");
			return false
		} 
	if(email.value != ""){

			if(!isValidEmail(email.value)){
				alert("Please Enter a Valid Email");
				return false
			}
		} 
	if(outline.value==""){
			alert("Please Enter a Project Outline");
			return false
		} 
		return true;

};


function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 
}

function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}


/*________________ Homepage Image Rotation __________________*/


/*****

Image Cross Fade Redux
Version 1.0
Last revision: 02.15.2006
steve@slayeroffice.com

Please leave this notice intact. 

Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html


*****/


