var strSpacerRow ="<TR height='1'><TD  bgcolor='#0000A9'></TD></TR>";

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for (	i=0;
		a && i<a.length && (x=a[i]) &&x.oSrc;
		i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images){
		if (!d.MM_p) d.MM_p=new Array();
	    	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    		if (a[i].indexOf("#")!=0){
			d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
		}
	}
}

function MM_findObj() { //v4.0
	var p,i,x;
	var n = ""
	n = arguments[0];
	var d = arguments[1];
	if(!d) d=document;
	if ((p=n.indexOf("?"))>0 && parent.frames.length) {
    		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
  	if (!(x=d[n]) && d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
  	for (i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
  	if (!x && document.getElementById) {
		x=document.getElementById(n);

	}
	return x;
}

function MM_swapImage() { //v3.0
  	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0; i<(a.length-2); i+=3)
   		if ((x=MM_findObj(a[i])) != null) {
			document.MM_sr[j++]=x;
			if(!x.oSrc) {
				x.oSrc=x.src;
			}
			x.src=a[i+2];
		}
}

function isIE() {
	var av = navigator.appVersion;
	var idxMSIE = av.indexOf("MSIE");
	return (idxMSIE >= 1);
}

var strItemRowStart = "<TR valign='center' align='right' ><TD class=\"leftmenuitem\" onMouseOver=\"this.bgColor='#5089E9'\" onMouseOut=\"this.bgColor='#0033C0'\"><A href=\"";
var strItemRowMiddle ="\" class=\"leftmenuitem\">";
var strItemRowEnd = "</A></TD></TR>"

// display one row of left menu
function displayLeftMenuItemRow(strLink, strText) {
	document.write(strItemRowStart + strLink + strItemRowMiddle + strText + strItemRowEnd);
	document.write(strSpacerRow);
}

// get current year
function getCurrentYear() {
	var now = new Date;
	var dt = now.getDate();
	var yr = now.getYear();
	return yr;
}

// display left menu
function displayLeftMenu() {
//	var IE = isIE();
	var strHeaderRowStart = "<TR valign='center' align='right' ><TD bgcolor='#FFFF48' class='leftmenuheader'>";
	var strHeaderRowEnd = "</TD></TR>"

	document.write("<TD valign='top' width='179px'>");
	document.write("<TABLE bgcolor='#0033C0' width='100%' height='100%' border='0' cellspacing='0' cellpadding='2'>");
	document.write(strHeaderRowStart + "Learn Cat-Training Basics" + strHeaderRowEnd);
	displayLeftMenuItemRow("default.html",  "Introduction (<FONT color='#FFFF4A'>Home Page</FONT>)");
	displayLeftMenuItemRow("cat-train-basics.htm", "Cat Training 101");
	displayLeftMenuItemRow("under_construction.htm", "Human Training 101");
	document.write("<TR height='15'><TD ></TD></TR>");
	document.write(strHeaderRowStart + "Train Your Cat To..." + strHeaderRowEnd);
	displayLeftMenuItemRow("under_construction.htm", "Use a Scratching Post");
	displayLeftMenuItemRow("under_construction.htm", "Not be Aggressive");
	displayLeftMenuItemRow("under_construction.htm", "Accept a New Cat");
	displayLeftMenuItemRow("under_construction.htm", "Accept a New Baby");
	displayLeftMenuItemRow("under_construction.htm", "Accept a New Adult");
	displayLeftMenuItemRow("under_construction.htm", "Use the Litter Box");
	displayLeftMenuItemRow("sleep.htm", "Let You Sleep Sometimes");
	displayLeftMenuItemRow("under_construction.htm", "Stay Indoors");
	displayLeftMenuItemRow("under_construction.htm", "Stay Out of Trouble");
        displayLeftMenuItemRow("stay_off_xmas_tree.htm", "Stay Off the Xmas Tree");
	displayLeftMenuItemRow("dont_eat_houseplants.htm", "Not Chew on Houseplants");
	displayLeftMenuItemRow("under_construction.htm", "Take a Pill");
	displayLeftMenuItemRow("cat_come_to_you.htm", "Come to You");
	displayLeftMenuItemRow("under_construction.htm", "Enjoy Being Held (Maybe)");
	displayLeftMenuItemRow("leash-walk.htm", "Walk On a Leash");
	displayLeftMenuItemRow("under_construction.htm", "Do Tricks--Maybe");
	displayLeftMenuItemRow("toilet_training.htm", "Use the Toilet?");
	document.write("<TR height='15'><TD ></TD></TR>");
	document.write(strHeaderRowStart + "Train The Humans To..." + strHeaderRowEnd);
	document.write(strSpacerRow);
	displayLeftMenuItemRow("under_construction.htm", "Ensure a Safe, Fun Home");
   displayLeftMenuItemRow("maintain_litter_box.htm", "Maintain the Litter Box");
	displayLeftMenuItemRow("under_construction.htm", "Play with Your Cat");
	displayLeftMenuItemRow("under_construction.htm", "Groom Your Cat");
	displayLeftMenuItemRow("under_construction.htm", "Trim Your Cat's Claws");
	displayLeftMenuItemRow("under_construction.htm", "Brush Your Cat's Teeth");
	displayLeftMenuItemRow("under_construction.htm", "Learn Cat Body Language");
	displayLeftMenuItemRow("under_construction.htm", "Monitor Your Cat's Health");
	displayLeftMenuItemRow("under_construction.htm", "Prepare for Emergencies");
	document.write("<TR height='15'><TD ></TD></TR>");
	document.write(strHeaderRowStart + "Teach Your Children To..." + strHeaderRowEnd);
	document.write(strSpacerRow);
	displayLeftMenuItemRow("under_construction.htm", "Be Good &quot;Cat Buddies&quot;");
	document.write("<TR height='15'><TD ></TD></TR>");
	document.write(strHeaderRowStart + "Essential Web Site Stuff" + strHeaderRowEnd);
	document.write(strSpacerRow);
	displayLeftMenuItemRow("mailto:vet@cathealth.com", "Contact Us");
	displayLeftMenuItemRow("terms_of_use.htm", "View Terms of Use");
	displayLeftMenuItemRow("default.html", "<FONT color='#FFFF4A'>Home Page</FONT> (Introduction)");
	document.write("<TR height='16'><TD></TD></TR>");
	document.write("<TR valign='center' align='center'><TD class='leftmenuitem' style='font-size:9px'>&copy; 2002-" + getCurrentYear() + "<br/>Dr. Christianne Schelling</TD></TR>");
	document.write("<TR valign='bottom'><TD></TD></TR>");
	document.write("</TABLE>");
	document.write("</TD>");
}

function displayHeader(boolDisplayImage) {
	document.write("<TABLE width='100%' border='0'' cellspacing='0' cellpadding='0'>");
	if (boolDisplayImage == 1) {
		// Most likely this is for the home page
		document.write("<TR>");
		document.write("<TD valign='top' align='left' width='251px' nowrap>");
//		document.write("<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver=\"MM_swapImage('welcome','','images/cats_carrier_copy3.jpg',1)\"><IMG id="welcome" src='images/cats_carrier14.jpg'  width=132 height=172 vspace='0' hspace=4' align='center' onmousedown=\"disableRightClick('Copyright &copy; Comstock Images');\" onmouseup='return false;' onclick='return false;'>");
		document.write("<a href='#' onMouseOut='javascript:MM_swapImgRestore()' onMouseOver=\"javascript:MM_swapImage('welcome','','images/cats_carrier_copy3.jpg',1)\"><IMG name='welcome' src='images/cats_carrier14.jpg'  width=132 height=172 vspace='0' hspace=4' align='center' onmousedown=\"disableRightClick('Copyright &copy; Comstock Images');\" onmouseup='return false;' onclick='return false;'></A>");
//		document.write("<IMG src='images/cats_carrier4.jpg' width=132 height=176 vspace='0' hspace=4' align='center' onmousedown=\"disableRightClick('Copyright &copy; Comstock Images');\" onmouseup='return false;' onclick='return false;'>");
		document.write("<SPAN class='welcome'><I>Welcome!</I></SPAN>	</TD>");
		document.write("<TD valign='bottom' align='left'>");
		document.write("<DIV style='width:72; height:43; background:#B2C4E4; position:relative; top:67px; left:190px; z-index:-1'></DIV>");
//		document.write("<DIV style='width:72; height:43; background:#AEC04E0; background:#B2C4E4; position:relative; top:67px; left:190px; z-index:-1'></DIV>");
		document.write("<DIV style='width:72; height:43; background:#FFFF48; position:relative; top:37px; left:178px; z-index:-1'></DIV>");
		document.write("<SPAN class='headerfirstletter'>T</SPAN><SPAN class='header'>raining <SPAN class='headerfirstletter'>Y</SPAN>our <SPAN class='headerfirstletter'>C</SPAN>at</SPAN>");
		document.write("<BR><SPAN class='presents'>Christianne Schelling, DVM</SPAN>");
		document.write("<HR color='#B2C4E4' color='#A767AA' align='left' width='208px' style='margin-bottom:4px; margin-left:1px'></TD></TR>");
		document.write("</TD></TR>");
//		document.write("</TD></TR>");
	}
	else {
		// Most likely this is for pages other than the home page
		document.write("<TR>");
		document.write("<TD valign='top' align='left' >");
		document.write("<DIV style='width:53; height:29; margin-top:-22px; background:#B2C4E4; position:relative; top:24px; left:120px; z-index:-1'></DIV>");
		document.write("<DIV style='width:50; height:27; margin-top:-18px; background:#FFFB4A; position:relative; top:20px; left:114px; z-index:-1'></DIV>");
		document.write("<a href='default.html' style='text-decoration:none;'><SPAN class='header2firstletter'>T</SPAN><SPAN class='header2'>raining <SPAN class='header2firstletter'>Y</SPAN>our <SPAN class='header2firstletter'>C</SPAN>at</SPAN></a>");
		document.write("<HR color='#B2C4E4' align='left' width='100%'>");
//		document.write("<HR color='#B2C4E4' width='520px'>");
		document.write("</TD>");
		document.write("<TD class='presents2' valign='top' align='right'>");
		document.write("Christianne Schelling, DVM");
		document.write("<HR color='#B2C4E4' width='100%'>");
		document.write("</TD>");
		document.write("<TD valign='top' rowspan='2' align='right' width='73px'><IMG src='images/tabby5.gif' width='66px' height='85px' align='right'></TD>");
		document.write("</TR>");
	}
	document.write("</TABLE>");
}

function displayLinkToTop() {
	document.write("<TABLE width='100%' border=0>");
	document.write("<TR><TD align='right' valign='bottom' ><a href='#top' class='articletextlink'><img src='images/up_arrow.gif' width=30 height=25 border=0 align='center'><span style='position:relative; top:4px; left:-1px'>Top of Page</span></a></TD></TR>");
	document.write("</TABLE>");
}

// "Email to a friend" form
function emailToFriend(strTitle, strSummary) {
	document.write("<HR color='#0000A9'>");
	document.write("<SPAN class='emailformheader'>Email this article to a friend:</SPAN>");
	var strCleanSummary = strSummary.replace(/'/g, "&#39;");
	document.write("<FORM name='emailform' method='post' action='send_email.asp' target='SendEmailWin' onSubmit='javascript:initMail(this," + "\"" + strTitle + "\",\""+ strCleanSummary + "\");'>");
	document.write("<INPUT type='hidden' name='subject' value='Fw: " + strTitle + " (from http://www.cattraining.com)'>");
	document.write("<INPUT type='hidden' name='message' value=''>");
	document.write("<TABLE border='0' width='480px'>");
	document.write("<TR><TD class='emailform' width='90px'>*Send to:</TD><TD><INPUT type='text' name='toemail' size=50></TD></TR>");
	document.write("<TR><TD></TD><TD class='emailform' valign='top'>(Enter as many email addresses as you like, separated by commas or semicolons.)</TD></TR>");
	document.write("<TR height='8px'><TD></TD></TR>");
	document.write("<TR><TD class='emailform' width='90px'>*Your Name:</TD><TD><INPUT type='text' name='fromname' size=50></TD></TR>");
	document.write("<TR><TD class='emailform' width='90px'>*Your Email:</TD><TD><INPUT type='text' name='fromemail' size=50></TD></TR>");
	document.write("<TR><TD><INPUT type='submit' value='Send It' onclick='javascript:somewin=window.open(\"send_email.asp\", \"SendEmailWin\",\"scrollbars,width=540,height=270,top=40,left=25\");somewin.focus()'>");
	document.write("<TR><TD></TD><TD class='emailfieldsreqd'>*All fields are required.</TD></TR>");
	document.write("</TD></TR>");
	document.write("</TABLE>");
	document.write("</FORM>");
}

function initMail(theForm, strTitle, strSummary) {
   var strFrom = "From: " + theForm.fromname.value + " (" + theForm.fromemail.value + ")\n\n";
   var strPreface = "I'm auto-recommending this article through <a href='http://www.cattraining.com'>http://www.cattraining.com</a> ---\n\n";
   var strURL = window.location + "";
   // we don't want to include anchors in the URL
   var intAnchorPos = strURL.indexOf("#");
   if (intAnchorPos >= 0) {
	strURL = strURL.substr(0, intAnchorPos);
   }
   var strLink = "URL (address): <a href='" + strURL + "'>" + strURL + "</a>\n\n";
   var strTitle = "Title: " + strTitle + "\n\n";
   var strSummary = "Summary: " + strSummary;
   theForm.message.value = strFrom + strPreface + strLink + strTitle + strSummary;
}

// display stuff at bottom of page
function displayFooter() {
	document.write("<TR height='1' valign='bottom'><TD width='179px' bgcolor='#0033C0'></TD><TD></TD><TD>");
	document.write("<HR color='#0000A9' width='100%'>");
	document.write("<DIV align='center' style='font-family:arial, verdana, helvetica; font-size:11px; line-height:13px'>");
	document.write("All material on CatTraining.com is provided for informational or educational purposes only, for persons who live with or take care of cats. It is not a replacement for qualified veterinary care. Please discuss your cat's symptoms and medical conditions with your veterinarian. (View <a href='terms_of_use.htm'><U>full terms of use</U></a>.)");
	document.write("</DIV>");
	document.write("</TD></TR>");
}

function disableRightClick(e) {
	var strMsg = "(right-click disabled.)";
	if (document.images) {
		var boolRightClick = false
		if (isIE()) {
			if (event.button==2) {
				if (arguments[0] != null) {
					strMsg = arguments[0];
				}
				alert(strMsg);
				return false;
			}
		}
		else {
				if (arguments[0] != null) {
					strMsg = arguments[0];
				}
				alert(strMsg);
				return false;
		}
	}
}
