 Ajax.Responders.register({
  onCreate: function() {
    Ajax.activeRequestCount++;
    
    //Element.spinBeside(Element,'Een ogenblik geduld aub'); 
  },
  onComplete: function(req) {

    //document.fire("foo:inithelp");
    Ajax.activeRequestCount--;
    if(Ajax.activeRequestCount == 0){
       // Element.hide('systemWorking');  
       //Element.stopBeside(Element);
    }
  }
});  

     
function updateCategory(catid){

    $('module-resultaat.breadcrumb').style.display = 'block';  
    updateCategoryForElement(catid,'breadcrumb','module-resultaat.breadcrumb');   
    updateCategoryForElement(catid,'gallery','module-resultaat.resultaat');   
    closeProductDetail();         
}

function showProductDetail(){                                         
    $('module-resultaat.resultaat').style.display = 'none';
    $('module-resultaat.detail').style.display = 'block';                                                    
}

function closeProductDetail(){
    showProductSearch();   
}

function showProductSearch(){

    if($('product-details') ){
        if($('product-details') != "undefined" )
            $('product-details').style.display = 'none';                                                     
    }
    
    $('module-resultaat.detail').style.display = 'none';                                                                                                     
    $('module-resultaat.resultaat').style.display = 'block'; 
}

function changeTab(artikelCode,tab,tab_selected){
    
    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'tabchange',
        artikelCode : artikelCode,       
        tab_selected: tab_selected,
        sid:Math.random()
    }
    ).toQueryString();
        
    $(tab).ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params
        }    
    );    
}

function changeViewType(){
    
    showProductSearch();
    
    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'typeSelection',
        type: $F('weergave'),
        sid:Math.random()
    }
    ).toQueryString();
     
    req_parameters = removeValuePairs(req_parameters,'sid','');
    req_parameters = removeValuePairs(req_parameters,'action','');  
    req_parameters = removeValuePairs(req_parameters,'nav_page','');          
    req_parameters = req_parameters + "&" + params;
    
    $('module-resultaat.resultaat').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: req_parameters,
          onComplete: function(){
            Lightview.updateViews();
          }
        }    
    ); 
    
    window.location.hash='#top';        
}

function changeSort(column,direction){
    
    showProductSearch();
    
    if(!column){
        pair = $F('sortering').split("|");
        column = pair[0];
        direction = pair[1];
    }
    
    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'sort',
        column:column,
        direction:direction,
        sid:Math.random()
    }
    ).toQueryString();
    
    req_parameters = removeValuePairs(req_parameters,'sid','');  
    req_parameters = removeValuePairs(req_parameters,'action','');  
    req_parameters = removeValuePairs(req_parameters,'sort',''); 
    req_parameters = removeValuePairs(req_parameters,'direction',''); 
    req_parameters = removeValuePairs(req_parameters,'column',''); 
    req_parameters = req_parameters + "&" + params;
    
    $('module-resultaat.resultaat').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: req_parameters,
          onComplete: function(){
            Lightview.updateViews()  
          }
        }    
    );   
    
    window.location.hash='#top';     
}

function removeValuePairs(params, key,value){
   
     if(params[0] == "?")
        params = params.substr(1);
        
     var pairs = params.split("&");  
     var splitPair;  
     
     res = "";
     // Load the key/values of the return collection  
     for (var i = 0; i < pairs.length; i++) {  
         splitPair = pairs[i].split("=");  

         if(key != splitPair[0]){
 
             if(res.length == 0)
                res = res + "?";
             else
                res = res + "&";
             
             res = res + splitPair[0] + "="  + splitPair[1]   
         }

     }  
   
     return res;        
}

function subproductDetails(artikelCode,parentArtikelCode){

    productDetail(artikelCode,parentArtikelCode,1,0);  
}

function returnToParentProductDetails(artikelCode){
    productDetail(artikelCode,'',0,1);
}

function productDetails(artikelCode){
    
    productDetail(artikelCode,'',0,0);
}

