function getExpDate(days, hours, minutes)
{
 var expDate=new Date();
 if(typeof days == "number" && typeof hours == "number" &&
  typeof minutes == "number") 
 {
  expDate.setDate(expDate.getDate()+parseInt(days));
  expDate.setHours(expDate.getHours()+parseInt(hours));
  expDate.setMinutes(expDate.getMinutes()+parseInt(minutes));
  return expDate.toUTCString();
 }
}

function getCookieVal(offset)
{
 var endstr = document.cookie.indexOf(";", offset);
 if (endstr == -1)
 {
  endstr = document.cookie.length;
 }
 return decodeURI(document.cookie.substring(offset, endstr));
}

function getCookie(name)
{
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen)
 {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg)
  {
   return getCookieVal(j);
  }
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
 }
 return "";
}

function setCookie(name, value, expires, path, domain, secure)
{
 document.cookie = name + "=" + encodeURI(value) +
  ((expires) ? "; expires=" + expires : "") +
  ((path)    ? "; path="    + path    : "") +
  ((domain)  ? "; domain="  + domain  : "") +
  ((secure)  ? "; secure" : "");
}

function deleteCookie(name, path, domain)
{
 if(getCookie(name))
 {
  document.cookie = name + "=" +
   ((path)   ? "; path="   + path   : "") +
   ((domain) ? "; domain=" + domain : "") +
   "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 }
}


var Visible = [];

function Clear(limit)
{
 var id, n;
 if(!limit)limit="";
 n=Visible.length;
 while(n--)
 {
  id=Visible[n];
  if(id==limit)break;
  Visible.pop();
  document.getElementById(id).style.display="none";
 }
}

function Append(id,to)
{
 var n,unseen=true;
 n=Visible.length;
 while(unseen && n--)unseen = Visible[n]!=id;
 if(!to)to="";
 Clear(to);
 if(unseen)
 {
  document.getElementById(id).style.display="block";
  Visible.push(id);
 }
}

function pixels(number)
{
 return (number + "px");
}


function setIframeSize(iframeName) 
{
 var eleFrame = document.getElementById
 ? document.getElementById(iframeName) : document.all
 ? document.all[iframeName]: null; 
 if (eleFrame) 
 {
  eleFrame.style.height = "auto"; // helps resize (for some) if new doc shorter than previous 
  var Width=0,Height=0,frameHeight; 
  if(typeof(window.innerWidth)=='number') 
  { //Non-IE 
   Width=window.innerWidth; 
   Height=window.innerHeight; 
  } 
  else if(document.documentElement 
  && (document.documentElement.clientWidth 
  || document.documentElement.clientHeight)) 
  { //IE 6+ in 'standards compliant mode' 
   Width=document.documentElement.clientWidth; 
   Height=document.documentElement.clientHeight; 
  } 
  else if(document.body 
  && (document.body.clientWidth 
  || document.body.clientHeight)) 
  { //IE 4 compatible 
   Width=document.body.clientWidth; 
   Height=document.body.clientHeight; 
  } 
  Width-=100;
  Height-=120;
  setCookie("frameWidth", Width-20);
  eleFrame.style.width = pixels(Width);
  eleFrame.style.height = pixels(Height); 
 } 
}

function adjustIframeSize(Window, Width, Height) 
{
 var eleWindow, height=0;
 if (Window.document.height) 
 {
  height=Window.document.height;
  eleWindow=document.getElementById(Window.name);
 }
 else if (document.all) 
 {
  if(Window.document.compatMode &&
      Window.document.compatMode != 'BackCompat') 
  {
   height=Window.document.documentElement.scrollHeight;
  }
  else 
  {
   height=Window.document.body.scrollHeight;
  }
  eleWindow=document.all[Window.name];
 }
 height+=6;           /*Moved to affect both cases*/
 if(arguments.length == 3)
 {
  eleWindow.style.height = pixels(Height);
 }
 else
 {
  if(arguments.length == 2)
  {
   if(Width)eleWindow.style.width = pixels(Width);
   else eleWindow.style.width = getCookie("frameWidth")+"px";
  }
  else eleWindow.style.width = "12em";
  eleWindow.style.height = pixels(height);
 }
}


