if (top != self) 
  top.location.href = location.href;

var pics = []; // = new Array();
var MyMsg = []; // = new Array();
var HOME = 0;
var BULL = 1;
var CALF = 2;
var COWS = 3;
var METH = 4;
var SALE = 5;
var MAIL = 6;
var i;
var date1 = new Date();
var nDay  = date1.getDay();

var newWindow;
var newWindow2;
var maxDays;

function makeNewWindow(fileName) {
  if (!newWindow || newWindow.closed) {
    newWindow = window.open(fileName,"","resizable,height=630,width=550,scrollbars=yes")
    if (!newWindow.opener) {
      newWindow.opener = window
    }
  } else {
    newWindow.focus(fileName)
  }
}

function getMap() {
  if (GBrowserIsCompatible()) {
    var map = new GMap(document.getElementById("popup"));
    var point = new GPoint(-94.784, 32.052);
    var html = "<b>Pool Ranch</b><br><br>8192 CR 314 S<br>Laneville, TX 75667<br><br>Phone: (903) 863-2171<br>Email: <a href='http://www.poolranch.com/mail/'>Form</a>";
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.centerAndZoom(point, 4);
    function createMarker(point) {
      var marker = new GMarker(point);
      GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html) });
      return marker;
    }
    var marker = createMarker(point);
    map.addOverlay(marker);
    map.openInfoWindowHtml(html);
  }
}

function SetCookie(cookieName, cookieValue, nDays) {
  var today = new Date();
  var expire = new Date();
  if (nDays == null || nDays == 0) nDays = 1;
  expire.setTime(today.getTime() + 3600000 * 24 * nDays);
  document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();
}

function ReadCookie(cookieName) {
  var theCookie = "" + document.cookie;
  var ind = theCookie.indexOf(cookieName);
  if (ind == -1 || cookieName == "") return ""; 
  var ind1 = theCookie.indexOf(';', ind);
  if (ind1 == -1) ind1 = theCookie.length; 
  return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}

function preload(i, name, varOut, varDown, varOver) {
  pics[i] = []; // =  new Array(4);
  pics[i][0] = new Image();
  pics[i][0].src = varOut;
  pics[i][1] = new Image();
  pics[i][1].src = varDown;
  pics[i][2] = new Image();
  pics[i][2].src = varOver;
  pics[i][3] = name;
}

function MidPage(i) {
  document.getElementById('popup').innerHTML = "<font>" + MyMsg[i] + "</font>";
}

function imgOut(i) {
  if (document.images && pics[i][3]) {
    document.images[pics[i][3]].src = pics[i][0].src;
  }
}

function imgDown(i) {
  if (document.images && pics[i][3]) {
    document.images[pics[i][3]].src = pics[i][1].src;
  }
  MidPage(i);
}

function imgOver(i) {
  if (document.images && pics[i][3]) {
    document.images[pics[i][3]].src = pics[i][2].src;
  }
}

function GetTDClass(rlWeekDay) {
  return (rlWeekDay == nDay) ? "day" : "reg";
}

function GetMonthYear() {
  var month = date1.getMonth();
  var strOut;
  if (month == 0)      { maxDays = 31; strOut = "January";  }
  else if (month == 1) { maxDays = 28; strOut = "February"; }
  else if (month == 2) { maxDays = 31; strOut = "March";    }
  else if (month == 3) { maxDays = 30; strOut = "April";    }
  else if (month == 4) { maxDays = 31; strOut = "May";      }
  else if (month == 5) { maxDays = 30; strOut = "June";     }
  else if (month == 6) { maxDays = 31; strOut = "July";     }
  else if (month == 7) { maxDays = 31; strOut = "August";   }
  else if (month == 8) { maxDays = 30; strOut = "September";}
  else if (month == 9) { maxDays = 31; strOut = "October";  }
  else if (month == 10){ maxDays = 30; strOut = "November"; }
  else if (month == 11){ maxDays = 31; strOut = "December"; }
  strOut += "&nbsp;" + date1.getFullYear();
  return strOut.replace("\n", " ");
}

function DayFromWeekDay(rlWeekDay) {
  var dayNum = date1.getDate() - (nDay - rlWeekDay);
  if (dayNum < 0) {
    dayNum = ((maxDays == 31) ? 30 : 31) + dayNum;
  } else if (dayNum > maxDays) {
    dayNum = dayNum - maxDays;
  }
  return dayNum;
}

function time() {
  var clock_time = new Date();
  document.getElementById('time').innerHTML = clock_time.toLocaleTimeString();
  setTimeout("time()", 1000);
}

function goHome() {
  window.location = "http://www.poolranch.com/";
}