function productDetail(artikelCode,parentArtikelCode,sub,backfromsub){
    
    showProductDetail();
    
    
    
    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'details',
        artikelCode : artikelCode,
        parentArtikelCode : parentArtikelCode, 
        sub: sub,
        backfromsub: backfromsub,
        sid:Math.random()                                      
    }
    ).toQueryString();
    
    $('module-resultaat.detail').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete:function(req){ 
              Lightview.updateViews()
              //getProductPrice(req.request.parameters.artikelCode);
          }
        }    
    );      
    
    return false;
}

function searchProducts(clean,general){

    showProductSearch();
    if(general){
        searchTerms = $F('general_searchterms');
        if($('general_exact'))
            exact = $F('general_exact');  
        else
            exact = 0;        
    }
    else{
        searchTerms = $F('searchterms');
        if($('exact'))
            exact = $F('exact');  
        else
            exact = 0;
    }

    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'search',
        searchTerms : searchTerms,
		exact: exact,   
        sid:Math.random()                                      
    }
    ).toQueryString();
    
    if(clean){
        req_parameters = params;
    }
    else{
        req_parameters = removeValuePairs(req_parameters,'searchTerms',''); 
        req_parameters = req_parameters + '&' + params;
    }
    
    //alert(req_parameters);
    
    
    $('module-resultaat.resultaat').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: req_parameters,
          onComplete:function(){ 
                Lightview.updateViews();    
                
                $('module-resultaat').removeClassName('module-resultaat');
                $('module-resultaat').addClassName('module-resultaat-full');

                $('menu_titel').addClassName('menu_titel_collapse');  
                $('module-info').style.width =  '22px';
               
                
                $('module-infoContents').style.display = 'none';   
                $('module-resultaat.breadcrumb').style.display = 'none';
          }
        }    
    );       
}
   
function updateProductListPage(page){

    showProductSearch();
    
    var url = '/modules/shop/front/server.php';
    //var params = $('form.module-resultaat.resultaat').serialize(true);
    var params=$H(
    {
        action:'navigate',
        nav_page:page,
        sid:Math.random()
    }
    ).toQueryString();
    
    req_parameters = removeValuePairs(req_parameters,'action',''); 
    req_parameters = removeValuePairs(req_parameters,'nav_page',''); 
    req_parameters = removeValuePairs(req_parameters,'sid',''); 
    req_parameters = req_parameters + "&" + params;

    $('module-resultaat.resultaat').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: req_parameters,
          onComplete: function(){
            Lightview.updateViews();  
          }
        }    
    );      
    window.location.hash='#top';  
    //shopApp.promtForNew(params); 
    
}

function updateCategoryForElement(catid,action,elementId){

    var url = '/modules/shop/front/server.php';
    var params=$H(
    {
        catid:catid,
        action:action,
        sid:Math.random()
    }
    ).toQueryString();

    req_parameters = params; 
    
    $(elementId).ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){
            Lightview.updateViews();  
          }
        }    
    );
}

function checkNumber(elId,afname){
    v = $F(elId);
    
    if(isNaN(v) || /^\s+$/.test(v)){
       $(elId).value = afname;
    }
    else{
        if(v == 0){
            $(elId).value = afname;
            v = afname;
        }
            
        if((v % afname) > 0){
           alert('Minimale afname is ' + afname + '. U kunt alleen hier meervouden van kiezen.');
           $(elId).value = afname;
        }
    }
}

function addQuantity(elId,afname){
    $(elId).value = parseInt($F(elId)) + afname;
    
    checkNumber(elId,afname);
}

function removeQuantity(elId,afname){
    
    
    temp = parseInt($F(elId)) - afname;
    if(temp < afname)
        $(elId).value = afname;
    else
        $(elId).value = temp;
    
    checkNumber(elId,afname);
}

