window.onresize = function() {
	sizeMenuDiv();
}

function sizeMenuDiv() {
	var newWidth = ((document.body.clientWidth - 585) / 2);
	newWidth = newWidth - 8;
	document.getElementById('menuDiv').style.width = newWidth + "px";
}

function toggleDivs(showId, hideId) {	
	document.getElementById(showId).innerHTML = '<form action="../add_to_gb.php" method="post" enctype="application/x-www-form-urlencoded" target="_self" onsubmit="MM_validateForm(\'Navn\',\'\',\'R\',\'Email\',\'\',\'NisEmail\',\'Besked\',\'\',\'R\');return document.MM_returnValue"><table cellpadding="0" cellspacing="0" border="0" id="gb_form_table"><tr><td class="legend">Navn:</td><td class="field"><input name="Navn" type="text" id="Navn" /><span class="star"> *</span></td></tr><tr><td class="legend">Email:</td><td class="field"><input name="Email" type="text" id="Email" /><span class="tinyText">Email adressen bliver ikke vist p\u00E5 hjemmesiden!</span></td></tr><tr><td class="legend">Besked:</td><td class="field"><textarea name="Besked" id="Besked" rows="10" cols="1"></textarea><span class="star"> *</span></td></tr><tr><td class="button_clm" colspan="2"><input name="Submit" type="image" src="../shellImages/send_btn.jpg" /></td></tr></table></form>';
	document.getElementById(showId).style.display = "block";
	document.getElementById(hideId).style.display = "none";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function closeAndReturn() {
	window.opener.location.reload();
	window.close();	
}


/* MM's form validation */
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' feltet skal vaere tomt eller vaere en email adresse.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' feltet skal indeholde et nummer.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' feltet skal indeholde et nummer mellem '+min+' og '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' feltet skal udfyldes.\n'; }
    } if (errors) alert('Din besked kan ikke sendes fordi:\n\n'+errors);
    document.MM_returnValue = (errors == '');
} }