function showOptions()
{
	if(document.getElementById('options_verzendkosten').style.display == 'none')
		document.getElementById('options_verzendkosten').style.display = 'block';
	else
		document.getElementById('options_verzendkosten').style.display = 'none';
}
/*function setOptionsTimer()
{
	setTimeout("$('options_verzendkosten').style.display = 'none'", 1000);
}*/
function setSelected(options_id)
{
	document.getElementById('selected_verzendkosten').innerHTML = document.getElementById(options_id).innerHTML;
	var land_id = options_id.replace('option_', '');
	document.getElementById('leverdag').value = land_id;
}
function hideOptions()
{
	document.getElementById('options_verzendkosten').style.display = 'none';
}

function timehideOptions()
{
	setTimeout("hideOptions();", 1000);
}



function giveNamePrice(el_id,aantal_lines) {
	var artikelnummer = document.getElementById("artikelnummer_" + el_id).value;
	var aantal = parseInt(document.getElementById("aantal_" + el_id).value);
	
	
	var httpRequest;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType) {
                httpRequest.overrideMimeType('text/xml');
                // See note below about this line
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) {
                try {
                    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch (e) {}
            }
        }

        if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        httpRequest.onreadystatechange = function() { returnNamePrice(httpRequest, el_id,aantal_lines); };
        httpRequest.open('GET', "/fastorder_ajax.php?a="+artikelnummer+"&c="+aantal, true);
        httpRequest.send('');
	
	
}


function returnNamePrice(httpRequest,el_id,aantal_lines) {

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {
            	var result  = httpRequest.responseText.split("||");

            	if (result[1]) {
	            	document.getElementById('omschrijving_'+el_id).innerHTML = result[0];
	            	document.getElementById('prijs_'+el_id).innerHTML = result[1];
	            	document.getElementById('prijs_hidden_'+el_id).value = result[2];
	            	calcTotal(aantal_lines);
            	}
            } 
        }

}


function calcTotal(aantal_lines) {
	total = 0;
	for (var i=0;i<aantal_lines;i++) {
		if (document.getElementById('prijs_hidden_'+i).value)
			total = total + parseFloat(document.getElementById('prijs_hidden_'+i).value);
	}
	
	
	total = total.toFixed(2)+'';
	var tmp = total.split(".");
	
	document.getElementById('total').innerHTML = '<table cellpadding=0 cellspacing=0><tr><td class="main" valign="bottom" style="padding-bottom: 3px; padding-right: 20px;">Totaal prijs: </td><td class="products_price2" valign="bottom">'+tmp[0]+',</td><td class="products_price" style="padding-top: 3px;" valign="top">'+tmp[1]+'</td></tr></table>';
}

function showSave(id){
	
	if(document.getElementById('save_'+id).style.display == 'none'){
		
		document.getElementById('save_'+id).style.display = 'block';
		
	}
	
}

function showOptions2()
{
	if(document.getElementById('options_verzendkosten2').style.display == 'none')
		document.getElementById('options_verzendkosten2').style.display = 'block';
	else
		document.getElementById('options_verzendkosten2').style.display = 'none';
}
/*function setOptionsTimer()
{
	setTimeout("$('options_verzendkosten').style.display = 'none'", 1000);
}*/
function setSelected2(options_id)
{
	document.getElementById('selected_verzendkosten2').innerHTML = document.getElementById(options_id).innerHTML;
	var land_id = options_id.replace('option_', '');
	document.getElementById('sort').value = land_id;
}
function hideOptions2()
{
	document.getElementById('options_verzendkosten2').style.display = 'none';
}

function timehideOptions2()
{
	setTimeout("hideOptions2();", 1000);
}

function showSave2(id){
	
	if(document.getElementById('save_'+id).style.display == 'none'){
		
		document.getElementById('save_'+id).style.display = 'block';
		
	}
	
}


bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      return false
   } else if (bIE && (event.button >1)) {
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;