function addRelated(div_id){


    
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'addRelated',
        cart_mode: 'simple',
        sid:Math.random()
    }
    ).toQueryString();

    params = params + "&" + $('form_related').serialize();

    $(div_id).ajaxUpdate(
        url,
        {
          method: 'post',
          parameters: params,
          onComplete: showCompleteCart()
        }    
    );    

}

function addToCart(div_id,product_id,quantity){


    cart_mode = 'simple';
    if(div_id == 'winkelmand_container')
        cart_mode = 'extended';
    
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'addToCart',
        product_id:product_id,
        cart_mode: cart_mode,
        quantity:quantity,
        sid:Math.random()
    }
    ).toQueryString();

    if(div_id == 'winkelmand_container'){
        $(div_id).ajaxUpdate(
            url,
            {
              method: 'get',
              parameters: params
            }    
        );
    }
    else{
        $(div_id).ajaxUpdate(
            url,
            {
              method: 'get',
              parameters: params
            }    
        );    
    }

}

function removeFromCart(id,product_id,cart_id){
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'remove',
        product_id: product_id,
        cart_id: cart_id,
        sid:Math.random()
    }
    ).toQueryString();

    
    $(id).ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){
          
                height = $('lightview').getHeight();
                width  = $('lightview').getWidth(); 
          
                if($('winkelmandje-overzicht')){
                    $('winkelmandje-overzicht').setStyle({'width':width-15+'px', 'height':(height*0.45)-5+'px'});  
                }
                
                if($('tab-details-subscribe.content')){
                        $('tab-details-subscribe.content').setStyle({'width':width-15+'px', 'height':(height*0.8)-5+'px'});  
                }                  
                
          }          
          
        }    
    );
}

function updateToCart(id,product_id,quantity,cart_id){

    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'update',
        product_id: product_id,  
        cart_id: cart_id,
        quantity:quantity,
        sid:Math.random()
    }
    ).toQueryString();

    
    $(id).ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){

            height = $('lightview').getHeight();
            width  = $('lightview').getWidth();           
            if($('winkelmandje-overzicht')){
                $('winkelmandje-overzicht').setStyle({'width':width-15+'px', 'height':(height*0.45)-5+'px'});  
                    
            }
            
            if($('tab-details-subscribe.content')){
                    $('tab-details-subscribe.content').setStyle({'width':width-15+'px', 'height':(height*0.8)-5+'px'});  
            }             
            
            
            
          }            
        }    
    );
    
}

function refreshCart(id){
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'refresh',
        sid:Math.random()
    }
    ).toQueryString();

    
    $(id).ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params
        }    
    );
}

function clearCart(){
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'clearCart',
        sid:Math.random()
    }
    ).toQueryString();

    
    $('winkelmand_container').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params
        }    
    );
}

function saveCart(id,name){


    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'save_cart',
        cart_id: id,
        cart_name: name,
        sid:Math.random()
    }
    ).toQueryString();

    
    $('winkelmandje-storebox').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){
            alert('Bestellijst is opgeslagen');
          }

        }    
    );
}

function loadSavedCart(id){
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'load_saved_cart',
        cart_id: id,
        sid:Math.random()
    }
    ).toQueryString();

    
    $('header_cart').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){
            showCompleteCart();
          }

        }    
    );

}

function deleteSavedCart(id){
    var url = '/modules/shop/front/server_cart.php';
    var params=$H(
    {
        action: 'delete_saved_cart',
        cart_id: id,
        sid:Math.random()
    }
    ).toQueryString();

    
    $('order_list_overview').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params
        }    
    );
}

var g_height;
var g_width; 
 
