var live="";

function toggle_site(site)
{
	text=site+'Text';
	over='Web-Design-Melbourne/'+site+'Over.jpg';

	if(live!="" && live!=site)
	{
		document.getElementById(live).style.display = 'none';
	}

	if(document.getElementById(text).style.display == 'none')
	{
		document.getElementById(site).src = over;
		document.getElementById(text).style.display = 'block';

		live=text;
	}
}

function reset_src(site)
{
	out='Web-Design-Melbourne/'+site+'.jpg';
	document.getElementById(site).src = out;
}

function highlight(obj)
{
	obj.bgColor = 'C0EDBE';
}

function unhighlight(obj)
{
	obj.bgColor = '';
}

function change_color(id, color)
{
	element = document.getElementById(id);
	element.style.background = color;
}

function check_empty(box)
{
	if(document.getElementById(box).value=="")
	{
		alert("Please add a quantity.");
		return false;
	}
	else
		return true;
}

function loadXMLDoc(url,quantity,status,pending)
{
	document.getElementById(status).innerHTML=pending;

	if(window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	//if we are adding to cart
	if(quantity!="")
	{
		quantity=document.getElementById(quantity).value;
		urlfinal=url+"&quantity="+quantity;
	}
	else
		urlfinal=url;

	xmlhttp.open("GET",urlfinal,false);
	xmlhttp.send();

	document.getElementById(status).innerHTML=xmlhttp.responseText;
}

function toggle_area(id)
{
	if(document.getElementById(id).style.display=='block')
		document.getElementById(id).style.display='none';
	else if(document.getElementById(id).style.display=='none')
		document.getElementById(id).style.display='block';
}
