var isNS4 = false;
var isIE4 = false;
var isIE5 = false;
var isNS6 = false;
var isNS7 = false;
var isFF  = false;
var isIE = false;
var isNS = false;
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;
isIE = (isIE4 || isIE5);
isNS = (isNS4 || isNS6);
if (isNS) {
  var agt=navigator.userAgent.toLowerCase();
  isNS7 = (agt.indexOf('netscape/7')!=-1);
  isFF  = (agt.indexOf('firefox')!=-1);
}


function op()
{
 var mW=window.open('mailit.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=600,width=437,screenX=50,screenY=0,top=0,left=20');
 mW.focus();
}

function onc(subDir)
{
 var sD = 'php/';
 if (subDir)
 {
  sD = subDir + "/";
 }
 var fileN = sD + "newClientReg.php";
 var mW=window.open(fileN, 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=514,width=467,screenX=50,screenY=0,top=0,left=20');
 mW.focus();
}

function ona(subDir)
{
 var sD = 'php/';
 if (subDir)
 {
  sD = subDir + "/";
 }
 var fileN = sD + "newPetReg.php";
 var mW=window.open(fileN, 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=514,width=437,screenX=50,screenY=0,top=0,left=20');
 mW.focus();
}

function oq()
{
 var mW=window.open('php/petRegQuestion.php', 'newPop', 'toolbar=0,personaltoolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=514,width=467,screenX=50,screenY=0,top=0,left=20');
 mW.focus();
}

function of()
{
 var mW=window.open('php/newFarmReg.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=514,width=467,screenX=0,screenY=30,top=0,left=30');
// mW.resizeTo(437, 492);
 mW.focus();
}

function oe()
{
 var mW=window.open('php/newEquineReg.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=514,width=467,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function oc()
{
 var mW=window.open('contact.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=480,width=600,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function ofood()
{
 var mW=window.open('food.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=600,width=600,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function otimes()
{
 var mW=window.open('openingTimes.php', 'timesPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=468,width=740,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function onewsletters()
{
 var mW=window.open('newsletters.html', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=600,width=605,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function onewsletter(newsletter)
{
 var mW=window.open(newsletter, 'newNewsletter', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=800,width=800,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function od(id)
{
 var url = 'directions.php';
 var winName = 'dirPop';
 if (id) {
   url += '?id=' + id;
   winName += id;
 }
 var mW=window.open(url, winName, 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=461,width=447,screenX=10,screenY=0,top=0,left=10');
 mW.focus();
}

var noticeCategory = 0;
function on(cat)
{
 if (cat < 0) cat = 0;
 if (cat > 1000) cat = 0;
 noticeCategory = cat;
 var mW=window.open('php/newNoticeReq.php', 'newPop', 'toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=no,scrollbars=1,resizable=1,height=520,width=448,screenX=0,screenY=30,top=0,left=30');
 mW.focus();
}

function transDate(dateStr)
{
 var d = new Date(dateStr);
 document.write(d.getMonth() + " " + d.getYear());
}

var pixMap = new Array(18);
pixMap[0] = new Image();
pixMap[1] = new Image();
pixMap[2] = new Image();
pixMap[3] = new Image();
pixMap[4] = new Image();
pixMap[5] = new Image();
pixMap[6] = new Image();
pixMap[7] = new Image();
pixMap[8] = new Image();
pixMap[9] = new Image();
pixMap[10] = new Image();
pixMap[11] = new Image();
pixMap[12] = new Image();
pixMap[13] = new Image();
pixMap[14] = new Image();
pixMap[15] = new Image();
pixMap[16] = new Image();
pixMap[17] = new Image();

pixMap[0].src = "images/largeButtBlue.gif";
pixMap[1].src = "images/print-pop-up-icon.gif";
pixMap[2].src = "images/largeButtBlueBlue.gif";
pixMap[3].src = "images/send-pop-up-icon.gif";
pixMap[4].src = "images/largeButtWhite.gif";
pixMap[5].src = "images/map-pop-up-icon.gif";
pixMap[6].src = "images/smallButtBlue.gif";
pixMap[7].src = "images/close-pop-up-icon.gif";

pixMap[8].src = "images/largeButtRed.gif";
pixMap[9].src = "images/send-pop-up-icon-red.gif";
pixMap[10].src = "images/smallButtRed.gif";
pixMap[11].src = "images/close-pop-up-icon-red.gif";

pixMap[12].src = "images/largeButtBlue.gif";
pixMap[13].src = "images/arrowOverBlue.gif";
pixMap[14].src = "images/arrowOverLightBlue.gif";

pixMap[15].src = "images/goOver.gif";
pixMap[16].src = "images/noOver.gif";
pixMap[17].src = "images/yesOver.gif";

function setUpImages(baseDir)
{
 pixMap[0].src = baseDir + "images/largeButtBlue.gif";
 pixMap[1].src = baseDir + "images/print-pop-up-icon.gif";
 pixMap[2].src = baseDir + "images/largeButtBlueBlue.gif";
 pixMap[3].src = baseDir + "images/send-pop-up-icon.gif";
 pixMap[4].src = baseDir + "images/largeButtWhite.gif";
 pixMap[5].src = baseDir + "images/map-pop-up-icon.gif";
 pixMap[6].src = baseDir + "images/smallButtBlue.gif";
 pixMap[7].src = baseDir + "images/close-pop-up-icon.gif";

 pixMap[8].src = baseDir + "images/largeButtRed.gif";
 pixMap[9].src = baseDir + "images/send-pop-up-icon-red.gif";
 pixMap[10].src = baseDir + "images/smallButtRed.gif";
 pixMap[11].src = baseDir + "images/close-pop-up-icon-red.gif";

 pixMap[12].src = baseDir + "images/largeButtBlue.gif";
 pixMap[13].src = baseDir + "images/arrowOverBlue.gif";
 pixMap[14].src = baseDir + "images/arrowOverLightBlue.gif";

 pixMap[15].src = baseDir + "images/goOver.gif";
 pixMap[16].src = baseDir + "images/noOver.gif";
 pixMap[17].src = baseDir + "images/yesOver.gif";
}

function globalIconChange(iconName, iconNum)
{
 if (document.getElementById)
 {
  iconName.src = pixMap[iconNum].src;
 }
}

function hmliam(r, echo, cl, sub, dom)
{
  var a = '\074\141';
  if (cl) {
    a += '\040\143\154\141\163\163\075\047' + cl + '\047';
  }
  a += '\040\150\162\145\146\075\047\155\141\151\154\164\157\072' + r + '\100';
  if (dom) {
    a += dom;
  }
  else {
  // \166\151\163\151\157\156\154\151\156\145\056\143\157\056\165\153
    dom = '\166\145\164\163\171\163\164\145\155\163\056\143\157\155';
    a += dom;
  }  
  if (sub) {
    a +='\077\163\165\142\152\145\143\164\075' + escape(sub);
  }
  a += '\047\076';
  if (echo == 'true') {
    a += r + '\100' + dom + '\074\057\141\076';
  }
  return(a);
}


function isEmailValid(email)
{
  var i = email.indexOf('@');
  var j = email.lastIndexOf('.');
  result = (  i     <  1 
           || i + 1 == email.length
           || j     <= i + 1
           || j + 1 == email.length
           )  ? false : true;
  return result;
}

function showLocationsMenu() {
  //alert('showLocationsMenu: lml ...');
  showLayer('locationsMenuLayer');
}

function hideLocationsMenu() {
  //alert('hideLocationsMenu: lml ...');
  hideLayer('locationsMenuLayer');
}


function showLayer(layerName){
  setLayerVisibility(layerName, 'visible');
}


function hideLayer(layerName){
  setLayerVisibility(layerName, 'hidden');
}


function setLayerVisibility(layerName, visibility){
  if (isNS4) {
    //alert("setlayerVisibility: "+layerName+" "+visibility);
    document.layers[layerName].visibility = visibility;
  } 
  else if (isIE4) {
    document.all[layerName].style.visibility = visibility;
  }
  else if (document.getElementById) { //IE5, NS6 & W3C compliants 
    document.getElementById(layerName).style.visibility = visibility;
  }
}
