// JavaScript Document
function makeMenus(){
	// all of the header and footer navigation is assigned here.
	var menuHTML = '';
	menuHTML += '<ul>';
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/index.htm">Home Page</a></li>';
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/salvation.htm">What must I do?</a></li>';
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/directions.htm">Directions</a></li>';
	<!-- menuHTML += '<li><a href="http://altoonapachurchofchrist.org/help.htm">Help</a></li>'; -->
	menuHTML += '</ul>';
	
	menuHTML += '<ul>';
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/studies.htm">Bible Studies</a></li>'; 
	<!-- menuHTML += '<li><a href="http://altoonapachurchofchrist.org/missions.htm">Church Ministries</a></li>'; -->
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/cgi-bin/contact_form.cgi">Contact</a></li>';
	menuHTML += '<li><a href="http://altoonapachurchofchrist.org/site_map.htm">Site Map</a></li>';
	menuHTML += '</ul>';
	document.getElementById('topNav').innerHTML = String(menuHTML);
	
	menuHTML += '<p>Copyright (c) 2008, Pleasant Valley church of Christ, Any portion of text or images on this site may be used to spread the Gospel of Christ. <br />Written permission from the church elders must be obtained in all other instances.</p><p>This site is designed for a minimum screen size of 800 x 600 and is best if viewed at 1024 x 768.</p>';
	document.getElementById('footer').innerHTML = String(menuHTML);
}
if (document.getElementById){
	window.onload = makeMenus;
}
function showMe(divName, divState){
	
	document.getElementById(divName).style.display = divState;

}

//This properly formats the textarea for the news section.
function formatNews(){
	// txtArea is a variable with a node reference to a TEXTAREA
//var val = String(document.getElementById('newstext').value);
document.getElementById('newshtml').value = document.getElementById('newstext').value
// Now all \r\n characters in Opera should be converted to \n chars
//var lines = val.split("\n");
//var newHtml = "";

	//for (i=0; i<lines.length; i++){
	//newHtml += "<p>"+lines[i]+"</p>";
	//}
//document.getElementById('newshtml').value = String(val);
}

//This properly formats the textarea for the encouragement section
function formatEncouragement(){
	// txtArea is a variable with a node reference to a TEXTAREA
//var val = String(document.getElementById('encourage').value);
document.getElementById('encourage').value = document.getElementById('encouragehtml').value
// Now all \r\n characters in Opera should be converted to \n chars
//var lines = val.split("\n");
//var newHtml = "";

	//for (i=0; i<lines.length; i++){
	//newHtml += "<p>"+lines[i]+"</p>";
	//}
//document.getElementById('encouragehtml').value = String(newHtml);
}

//This properly formats the textarea for the schedule section
function formatSchedule(){
	document.getElementById('schedulehtml').value = document.getElementById('schedule').value
	// txtArea is a variable with a node reference to a TEXTAREA
//var val = String(document.getElementById('schedule').value);

// Now all \r\n characters in Opera should be converted to \n chars
//var lines = val.split("\n");
//var newHtml = "<p><ul>";
	//for (i=0; i<lines.length; i++){
	//newHtml += "<li style='padding:3px;'>"+lines[i]+"</li>";
	//}
	//newHtml += "</ul></p>"
//document.getElementById('schedulehtml').value = String(newHtml);
}
// This shows and hides the divs in the form for updating.
function editMe(name, numb){
	document.getElementById('ncl').style.display='none';
	document.getElementById('1').innerHTML = '<img src="http://altoonapachurchofchrist.org/images/earrow.jpg" />';
	document.getElementById('news').style.display='none';
	document.getElementById('2').innerHTML = '<img src="http://altoonapachurchofchrist.org/images/earrow.jpg" />';
	document.getElementById('meetings').style.display='none';
	document.getElementById('3').innerHTML = '<img src="http://altoonapachurchofchrist.org/images/earrow.jpg" />';
	document.getElementById('sch').style.display='none';
	document.getElementById('4').innerHTML = '<img src="http://altoonapachurchofchrist.org/images/earrow.jpg" />';
	// make visible the selection
	document.getElementById(name).style.display='block';
	document.getElementById(numb).innerHTML = '<img src="http://altoonapachurchofchrist.org/images/arrow.jpg" />';
}
function getMe(filename){
	document.getElementById('ncltext').value='ahahahahha';
}
function genUniqueName(){
	
	var numb_a = Math.floor((Math.random() * 8+1));
	var numb_b = Math.floor((Math.random() * 8+1));
	var alphaList = new Array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
	
	var numb_c = Math.floor((Math.random() * alphaList.length));
	
	document.getElementById('sfilename').value = document.getElementById('lm_name').value+'_'+numb_a+numb_c+numb_b+'.htm';
	
}
