// JavaScript Document
//MM
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



//Request
	var xmlhttp = false;
	//Check if we are using IE.
	try {
		//If the javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using IE.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	//If we are using a non-IE browser, create a JavaScript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	

 var cartje;; 
function AddItemCart(idke, aantal)
{
	aantal = aantal + 1;
	aantal = ":: My cart [" + aantal + "]";
	cartje = "c" + idke;
	var url = "/cart.php?A=1&P="+ idke;
	xmlhttp.open('GET', url , true);
	xmlhttp.send(null);
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
			result = xmlhttp.responseText;
			new Effect.Fade(cartje, {duration: 1.0, queue: 'front'});
			if (result == "")
			{
				document.getElementById("cartaantal").innerHTML = aantal;
				new Effect.Appear(cartaantal, {duration: 1.0, queue: 'front'});
			}else{
				document.getElementById('error').innerHTML = result;
				new Effect.Appear(error, {duration: 1.0, queue: 'front'});
			}
		}
	}
}

function ShowForm(type,I,C)
{
	new Effect.Fade('showform', {duration: 0.5, queue: 'front'});
	if (type == 1)
	{
		var url = "/inc_backform.php?I="+ I + "&C="+ C;
	}else{
		var url = "/inc_preform.php?I="+ I + "&C="+ C;
	}
	xmlhttp.open('GET', url , true);
	xmlhttp.send(null);
	xmlhttp.onreadystatechange = function() 
	{
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
			result = xmlhttp.responseText;
			document.getElementById('orderform').innerHTML = result;
			new Effect.Appear('orderform', {duration: 2.0, queue: 'front'});
		}
	}
}
function Backorders(){
	var params = Form.serialize($('backorder'));
	new Ajax.Updater('orderform', '/inc_backorder.php', {onComplete:function(){ new Effect.Appear('orderform', {duration: 2.0, queue: 'front'});},asynchronous:true, parameters:params});
}
function Preorders(){
	var params = Form.serialize($('preorder'));
	new Ajax.Updater('orderform', '/inc_preorder.php', {onComplete:function(){ new Effect.Appear('orderform', {duration: 2.0, queue: 'front'});},asynchronous:true, parameters:params});
}
function PlayAudio (audiofile)
{
	$('audioplayer').innerHTML = 'Loading player...';
	url = "/playaudio.php?audio=" + audiofile;
	new Ajax.Updater('audioplayer', url, {onComplete:function(){ new Effect.Appear('audioplayer');}, asynchronous:true});
}

function RequestDownloadSlot (ID, IDtwo)  
{
	block = "dbutton_" + IDtwo
	$('block').innerHTML = 'Loading...';
	url = "/downloadtrack.php?I=" + ID + "&R=" + IDtwo;
	new Ajax.Updater(block, url, {onComplete:function(){ new Effect.Appear(block);}, asynchronous:true});
}

function GetSubCats (category)  
{
	block = "subcat";
	$('block').innerHTML = 'Loading...';
	var selcat = category.options[category.selectedIndex].value;
	url = "/getsubcatssearch.php?ID=" + selcat;
	new Ajax.Updater(block, url, {onComplete:function(){ new Effect.Appear(block);}, asynchronous:true});
}

