//*****************************************************************************************
//* 	Declare vairables
//*****************************************************************************************
			
var head="display:''"
var newWinObject;
var strBannerId  ="";              

//*****************************************************************************************
function showmeCommon() {
    alert("Showing it: showmeCommon");
}

//*****************************************************************************************
//* Function: 			MainLine
//* Passed Values:		None
//*	Returned Value:		None
//*	Purpose:			The top of all JavaScrips
//*****************************************************************************************
function getMainLine() {
}
//*****************************************************************************************
function getSelector(strFunctionName) {
    var result;
    var newPicWidow;
    newPicWindow = strFunctionName;
    if (newPicWindow > "") {
       OpenWindow(newPicWindow,'CIWOASelector','titlebar,scrollbars,resizable,menubar,directories=yes;innerWidth=750,innerHeight=570,width=750,height=570,top=40,left=40;');
    }
    return;
}
//*****************************************************************************************
function getClose() {
  window.close();
}
//*****************************************************************************************
//*   Function:				getLargerView
//*   Passed Values:		path and file name
//*	  Returned Value:		none
//*	  Purpose:				new window to show picture
//*****************************************************************************************
function getPicture(strPathPicture)
{
    var result;
    var newPicWidow;
//*	window.showModalDialog("getPicture.asp?PATHPIC="+strPathPicture,"MAWA Pictures","dialogHeight:550px;dialogWidth:600px;center:Yes;status:yes;help:yes;center=yes;scroll=yes;menubar=yes;toolbar=yes;");
//*	window.open("getPicture.asp?PATHPIC="+strPathPicture,"","dialogHeight:550px;dialogWidth:700px;center:Yes;status:yes;help:yes;center=yes;scroll=yes;");
//*	window.open("getPicture.asp?PATHPIC="+strPathPicture,"","");
//* window.open("getPicture.asp?PATHPIC=PhotoLibrary/2002NewEnglands/FullSize/~lwf0000.JPG", "messageWindow", "toolbar,directories=yes");
//*    window.open("getPicture.asp?PATHPIC="+strPathPicture, "messageWindow", "titlebar,scrollbars,resizable,menubar,directories=yes;toolbar=no;innerHeight=450;innerWidth=300;");
    newPicWindow = "getPicture.asp?PATHPIC="+strPathPicture;
    OpenWindow(newPicWindow,'Pictures','titlebar,scrollbars,resizable,menubar,directories=yes;innerWidth=750,innerHeight=550,width=750,height=550');	
    return;
}
//*****************************************************************************************
//*   Function:				getLargerView
//*   Passed Values:		path and file name
//*	  Returned Value:		none
//*	  Purpose:				new window to show picture
//*****************************************************************************************
function getPictureAndText(strPathPicture,strGalleryPictureText)
{
    var result;
    var newPicWidow;
    newPicWindow = "getPictureAndText.asp?PATHPIC="+strPathPicture+"&strGalleryPictureText="+strGalleryPictureText;
    OpenWindow(newPicWindow,'Pictures','titlebar,scrollbars,resizable,menubar,directories=yes;innerWidth=750,innerHeight=570,width=750,height=570,top=40,left=40;');	
    return;
}
//*****************************************************************************************
//*   Function:				getLargerView
//*   Passed Values:		path and file name
//*	  Returned Value:		none
//*	  Purpose:				new window to show picture
//*****************************************************************************************
function getComments(strComments)
{
    var result;
    var newPicWidow;
    newPicWindow = "getComments.asp?strComments="+strComments;
    OpenWindow(newPicWindow,'Comments','scrollbars=yes,toolbar=no,titlebar=no,resizable=no,menubar=no,directories=no,innerWidth=400,innerHeight=300,width=400,height=300,top=200,left=150;');	
    return;
}
//*****************************************************************************************
//*   Function:				getNewWindow
//*   Passed Values:		wiindow name
//*	  Returned Value:		none
//*	  Purpose:				new window
//*****************************************************************************************
function getModalWindow(strWindowName)
{
    var resultWin;
    returnWin =  window.showModalDialog(strWindowName,"","dialogHeight:300px;dialogWidth:400px;center:Yes;status:No;help:No;");
    return returnWin;
}
//*****************************************************************************************
//*   Function:				getNewWindow
//*   Passed Values:		wiindow name
//*	  Returned Value:		none
//*	  Purpose:				new window
//*****************************************************************************************
function getNewWindow(strWindowName)
{
    var result;
	window.showModalDialog(strWindowName,"","dialogHeight:300px;dialogWidth:400px;center:Yes;status:No;help:No;");
    return;
}
//*****************************************************************************************
//*   Function:				getNewWindow
//*   Passed Values:		wiindow name
//*	  Returned Value:		none
//*	  Purpose:				new window
//*****************************************************************************************
function OpenWindow (URL, WinName, Features) {  
     window.open(URL, WinName, Features);
}

