// JavaScript Document

//	Need to declare array of menus 


function showBlock(elem) {
	elem.style.display = "block";
}

//	Hide a block
function hideBlock(elem) {
	elem.style.display = "none";
}

function menuItem(elem) {
	if(document.getElementById(elem).style != null && document.getElementById(elem).style.display != null) {
		if(document.getElementById(elem).style.display == "none"){
			showBlock(document.getElementById(elem));
			showBlock(document.getElementById(elem));
		}else if(document.getElementById(elem).style.display == "block")
			hideBlock(document.getElementById(elem));
	}
	else
		alert("No Properties");
}

function setSelected(elem) {
		//alert("setting " + elem + " to selected");
		document.getElementById(elem).className = "selected";
		//document.getElementById('club_football_news').className = "";
		
}

function setBreadCrumb() {
	//	Variables
	var sURL = new String;
	var x = 0;
	var stop = 0;
	var folderPath = new Array();
	
	//	Strip URL of http:// and to first /
	sURL = location.href;
	sURL = sURL.slice(8,sURL.length);
	chunkStart = sURL.indexOf("/");
	sURL = sURL.slice(chunkStart+1,sURL.length);
	  
	while(sURL.indexOf("/") != -1) {
		var tempPlace = sURL.indexOf("/");
		//	A back slash exists
		var tempString = sURL.slice(0,tempPlace);
		if(tempString != "" && tempString != "?")
			folderPath.push(tempString);
		else
			break;
		sURL = sURL.slice(tempPlace+1,sURL.length);		
	}
	
	// Main Navigation
	if(folderPath.length >= 1) {		
		setSelected(folderPath[0]);
	}
	else {
		setSelected("home");
	}
	
	//	menu Items
	var selected = "";
	for(var i=0; i<folderPath.length; i++) {
		selected += folderPath[i];
		if(document.getElementById(selected) != null) {
			menuItem(selected);
		}
		if(i+1 < folderPath.length)
			selected += "_";
	}	
	
	if(document.getElementById(selected) != null) {
		setSelected(selected);
	}
	
}


function pickBanner(p_loc){
	
	var banner = p_loc;
	//alert ("location is:"+banner);
	var Pic = new Array() ;
			//alert("locat is:"+pickBanner(locat));
		
	if (banner ==""){
		Pic[0] = '/flash/home/Home1.swf';
		Pic[1] = '/flash/home/Home1.swf';	
		Pic[2] = '/flash/home/Home1.swf';	
		Pic[3] = '/flash/home/Home1.swf';	
		Pic[4] = '/flash/home/Home1.swf';
	
	}else if(banner.indexOf("club") != -1){
		Pic[0] = '/flash/club/club1.swf';
		Pic[1] = '/flash/club/club2.swf';
		Pic[2] = '/flash/club/club3.swf';	
		Pic[3] = '/flash/club/club4.swf';
		Pic[4] = '/flash/club/club5.swf';
	}else if(banner.indexOf("youth") != -1){
		Pic[0] = '/flash/youth/youth1.swf';
		Pic[1] = '/flash/youth/youth2.swf';
		Pic[2] = '/flash/youth/youth3.swf';	
		Pic[3] = '/flash/youth/youth4.swf';	
		Pic[4] = '/flash/youth/youth5.swf';
	}else if(banner.indexOf("culture") != -1){
		Pic[0] =  '/flash/history/history1.swf';
		Pic[1] =  '/flash/history/history2.swf';
		Pic[2] =  '/flash/history/history3.swf';	
		Pic[3] =  '/flash/history/history4.swf';	
		Pic[4] =  '/flash/history/history5.swf';
	}else if(banner.indexOf("countyboard") != -1){
		Pic[0] =  '/flash/countyboard/Board1.swf';
		Pic[1] =  '/flash/countyboard/Board2.swf';
		Pic[2] =  '/flash/countyboard/Board3.swf';	
		Pic[3] =  '/flash/countyboard/Board4.swf';
		Pic[4] =  '/flash/countyboard/Board5.swf';
	}else if(banner.indexOf("county") != -1){
		Pic[0] = '/flash/county/county1.swf';
		Pic[1] = '/flash/county/county2.swf';
		Pic[2] = '/flash/county/county3.swf';
		Pic[3] = '/flash/county/county4.swf';	
		Pic[4] = '/flash/county/county5.swf';	
	}else{
		Pic[0] =  '/flash/home/Home1.swf';
		Pic[1] =  '/flash/home/Home1.swf';	
		Pic[2] =  '/flash/home/Home1.swf';
		Pic[3] =  '/flash/home/Home1.swf';
		Pic[4] =  '/flash/home/Home1.swf';	
	}
	
	var randomnumber=Math.floor(Math.random()*5)
	//alert ("banner is:"+Pic[randomnumber]);
  return Pic[randomnumber];
	
}



function createFlashObject(filename,width,height){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width='+width+' height='+height+' border="0">');
document.write('<param name="movie" value='+filename+'>');
document.write('<param name="quality" value="high">');
document.write('<embed src='+filename+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+width+' height='+height+'></embed>');
document.write('</object>');
}