//Javascript Document

// hide address bar in iPhone
window.onload = hideURLbar	

function hideURLbar(){
window.scrollTo(0,1);
}

//togglelayer to show/hide object
function toggleLayer(whichLayer)
{		
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function addEvent(element, eventType, lamdaFunction, useCapture) {
    if (element.addEventListener) {
        element.addEventListener(eventType, lamdaFunction, useCapture);
        return true;
    } else if (element.attachEvent) {
        var r = element.attachEvent('on' + eventType, lamdaFunction);
        return r;
    } else {
        return false;
    }
}
//addEvent(window, 'load', init, false);



/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this javascript and the associated (x)html
is available at http://www.stunicholls.com/gallery/simple.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This javascript and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
clickMenu = function(menu) {
	var getEls = document.getElementById(menu).getElementsByTagName("LI");
	var getAgn = getEls;

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
				//Loop through all items
				for (var x=0; x<getAgn.length; x++) {
					//Set the default/main image innerhtml to the currently clicked item
					if ((getAgn[x].className.indexOf('default')) != -1)
						getAgn[x].innerHTML = this.innerHTML;
				}
			}
		}
	}

function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}
//to load, do this: loadjscssfile('includes/gallery/simple.css','css');
//loadjscssfile('includes/gallery/simple_ie.css','css');



