  
 if( parent && parent.navigate && parent.left ) {
   top.location.target="_top"
   if(window.location.target!="_top"){
     top.location.href=window.location.href
   }
 }
  
// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
  }

function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}

function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
  
function gotoAnchor(AnchorId, Id) 
{
  var anchor = getAnchorPosition(AnchorId);
  var h = document.getElementById(Id).clientHeight-100;
  var top=0;
  if (anchor.y > h) top = anchor.y-h;
  document.getElementById(Id).scrollTop =top;
}

function PAmaattabel() 
{
  window.open("PAmaattabel.html", "nieuw", "width=680,height=450,scrollbars=yes, resizable=yes");
}

function bestellingstatus()
{
  window.open("bestellingstatus.html", "nieuw", "width=680,height=450,scrollbars=yes, resizable=yes");
}

function legenda()
{
  window.open("legenda.php", "nieuw", "width=480,height=260,scrollbars=yes, resizable=yes");
}

function actiebanner()
{
  window.open("actiebanner.html", "nieuw", "width=580,height=520,scrollbars=yes, resizable=yes");
}

function OpenAlgv()
{
  window.open("Alg_Voorwaarden.php", "nieuw", "width=680,height=450,scrollbars=yes, resizable=yes");
}

function OpenAlgvAanvullend()
{
  window.open("alv_abonnement.html", "nieuw", "width=680,height=450,scrollbars=yes, resizable=yes");
}

function voertuigenlijst()
{
  window.open("voertuigenlijst.htm", "nieuw", "width=981,height=600,scrollbars=yes, resizable=yes");
}

function hondenlijst()
{
  window.open("hondenlijst.htm", "nieuw", "width=981,height=600,scrollbars=yes, resizable=yes");
}

function frmsubmit(oform)
{
   oform.submit();
}

function switchafleveradres(id){
  if (document.aanmelden.afleveradres.checked) {
    document.getElementById(id).style.display = 'block';
  }  
  else {
    document.getElementById(id).style.display = 'none';    
    document.aanmelden.post_bedrijfsnaam.value = '';
    document.aanmelden.post_naam.value = '';
    document.aanmelden.post_adres.value = '';
    document.aanmelden.post_postcode.value = '';
    document.aanmelden.post_woonplaats.value = '';
  }
}

function checkform()
{
  var field = document.aanmelden.klant_naam;
  var correct = true;
  var FirstErrorField = field;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    FirstErrorField = field;
    correct = false;
  }

  field = document.aanmelden.klant_adres;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_postcode;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_woonplaats;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_telefoon;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_email;
  if ( (field.value == '') || 
       (field.value.indexOf("@") == -1) || 
       (field.value.indexOf(" ") > -1)
      ) 
  {
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }
 
  field = document.aanmelden.klant_gebruikersnaam;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_wachtwoord;
  if ( (field.value == '') || (document.aanmelden.klant_herhaal_wachtwoord.value != field.value) ){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }

  field = document.aanmelden.klant_herhaal_wachtwoord;
  if ( (field.value == '') || (document.aanmelden.klant_wachtwoord.value != field.value) ){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    if (correct){
      FirstErrorField = field;
    }
    correct = false;
  }


  if ((document.aanmelden.post_naam.value != '') ||
      (document.aanmelden.post_adres.value != '') ||
      (document.aanmelden.post_postcode.value != '') ||
      (document.aanmelden.post_woonplaats.value != '')  )
  {
    field = document.aanmelden.post_naam;
    if (field.value == ''){
      field.style.backgroundColor = '#FFBBBB';
      field.style.borderColor = '#FF5656';
      if (correct){
        FirstErrorField = field;
      }
      correct = false;
    }

    field = document.aanmelden.post_adres;
    if (field.value == ''){
      field.style.backgroundColor = '#FFBBBB';
      field.style.borderColor = '#FF5656';
      if (correct){
        FirstErrorField = field;
      }
      correct = false;
    }

    field = document.aanmelden.post_postcode;
    if (field.value == ''){
      field.style.backgroundColor = '#FFBBBB';
      field.style.borderColor = '#FF5656';
      if (correct){
        FirstErrorField = field;
      }
      correct = false;
    }

    field = document.aanmelden.post_woonplaats;
    if (field.value == ''){
      field.style.backgroundColor = '#FFBBBB';
      field.style.borderColor = '#FF5656';
      if (correct){
        FirstErrorField = field;
      }
      correct = false;
    }
  }

  if (correct == false){
    FirstErrorField.focus();
  }

  return correct;
}



function checkusernameform()
{
  field = document.usernamechange.klant_gebruikersnaam;
  if (field.value == ''){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    field.focus();    
    return false;
  }
  return true;
}


function checkalgv()
{
  field = document.shopfrm.betaalmethode;
  if (field.options.selectedIndex < 1){
    field.style.backgroundColor = '#FFBBBB';
    field.style.borderColor = '#FF5656';
    alert('Selecteer een betaalmethode!');
    return false;
  }

  field = document.shopfrm.algemenevoorwaarden;
  if (! field.checked){
    var box=window.confirm("Door op ok te drukken gaat u akkoord met de algemene voorwaarden.")
    if(box!=true){ 
      field.style.backgroundColor = '#FFBBBB';
      field.style.borderColor = '#FF5656';
      return false;
    }
  }
  
  /*
  var box=window.confirm("Tot 11 januari 2010 is Pets Passion gesloten. \n\r"+
                         "Bestellingen kunnen wel geplaatst worden, maar worden vanaf 11 januari verwerkt. \n\r\n\r"+
                         "Druk op OK om verder te gaan met het plaatsen van de bestelling.")
  if (box!=true){ 
    return false;
  } 
  */
  
  return true;
}

function ConfirmMaakFactuur(bedrag, status)
{
  var result = true;
  if (bedrag != "0") 
    result = window.confirm('Het resterende bedrag is niet 0, doorgaan?');
  if (status != "4")
    result = window.confirm('De status is niet verzonden, doorgaan?');
  
  if (result)
    document.frmorders.action='index.php?gr=74';
  return result;
}

function ConfirmDeleteBestelling()
{
  return window.confirm('De bestelling wordt verwijderd.');
}

function ConfirmDeleteBestelregel()
{
  return window.confirm('De bestelregel wordt verwijderd.');
}

function ShowPaypalInfo()
{
  alert('Bedankt voor uw bestelling.\n\nU verlaat nu Pets Passion.\nU wordt doorgestuurd naar Paypal.\n\nAls de betaling voltooid is dient u terug te keren naar Pets Passion. \nDe bestelling wordt dan geplaatst.\n\nTer bevestiging van uw bestelling ontvangt u een email. Indien u geen email ontvangt kan het zijn dat er een fout is opgetreden. ');  
}

function isEmpty(field) {
  if (field.value != '') {
    field.style.backgroundColor = '#FFFF95';
    field.style.borderColor = '#19206E';
  }
}


