
window.onload=loadUP;

function loadUP(){
	AttachMouseOver();	// For Top level Menus
}

// Cross Browser DOM Functions used to create objects and get top / left coords
// copyright Stephen Chapman, 4th Jan 2005
// you may copy this code but please keep the copyright notice as well
var aDOM = 0, ieDOM = 0, nsDOM = 0
var stdDOM = document.getElementById;
if (stdDOM) aDOM = 1; else {
  ieDOM = document.all;
  if (ieDOM) aDOM = 1; else {
    var nsDOM = (
      (navigator.appName.indexOf('Netscape') != -1)
      && (parseInt(navigator.appVersion) ==4));
    if (nsDOM) aDOM = 1;
  }
}
function xDOM(objectId, withStyle) {
var st = ''; if (withStyle) st = '.style';
if (stdDOM) return (eval('document.getElementById(objectId)'+st));
if (ieDOM) return (eval('document.all[objectId]'+st));
if (nsDOM) return (document.layers[objectId]);
}
// Object Functions
// copyright Stephen Chapman, 4th Jan 2005
// you may copy these functions but please keep the copyright notice as well
function objLeft(objectID) {var obj = xDOM(objectID,0);var objs = xDOM(objectID,1);  if(objs.left) return objs.left; if (objs.pixelLeft) return objs.pixelLeft; if (obj.offsetLeft) return obj.offsetLeft; return 0;}
function objTop(objectID) {var obj = xDOM(objectID,0);var objs = xDOM(objectID,1);  if(objs.top) return objs.top; if (objs.pixelTop) return objs.pixelTop; if (obj.offsetTop) return obj.offsetTop; return 0;}


//**** MAIN DHTML NAVIGATION

// Variables
var intNegativeIndent = "-150px" // Used when the sub-menu is shown to the left of the parent 
var intIndent = "150px"  // Indent when shown to the right

	
// Variables to store active items
var activeTopMenu = ""
var activeParent = ""
var activeSubMenu = ""

function ShowMenu(menuID,strType,trigObj){
	var screenWidth = getBrowserWidth()
	if (strType=="top"){
		if (activeTopMenu!=""){
			HideMenu(activeTopMenu)
		}
		activeTopMenu = menuID
		var menuObj = xDOM(menuID,0);
		if((objLeft(trigObj) + 290) > screenWidth){
			menuObj.style.left = screenWidth - 260 + "px";	
		}else{
			menuObj.style.left = objLeft(trigObj) + "px";	
		}		
		
		activeParent = trigObj
	}else{
		if (activeSubMenu!=""){
			HideMenu(activeSubMenu)
		}
		
		var menuSubObj = xDOM(menuID,0);
		var topIndent = objTop(trigObj) + 5 + "px";
		
		if((objLeft(activeParent) + 550) > screenWidth){
			menuSubObj.style.left = intNegativeIndent;
			menuSubObj.style.top = topIndent;
		}else{
			menuSubObj.style.left = intIndent;
			menuSubObj.style.top = topIndent;
		}
		activeSubMenu = menuID
	}
}
function HideMenu(menuID){
	var menuObj = xDOM(menuID,0);
	menuObj.style.left = "-999em";	
}
function getBrowserWidth() {
	if (document.all){
		var intScreenWidth = document.body.clientWidth
	}else{
		var intScreenWidth = window.innerWidth
		
	}
	return intScreenWidth
}

function HideSub(){
	if (activeSubMenu!=""){
		HideMenu(activeSubMenu)
		activeSubMenu = ""
	}		
}

function hideAllMenus(){
	if (activeSubMenu!=""){
		HideMenu(activeSubMenu)
		activeSubMenu = ""
	}			
	if (activeTopMenu!=""){
		HideMenu(activeTopMenu)
		activeTopMenu = ""
		activeParent = ""
	}	
}


function AttachMouseOver(){
	//This attaches a HideSub mouseover for all first level items that dont have an event.
	var menuAnchors = document.getElementById("nav").getElementsByTagName("A");
	for (var i=0; i<menuAnchors.length; i++) {
		if (menuAnchors[i].onmouseover!=undefined){
		}else if(menuAnchors[i].className=="topLevel"){
			menuAnchors[i].onmouseover = hideAllMenus;
		}else if(menuAnchors[i].className!="subItem"){
			menuAnchors[i].onmouseover = HideSub;
			//alert("item Numnber" & i)
		}
	}
}

function enableInput(obj, strText){
	obj.className='enabledInput';
	if(obj.value==strText){
		obj.value='';
	}
}

function disableInput(obj, strText){
	if(obj.value==''){	
		obj.className='disabledInput';
		obj.value=strText;
	}
}
function PhotoPop(id){
	if(id!=""){
		var strURL = "photo.asp?id=" + id
		var objPhotoWindow = window.open(strURL,'photo','height=500,width=550,left=10,top=10,directories=0,fullscreen=0,location=0,menubar=0,scrollbars=1,resizable=0,status=0,toolbar=0');

	}
}

function montre(id) {
var d = xDOM(id,0);
//alert(d);
	for (var i = 1; i<=50; i++) {
		if (document.getElementById('smenu'+i)){
		document.getElementById('smenu'+i).style.display='none';
		}
	}
if (d) {
d.style.display='block';
}
}