function showUserAgreement(atag, title) {
	window.open(atag.href, title, 'scrollbars=yes,resizable=yes,width=800,height=600');
}

function applyErrorStyle(id) {

	if (document.getElementById(id) != null) {
		document.getElementById(id).style.borderColor = "#a01b1c";
		document.getElementById(id).style.borderWidth = "2px";
		document.getElementById(id).style.borderStyle = "solid";
	}

	if (document.getElementById(id + '.box') != null) {

		if (document.getElementById(id) != null) {
			document.getElementById(id).style.borderStyle = "none";
		}

		document.getElementById(id + '.box').style.borderColor = "#a01b1c";
		document.getElementById(id + '.box').style.borderWidth = "2px";
		document.getElementById(id + '.box').style.borderStyle = "solid";
	}
}

function submitOnEnter(form, e) {
  var keycode;
  if(window.event) {
    keycode = window.event.keyCode;
  } else if(e) {
    keycode = e.which;
  } else {
    return true;
  }
  
  if (keycode == 13 && form) {
    form.submit();
    return false;
  } else {
    return true;
  }
}

function checkCookies() {
  if ( !navigator.cookieEnabled ) {
    if ( window.location.href.indexOf('cookieerror.action') == -1 ) {
      window.location = '/vuokraovi/cookieerror.action';
    }
  }
}