var obj = {

  fx: function(event) {

        height = $('lightview').getHeight(); 
        width  = $('lightview').getWidth(); 
  
        if((g_height != height && g_width != width) || height <= 150 ){

            $$('.lv_External')[0].setStyle({ 'width':width+'px', 'height':height+'px'});    

            g_height = height;
            g_width = width;
            
            setTimeout(function(){
                $('lightview').fire('foo:bar', 'foobarbaz');
            }, 500);                
            
        }
        else{
            
            if($('winkelmandje-overzicht')){
                $('winkelmandje-overzicht').setStyle({'width':width-15+'px','height':(height*0.45)-5+'px'});          
            }
                
            if($('tab-details-subscribe.content')){
                    $('tab-details-subscribe.content').setStyle({'width':width-15+'px', 'height':(height*0.8)-5+'px'});  
            }             
                
            Event.stopObserving($('lightview'), 'foo:bar', obj.bfx);
        }  
  
  }
};
 
 
function switchPersonal(){


    if($('user_choice_subscribe').visible()){
    
        $('user_choice_login').show();
        $('user_choice_subscribe').hide();
        $('tabs_tab_subscribe').removeClassName('active');
        $('tabs_tab_login').addClassName('active');        
        
        valid = new Validation('form_login', {immediate : true, onFormValidate : formCallback,useTitles:true});          
    }
    else if($('user_choice_login').visible()){
    
        $('user_choice_subscribe').show();
        $('user_choice_login').hide();
        $('tabs_tab_subscribe').addClassName('active');
        $('tabs_tab_login').removeClassName('active');
        
        valid = new Validation('form_user', {immediate : true, onFormValidate : formCallback,useTitles:true});          
            Validation.addAllThese([
                    ['validate-url', 'Een correcte adres invullen a.u.b.', function (v) {
                        return Validation.get('IsEmpty').test(v) || v == "http://" || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
                    }],            
                    ['validate-postcode', 'Postcode is niet correct', function (v,elm) {

                        return Validation.get('IsEmpty').test(v) ||  /^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v) 
                    }]
                ]);                             
    }
}   

function goto_checkout(step,substep,action){
    
    var url = '/modules/shop/front/server_cart.php';
    
    var params=$H(
    {
        action: action,
        step: step,
        substep: substep,
        sid:Math.random()
    }
    ).toQueryString();

    
    $('popup_module-resultaat').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){

        
          
                if($('form_checkout')){
                    valid = new Validation('form_checkout', {immediate : true, onFormValidate : formCallback,useTitles:true});          
                }
                else{ 
                    if($('form_user') && $('user_choice_subscribe').visible()){
                        valid = new Validation('form_user', {immediate : true, onFormValidate : formCallback,useTitles:true});          
                        Validation.addAllThese([
                                ['validate-url', 'Een correcte adres invullen a.u.b.', function (v) {
                                    return Validation.get('IsEmpty').test(v) || v == "http://" || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
                                }],            
                                ['validate-postcode', 'Postcode is niet correct', function (v,elm) {

                                    return Validation.get('IsEmpty').test(v) ||  /^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v) 
                                }]
                            ]);                     
                    }
                    else if($('form_login') && $('user_choice_login').visible()){
                        valid = new Validation('form_login', {immediate : true, onFormValidate : formCallback,useTitles:true});          
                    }
                }
                
                  
                
                height = $('lightview').getHeight();
                width  = $('lightview').getWidth(); 
               
         
                    
                if($('winkelmandje-overzicht')){
    
                    $('winkelmandje-overzicht').setStyle({'width':width-15+'px', 'height':(height*0.45)-5+'px'});  
                    
                }
                else if($('tab-details-subscribe.content')){
                    $('tab-details-subscribe.content').setStyle({'width':width-15+'px', 'height':(height*0.8)-5+'px'});  
                }
          }
        }    
    );  

}    
    
function  checkout_goto(step){
    goto_checkout(step,'','show');
}

