function action(action) {
  document.location.href = action;
}

function resizeFlash(height) {
 var flashObj = document.getElementById('flashmenu');//menu
 var menuDiv = document.getElementById('menu');//menu
 flashObj.style.height = height+'px';
 menuDiv.style.height = (height+6)+'px';
}


var contentDiv = null;
var contenttextholder = null;



function AddOnload(myfunc)
{
 if(window.addEventListener)
  window.addEventListener('load', myfunc, false);
 else if(window.attachEvent)
  window.attachEvent('onload', myfunc);
}


function bestel_product(pid) {

	GB_show('', '/site/orderproduct/?pid='+pid, 314, 488);
}

function removeProduct(pid) {

	document.location.href = '?remID='+pid;
}


function registration_confirm() {

	GB_show('', '/site/registration-confirmation', 314, 488);
}

function registration_confirm_reseller() {

	GB_show('', '/site/registration-confirmation-reseller', 314, 488);
}

var xmlHttp = null;
function winkelmandje_div_update() {

	if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest()
	else if (window.ActiveXObject) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    xmlHttp.onreadystatechange = winkelmandje_ProcessRequest; 
    xmlHttp.open( "GET", "/_getKruiwagenStatus.php", true ); 
    xmlHttp.send( null ); 

}

function winkelmandje_ProcessRequest()  
{ 
    if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )  
    { 

        var kw_stat = window.parent.document.getElementById('kruiwagen_status'); 
		setAndExecute(kw_stat,xmlHttp.responseText);
    } 
} 



function order_deliverydays(what) {
	var str = '';
	for(var i=0; i < what.length; i++){
		if (what[i].checked) str+= what[i].value+' ';
	}
	
	
	if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest()
	else if (window.ActiveXObject) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 


	var params = "afleverdag="+str;

    xmlHttp.open( "GET", "/_order_lines.php?"+params, true ); 
	//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp.setRequestHeader("Content-length", params.length);
	//xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(null ); 

}
function orderlines_ProcessRequest()  
{ 

    if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )  
    { 

        var order = window.parent.document.getElementById('order');  
		setAndExecute(order,xmlHttp.responseText);
		winkelmandje_div_update();
    } 
} 
function orderlines_div_update(productID,quantity,type,cat) {

	if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest()
	else if (window.ActiveXObject) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 

    xmlHttp.onreadystatechange = orderlines_ProcessRequest;

	var params = "type="+type+"&product="+productID+"&quantity="+quantity+"&cat="+cat;

    xmlHttp.open( "GET", "/_order_lines.php?"+params, true ); 
	//xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp.setRequestHeader("Content-length", params.length);
	//xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.send(null ); 



}

function setAndExecute(div, innerHTML)   
{   
   div.innerHTML = innerHTML;   
   var x = div.getElementsByTagName("script");    
   for(var i=0;i<x.length;i++)   
   {   
       eval(x[i].text);   
   }   
}  