//*****************************************************************************************
//* Function:			PutCookieVisits
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			Given cookie, return visit attributes
//*****************************************************************************************
function putCookiePollSetup(name)
  {
   var expdate = new Date();
   var visits;

   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   visits = 0;

   SetCookie(name, visits, expdate, "/", null, false);
   return visits;
  }
//*****************************************************************************************
//* Function:			GetCookieVisits
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			Given cookie, return visit attributes
//*****************************************************************************************
function getCookiePollSetup(name)
  {
   var expdate = new Date();
   var visits = -1;

   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   visits = GetCookie(name)
   return visits;
  }
//*****************************************************************************************
//* Function:			PutCookieVisits
//* Passed Values:		none
//* Returned Value:		none
//* Purpose:			Given cookie, return visit attributes
//*****************************************************************************************
function putCookiePollComplete(name)
  {
   var expdate = new Date();
   var visits;

   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));


   if(!(visits = GetCookie(name)))
        visits = 0;
   visits++;

   SetCookie(name, visits, expdate, "/", null, false);
   return visits;
  }
//*****************************************************************************************
//* 	Function:					PutCookieVisits
//*   Passed Values:		none
//*		Returned Value:		none
//*		Purpose:					Given cookie, return visit attributes
//*****************************************************************************************
function PutCookieVisits(name)
  {
   var expdate = new Date();
   var visits;
   
   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   if(!(visits = GetCookie(name)))
        visits = 0;
   visits++;

   SetCookie(name, visits, expdate, "/", null, false);

   document.write("<td class='white8' align='center'>Your Visits:<td class='gold8' align='center'>" + visits + " ");
  }
//*****************************************************************************************
//* 	Function:					PutCookieMenuOption
//*   Passed Values:		DirPath, MenuItem
//*		Returned Value:		none
//*		Purpose:					Given cookie, return visit attributes
//*****************************************************************************************
function PutCookieMenuOption(DirPath, MenuItem)
  {
   var DirPathName;
   var MenuOption;
   var expdate = new Date();
   expdate.setTime(expdate.getTime() +  (48 * 60 * 60 * 1000 * 365));

   if(!(MenuOption = GetCookie("MenuOption")))
	{   MenuItemAgain = "whatMenuItem";}

   SetCookie("MenuOption", MenuItem, expdate, "/", null, false);
   
   if(!(DirPathName = GetCookie("DirPathName")))
	{   DirPathAgain = "whatPathDir";}

   SetCookie("DirPathName", DirPath, expdate, "/", null, false);

  }
//*****************************************************************************************
//* Function:					GetCookie
//* Passed Values:		userName
//* Returned Value:		none
//* Purpose:					Gets cooie and its attributes
//*****************************************************************************************
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 null;
  }
//*****************************************************************************************
//* 	Function:					SetCookie
//*   Passed Values:		userName, escape value
//*		Returned Value:		none
//*		Purpose:					Sets cookie attributes
//*****************************************************************************************
function SetCookie (name, value)
  {
   var argv    = SetCookie.arguments;
   var argc    = SetCookie.arguments.length;

   var expires = (2 < argc) ? argv[2] : null;
   var path    = (3 < argc) ? argv[3] : null;
   var domain  = (4 < argc) ? argv[4] : null;
   var secure  = (5 < argc) ? argv[5] : false;

   document.cookie = name + "=" + escape (value) +
     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
     ((path    == null) ? "" : ("; path=" + path)) +
     ((domain  == null) ? "" : ("; domain=" + domain)) +
     ((secure  == true) ? "; secure" : "");
  }
