
<!--
function confirmSubmit()
{
var agree=confirm("Are you sure you want to buy this dog?");
if (agree)
	return true ;
else
	return false ;
}

function addBookmark(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=250');");
	}

var xmlHttp

function checkSupport(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp!=null)
	{
		if(document.getElementById("clink"))
	  		document.getElementById("clink").innerHTML='<a onClick="javascript:removeCollar('+did+')" class="llink">[x] Remove Collar</a>';
		if(document.getElementById("lelink"))
	  		document.getElementById("lelink").innerHTML='<a onClick="javascript:removeLeash('+did+')" class="llink">[x] Remove Leash</a>';
	  	
		if(document.getElementById("blink"))
	 		 document.getElementById("blink").innerHTML='<a onClick="javascript:removeBed('+did+')" class="llink">[x] Remove Bed</a>';
	  	
		if(document.getElementById("wblink"))
	 		 document.getElementById("wblink").innerHTML='<a onClick="javascript:refillWater('+did+')" class="llink">Refill</a> | <a onClick="javascript:removeWaterBowl('+did+')" class="llink">Remove</a>';
	  	
		if(document.getElementById("fblink"))
	 		 document.getElementById("fblink").innerHTML='<a onClick="javascript:refillFood('+did+')" class="llink">Refill</a> | <a onClick="javascript:removeFoodBowl('+did+')" class="llink">Remove</a>';
			 
		if(document.getElementById("plink"))
	 		 document.getElementById("plink").innerHTML='<a onClick="javascript:play('+did+')" class="llink">Play!</a>';
		
	  return;
	} 
}


function removeCollar(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	document.getElementById("collar").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=1";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function removeLeash(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("leash").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=2";
	xmlHttp.onreadystatechange=stateChanged2;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function removeBed(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("bed").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=3";
	xmlHttp.onreadystatechange=stateChanged3;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function removeWaterBowl(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("waterbowl").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=4";
	xmlHttp.onreadystatechange=stateChanged4;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function removeFoodBowl(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("foodbowl").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=5";
	xmlHttp.onreadystatechange=stateChanged5;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function play(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("play").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=6";
	xmlHttp.onreadystatechange=stateChanged6;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}  

function refillWater(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("waterbowl").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=7";
	xmlHttp.onreadystatechange=stateChanged7;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function refillFood(did)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	document.getElementById("foodbowl").innerHTML="<img src=images/loading.gif width=50 height=15 alt=Loading>";
	var url="dogstuff.php";
	url=url+"?qid="+Math.random();
	url=url+"&did="+did;
	url=url+"&req=8";
	xmlHttp.onreadystatechange=stateChanged8;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 
	
function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("collar").innerHTML=xmlHttp.responseText;
		document.getElementById("agi").innerHTML=document.getElementById("nagi").innerHTML;
		document.getElementById("con").innerHTML=document.getElementById("ncon").innerHTML;
		document.getElementById("int").innerHTML=document.getElementById("nint").innerHTML;
		document.getElementById("spd").innerHTML=document.getElementById("nspd").innerHTML;
		document.getElementById("stm").innerHTML=document.getElementById("nstm").innerHTML;
		document.getElementById("str").innerHTML=document.getElementById("nstr").innerHTML;
		
	}
}

function stateChanged2() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("leash").innerHTML=xmlHttp.responseText;
		document.getElementById("agi").innerHTML=document.getElementById("nagi").innerHTML;
		document.getElementById("con").innerHTML=document.getElementById("ncon").innerHTML;
		document.getElementById("int").innerHTML=document.getElementById("nint").innerHTML;
		document.getElementById("spd").innerHTML=document.getElementById("nspd").innerHTML;
		document.getElementById("stm").innerHTML=document.getElementById("nstm").innerHTML;
		document.getElementById("str").innerHTML=document.getElementById("nstr").innerHTML;
	}
}

function stateChanged3() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("bed").innerHTML=xmlHttp.responseText;
		
		if(document.getElementById("ncomf"))
		{
			document.getElementById("comfort").innerHTML="<div class='statusbar'><div class='currentstatus' style='width:0%'></div></div>";
			document.getElementById("comforts").innerHTML="Poor";
			
			var newOverallWidth = document.getElementById("overalln").innerHTML - 5;
			
			document.getElementById("overall").innerHTML="<div class='statusbar'><div class='currentstatus' style='width:"+newOverallWidth+"%'></div></div>";
			document.getElementById("overalls").innerHTML=dstatus(newOverallWidth);
			document.getElementById("overalln").innerHTML=newOverallWidth;
		}
	}
}

function stateChanged4() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("waterbowl").innerHTML=xmlHttp.responseText;
		document.getElementById("water").innerHTML="<div class='statusbar'><div class='currentstatus' style='width:50%'></div></div>";
		document.getElementById("waters").innerHTML="Poor";
	}
}

function stateChanged5() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("foodbowl").innerHTML=xmlHttp.responseText;
	}
}

function stateChanged6() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("play").innerHTML=xmlHttp.responseText;
		document.getElementById("happy").innerHTML=document.getElementById("newhappy").innerHTML;
		document.getElementById("happys").innerHTML=document.getElementById("newhappys").innerHTML;
	}
}

function stateChanged7() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("waterbowl").innerHTML=xmlHttp.responseText;
		document.getElementById("water").innerHTML="<div class='statusbar'><div class='currentstatus' style='width:100%'></div></div>";
		document.getElementById("waters").innerHTML="Fantastic!";
	}
}

function stateChanged8() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("foodbowl").innerHTML=xmlHttp.responseText;
		document.getElementById("food").innerHTML=document.getElementById("newfood").innerHTML;
		document.getElementById("foods").innerHTML=document.getElementById("newfoods").innerHTML;
		document.getElementById("agi").innerHTML=document.getElementById("nagi").innerHTML;
		document.getElementById("con").innerHTML=document.getElementById("ncon").innerHTML;
		document.getElementById("int").innerHTML=document.getElementById("nint").innerHTML;
		document.getElementById("spd").innerHTML=document.getElementById("nspd").innerHTML;
		document.getElementById("stm").innerHTML=document.getElementById("nstm").innerHTML;
		document.getElementById("str").innerHTML=document.getElementById("nstr").innerHTML;
	}
}
	
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
    }
	catch (e)
	{
	  // Internet Explorer
	  try
	  {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	  catch (e)
	  {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
	
	return xmlHttp;
}

function dstatus(n)
{
	if(n >= 100)
		return 'Fantastic!';
	else if(n >= 90)
		return 'Great!';
	else if(n >= 80)
		return 'Good';
	else if(n >= 70)
		return 'Decent';
	else if(n >= 60)
		return 'Ok';
	else return 'Poor';	
}
// End -->