var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

window.onload = function() {
  if (!document.getElementsByTagName) return false;
  var lnks = document.getElementsByTagName("a");
  for (var i=0; i<lnks.length; i++) {
    if (lnks[i].getAttribute("class") == "popup") {
      lnks[i].onclick = function() {
        popUp(this.getAttribute("href"));
        return false;
      }
    }
    if (lnks[i].getAttribute("class") == "popVid") {
      lnks[i].onclick = function() {
        popVid(this.getAttribute("href"));
        return false;
      }
    }
    if (lnks[i].getAttribute("class") == "map") {
      lnks[i].onclick = function() {
        popmap(this.getAttribute("href"));
        return false;
      }
    } 
  }
}

function popUp(winURL) {
  window.open(winURL,"popup","width=600,height=400,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes");
}
function popVid(winURL) {
  window.open(winURL,"popVid","width=340,height=300,resizable=no");
}
function popmap(winURL) {
  window.open(winURL,"popVid","width=370,height=390,resizable=no");
}
Effect.OpenUp = function(element) {
     element = $(element);
     new Effect.BlindDown(element, arguments[1] || {});
}

Effect.CloseDown = function(element) {
     element = $(element);
     new Effect.BlindUp(element, arguments[1] || {});
}

Effect.Combo = function(element) {
	element = $(element);
	if(element.style.display == 'none') { 
    	new Effect.OpenUp(element, arguments[1] || {}); 
	} else {
		new Effect.CloseDown(element, arguments[1] || {}); 
	}
}

/*
Effect.Combo = function(element) {
	element = $(element);
	if(element.getAttribute("style")) {
	  var text = element.getAttribute("style");
	} else {
	  var text = "";
	}
	if(text == 'blind') { 
    	new Effect.OpenUp(element, arguments[1] || {}); 
	} else {
		new Effect.CloseDown(element, arguments[1] || {}); 
	}
}
*/