
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Site Library  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Site Library:	functies die door de voorkant van deze site worden gebruikt. /////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//highlight van images
function ImgChange(wiID) {
	if (document.images['menu' + wiID].src == eval('menuoff' + wiID + '.src')){
		document.images['menu' + wiID].src = eval('menuon' + wiID + '.src');
	} else {
		document.images['menu' + wiID].src = eval('menuoff' + wiID + '.src');
	}
}

function showBodyHeight()
{
	alert(document.body.scrollHeight);
}

function showWindowHeight()
{
	alert(document.documentElement.scrollHeight);
}

function showScroll()
{
	if (document.body.scrollHeight > document.documentElement.scrollHeight) {
		return true;
	} else {
		return false;
	}
}

function sameInfo(){
	if(document.bookingfrm.sameasconsignee.checked){
		document.bookingfrm.notifyname.value = document.bookingfrm.consigneename.value;
		document.bookingfrm.notifycontact.value = document.bookingfrm.consigneecontact.value;
		document.bookingfrm.notifyaddress.value = document.bookingfrm.consigneeaddress.value;
		document.bookingfrm.notifyphone.value = document.bookingfrm.consigneephone.value;
		document.bookingfrm.notifyfax.value = document.bookingfrm.consigneefax.value;
		document.bookingfrm.notifyemail.value = document.bookingfrm.consigneeemail.value;
	}
	else{
		document.bookingfrm.notifyname.value = '';
		document.bookingfrm.notifycontact.value = '';
		document.bookingfrm.notifyaddress.value = '';
		document.bookingfrm.notifyphone.value = '';
		document.bookingfrm.notifyfax.value = '';
		document.bookingfrm.notifyemail.value = '';
	}
}

function enableTempAndVent(){
	document.bookingfrm3.temp.disabled=false;
	document.getElementById('templabel').className = 'enabled';
	document.getElementById('tempunit').className = 'enabled';
	document.bookingfrm3.vent.disabled=false;
	document.getElementById('ventlabel').className = 'enabled';
	document.getElementById('ventunit').className = 'enabled';
}

function disableTempAndVent(){
	document.bookingfrm3.temp.disabled=true;
	document.bookingfrm3.temp.value='';
	document.bookingfrm3.temp.className='small';
	document.getElementById('templabel').className = 'disabled';
	document.getElementById('tempunit').className = 'disabled';
	document.bookingfrm3.vent.disabled=true;
	document.bookingfrm3.vent.value='';
	document.bookingfrm3.vent.className='small';
	document.getElementById('ventlabel').className = 'disabled';
	document.getElementById('ventunit').className = 'disabled';
}

function enableType(){
	var typeSel = document.getElementById('type');
	var i;
	document.bookingfrm3.type.disabled=false;
	document.getElementById('typelabel').className = 'enabled';
	if (document.bookingfrm3.type.value == 'Reefer'){
		enableTempAndVent();
	}
	if(typeSel.options[0].value == ''){
	    for (i = typeSel.length - 1; i>=0; i--) {
	   		if (typeSel.options[i].selected) {
		      typeSel.remove(i);
		    }
		}
		document.bookingfrm3.type.options[0].selected = true;
	}

}

function disableType(){
	var typeSel = document.getElementById('type');
	var emptyOption = document.createElement('option');
    emptyOption.text = '';
    emptyOption.value = '';

	document.bookingfrm3.type.disabled=true;
	document.getElementById('typelabel').className = 'disabled';
	try{
		typeSel.add(emptyOption, typeSel.options[0]); //standards compliant; not in IE
	}catch(ex){
		typeSel.add(emptyOption, 0); //IE only
	}
	document.bookingfrm3.type.options[0].selected = true;
	disableTempAndVent();
}

function toggleIMDG(){
	var status = document.bookingfrm3.imo.disabled;
	if(status == true){
		document.getElementById('imolabel').className = 'enabled';
	}else{
		document.getElementById('imolabel').className = 'disabled';
		document.getElementById('imo').className = 'imo';
		document.bookingfrm3.imo.value = '';
	}
	document.bookingfrm3.imo.disabled = !status;
}

function enableSpecifyPlace(){
	document.bookingfrm4.specific.disabled=false;
	document.getElementById('specificlabel').className = 'enabled';
}

function disableSpecifyPlace(){
	document.bookingfrm4.specific.disabled=true;
	document.getElementById('specificlabel').className = 'disabled';
	document.bookingfrm4.specific.value = '';
}

function confirmDelete(wsRedirect){
	var answer = confirm('Are you sure you want to delete this commodity?')
	if(answer){
		window.location = wsRedirect;
	}else{
	}
}

// If the element's string matches the regular expression it is all numbers
function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		//alert(helperMsg);
		elem.className = 'LV_invalid_field';
		return false;
	}
}