function checkout_confirm_form(form,nextstep){

        $(form).request({
            onComplete: function(req){ 
                    //if(dialogCounter == 1) 
                        //hideProcessing();  
                    $('popup_module-resultaat').innerHTML = req.responseText; 
                    
                    if($('form_checkout')){  
                        valid = new Validation('form_checkout', {immediate : true, onFormValidate : formCallback,useTitles:true});
                    }
                    else{
                        if($('form_user') && $('user_choice_subscribe').visible()){ 
                            valid = new Validation('form_user', {immediate : true, onFormValidate : formCallback,useTitles:true});   
                            Validation.addAllThese([
                                    ['validate-url', 'Een correcte adres invullen a.u.b.', function (v) {
                                        return Validation.get('IsEmpty').test(v) || v == "http://" || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
                                    }],            
                                    ['validate-postcode', 'Postcode is niet correct', function (v,elm) {

                                        return Validation.get('IsEmpty').test(v) ||  /^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v) 
                                    }]
                                ]);                                
                        }
                        else if($('form_login') && $('user_choice_login').visible()){ 
                            valid = new Validation('form_login', {immediate : true, onFormValidate : formCallback,useTitles:true});          
                        }                    
                    }

                    
                height = $('lightview').getHeight();
                width  = $('lightview').getWidth(); 
                    
                if($('winkelmandje-overzicht')){
    
                    $('winkelmandje-overzicht').setStyle({'width':width-15+'px', 'height':(height*0.45)-5+'px'});  
                    
                }
                else if($('tab-details-subscribe.content')){
                    $('tab-details-subscribe.content').setStyle({'width':width-15+'px', 'height':(height*0.8)-5+'px'});  
                }                         
                    
            }
        }); 
    return false;
}


function showCompleteCart(action){

    if(action && action=='payment'){
        action = action;
    }
    else
        action = 'show';  

    var params=$H(
    {
        action:action,
        sid:Math.random()
    }
    ).toQueryString();

    req_parameters = params;
    
    obj.bfx = obj.fx.bindAsEventListener(obj);

    Event.observe($('lightview'),'foo:bar', obj.bfx);

    Lightview.show({
      href: '/modules/shop/front/server_cart.php',
      rel: 'ajax',
      options: {
        menubar: false,
        innerPreviousNext:false,
        scrolling: false,
        topclose: true,
        autosize: false,     
        ajax: {
          method: 'get',
          parameters: req_parameters, 
          onComplete: function(){ 
           
            $('lightview').fire('foo:bar', 'foobarbaz');     

          }
        }
      }
    });
}

function password_forgotten(form_id,login_box_id,login_box_forgotten_id,name_id,name_forgotten_id){
      
      if($(login_box_id + '_confirm'))
        $(login_box_id + '_confirm').hide();
                    
      $(name_forgotten_id).value = $F(name_id);
      $(login_box_id).toggle(); 
      $(login_box_forgotten_id).toggle(); 
}

function send_password(form_id,login_box_id,login_box_forgotten_id,name_id,name_forgotten_id){
    f_value = $F(name_forgotten_id);

    
    
    var url = '/modules/shop/front/server_user.php';
    var params=$H(
    {
        action: 'send',
        id:f_value,
        sid:Math.random()
    }
    ).toQueryString();

    
    $('passwordforgotten_response').ajaxUpdate(
        url,
        {
          method: 'get',
          parameters: params,
          onComplete: function(){

                 
                 $(form_id).password.value = '';   
                 $(name_id).value = $F(name_forgotten_id);
                 password_forgotten(form_id,login_box_id,login_box_forgotten_id,name_id,name_forgotten_id);
                 if($(login_box_id + '_confirm'))
                    $(login_box_id + '_confirm').show();                 
          }
        }    
    );
}

