function toggleView(updateid,toggleview,varnew,related,extras) {
   new Ajax.Updater(updateid, '/createProductsBlock', {parameters:'new:int='+varnew +'&toggleview='+toggleview +'&updateid='+updateid + '&related=' +related + extras} );
}
function toggleCatMenu(varnew) {
 params = 'new:int='+varnew ;
 if (varnew == '0') { params = 'reset:int=1'; }
 new Ajax.Updater('catmenu', '/categoryMenu', {parameters:params} );
 //location.href = location.href + '#m'+varnew;
}

function loadMaps() {
  //google.load("maps", "2", {"callback" : mapsLoaded});
  google.load("maps", "2", {"callback" : load});
}

function initLoader() {
  var script = document.createElement("script");
  script.src = "http://www.google.com/jsapi?key=AABQIAAAAoRXjJsL4TRsKMCh6hu_nTxRRXFdJrC5My3zJSKhqY0A7CgboLxQXg_6mr4H_wEyNSS436nQPkLdEzg&callback=loadMaps";
  script.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(script);
}

function showGMap(product_id) {
 initLoader();
 new Ajax.Updater('icontent', '/showGoogleMap', {parameters:'product_id='+product_id} );
 myIpop.doipop();
} 

//evalScripts:true
function doRequestPrice(product_id,currenturl) {
 new Ajax.Updater('icontent', '/showRequestPriceForm', {parameters:'product_id='+product_id+'&curl=' + encodeURIComponent(currenturl)} );
 myIpop.doipop();
}
function doCheck(form) {
 if ( checkRequest(form) == true ) { form.submit(); }
}
function checkRequest(form) {
 if (!checkinput('name','Please fill in your name',form,type='string') ) {return false} ;
 if (!checkinput('email','Please fill in a correct email address',form,type='email') ) {return false} ;
 if (!checkinput('company','Please fill in your company name',form,type='string') ) {return false} ;
 if (!checkinput('telephone_country','Please fill in your telephone country code',form,type='string') ) {return false} ;
 if (!checkinput('telephone_number','Please fill in your telephone number',form,type='string') ) {return false} ;
 if (!checkinput('request','Please fill in your request',form,type='string') ) {return false} ;
 return true;
}

function checkNBaanmeld( form ) {
  if (form.initialen.value == "") {
    alert( "Please fill in your intials" );
    form.initialen.focus();
    return false ;
  }
  if (form.achternaam.value == "") {
    alert( "Please fill in your surname" );
    form.achternaam.focus();
    return false ;
  }
  if (form.email.value == "") {
    alert( "Please fill in your email address" );
    form.email.focus();
    return false ;
  }
  var emailAdres = form.email.value;
  valid = new RegExp("^[a-zA-Z]+([.]?[a-zA-Z0-9_-]+)*[@]([a-zA-Z0-9_-]+[.])+([a-zA-Z]{2,4})$").exec(emailAdres);
  if(!valid) { 
    alert( "Please fill in a correct email address" );
    form.email.focus();
    return false;
  }

  return true;
}

