// Navigation for IE

navHover = function() {
	var navLi = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<navLi.length; i++) {
		navLi[i].onmouseover=function() {
			this.className+=" over";
		}
		navLi[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);

/*

*/

function selectAll(id, formName) {
  // get the elements. if formName is p rovided, get the elements inside the form
  if (formName==null) {
     checkboxes = document.getElementsByName(id)
     for (i = 0; i < checkboxes.length; i++)
         checkboxes[i].checked = true ;
  } else {
     for (i=0; i<document.forms[formName].elements.length;i++)
     {
       if (document.forms[formName].elements[i].name==id)
            document.forms[formName].elements[i].checked=true;
      }
  }
}

function deselectAll(id, formName) {
  if (formName==null) {
     checkboxes = document.getElementsByName(id)
     for (i = 0; i < checkboxes.length; i++)
         checkboxes[i].checked = false ;
  } else {
     for (i=0; i<document.forms[formName].elements.length;i++)
     {
       if (document.forms[formName].elements[i].name==id)
            document.forms[formName].elements[i].checked=false;
      }
  }
}

function toggleSelect(selectbutton, id, initialState, formName) {
  // required selectbutton: you can pass any object that will function as a toggle
  // optional id: id of the the group of checkboxes that needs to be toggled (default=ids:list
  // optional initialState: initial state of the group. (default=false)
  //   e.g. folder_contents is false, search_form=true because the item boxes
  //   are checked initially.
  // optional formName: name of the form in which the boxes reside, use this if there are more
  //   forms on the page with boxes with the same name
  id=id || 'ids[]'  // defaults to ids:list, this is the most common usage

  if (selectbutton.isSelected==null)
  {
      initialState=initialState || false;
      selectbutton.isSelected=initialState;
  }

  // create and use a property on the button itself so you don't have to
  // use a global variable and we can have as much groups on a page as we like.
  if (selectbutton.isSelected == false) {
    selectbutton.isSelected=true;
    return selectAll(id, formName);
  }
  else {
    selectbutton.isSelected=false;
    return deselectAll(id, formName);
  }
}



function changeStyle(id, newClass) {
    identity=document.getElementById(id);
    identity.className=newClass;
}

function PopupPic(sPicURL) {
    window.open( "/templates/popup.html?static=1&"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}