/* payment functions */

    function checkAgree(){
        return $('agree2').checked;
        //return true;
    }    
    
    function showPaymentDescription(){
          pchoice = $RF('pchoice');  
          if (pchoice != null){ 
          
               switch(pchoice){
                    
                    case 'Buckaroo_ideal': 
                        $('payment_method_description').innerHTML = $('form_description_buckaroo_ideal').innerHTML;
                        break;
                    case 'Buckaroo_incasso':       
                        $('payment_method_description').innerHTML = $('form_description_buckaroo_incasso').innerHTML;                   
                        break;                    
                    case 'Vooruitbetalen': 
                        $('payment_method_description').innerHTML = $('form_description_vooruitbetalen').innerHTML;   
                        break;
                    case 'OpRekening': 
                        $('payment_method_description').innerHTML = $('form_description_oprekening').innerHTML;       
                        break;                    
                    case 'PayPal': 
                        $('payment_method_description').innerHTML = $('form_description_paypal').innerHTML;       
                        break;    
                }          
          }
    }
    
   
    function pay(){
        
        
        if(checkAgree()){
            pchoice = $RF('pchoice');
            
            if (pchoice == null){
                alert("Kies eerst de gewenste betaalmethode");
                return;
            }

           
            switch(pchoice){
                
                case 'Buckaroo_ideal': 
                               
                    var pform = $('form_payment_buckaroo_ideal');
                    
                    $('payment_method_description').innerHTML = $('form_description_buckaroo_ideal').innerHTML;
                    
                    /*if($F('BPE_Issuer') == "" ){
                        alert("Kies eerst de gewenste betaalmethode");
                        return;
                    }                             
                    
                    if($F('BPE_Issuer') == "X" ){
                        alert("U kunt uitsluitend met iDeal betalen\nals u bankiert bij ��n van de genoemde banken.\nSelecteer andere betaalmethode!");
                        //setRadio('pform','pchoice','incasso');
                        return;
                    } */
                    //self.name = "payopener"; 
                    //prevWin = open('','_pay','toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=800, height=600, top=100, left=150');
                    //if (prevWin && !prevWin.closed)
                        //prevWin.focus();

                    pform.submit();                                
                    //submitFormAfterValidate_project(pform.id,0); 
                
                    return true;
                    break;

                case 'Buckaroo_incasso': 
                    
                    var pform = $('form_payment_buckaroo_incasso');           
                    $('payment_method_description').innerHTML = $('form_description_buckaroo_incasso').innerHTML;
                    
                    //self.name = "payopener"; 
                    //prevWin = open('','_pay','toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=800, height=600, top=100, left=150');
                    //if (prevWin && !prevWin.closed)
                       // prevWin.focus();
                    
                    
                    pform.submit();                                
                    //submitFormAfterValidate_project(pform.id,0);
                    return true;                       
                    break;                    
                    
                case 'Vooruitbetalen': 
                    var pform = $('form_payment_vooruitbetalen'); 
                    $('payment_method_description').innerHTML = $('form_description_vooruitbetalen').innerHTML;   
                    
                    pform.submit();

                    break;
                    
                case 'OpRekening': 
                    var pform = $('form_payment_oprekening'); 
                    $('payment_method_description').innerHTML = $('form_description_oprekening').innerHTML;       
                    pform.submit();
                    
                    break;                    
                    
                case 'PayPal': 
                    var pform = $('form_payment_paypal'); 
                    $('payment_method_description').innerHTML = $('form_description_paypal').innerHTML;       
                    pform.submit();
                    
                    // $('paysubscription').submit();
                   //submitFormAfterValidate_project($('paysubscription').id,0);
                    break;   
                
                default : 
                    alert("Het is niet mogelijk om te betalen via deze weg. Neem contact op met de eigenaar.");  
        
            }
        }else{
            alert("U dient alvorens de betaling akkoord te gaan met de Algemene Voorwaarden");
        }
        
    }
    
    
    function showGeneralConditions(buttons){
    
         if($('general_conditions')){
            
            if($(buttons + '_confirm'))
                $(buttons + '_confirm').toggle();
            if($(buttons + '_previous'))
                $(buttons + '_previous').toggle();                
                
            $('payment_container').toggle();
            $('general_conditions').clonePosition($('lightview'));
            $('general_conditions').setStyle({'width':width-20+'px', 'height':height-100+'px'});
            $('general_conditions').toggle();
        }   
    
    }
    
    function loginEnter(e){
        
      if(window.event && e.keyCode == 13){ // IE{
            valid.validate();
      }
      else if(e.which && e.which == 13){ // Netscape/Firefox/Opera{
            valid.validate();
      } 
    }    