var internal = false;

<!-- var properties = '"' + 'titlebar=yes,toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,resizable=yes,fullscreen=yes,width=' + screen.width + ',height=' + screen.height + ',screenX=' + winleft + ', screenY=' + winUp + '"'; -->

function openWindow2(url) {
	var winleft = screen.width;
	var winUp = screen.height;
	var properties = '"' + 'titlebar=yes,toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,resizable=yes,fullscreen=no"'; <!--,width=' + screen.width + ',height=' + screen.height + ',screenX=' + winleft + ', screenY=' + winUp + '"';-->
	
	window.open(url, "popup", properties);
}

function openWindow2(url, width, height, modal) {
	var winleft = (screen.width - width) / 2;
	var winUp = (screen.height - height) / 2;
	var properties = 'resizable=yes,toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,width=' + width +',height=' + height + ',left=' + winleft + ', top=' + winUp;
	if (modal) {
		properties = 'toolbar: no,status: no,scroll: no,resizable: yes, center: yes, dialogWidth: ' + width + ', dialogHeight: ' + height;
		window.showModalDialog(url, self, properties) 
	}
	else
		window.open(url,'window', properties);
}

function confirmCancel(url, target) {
	internal=true;
	if (window.confirm('Er du sikker på at salget skal avbrytes?')) {
		target.location.href=url;
	}
}

function closeWindowEvent()
  {
  	internal=true;
  	return;
  	alert('internal= ' + internal);
  	if (!internal) {
  		alert('window close');
    	event.returnValue = "***** Klikk OK for å lukke vinduet *****";
    } else
    	alert('window not closed');
    	
  }
  
  
function clickOK() {
	<!-- alert('clickOK');-->
	internal=true;	
}

function disabledButton(formName, button) {
	formName.submit();
	button.disabled = true;
}

function enterPressed(button) {
		if ((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
			button.click();
		  return true;
	  } 
    else return false;
}

