function rendermail(user, domain, classname){
  var1=user;
  var2=domain;
  var3=var1+'@'+var2;
  emailE=(var3);
  document.write ('<a class="'+ classname +'" href="mailto:' + emailE + '">' + emailE + '<\/a>');
}

function StartClientMail(user, domain){
  var1=user;
  var2=domain;
  var3=var1+'@'+var2;
  emailE=(var3);
  document.location.href='mailto:' + emailE;
}

function onEnter( evt, frm ) {
	var keyCode = null;

	if( evt.which ) {
		keyCode = evt.which;
	} else if( evt.keyCode ) {
		keyCode = evt.keyCode;
	}
	if( 13 == keyCode ) {
		frm.btnEnter.click();
		return false;
	}
	return true;
}

function getPrintPage(){
	if(document.getElementById('AjrPrintContent') != null){
		var pageP = window.open('/print.asp','Print','width=680, height=650, resizable=1')
	}
}

function printPage(){

	window.document.title = window.opener.document.title;

	var sOut;
	sOut = '';

	if (window.opener.document.getElementById('AjrPrintContent')) {
	  sOut = sOut + window.opener.document.getElementById('AjrPrintContent').innerHTML;
	}

	if (window.opener.document.getElementById('AjrPrintContent2')) {
	  sOut = sOut + '<div style="margin-top: 30px;">' + window.opener.document.getElementById('AjrPrintContent2').innerHTML + '</div>';
	}

	document.getElementById('AjrPrintContent').innerHTML = sOut;
	document.body.style.backgroundImage='none';
	document.body.style.backgroundColor='#ffffff';

	window.print();
}

function checkmyform(me) {
		
	resetfieldclasses(me);
	
	if (me.navn.value==''){alert('Angiv venligst dit navn.'); redalert(me.navn); return false;}
	if (me.adresse.value==''){alert('Angiv venligst adresse.'); redalert(me.adresse); return false;}
	if (me.postnummer.value==''){alert('Angiv venligst dit postnummer.'); redalert(me.postnummer); return false;}
	if (me.by.value==''){alert('Angiv venligst din by.'); redalert(me.by); return false;}
	if (!emailCheck(me.email.value)){alert('Din mailadresse er ikke gyldig.'); redalert(me.email); return false;}
	if (me.antal.value==''){alert('Angiv venligst et antal.'); redalert(me.antal); return false;}
	
	me.submit();

}

function resetfieldclasses(me){
	for ( var i=0;i<me.elements.length;i++ )
	{
		if(me.elements[i].name != ''){
			if( me.elements[i].type=='text' )
			{
			me.elements[i].style.border='1px solid #cccccc';
			}
		}		
	}
}

function redalert(me){
	me.style.border='1px solid red';
	me.focus();
}

function setSelectedIndex( me, valsearch )
{
  for (i = 0; i< me.options.length; i++)
  {
    if (me.options[i].value == valsearch)
    {
      me.options[i].selected = true;
      me.options[i].style.backgroundColor = '#dddddd';
      break;
    }
  }
  return;
}

function showhidediv(id){
	if (document.getElementById(id)){
		if(document.getElementById(id).style.display=='none'){
			document.getElementById(id).style.display='block';
		} else {
			document.getElementById(id).style.display='none';
		}
	}
}