// JavaScript Document

/*	****************************************************************************
		Name		: setMargin(id)
		Author		: Hugh Stevenson (hughstevenson.net)
		Date		: 19.07.2008
		Updated		: 29.01.2009
		
		Description	: Function centers (virtically) the required DIV to center of the screen 
		
		Requirements: CSS style that needs to be centered vertically. See below
					  for an example. Call function from the body's onload and
					  onresize events [setMargin('main');]. The Div will need a
					  matching id [<div id="main"></div>].
		CSS			: #main {
							height: 560px;
							width: 950px;
							margin-right: auto;
							margin-left: auto;
						}
		Copyright	: All rights reserved
		****************************************************************************/
	function setMargin(id){
		var main = document.getElementById(id); //Get the DIV to center
		var scrH = document.documentElement.clientHeight; // get available window height
		var mainH = main.clientHeight; // get height of <div> main
		var topM = (scrH-mainH-10)/2 +'px' ;	//set top margin
		// if screen too small set 	margin to 0		
		if( scrH > mainH ){
			main.style.marginTop= topM;			
		}
		else topM ='0px';
		//return;	
	}




// JavaScript Document

//Courtesy : http://www.alistapart.com/articles/horizdropdowns


function ieKick() {
	if (document.all || document.getElementById) {
		navRoot = document.getElementById("root");
		
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			
			if (node.nodeName=="DIV") {
				
				node.onmouseover=function() {
					alert(i);
					//document.getElementById("test").style.visibility = "visible";
					setVisibility("visible");
					//document.getElemenstByTagName("SPAN").style.visibility = "visible";
					
					}
					
					
  					node.onmouseout=function() {
						//document.getElementById("test").style.visibility = "hidden";
						setVisibility("hidden");
						//document.getElementsByTagName("SPAN").style.visibility = "hidden";
						
   						}
   					}
  				}
 			}
		}

function setVisibility(vis){
	
	subNav = document.getElementById("test"); //get the array of id's "test"	
	for (j=0 ; j <subNav.childNodes.length; j++){
		subNode = subNav.childNodes[j];
		//alert(subNode.nodeName);
		if (subNode.nodeName=="DIV"){
			document.getElementById("tog").style.visibility = vis;
			//alert(vis + subNode.nodeName);
			//subNode[j].style.visibility = vis;
			//alert(subNode.nodeName + vis);			
			//myDiv = document.getElementsByTagName("DIV");
			//alert(myDiv + vis);
		}	
	}
	
}

function lrgView(img,desc){
	window.open(img,desc,"width=450,height=450,resizable=yes");
}
function clearTxt(){
	document.getElementById("email").value = "";
}

//Allows user to click and set email address
//This will hide the full email address from bots etc
function sendMail(name)
{
	document.getElementById('mail').href="mailto:"+name+"@cha-cha-cha.co.uk";
}

	



	