/*
 * custom.js
 */

Custom = {};

// Save order into DB and then post Paypay form if is ok
Custom.goPaybox = function ()
{
    var		frm = $('frm-paybox');

    Page.get ('module=order&action=insert', '', function () {
	    if (!isNaN (this.response.text))
		{ 		    
		    frm.PBX_CMD.value = this.response.text;
		    frm.submit();
		}
	}); 
}
    

// Save order into DB and then post Paypay form if is ok
Custom.goAtos = function ()
{
    var		frm = $('frm-atos');

    Page.get ('module=order&action=insert', '', function () {
	    if (!isNaN (this.response.text))
		{ 		    
		    frm.order_id.value = this.response.text;
		    frm.submit();
		}
	}); 
}   

// Reload page with given rim selectors
Custom.viewRim = function (diameter_id, brand_id, model_id)
{
    window.location = U_ROOT + '/?brand_id=' + brand_id + '&model_id=' + model_id + '&diameter_id=' + diameter_id;
}

// View jantes form
Custom.viewJantes = function ()
{
    $('jantes').style.display = "block";
    $('pneus').style.display = "none";
}

// View pneus form
Custom.viewPneus = function ()
{
    $('jantes').style.display = "none";
    $('pneus').style.display = "block";
}