//*****************************************************************************************
//* 	Function:					GetCookieVal
//*   Passed Values:		Starting ocation of cookie attribute
//*		Returned Value:		attribute value
//*		Purpose:					Sets an returns attribute value
//*****************************************************************************************
function GetCookieVal (offset)
  {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
       endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
  }
//*****************************************************************************************
//* 	Function:					GetTime
//*   Passed Values:		none
//*		Returned Value:		none
//*		Purpose:					Show Nailed Bug 
//*****************************************************************************************
function GetCurrTime()
  {
   today = new Date();
  
   if(today.getMinutes() < 10)
     {pad = "0"}
   else
      pad = ""; 

   document.write("<table align='center'><tr><td class='white8' align='center'>"+today+"</table>");
  }






//*****************************************************************************************
function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

var activeButton = null;

if (browser.isIE)
  document.onmousedown = pageMousedown;
else
  document.addEventListener("mousedown", pageMousedown, true);

//*****************************************************************************************
function pageMousedown(event) {

  var el;

  if (activeButton == null)
    return;

  if (browser.isIE)
    el = window.event.srcElement;
  else
    el = (event.target.tagName ? event.target : event.target.parentNode);

  if (el == activeButton)
    return;

  if (getContainerWith(el, "DIV", "menu") == null) {
    resetButton(activeButton);
    activeButton = null;
  }
}

//*****************************************************************************************
function buttonClick(event, menuId) {

  var button;

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  button.blur();

  if (button.menu == null) {
    button.menu = document.getElementById(menuId);
    if (button.menu.isInitialized == null)
      menuInit(button.menu);
  }

  if (button.onmouseout == null)
    button.onmouseout = buttonOrMenuMouseout;

  if (button == activeButton)
    return false;

  if (activeButton != null)
    resetButton(activeButton);

  if (button != activeButton) {
    depressButton(button);
    activeButton = button;
  }
  else
    activeButton = null;

  return false;
}

//*****************************************************************************************
function buttonMouseover(event, menuId) {

  var button;

  if (activeButton == null) {
    buttonClick(event, menuId);
    return;
  }

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  if (activeButton != null && activeButton != button)
    buttonClick(event, menuId);
}

//*****************************************************************************************
function depressButton(button) {

  var x, y;

  button.className += " menuButtonActive";

  if (button.onmouseout == null)
    button.onmouseout = buttonOrMenuMouseout;
  if (button.menu.onmouseout == null)
    button.menu.onmouseout = buttonOrMenuMouseout;

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  // For IE, adjust position.

  if (browser.isIE) {
    x += button.offsetParent.clientLeft;
    y += button.offsetParent.clientTop;
  }

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";
}

//*****************************************************************************************
function resetButton(button) {

  removeClassName(button, "menuButtonActive");

  if (button.menu != null) {
    closeSubMenu(button.menu);
    button.menu.style.visibility = "hidden";
  }
}

//*****************************************************************************************
function menuMouseover(event) {

  var menu;

  if (browser.isIE)
    menu = getContainerWith(window.event.srcElement, "DIV", "menu");
  else
    menu = event.currentTarget;

  if (menu.activeItem != null)
    closeSubMenu(menu);
}

//*****************************************************************************************
function menuItemMouseover(event, menuId) {

  var item, menu, x, y;

  if (browser.isIE)
    item = getContainerWith(window.event.srcElement, "A", "menuItem");
  else
    item = event.currentTarget;
  menu = getContainerWith(item, "DIV", "menu");

  if (menu.activeItem != null)
    closeSubMenu(menu);
  menu.activeItem = item;

  item.className += " menuItemHighlight";

  if (item.subMenu == null) {
    item.subMenu = document.getElementById(menuId);
    if (item.subMenu.isInitialized == null)
      menuInit(item.subMenu);
  }

  if (item.subMenu.onmouseout == null)
    item.subMenu.onmouseout = buttonOrMenuMouseout;

  x = getPageOffsetLeft(item) + item.offsetWidth;
  y = getPageOffsetTop(item);

  var maxX, maxY;

  if (browser.isNS) {
    maxX = window.scrollX + window.innerWidth;
    maxY = window.scrollY + window.innerHeight;
  }
  if (browser.isIE) {
    maxX = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) +
      (document.documentElement.clientWidth != 0 ? document.documentElement.clientWidth : document.body.clientWidth);
    maxY = Math.max(document.documentElement.scrollTop, document.body.scrollTop) +
      (document.documentElement.clientHeight != 0 ? document.documentElement.clientHeight : document.body.clientHeight);
  }
  maxX -= item.subMenu.offsetWidth;
  maxY -= item.subMenu.offsetHeight;
  if (x > maxX)
    x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
      + (menu.offsetWidth - item.offsetWidth));
  y = Math.max(0, Math.min(y, maxY));

  item.subMenu.style.left = x + "px";
  item.subMenu.style.top  = y + "px";
  item.subMenu.style.visibility = "visible";

  if (browser.isIE)
    window.event.cancelBubble = true;
  else
    event.stopPropagation();
}

