var active 	= false;
var baseUrl = "http://www.vpracing.nl/development/"
function ajaxObject()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}
function ajaxLoad(target, onloadevent, loadevent)
{
	
	xmlhttp = ajaxObject();
	xmlhttp.onreadystatechange = function()
	{
		
		if(xmlhttp.readyState==1)
		{
			if (loadevent != "")
			{
				loadevent();
			}
		}
		if(xmlhttp.readyState==4)
	  	{
			onloadevent(xmlhttp);
	  	}
	}
	xmlhttp.open("GET",target,true);
	xmlhttp.send(null);
}

function activeaan()
{
	active =true;
}
function activeuit()
{
	active =false;
}

function openanimation()
{
	object = document.getElementById("dropdownmenu");
	object2 = document.getElementById("catogoriensize");
	if (parseInt(object.style.height) < object2.offsetHeight)
	{
		object.style.height = parseInt(object.style.height) + 10 +"px";
		setTimeout("openanimation();", 30);
	}
}
function nextimage(id)
{
	var myid 		= parseInt(id);
	var slider		= document.getElementById("slider");
	
	alert (parseInt(slider.style.marginLeft));
	alert ((myid-2) * 20);
}
function previmage()
{
	
}
function changepicture(value)
{
	var object = document.getElementById("picture");
	object.src =value;
}

function winkelwagen_aantal (artnr, amount)
{
	ajaxLoad (baseURL + "source/ajax/winkelcartaantal.php?artnr="+artnr+"&count="+amount+"", function (data)
					{
						if (data.responseText == "ERROR")
						{
							alert ("Er is iets verkeerd gegaan met het verzenden van de data.");
							return;
						}
						window.location = location.href;
					}, "");
}
