/* BEGIN
This JS file contains all JS functions needed for the CICLOPS dynamic site.
Popup functions used for media are excluded. */

function rollOver(button,bool,type)
{
  document.images[type + "_" + button].src = "../images/interface/btn_" + button + "_" + bool + ".gif";
  /*
  if (index){
    describe(button,bool,type);
  }
  */
}



// Function to put crawler-proof emails in page
// We are careful not to have anything to obviously resembling an eail addresses, or
// even to use arg names and expressions that make sense to someone looking to harvest
// (including this comment!)
var att='.@oAtailmv:';  
function eema(toplevel, doma, callem)
{
    if (toplevel==0)
    {
   tarzan=callem + att.charAt(1) + "ciclops" + att.charAt(0) + att.charAt(2) + "rg";
    }
    else
    {	
   tarzan=callem + att.charAt(1) + doma + att.charAt(0) + toplevel;
 }
 document.writeln('<' + att.charAt(3) + ' HREF="'+ att.charAt(8)+att.charAt(5) + att.charAt(6)+att.charAt(7)+"to" + att.charAt(10) + tarzan + '">' + tarzan + "</A>");
}


// Opens the web credits window
function PopupWebCredits()
{
  window.open(baseurl + "/webcredits.php","CICLOPS_Website_Credits","width=825,height=660,scrollbars=on");
}

// Opens the image credits window
function PopupImgCredits(group)
{
  window.open(baseurl + '/images_credit.php?group_id='+group,'img_credit','width=880,height=580,scrollbars=yes,toolbar=no');
}

// Pop up media files
function pop_up(id,w,h,rel)
{
  width  = parseInt(w) + 40;
  height = parseInt(h) + 40;
  window.open(baseurl + "/view_media.php?id=" + id,id,'menubar=no,statusbar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);
}

// Pop up image files
function pop_up_img(path,w,h,title)
{
  width  = parseInt(w) + 40;
  height = parseInt(h) + 40;
  window.open(baseurl + "/view_media.php?path=" + path + "&width=" + w + "&height=" + h + "&title=" + title,title,'menubar=no,statusbar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);
}

function pop_up_template(id,h)
{
    height = parseInt(h)+40;
    window.open(baseurl + '/view_popup.php?id='+id, 'template_'+id, 'menubar=no,statusbar=no,width='+height+',height=500,scrollbars=yes,resizable=yes');
}

function pop_up_jar(jar, code, params, w, h, title)
{
  width  = parseInt(w) + 40;
  height = parseInt(h) + 60;
  window.open(baseurl + "/view_media.php?jar=" + jar + "&code=" + code + "&params=" + params + "&width=" + w + "&height=" + h + "&title=" + title,title,'menubar=no,statusbar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);
}

// Pop Up a Group/Static Caption
function gc(relative,key,val)
{
  window.open(relative+'group_caption.php?'+key+'='+val,'gc_'+val,'width=700,height=750,scrollbars=yes');
}


/* Helper Functions (probably not used)*/
function so_clearInnerHTML(obj) {
	// so long as obj has children, remove them
	while(obj.firstChild) obj.removeChild(obj.firstChild);
}

function escapeHTML(someText) {
  var div = document.createElement('div');
  var text = document.createTextNode(someText);
  div.appendChild(text);
  return div.innerHTML;
}


// Pop up image files w/out view_media
function pop_up_img2(path,w,h,title)
{
  width  = parseInt(w) + 40;
  height = parseInt(h) + 40;
  window.open(baseurl + "/" + path,title,'menubar=no,statusbar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);
}

