volgnummers = new Array();
tomhideall = setTimeout('mhide(0);',mHideAfter);
clearTimeout(tomhideall);

function getHTTPObject() {
    if (typeof XMLHttpRequest != 'undefined') {
        return new XMLHttpRequest();
    }
    try {
        return new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
    return false;
}
function ajaxRun(url, callback, method, qs, noAsync, passXMLObj){
	if(!noAsync){
		noAsync = false;
	}
 
	var xmlHttp = null;
	xmlHttp = getHTTPObject();
	if(xmlHttp == null){
		window.status = "Your browser does not support AJAX!";
		return;
	}
	//url = clientURL() + url;
	if(method=="GET"){
		url = url + "?" + qs;
	}
	// Check if we're passing the XML object to the callback function
	if(passXMLObj){
		var cb = callback;
		callback = function(){
			var xmlObj = xmlHttp;
			cb(xmlObj);
			return;
		}
	}
	// The magic happens next
	xmlHttp.open( method, url, !noAsync );
	xmlHttp.onreadystatechange = callback;
	if(method=="POST"){
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlHttp.send(qs);
	}else{
		xmlHttp.send(null);
	}
	return;
}

elFadeSiteWarning = false;
function fadeSiteWarning(iFadeSiteWarning){
	if (elFadeSiteWarning){
		switch (iFadeSiteWarning){
			case 0:
				elFadeSiteWarning.style.backgroundColor = '#fcfc22';
				setTimeout('fadeSiteWarning(1);',200);
				break;
			case 1:
				elFadeSiteWarning.style.backgroundColor = '#f9f944';
				setTimeout('fadeSiteWarning(2);',200);
				break;
			case 2:
				elFadeSiteWarning.style.backgroundColor = '#f6f666';
				setTimeout('fadeSiteWarning(3);',200);
				break;
			case 3:
				elFadeSiteWarning.style.backgroundColor = '#f3f388';
				setTimeout('fadeSiteWarning(4);',200);
				break;
			case 4:
				elFadeSiteWarning.style.backgroundColor = '#f0f0aa';
				setTimeout('fadeSiteWarning(5);',200);
				break;
			case 5:
				elFadeSiteWarning.style.backgroundColor = '#eeeeee';
				break;
		}
	}else{
		if (MM_findObj('sitewarning')){
			elFadeSiteWarning = MM_findObj('sitewarning');
			setTimeout('fadeSiteWarning(0);',200);
		}
	}//forget about it
}
EditQuantityInCartOpen = 0;
function EditQuantityInCart(EditQuantityInCartId,EditQuantityInCartEdit){
	//document.forms['shoppingcartform'].elements['qtyselect'+EditQuantityInCartId].options.remove(1);
	document.forms['shoppingcartform'].elements['qtyselect'+EditQuantityInCartId].options[1] = null;
	if (EditQuantityInCartEdit){
		if (EditQuantityInCartOpen == 0){
			EditQuantityInCartOpen = EditQuantityInCartId;
			MM_findObj('quantitycell'+EditQuantityInCartId).childNodes[0].style.display = 'none';
			MM_findObj('quantitycell'+EditQuantityInCartId).childNodes[1].style.display = 'block';
			document.forms['shoppingcartform'].elements['quantity'+EditQuantityInCartId].focus();
			document.forms['shoppingcartform'].elements['quantity'+EditQuantityInCartId].select();
		}else{
			EditQuantityInCart(EditQuantityInCartOpen,false);
			setTimeout('EditQuantityInCart('+EditQuantityInCartId+',true);',250);
		}
	}else{
		if (EditQuantityInCartId > 0){
			EditQuantityInCartOpen = 0;
			MM_findObj('quantitycell'+EditQuantityInCartId).childNodes[1].style.display = 'none';
			MM_findObj('quantitycell'+EditQuantityInCartId).childNodes[0].style.display = 'block';
		}
	}
}
function EditQuantityInCartKeyUp(EditQuantityInCartKeyUpEvent,EditQuantityInCartKeyUpInput){
	key = EditQuantityInCartKeyUpEvent.keyCode || EditQuantityInCartKeyUpEvent.which;
	switch(key){
		case 13: //enter
			EditQuantityInCartKeyUpInput.form.submit();
			break;
		case 27: //escape
			EditQuantityInCart(EditQuantityInCartOpen,false);
			break;
	}
}
function EditQuantityInCartSafari(EditQuantityInCartSafariWhich){
	EditQuantityInCartSafariWhich.options[1] = new Option('Wijzig',0);
}

from = new Array();
mSkins = new Array();
arrrestrictions = new Array();
arrrestrictions[0] = '<img src="img/x.gif" width="'+mIndent+'" height="' + (mItemHeight - 2 * mBorder) + '" align="absMiddle" border="0">'
//arrrestrictions[0] = '';
arrrestrictions[1] = '<img src="img/indicate_restricted.gif" alt="This item is restricted to registered users" width="'+mIndent+'" height="' + (mItemHeight - 2 * mBorder) + '" align="absMiddle" border="0" onMouseOver="this.width=10;clearTimeout(tomhideall);" onMouseOut="this.width='+mIndent+';tomhideall = setTimeout(\'mhide(0);\',mHideAfter);">'
arrrestrictions[2] = '<img src="img/indicate_restricted.gif" alt="This item is restricted to validated users" width="'+mIndent+'" height="' + (mItemHeight - 2 * mBorder) + '" align="absMiddle" border="0" onMouseOver="this.width=10;clearTimeout(tomhideall);" onMouseOut="this.width='+mIndent+';tomhideall = setTimeout(\'mhide(0);\',mHideAfter);">'

imgMargin = '<img src="img/x.gif" width="'+mIndent+'" height="'+(mItemHeight - 2 * mBorder)+'" align="'+imgAlign+'" border="0">';

GoEditTimeout = setTimeout('GoEdit(false,false,false);',5000);
clearTimeout(GoEditTimeout);
//clearTimeout(GoEditTimeout);
OldFromElement = false;
function GoEdit(FromElement,Link,sh,pass){ if (event){ event.cancelBubble = true; } if (isAdmin){
	EditElement = MM_findObj('mEdit');
	IndicationElement = MM_findObj('mIndicate');
	if (sh){
		clearTimeout(GoEditTimeout);
		//FromElement.style.border = 'solid 1px '+color;
		//if (OldFromElement){ OldFromElement.style.border = 'none'; }
		IndicationElement.style.width = FromElement.offsetWidth;
		IndicationElement.style.height = FromElement.offsetHeight;
		EditElement.innerHTML = Link;
		positionLayer(EditElement,findPosX(FromElement),findPosY(FromElement),4);
		EditElement.style.visibility = 'visible';
		if (OldFromElement != FromElement){
			positionLayer(IndicationElement,findPosX(FromElement),findPosY(FromElement),3);
			IndicationElement.style.visibility = 'visible';
		}
		OldFromElement = FromElement;
		GoEditTimeout = setTimeout('GoEdit(false,false,false,1);',500);
	}else{
		if (pass == 1){
			positionLayer(IndicationElement,-2000,-2000);
			IndicationElement.style.visibility = 'hidden';
			GoEditTimeout = setTimeout('GoEdit(false,false,false,2);',4000);
		}else{ //pass == 2
			//if (OldFromElement){ OldFromElement.style.border = 'none';OldFromElement=false; }
			positionLayer(EditElement,-2000,-2000);
			EditElement.style.visibility = 'hidden';
		}
	}
} }
function displayMenuTools(tbid,hide,tbd,tbi,xMenuTools,yMenuTools){ if (isAdmin && !assigningSub){ if (hide){
	document.getElementById('mTools').style.visibility='hidden';
	}else{
	document.getElementById('mTools').style.top=yMenuTools;//yPos+getOffsetFromTop();
	document.getElementById('mTools').style.left=xMenuTools;//xPos-36;//mgetfromleft(tbi);
	document.getElementById('mTools').innerHTML = '<a href="page.asp?id='+tbid+'"><img src="img/adm_view.gif" border="0" ><a href="page_edit.asp?id='+tbid+'"><img src="img/adm_edit.gif" border="0" ></a><a href="scripts/changeseq.asp?i='+tbi+'&tbl=item&id='+tbd+'&tblid=sub"><img src="img/adm_down.gif" border="0" ></a><a href="scripts/changeseq.asp?i='+tbi+'&tbl=item&id='+tbd+'&tblid=sub&end=1"><img src="img/adm_bottom.gif" border="0" ></a><a href="scripts/changeseq.asp?i='+tbi+'&tbl=item&id='+tbd+'&tblid=sub&end=-1"><img src="img/adm_top.gif" border="0" ></a>'
	document.getElementById('mTools').style.visibility='visible';
} } }//only admins get tools
remember = new Array();

//only used in form_viewentries for now:
function xml(id){ row = (document.all)?document.all['lyr'+id]:document.getElementById('lyr'+id);
	if (!remember[id]){ remember[id] = true; args = xml.arguments; l = ''; 
	for (i=1; i<args.length; i++){ l=l+'<td valign="top" width="25%" style="border:solid 1px #cccccc;">'+args[i]+'</td>'; if (i%4==0){ l=l+'</tr><tr>'; } }//else
	//if (i%4==3 && i>4){ i++; l=l+'<td><a href="adm_vod.asp?orderid='+args[i]+'">[View order]</a></td></tr><tr>'; } }
	row.innerHTML = '<table width="100%"><tr>'+l+'</tr></table>';
	}else{ remember[id] = false; row.innerHTML = ''; }
}

function enlargepic(urlofthepic){
	if (window.loaded) {
		var enlargepicwindow = window.open('enlargepic.asp?upload'+urlofthepic,'enlargepicwindow','width=100,height=10,status,scrollbars,resizable');
		enlargepicwindow.focus();
	}
}
function openflashpopup(openflashpopuptype,openflashpopupurl,openflashpopupwidth,openflashpopupheight,openflashpopupt){
	if (window.loaded) {
		var flashpopupwindow = window.open('flashpopup.asp?type='+openflashpopuptype+'&url='+openflashpopupurl+'&t='+openflashpopupt,'flashpopupwindow','width='+(openflashpopupwidth+22)+',height='+(openflashpopupheight+22)+',status,scrollbars,resizable');
		flashpopupwindow.focus();
	}
}

function printOrder(orderIdToPrint){
	orderWindow = window.open('printorder.asp?orderid='+orderIdToPrint,'orderWindow','width=400,height=400,resizable,scrollbars,status');
	orderWindow.focus();
}

function SameLevelExpand(openexpansion){
	if (SameLevelMenuOffsetHeight){
		divSameLevelMenu = document.getElementById('SameLevelMenuId');
		if (openexpansion){
			divSameLevelMenu.style.height = SameLevelMenuOffsetHeight + smallMargin;// + ((document.all)?2*smallMargin:0);
		}else{
			divSameLevelMenu.style.height = 20;// - ((document.all)?0:2*smallMargin);
		}
	}
}

var SameLevelMenuOffsetHeight = false;
function sameLevelMenu(){
	if (window.loaded) {
		divSameLevelMenu = document.getElementById('SameLevelMenuId');
		divSameLevelMenuDuplicate = document.createElement('DIV');
		divSameLevelMenuDuplicate.innerHTML = divSameLevelMenu.innerHTML;
		divSameLevelMenuDuplicate.style.position = 'absolute';
		divSameLevelMenuDuplicate.style.visibility = 'hidden';
		divSameLevelMenuDuplicate.style.left = '0px';
		divSameLevelMenuDuplicate.style.top = '0px';
		divSameLevelMenuDuplicate.style.width = divSameLevelMenu.offsetWidth;
		divTemp = divSameLevelMenu.parentNode;
		divTemp.insertBefore(divSameLevelMenuDuplicate,divTemp.childNodes[0]);
		SameLevelMenuOffsetHeight = divSameLevelMenuDuplicate.offsetHeight;
		divTemp.removeChild(divTemp.childNodes[0]);
	}else{
		setTimeout('sameLevelMenu();',800);
	}
}

document.onmousedown = function(e){
	var clickedOn = (e)?e.target:event.srcElement; // Correct or IE
	while (clickedOn.tagName != 'A' && clickedOn.tagName != 'BODY'){
		clickedOn = clickedOn.parentNode;
	}
	if (clickedOn.parentNode.id.substr(0,8) != 'menuItem' && !isAdmin){
		clearTimeout(tomHideAll);
		clearTimeout(tomHideAll);
		startMenu();
	}
}