//*****************************************************************************************
function closeSubMenu(menu) {

  if (menu == null || menu.activeItem == null)
    return;

  if (menu.activeItem.subMenu != null) {
    closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility = "hidden";
    menu.activeItem.subMenu = null;
  }
  removeClassName(menu.activeItem, "menuItemHighlight");
  menu.activeItem = null;
}

//*****************************************************************************************
function buttonOrMenuMouseout(event) {

  var el;

  if (activeButton == null)
    return;

  if (browser.isIE)
    el = window.event.toElement;
  else if (event.relatedTarget != null)
      el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);

  if (getContainerWith(el, "DIV", "menu") == null) {
    resetButton(activeButton);
    activeButton = null;
  }
}

//*****************************************************************************************
function menuInit(menu) {

  var itemList, spanList;
  var textEl, arrowEl;
  var itemWidth;
  var w, dw;
  var i, j;

  if (browser.isIE) {
    menu.style.lineHeight = "2.5ex";
    spanList = menu.getElementsByTagName("SPAN");
    for (i = 0; i < spanList.length; i++)
      if (hasClassName(spanList[i], "menuItemArrow")) {
        spanList[i].style.fontFamily = "Webdings";
        spanList[i].firstChild.nodeValue = "4";
      }
  }

  itemList = menu.getElementsByTagName("A");
  if (itemList.length > 0)
    itemWidth = itemList[0].offsetWidth;
  else
    return;

  for (i = 0; i < itemList.length; i++) {
    spanList = itemList[i].getElementsByTagName("SPAN");
    textEl  = null;
    arrowEl = null;
    for (j = 0; j < spanList.length; j++) {
      if (hasClassName(spanList[j], "menuItemText"))
        textEl = spanList[j];
      if (hasClassName(spanList[j], "menuItemArrow"))
        arrowEl = spanList[j];
    }
    if (textEl != null && arrowEl != null)
      textEl.style.paddingRight = (itemWidth
        - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
  }

  if (browser.isIE) {
    w = itemList[0].offsetWidth;
    itemList[0].style.width = w + "px";
    dw = itemList[0].offsetWidth - w;
    w -= dw;
    itemList[0].style.width = w + "px";
  }

  menu.isInitialized = true;
}

//*****************************************************************************************
function getContainerWith(node, tagName, className) {

  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.

  while (node != null) {
    if (node.tagName != null && node.tagName == tagName &&
        hasClassName(node, className))
      return node;
    node = node.parentNode;
  }

  return node;
}

//*****************************************************************************************
function hasClassName(el, name) {

  var i, list;

  // Return true if the given element currently has the given class
  // name.

  list = el.className.split(" ");
  for (i = 0; i < list.length; i++)
    if (list[i] == name)
      return true;

  return false;
}

//*****************************************************************************************
function removeClassName(el, name) {

  var i, curList, newList;

  if (el.className == null)
    return;

  // Remove the given class name from the elements className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
      newList.push(curList[i]);
  el.className = newList.join(" ");
}

//*****************************************************************************************
function getPageOffsetLeft(el) {

  var x;

  // Return the x coordinate of an element relative to the page.

  x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

//*****************************************************************************************
function getPageOffsetTop(el) {

  var y;

  // Return the x coordinate of an element relative to the page.

  y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}
