function externalLinks()
{
  if(!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for(var i = links.length - 1; i > -1; i--)
  {
    if(links[i].getAttribute("href") && links[i].getAttribute("rel") == "external")
      links[i].target ="_blank";
  }
}

function popupLinks()
{
  if(!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  for(var i = links.length - 1; i > -1; i--)
  {
    if(links[i].getAttribute("href") && links[i].getAttribute("rel") == "popup")
    {
      links[i].onclick = function(){
        newwindow = window.open(this.getAttribute("href"), 'PR','width=648,height=600,toolbar=no,location=no,directories=no,status=no,copyhistory=no,menubar=no,resizable=no,scrollbars=yes');
        if (window.focus) { newwindow.focus() }
        return false;
      }
      links[i].onkeypress = links[i].onclick;
    }
  }
}
function copyright(event){
	element = Event.element(event);
	con = "\251 20xx " + element.readAttribute('title') + ".\nPersonal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from " + element.readAttribute('title') + ' or Noted Company/Conference'
	if(!confirm(con)){
		Event.stop(event);
	}
}
sfHover = function() {
	if(!document.getElementById("nav")) return false;
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=" sfhover";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}
function menufication( target ){
  var links = $("nav").getElementsByTagName("a");
  var i;
	reg = /\w+.html|\w+.php/;
	target = reg.exec(target.toString());
  for (i = 0; i<links.length ; i++) {
    if(links[i].getAttribute("href") == target){
      break;
    }
  }
  if(i < links.length)
  {
    links[i].style.color ="#ffffff";
    links[i].style.backgroundColor ="";
    links[i].parentNode.style.backgroundColor = "";
    links[i].parentNode.style.borderRight = "";  
  }
      //document.getElementById('shop'+i).style.display='none';
}
window.onload = function() {
  externalLinks();
  popupLinks();
	menufication(window.location);
	$$('.copywritten').each(function(e){
		e.observe('click',copyright)
	})
  //if (window.attachEvent) { window.attachEvent("onload", sfHover); }
}