var shownow, mouseonsubmenu;
shownow = "0";
mouseonsubmenu = "";
var max = 244; // negative of margin-left for image to animate

function ViewAbstract(idnum) {
   HideAbstract();
   document.getElementById(idnum).style.display='block';
   shownow=idnum;
}
function HideAbstract() {
   if (shownow!="0")
	  document.getElementById(shownow).style.display='none';
}
function OpenDropDown(item_name) {
   var i, children, submenu;
   children = document.getElementById(item_name).childNodes;
   for (i=0;i<children.length;i++)
   {
	  if (children[i].nodeName == "UL")
	  {
		 submenu = children[i];
	  }
   }
   if (submenu) {
	  submenu.style.display='block';
   }
}
function CloseDropDown(item_name) {
   setTimeout("HideSubMenu('" + item_name +"')",300);
}

function HideSubMenu(item_name) {
   var i, children, submenu;
   if (item_name == mouseonsubmenu) {
	  CloseDropDown (item_name);
	  return;
   }
   children = document.getElementById(item_name).childNodes;
   for (i=0;i<children.length;i++)
   {
	  if (children[i].nodeName == "UL")
	  {
		 submenu = children[i]; 
	  }
   }
   if (submenu) {
	  submenu.style.display='none';
   }
}

function DontCloseDropDown(item_name) {
   mouseonsubmenu = item_name; 
}

function CanCloseDropDown(item_name) {
   mouseonsubmenu = ""; 
}

function ShowFace(face_id, card_id) {
   document.getElementById(face_id).style.display='block';	
   document.getElementById(card_id).style.backgroundColor='#c34e37';	
}

function HideFace(face_id, card_id) {
   document.getElementById(face_id).style.display='none';	
   document.getElementById(card_id).style.backgroundColor='#e7c3ad';	
}


function shiftimage() // runs through frames 1 to 5
{
   pixels_to_shift = 8;
   speed = 20;
   i = 1;
   delay = 1500;

   imageToMove = document.getElementById ('inner-image');
   if (!imageToMove)
	  return;

   imageToMove.style.marginLeft = (-1*parseInt(max))+'px';

   marginLeft = -1*parseInt(max);

   while (marginLeft <= 0) {
	  if (pixels_to_shift*0.9 > 0.75) {
		 pixels_to_shift = pixels_to_shift*0.96;
	  } else {
		 pixels_to_shift = 0.75;
	  }
	  marginLeft += pixels_to_shift;
	  time = setTimeout ('shift('+pixels_to_shift+')', speed*i+delay);
	  i++;
   }
   setTimeout ('shift_end()', speed*i+delay);
   
}

function shift(amount)
{
   if (parseInt (imageToMove.style.marginLeft) < 0)
	  imageToMove.style.marginLeft = parseInt (imageToMove.style.marginLeft) + amount + 'px';
}

function shift_end()
{
   imageToMove.style.marginLeft = '0px';
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=360,height=180,left = 572,top = 397');");
}

