// JavaScript Document

function toggle_menu_item ( submenu ) 
{
	if (document.getElementById(submenu).className == 'child') 
		document.getElementById(submenu).className = 'child_open';
	else 
		document.getElementById(submenu).className = 'child';
	return false;
}
var klantenservice_initialiseren = false;
window.onload = function()
{
	if ( klantenservice_initialiseren )
		init_klantenservice ();
	if ( doe_transactie )
		__utmSetTrans();
	if ( doe_positie )
		positioneer_uploadform();

	var menu_url = document.getElementById("menu_schrijfwaren");
	if ( menu_url )
	{
		var links = menu_url.parentNode.parentNode.getElementsByTagName("a");
		var i;
		for (i = 0; i<links.length; i++) 
		{
			if ( links[i].className == "artikelgroep" )
			{
				links[i].onclick = function ( )	
				{ 
					var id_naam = this.id+'_meer';
					toggle_menu_item (id_naam);
					update_sessie ( this.id );
					return false;
				}
			}
		}
	}
	if ( document.getElementById ('error_veld' ) )
	{
		window.location.hash = '#errors';
	}

}

var http = getHTTPObject(); // We create the HTTP Object
var rubriek_update_url = "/ajax_update_rubriek.php5?toggle_rubriek="; // The server-side script 

function update_sessie ( rubriek_id ) 
{
		http.open("GET", rubriek_update_url + escape ( rubriek_id ), true );
		http.onreadystatechange = handleHttpResponse; 
		http.send ( null );
}

function handleHttpResponse ( ) 
{

	if (http.readyState == 4)
	{ 
		if (http.status == 200) 
		{
			results = http.responseText.split("|");
		}
	} 
}


// Returned het httpobject
function getHTTPObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
		try 
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) 
		{
			try 
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (E) 
			{
				xmlhttp = false;
			}
		}
	@else
		xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
		try
		{
				xmlhttp = new XMLHttpRequest();
		} 
		catch (e) 
		{
				xmlhttp = false;
		}
	}
	return xmlhttp;
}
function submit_zoekformulier (a, b, c)
{
	if ( b != 0 || c != 0 )
	{
		window.location.href = '/search/'+a+'/'+b+'/'+c;
	}
	else
		window.location.href = '/search/'+a;
}
$(document).ready(function()
{
$('#titel_banners').cycle({ 
		fx:      'fade', 
		speed:    2500, 
		timeout:  7000 
	});
});