function UnusedStarts() {
  var oldMyMsg1 = '<table><tr><td class="pop" style="width:600px;"><b>The main production bull, at this time, on Pool Ranch:</b></td></tr><tr><td class="pop">3K/BOLA MAJOR PLAYER 1-A<br/>SIRE: LCC MAJOR LEAGUE A502M<br/>DAM: BCRR ROBIN 0153<br/>BWT: 77 lbs; WWT: 552 lbs<br/>EPDs: -0.4 44 67</td></tr><tr><td><img src="ForSale/major.jpg" width="600"/></td></tr></table>';
  var oldMyMsg5 = '<table border="1"><tr><td><b>Bulls for sale at Pool Ranch:</b> Follow links to pictures.</td><td colspan="2"><img src="images/FSBO.jpg" width="212" height="175"></td></tr><tr><th>Bull</th><th>Link 1</th><th>Link 2</th></tr><tr><td>dP 714</td><td><a href="ForSale/dp714a.jpg">HERE</a></td><td></td></tr><tr><td>dP 726</td><td><a href="ForSale/dp726a.jpg">HERE</a></td><td><a href="ForSale/dp726b.jpg">HERE</a></td></tr><tr><td>dP 727</td><td><a href="ForSale/dp727a.jpg">HERE</a></td><td><a href="ForSale/dp727b.jpg">HERE</a></td></tr><tr><td>dP 728</td><td><a href="ForSale/dp728a.jpg">HERE</a></td><td></td></tr><tr><td>dP 730</td><td><a href="ForSale/dp730a.jpg">HERE</a></td><td></td></tr><tr><td>dP 732</td><td><a href="ForSale/dp732a.jpg">HERE</a></td><td><a href="ForSale/dp732b.jpg">HERE</a></td></tr></table>';
}

function Start(i) { // index, string, mouseout, mousedown, mouseover
  MyMsg[0] = '<table><tr><td class="pop"><b>Welcome to the Pool Ranch website!</b><br /><br />This site is dedicated to the quality Red Angus and Angus Plus cattle that are always found at Pool Ranch in Laneville, Texas.<br><br>Whether you desire a high quality bull or a nice young heifer, Pool Ranch has your breeding solutions. If you have questions about the animals or would rather visit the ranch to view the livestock, contact David Pool.<br><br>To set up an appointment,<br>call 903-863-2171 or <a href="mail/">email</a> us.<br>Laneville, Texas</td><td><img src="photos/cow3.jpg" width="300" height="200"></td>'
  MyMsg[1] = ''
  MyMsg[2] = '<table><tr><td class="pop"><b>Calves produced at Pool Ranch</b><br /><br />Click <a href="calves.htm">here</a> to display a list of images of new calves.</td><td><img src="photos/dp024.jpg" class="p-up" /></td></tr></table>'
  MyMsg[3] = '<table><tr><td class="pop"><b>Breeding cows at Pool Ranch</b><br /><br />Here are a few pictures of Angus cattle used to produce the new crop.</td><td><img src="photos/small/P1000399.jpg" class="p-up" /></td></tr><tr><td><img src="photos/small/P1000405.jpg" class="p-up" /></td><td><img src="photos/cow1.jpg" class="p-up" /></td></tr></table>'
  MyMsg[4] = '<table><tr><td class="pop"><b>Bull Producing Techniques at Pool Ranch</b><br/><br/>All bulls receive a sperm test before they are sold to ensure our Customers receive a top quality producer.<br/><br/>To the right are the stats for bull <i>dP 714</i>. As you can tell from the photos and numbers, this was a top notch bull; however, sperm testing for this animal returned negative, and he was not sold.</td><td><img src="photos/pair.jpg" class="p-up"/><table border=1><tr><th>Line</td><th>Name</td><th>SIRE</td><th>DAM</td><th>BWT</td><th>WWT</td><th>EPDs</td></tr><tr><td>*</td><td>dP714</td><td>*</td><td>*</td><td>72</td><td>765</td><td>*</td></tr><tr><td colspan=7><img src="ForSale/dP714a.jpg"></td></tr></table></td></tr></table>'
  MyMsg[5] = ''
  MyMsg[6] = '<table><tr><td class="pop"><b>Contact us at Pool Ranch</b><br /><br />We\'d love to hear from you!<br /><br /><table><tr><td colspan="2"><b>David Pool</b></td></tr><tr><td><b>Phone</b></td><td>(903) 863-2171</td></tr><tr><td><b>Drop By</b></td><td>View <a href="#" onmousedown="getMap()">map</a></td></tr><tr><td><b>Send an Email</b></td><td>Open <a href="mail/index.asp">Form</a></td></tr></table></td><td width="300"><img src="images/anicow1.gif" align="absbottom" style="width: 299px; height: 99px" /></td></tr><tr><td colspan="2"></td></tr></table>'
  preload(BULL, "bull", "images/bull.gif", "images/bulldn.gif", "images/bullov.gif" );
  preload(CALF, "calf", "images/calf.gif", "images/calfdn.gif", "images/calfov.gif" );
  preload(COWS, "cow",  "images/cow.gif",  "images/cowdn.gif",  "images/cowov.gif"  );
  preload(METH, "meth", "images/meth.gif", "images/methdn.gif", "images/methov.gif" );
  preload(SALE, "sale", "images/sale.gif", "images/saledn.gif", "images/saleov.gif" );
  preload(MAIL, "mail", "images/mail.gif", "images/maildn.gif", "images/mailov.gif" );
  if (i != 0) {
    setTimeout('goHome()', i * 1000);
  }
}
