function confirmLink(theLink, melding)
{
	if (typeof(window.opera) != 'undefined') {
		return true;
	}
	var is_confirmed = confirm(melding);
	if (is_confirmed) {
		window.location=theLink;
	}
	return is_confirmed;
} 
/*
	Sometimes this version was used. Why?
function confirm_link(link, melding){
	var is_confirmed = confirm(melding);
	if (is_confirmed) {
		window.location = link;
	}
	return true;
} 
*/

/* This function is used in user_invoices_pay */
function confirmsubmiteditform(formname, melding){
	if (typeof(window.opera) != 'undefined') {
		document.getElementById(formname).submit();
		return true;
	}
	var is_confirmed = confirm(melding);
	if (is_confirmed) {
		document.getElementById(formname).submit();
	}
	return true;
} 
/* This function is used in user_invoices_pay */
function submiteditform(formname){
	document.getElementById(formname).submit();
} 

function ShowContent (element){
	buttonname = "button" + element;

    if (document.getElementById(element).style.display == 'none'){
        document.getElementById(element).style.display = 'block';
		link = '<a href="javascript:void(0);" onclick="ShowContent(\'' + element + '\');"> - </a>';
		document.getElementById(buttonname).innerHTML=link;
    } else {
        document.getElementById(element).style.display = 'none';
		link = '<a href="javascript:void(0);" onclick="ShowContent(\'' + element + '\');"> + </a>';
		document.getElementById(buttonname).innerHTML=link;
    }
}

function jumpto(x){
	if (document.form.jumpmenu.value != "null") {
		document.location.href = x
	}
}

function confirmLink_wait(theLink, melding)
{
	if (typeof(window.opera) != 'undefined') {
		return true;
	}
	var is_confirmed = confirm(melding);
	if (is_confirmed) {
		document.getElementById('PleaseWait').style.pixelTop = (document.body.scrollTop + 50);
		document.getElementById('PleaseWait').style.visibility="visible";
		window.location=theLink;
	}
	return is_confirmed;
} 

/*For admin_invoice_edit quickadd */

function submitform_quickadd(product){
  var product_split=product.split("X----X"); 
  document.editform.NEW_product.value=product_split[2];
  document.editform.NEW_price_ex.value=product_split[0];
  document.editform.NEW_quantity.value=product_split[1];
  document.editform.submit();
}

function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

function submitenter(myfield,e){
	var keycode;
	if (window.event)
		keycode = window.event.keyCode;
	else 
		if (e)
			keycode = e.which;
		else 
			return true;
	
	if (keycode == 13){
	   myfield.form.submit();
	   return false;
	} else
	 	return true;
}
