function submenu(language)
{
	var lang = '';
	if(language == 'it') {
		lang = '_it';
	}
	var items = $$('#submenu .categorie');	
	items.each(function(el, i){
		var assortment = $(el).className.split(' ');
		el.observe('click', function(e){
			$(assortment[1]).style.display = 'block';	
			$('image_'+assortment[1]).src = "images/template/"+assortment[1]+"_small_active"+lang+".jpg";
			items.each(function(other, j) {
				var active_assortment = $(other).className.split(' ');
				if(i != j) {
					$(active_assortment[1]).style.display = 'none';	
					$('image_'+active_assortment[1]).src = "images/template/"+active_assortment[1]+"_small"+lang+".jpg";
				}
			});
		});
	});
}

var active_tab = 'information';
var active_zindex = '20';

function tab(id, zindex)
{
	if(active_tab != id)	
	{
		$(active_tab+'_tab').className = 'tab_detail';	
		$(active_tab).style.display = 'none';
		$(active_tab+'_tab').style.zIndex = active_zindex;	
		
		$(id+'_tab').className = 'tab_active';
		$(id).style.display = 'block';
		$(id+'_tab').style.zIndex = '25';
		
		active_zindex = zindex;		
		active_tab = id; 
	}	
}

function shoppingcart(pRequest, pArtikel, pData)
{
	if(pRequest == 'update' || pRequest == 'delete')
	{
		url='request.php';
		new Ajax.Request(url, { 
			method:'post', 
			postBody: 'request=shoppingcart&action='+pRequest+'&artikelID='+pArtikel+'&update=' + pData,
			onSuccess: 
			function(response) {
				document.getElementById('shoppingcart').innerHTML = response.responseText;
			}
			
		});	
	}
}

function setLanguage(pLanguage)
{
	if(pLanguage != '')
	{
		url='request.php';
		new Ajax.Request(url, { 
			method:'post', 
			postBody: 'request=language&language='+pLanguage,
			onSuccess: 
			function() {
				location.href='index.php';
			}		
		});
	}
}


function pagina(paginaID, archief){  // © Micha Pieterman
	if(archief == "inhoud") {
		url = "http://www.webkey3.nl/cms3/archief.php";
		url2 = "index.php?archief=inhoud";
	} else if(archief == "archiefstuk") {
		url = "http://www.webkey3.nl/cms3/archief.php?menuid=" + paginaID;
		url2 = "index.php?archief=archiefstuk&paginaID=" + paginaID;
	} else {
		url = "http://www.webkey3.nl/cms3/index.php?menuid=" + paginaID;
		url2 = "index.php?paginaID=" + paginaID;
	}
	try {
		obj = window.top.topvenster;
	} catch(e){}
	if(obj){
	window.top.location.href=url;
	} else {
		window.location.href=url2;
	}
}

function page(paginaID) {  
	var url = 'http://www.webkey3.nl/cms3/index.php?menuid=' + paginaID;
	try {
				var parent = window.top.topvenster;
	}
	catch(e) {
	}
	if(parent) {
				window.top.location.href = url;
	}
}

function taal(sitename){
	var url = "http://www.webkey3.nl/cms3/index.php?naamw=" + sitename;
	try{
		obj = window.top.topvenster;
	}
	catch(e){
	}
	if(obj){
		window.top.location.href=url;
	}
}
function form(formID) {  
	var url = 'http://www.webkey3.nl/cms3/form.php?action=wijzigen&formid=' + formID;
	try {
				var parent = window.top.topvenster;
	}
	catch(e) {
	}
	if(parent) {
				window.top.location.href = url;
	}
}
function product(artikelID) {  
	var url = 'http://www.webkey3.nl/cms3/yarrah.php?id=' + artikelID;
	try {
				var parent = window.top.topvenster;
	}
	catch(e) {
	}
	if(parent) {
				window.top.location.href = url;
	}
}

function changeAnimal(p_nId) {
	var sElement = 'huisdier'+p_nId;
	var sContainer = 'container'+p_nId;
	
	if($(sElement).checked == true) {
		$(sContainer).show();
	} else {
		$(sContainer).hide();
	}
}

function changeSoort(p_value, p_nId) {
	
	var sKatElement = 'katcheck'+p_nId;
	var sHondElement = 'hondcheck'+p_nId;
	
	if(p_value == 'kat') {
		$(sHondElement).hide();
		$(sKatElement).show();
	} else {
		$(sKatElement).hide();
		$(sHondElement).show();
	}
	//alert(p_value);

}

function pagina(paginaID, archief){  // © Micha Pieterman
	if(archief == "inhoud") {
		url = "http://www.webkey3.nl/cms3/archief.php";
		url2 = "index.php?archief=inhoud";
	} else if(archief == "archiefstuk") {
		url = "http://www.webkey3.nl/cms3/archief.php?menuid=" + paginaID;
		url2 = "index.php?archief=archiefstuk&paginaID=" + paginaID;
	} else {
		url = "http://www.webkey3.nl/cms3/index.php?menuid=" + paginaID;
		url2 = "index.php?paginaID=" + paginaID;
	}
	try{
		obj = window.top.topvenster;
	} catch(e) {}
	if(obj) {
		window.top.location.href=url;
	} else {
		window.location.href=url2;
	}
}

function formw(formID){  // © Micha Pieterman
	url = "http://www.webkey3.nl/cms3/form.php?action=wijzigen&formid=" + formID;
	try{
		obj = window.top.topvenster;
	} catch(e){}
	if(obj){
		window.top.location.href=url;
	}
}


