// JavaScript Document

//show hide layers
var cur_lyr = new Array();	// holds id of currently visible layer
function swapLayers(id) {
  var nameL = id+'_box';
  if (cur_lyr[nameL]){ 
  	hideLayer(nameL);
	cur_lyr[nameL] = false;
	document.getElementById(id).innerHTML='[+] Show Full Article';
  }else{
	  showLayer(nameL);
	  cur_lyr[nameL] = true;
	  document.getElementById(id).innerHTML='[-] Hide Full Article';
  }
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	//alert(id);
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

//confirm delete
function doDelete(location, message)
{
    var agree=confirm(message);
    if (agree){
        parent.location=location; 
		return true;
	}	
    else{return false;}
}

function goTo(location){
	parent.location=location; 
	return true;
}

//confirm delete
function confirmDelete(id, location, message)
{
    var agree=confirm(message);
    if (agree){
        parent.location=location + id; 
		return true;
	}	
    else{return false;}
}

function simpleConfirmDelete()
{
    var agree=confirm("Are you sure you want to delete this entry?");
    if (agree){
		return true;
	}	
    return false;
}

//pop-up
function popup(mylink, windowname)
{
	var href;
	
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	
	popWin = window.open(href, windowname, 'width=800,height=750,scrollbars=yes,resizable=yes');
	
	setTimeout("moveFocus()", 300);
	
	return false;
}

function moveFocus() {
	popWin.focus();
}

function submitform(name)
{
  document.forms[name].submit();
}
