/*----------------------------------------\
|                Functions                |
|-----------------------------------------|
|    For Delfi (http://www.delfi.dk/)     |
|-----------------------------------------|
| This script is  provided as is  without |
| any warranty whatsoever. It may be used |
| free of charge for non commerical sites |
| For commerical use contact  the  author |
| of this script for further details.     |
|-----------------------------------------|
| Created 2001-11-06 | Updated 2001-11-06 |
\----------------------------------------*/

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
  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=MM_findObj(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+' skal indeholde en email-adresse.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' skal indeholde et tal.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' skal indeholde et tal mellem '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' skal udfyldes.\n'; }
  } if (errors) alert('Følgende fejl opstod:\n'+errors);
  document.MM_returnValue = (errors == '');
}

var f_loaded = true;


theDate= new Date();
days = new Array();

days[1] ="_img/jul/dec01.gif";
days[2] ="_img/jul/dec02.gif";
days[3] ="_img/jul/dec03.gif";
days[4] ="_img/jul/dec04.gif";
days[5] ="_img/jul/dec05.gif";
days[6] ="_img/jul/dec06.gif";
days[7] ="_img/jul/dec07.gif";
days[8] ="_img/jul/dec08.gif";
days[9] ="_img/jul/dec09.gif";
days[10] ="_img/jul/dec10.gif";
days[11] ="_img/jul/dec11.gif";
days[12] ="_img/jul/dec12.gif";
days[13] ="_img/jul/dec13.gif";
days[14] ="_img/jul/dec14.gif";
days[15] ="_img/jul/dec15.gif";
days[16] ="_img/jul/dec16.gif";
days[17] ="_img/jul/dec17.gif";
days[18] ="_img/jul/dec18.gif";
days[19] ="_img/jul/dec19.gif";
days[20] ="_img/jul/dec20.gif";
days[21] ="_img/jul/dec21.gif";
days[22] ="_img/jul/dec22.gif";
days[23] ="_img/jul/dec23.gif";
days[24] ="_img/jul/dec24.gif";
days[25] ="_img/jul/dec24.gif";
days[26] ="_img/jul/dec24.gif";
days[27] ="_img/jul/dec24.gif";
days[28] ="_img/jul/dec24.gif";
days[29] ="_img/jul/dec24.gif";
days[30] ="_img/jul/dec24.gif";
days[31] ="_img/jul/dec24.gif";

function printDate() {
	if (theDate.getMonth() != 11) {
		document.write('<img src="_img/jul/dec00.gif" border ="0" usemap="#MapDays">'); // day
		document.write('<br>'); // bottom
	}else{
		document.write('<img src="' + days[theDate.getDate()] + '" border ="0" usemap="#MapDays">'); // day
		document.write('<br>'); // bottom
		}
}

//Tilføjet af TM 3/3-2005 for bestilling
function setAntal(varenr,antal)
{
	location.href="bestilling.asp?varenr=" + varenr + "&antal=" + antal;
}
function toem()
{
	if(confirm("Vil du slette indholdet fra din indkøbsseddel?")) 
		location.href="bestilling.asp?action=toem";
}
function printbestilling()
{
	window.open("bestillingprint.asp","PrintWindow","width=649;");
}
function sletvare(varenr,tekst)
{
	if(confirm("Vil du fjerne ' " + tekst + " ...' fra sedlen?"))
		location.href="bestilling.asp?action=slet&varenr=" + varenr;
}

function CheckBlankFind()
{
	if (document.search.find.value.length < 3)
	{
		alert ("Skriv venligst et søgeord \npå minimum 3 tegn !");
		return false;
	} 
	else
		return true;
}
