// JavaScript Document

var lastsel = new Array(5);
lastsel[0] = -1;
lastsel[1] = -1;
lastsel[2] = -1;
lastsel[3] = -1;
lastsel[4] = -1;

function entity(n, d) {
  var p,i,x;  if(!d) d=document; if((p= n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length ;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function optsel(entity, root, n) 
{
    if (lastsel[n] != -1) { lastsel[n].className = root; }
    entity.className = root + 'sel';
    lastsel[n] = entity;
}

function optover(entity, root) 
{
    if (entity.className != root + 'sel') { entity.className = root + 'on'; }
}

function optout(entity, root) 
{
    if (entity.className != root + 'sel') { entity.className = root; }
}

function getDirections()
{
	var urlstr;
	urlstr = "http://maps.google.com/maps?";
	urlstr += "daddr=" + entity('ADDR_1').value;
	urlstr += "+" + entity('CITY_1').value;
	urlstr += "+" + entity('STATE_1').value;
	urlstr += "+" + entity('ZIP_1').value;
	
	urlstr += "&saddr=" + entity('ADDR_0').value;
	urlstr += "+" + entity('CITY_0').value;
	urlstr += "+" + entity('STATE_0').value;
	urlstr += "+" + entity('ZIP_0').value;
	
	urlstr += "&f=li&hl=en";
	if (urlstr) newwindow=window.open(urlstr,'Directions','height=800,width=1200,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
	if (!window.focus) {newwindow.focus(); }
}

function openPopUp(mode)
{
	var options = 'directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,titlebar=no,toolbar=no,dependent=no,height=500,width=560';
	window.open('music.php?act=' + mode + ' ', 'Popup', options)
}

function closeWindow()
{
	window.close();
}

function openNYEPopup()
{
	var options = 'directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,titlebar=no,toolbar=no,dependent=no,height=662,width=510';
	window.open('nyepopup.html', 'Popup', options)
}


/**
* Function to set an element with the given id a style of hidden
*/
function hideElement(id) {
  var fieldset = document.getElementById(id);
  if (fieldset) {
    fieldset.style.display = "none";
  }
}

/**
* Function to set an element with the given id a style of shown
*/
function showElement(id) {
  alert(id);
  var fieldset = document.getElementById(id);
  alert(fieldset);
  if (fieldset) {
    fieldset.style.display = "block";
  }
}