function no()
{
	location.href="http://www.woolly-hooves.com";
}

function seellama()
{

	var basecolor = document.getElementById("chosencolor").value;
	var marking = document.getElementById("marking");
	var markingid = marking.options[marking.selectedIndex].value;
	var markingcolor = document.getElementById("chosenmcolor").value;	
	
	
	document.getElementById("preview").src = "buildllama.php?base="+basecolor.substr(1,6)+"&marking="+markingid+"&markingc="+markingcolor.substr(1,6);

}

function test0()
{
	var marking = document.getElementById("marking");
	if(marking.options[marking.selectedIndex].value == '0')
		hideOptions();
	else showOptions();
		
}

function hideOptions()
{
	document.getElementById("moptions").style.height = "0px";
	document.getElementById("moptions").style.visibility = "hidden";
}

function showOptions()
{
	document.getElementById("moptions").style.height = "auto";
	document.getElementById("moptions").style.visibility = "visible";
}

function register1(tkey)
{
	if(tkey == 'prev')
	{
		document.getElementById("gender").style.visibility = "visible";
		document.getElementById("marking").style.visibility = "visible";
		document.getElementById("uinfo").style.visibility = "hidden";
		document.getElementById("pandat").innerHTML = document.getElementById("secondt").innerHTML;
	}
	else
	{
		document.body.scrollTop = '0';
		document.getElementById("holdstuff").innerHTML = document.getElementById("second").innerHTML;
	}
	document.getElementById("middle").innerHTML = "Register (Step 2/4)";
}

function register2()
{
	document.getElementById("gender").style.visibility = "hidden";
	document.getElementById("marking").style.visibility = "hidden";
	document.getElementById("pandat").innerHTML = document.getElementById("third").innerHTML;
	seellama();
	document.getElementById("uinfo2").style.visibility = "hidden";
	document.getElementById("uinfo").style.visibility = "visible";
	document.getElementById("middle").innerHTML = "Register (Step 3/4)";
}

function register3()
{
	document.getElementById("gender").style.visibility = "hidden";
	document.getElementById("marking").style.visibility = "hidden";
	document.getElementById("pandat").innerHTML = document.getElementById("third").innerHTML;
	seellama();
	document.getElementById("uinfo").style.visibility = "hidden";
	document.getElementById("uinfo2").style.visibility = "visible";
	document.getElementById("middle").innerHTML = "Register (Step 4/4)";
}

function changeColor(ctype, cid)
{
	var chosenid;
	
	if(ctype == 'color')
	{
		chosenid = document.getElementById("chosencolor");
	}
	else 
	{
		chosenid = document.getElementById("chosenmcolor");			
	}
	
	chosenid.value = getColor(cid, chosenid);
}

function showColor(ctype, cid)
{
	var showbox;
	var chosenid;
	
	if(ctype == 'color')
	{
		showbox = document.getElementById("selectedcolor");
		chosenid = "chosencolor";
	}
	else
	{
		showbox = document.getElementById("selectedmcolor");
		chosenid = "chosenmcolor";
	}
	
	showbox.style.background = getColor(cid, chosenid);
}

function getColor(cid, oid)
{
	if(cid == 'color1')
		return "#e0d4e0";
	else if(cid == 'color2')
		return "#9d97a3";
	else if(cid == 'color3')
		return "#524b52";
	else if(cid == 'color4')
		return "#5b4949";
	else if(cid == 'color5')
		return "#30232c";
	else if(cid == 'color6')
		return "#2a1b20";
	else if(cid == 'color7')
		return "#221a24";
	else if(cid == 'color8')
		return "#b0938d";
	else if(cid == 'color9')
		return "#ac8c7d";
	else if(cid == 'color10')
		return "#9a7771";
	else if(cid == 'color11')
		return "#7d5850";
	else if(cid == 'color12')
		return "#734842";
	else if(cid == 'color13')
		return "#664744";
	else if(cid == 'color14')
		return "#3c2422";
	else return document.getElementById(oid).value;
}

function rname()
{
	var newname;
	var randomnum = Math.floor(21*Math.random());
	
	if(randomnum == '0') newname = "Llucy";
	else if(randomnum == '1') newname = "Lloyd";
	else if(randomnum == '2') newname = "Llary";
	else if(randomnum == '3') newname = "Lleopold";
	else if(randomnum == '4') newname = "Llamo";
	else if(randomnum == '5') newname = "Llisa";
	else if(randomnum == '6') newname = "Elliza";
	else if(randomnum == '7') newname = "Lleonard";
	else if(randomnum == '8') newname = "Lleo";
	else if(randomnum == '9') newname = "Llollllipop";
	else if(randomnum == '10') newname = "Tullip";
	else if(randomnum == '11') newname = "Llasa";
	else if(randomnum == '12') newname = "Lluke";
	else if(randomnum == '13') newname = "Lloopy";
	else if(randomnum == '14') newname = "Llionell";
	else if(randomnum == '15') newname = "Lloolloo";
	else if(randomnum == '16') newname = "Llilly";
	else if(randomnum == '17') newname = "Lliz";
	else if(randomnum == '18') newname = "Arnolld";
	else if(randomnum == '19') newname = "Lleto";
	else if(randomnum == '20') newname = "Lleet";
		else newname = "Pony";
			
	document.getElementById("lname").value = newname;
}

//// AJAX Stuff
//function completeRegistration()
//{
//	xmlHttp=GetXmlHttpObject()
//	
//	if (xmlHttp==null)
//	{
//	  alert ("Your browser does not support AJAX!");
//	  return;
//	} 
//	
//	document.getElementById("apending").style.visibility = "visible";
//	
//	var params = "username="+document.getElementById("username").value;
//	params = params+"&password1="+document.getElementById("pass1").value;
//	params = params+"&password2="+document.getElementById("pass2").value;
//	params = params+"&email="+document.getElementById("email").value;
//	
//	var url = "newplayerstuff.php";
//	xmlHttp.open("POST",url,true);
//	
//	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//	xmlHttp.setRequestHeader("Content-length", params.length);
//	xmlHttp.setRequestHeader("Connection", "close");
//	
//	xmlHttp.onreadystatechange=stateChanged;
//	
//	xmlHttp.send(params);
//}
//
//function stateChanged() 
//{ 
//	if (xmlHttp.readyState==4 && xmlHttp.status==200)
//	{ 
//		alert(xmlHttp.responseText);
//
//	}
//}
//
//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;
//}