
var fontSize = "0%";


function adjustFont(input){


	var s = document.getElementsByTagName('BODY');

	inspect(s[0], 0);

	if(fontSize == "0%"){
		fontSize = "75%";
	}

	fontSize = changeFont(input,fontSize);

	document.body.style.fontSize = fontSize;



}

function inspect(input, count){


	var output;

	for(props in input){

		if(props.indexOf("fontSize") > -1){
			if(input[props].indexOf("%") > -1){

				//alert(input.name + " --- " + props + " --- " + input[props]);
				fontSize = input[props];


			}
		}
		else if(input[props] == "[object]" && count < 5){
			count++;
			inspect(input[props], count);
		}

	}



}

function changeFont(input, fSize){



	var posPercent = fSize.indexOf("%");
	var number     = fSize.substring(0, posPercent);
	var output		= new Number(number);

	if(input == 1){
		output 			+= 10;
	}
	else{
		output			-= 10;
	}

	output 			= output + "" + "%";

	return output;



}

function nothing(){}





function shellWrite(token){

	var outputText;
	
	if(token == "start"){		
	
		outputText = "<link rel='stylesheet' href='styles/trmsStyle.css' type='text/css'><title>Tulsa Rock and Mineral Society</title></head><body><div class='pageContainer'><h3 class='left'>Tulsa Rock and Mineral Society</h3><h3 class='right'>Serving Tulsa, Oklahoma since 1958</h3><br><br><div class='shadowUnder'><h1 class='logo'></h1></div><div class='menu left'><ul><li>" + createAMenuLink('Home Page', 'index.html' , null) + "</li><li>" + createAMenuLink('Events', 'events.html' , null) + "</li><li>" + createAMenuLink('Newsletter', 'newsletter.pdf' , '_blank') + "</li><li>" + createAMenuLink('Meeting Map', 'meetingMap.html' , null) + "</li><li>" + createAMenuLink('Links', 'links.html' , null) + "</li><li>" + createAMenuLink('Other Clubs', 'otherClubs.html' , null) + "</li><li>" + createAMenuLink('About TRMS', 'aboutTRMS.html' , null) + "</li><li>" + createAMenuLink('Membership', 'membership.pdf' , null) + "</li><li>" + createAMenuLink('Benefits', 'benefits.html' , null) + "</li><li>" + createAMenuLink('Workshop', 'workshop.html' , null) + "</li><li>" + createAMenuLink('Contact', 'contact.html' , null) + "</li><li>" + createAMenuLink('Gallery', 'pictures.html' , null) + "<br><br></li></ul></div>";
	
	}
	else if(token == "footer"){
	
	
		outputText = "<div class='footer'>Website designed by <a href='mailto:att_maddox@hotmail.com'>Tim Maddox</a></div>";
	
	}

	
	
	document.write(outputText);
	
		
		
}


function getPageName(value){

	var sPath;
	var sPage;
	
	if(value != null){
		sPath = value;
		sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	}
	else{
	
		sPath = window.location.pathname;
		sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	}
	

	
	return sPage;

}


function identifyCurrent(){

	var i, obj;	
	
	var cPageName = getPageName(null);
	
	var anchors = document.getElementsByTagName("A");

	obj = anchors;

	for(i = 0; i < anchors.length; i++){

		if(getPageName(anchors[i].getAttribute("href")) == cPageName){
					
			
			anchors[i].setAttribute("class", "current");
			anchors[i].setAttribute("className", "current");
			
		}
	
	
	}

}



function getElementByClass(theClass){


	var targetClass = null;
	
	//Create an array var 
	allPageTags = new Array(); 

	//Populate the array with all the page tags  
	var allPageTags=document.getElementsByTagName("*");  
	
	//Cycle through the tags using a for loop  
	for (i=0; i<allPageTags.length; i++) {  
		//Pick out the tags with our class name  
		if (allPageTags[i].className==theClass){
			//Manipulate this in whatever way you want  
			targetClass = allPageTags[i];
		}  

	} 

	return targetClass;

}


function createAMenuLink( text, link, target ){



	var start = "<div class='spiffyItem'><b class='spiffy'><b class='spiffy1'><b></b></b><b class='spiffy2'><b></b></b><b class='spiffy3'></b><b class='spiffy4'></b><b class='spiffy5'></b></b><div class='spiffyfg'>";

	var tGet;

	if(target == null){
		tGet = "";
	}
	else{
		tGet = " target='" + target + "' ";
	}
	

	var link ="<a href='" + link + "' " + tGet + " >" + text + "</a>";

	
	var end = "</div><b class='spiffy'><b class='spiffy5'></b><b class='spiffy4'></b><b class='spiffy3'></b><b class='spiffy2'><b></b></b><b class='spiffy1'><b></b></b></b>";
	

	return start + link + end;


}