var isNN4,isNN7, isIE
var coll = "";
var styleObj = "";
var hidden, visible;
var IEversion = true;
visible = 'visible'
hidden = 'hidden'
if (parseInt(navigator.appVersion)>=4){
	if(navigator.appName == "Netscape") {
	   if (parseInt(navigator.appVersion)==4){
		  isNN4 = true;
    	  visible = 'show';
  	      hidden = 'hide';
		} else {
		  isNN7 = true;
		}
	} else {
		isIE = true;
		coll ="all.";
		styleObj = ".style";
	}
}

function writeOut(div,content){
var cObj = document.getElementById(div);
 if (isIE||isNN7){
   cObj.style.visibility = visible;
   cObj.innerHTML = content;
 } else {
  cObj.visibility = visible;
  var cDoc = document.layers[div].document;
  cDoc.open();
  cDoc.writeln(content);
  cDoc.close();
 }
}

function writeBase(){
var html = "<table cellpadding=0 cellspacing=0 border=0 class=cr>";
	   	   html += "<tr><td>&nbsp;&copy; Castle Vets - 2011</td></tr>";
	   	   html += "</table>";
writeOut("base",html)
}

function writeBTT(){
var html = "<table cellpadding=0 cellspacing=0 border=0 width=100%>";
	   	   html += "<tr><td align=right><a class=btt href=\"#\">BACK TO TOP</a>&nbsp;&nbsp;</td></tr>";
	   	   html += "</table>";
writeOut("btt",html)
}



/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var menu1=new Array()
menu1[0]='<a class=menuleft href=\"farm.html\">Farm Animals</a>'
menu1[1]='<a class=date href=\"equine.html\">Equine</a>'
menu1[2]='<a class=date href=\"small.html\">Small Animals</a>'
menu1[3]='<a class=date href=\"payments.html\">Payments</a>'
menu1[4]='<a class=date href=\"links.html\">Links</a>'
		
var menu2=new Array()
menu2[0]='<a class=menuleft href=\"../cv-test/farm.html\">Farm Animals</a>'
menu2[1]='<a class=date href=\"../cv-test/equine.html\">Equine</a>'
menu2[2]='<a class=date href=\"../cv-test/small.html\">Small Animals</a>'
menu2[3]='<a class=date href=\"../payments.html\">Payments</a>'
menu2[4]='<a class=date href=\"../links.html\">Links</a>'
		
var menu3=new Array()
menu3[0]='<a class=menuleft href=\"about.html\">Who we are</a>'
menu3[1]='<a class=date href=\"premises.html\">Premises</a>'
		
var disappeardelay=100  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=5 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


function writeMenuCV(){
var html = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"images/square.gif\"></td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><a class=menu href=\"index.html\"><b>Home</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"images/square.gif\"></td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><a class=menu href=\"#\" onMouseover=\"dropdownmenu(this, event, menu3, '150px')\" onMouseout=\"delayhidemenu()\"><b>About&nbsp;&nbsp;&raquo;</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"images/square.gif\"></td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><a class=menu href=\"#\" onMouseover=\"dropdownmenu(this, event, menu1, '150px')\" onMouseout=\"delayhidemenu()\"><b>Services&nbsp;&nbsp;&raquo;</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"images/square.gif\"></td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><a class=menu href=\"find.html\"><b>Find us</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"images/square.gif\"></td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><a class=menu href=\"contact.html\"><b>Contact</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "</tr></table>";
writeOut("menucv",html)
}

function writeMenuCVMap(){
var html = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr valign=top>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"../cv-test/images/square.gif\">&nbsp;<a href=\"../cv-test/index.html\"><b>Home</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"../cv-test/images/square.gif\">&nbsp;<a href=\"../cv-test/about.html\"><b>Who we are</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"../cv-test/images/square.gif\">&nbsp;<a href=\"../cv-test/contact.html\"><b>Contact</b></a>&nbsp;</td>";
	   	   html += "<td bgcolor=\"#ffffff\" width=\"15\">&nbsp;</td>";
	   	   html += "<td class=menuleft bgcolor=\"#ffffff\"><img src=\"../cv-test/images/square.gif\">&nbsp;<a href=\"#\" onMouseover=\"dropdownmenu(this, event, menu2, '150px')\" onMouseout=\"delayhidemenu()\"><b>Services&nbsp;&nbsp;&raquo;</b></a>&nbsp;</td>";
	   	   html += "</tr></table>";
writeOut("menucvmap",html)
}


