// JavaScript Source File

// 2 functions used to tailor welcome message

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


// function to open pdf file in new window of apprpriate dimensions

function pdfWin(dname,wName,wHeight,wWidth,vOffset,hOffset) {
 var fName=dname;
 fName+=wName;
 fName+=".pdf#pagemode='none'&page='1'";
 var wPara="height=";
 wPara+=wHeight;
 wPara+=",width=";
 wPara+=wWidth;
 wPara+=",screenY=";
 wPara+=vOffset;
 wPara+=",screenX=";
 wPara+=hOffset;
 wPara+=",location='0',status='0',menubar='0',scrollbars='1',resizable='Yes'";
 var fileName=dname;
 fileName+=wName;
 fileName+=".pdf";
 var uName="unavailable.pdf";
 var fileExists=true;
 if ( fileExists ) {
 	window.open( fName,wName,wPara );
 } else {
 	window.open( uName,wName,wPara );
 }
}


// function to open image file in new window of apprpriate dimensions
// wWidth & wHeight should each be 16 pixels larger than the corresponding picture dimension

function bigPhoto( pPath, pName, wWidth, wHeight ) {
  var fName=pPath; 
  fName+=pName;
  fName+=".jpg";
  var wFeatures="width=";
  wFeatures+=wWidth;
  wFeatures+=",height=";
  wFeatures+=wHeight;
  wFeatures+=",scrollbars='yes'";
  wFeatures+=",resizable='yes'";
  wFeatures+=",toolbar='no'";
  wFeatures+=",menubar='yes'";
  window.open( fName, pName, wFeatures );
}

