window.addEvent('domready', function() {
    
    var calculate = document.getElementById('calculate');
    
    if (calculate != null)
    {
        calculate.style.display = 'none';
    }
    
    $('instantquote').addEvent('submit', function(e) {
	   /* Prevent the submit event */
	   new Event(e).stop();

        GetPricing();
    });
    
    $('instantquote').getElements('input[type=checkbox]').addEvent('click', function(e) {
    
        GetPricing();
        
    });
    
    $('instantquote').getElements('input[type=radio]').addEvent('click', function(e) {
    
        GetPricing();
        
    });
    
});

function GetPricing()
{
    if ($('extras1').get('checked')) {
        var Bookings = $('extras1').get('value');
    }
    else {
        var Bookings = "";
    }
    
    if ($('extras2').get('checked')) {
        var CanididateAccess = $('extras2').get('value');
    }
    else {
        var CanididateAccess = "";
    }
    
    if ($('extras3').get('checked')) {
        var ClientAccess = $('extras3').get('value');
    }
    else {
        var ClientAccess = "";
    }
    
    if ($('extras4').get('checked')) {
        var JobsBoard = $('extras4').get('value');
    }
    else {
        var JobsBoard = "";
    }
    
    if ($('extras5').get('checked')) {
        var Website = $('extras5').get('value');
    }
    else {
        var Website = "";
    }
    
    if ($('standard').get('checked')) {
        var Hosting = $('standard').get('value');
    }
    else {
        var Hosting = $('premium').get('value');
    }
    
	new Request.HTML({
		url: "javascript/instantquote_ajax.php",
		update: $('yourprice')
	}).post({'1': Bookings, '2': CanididateAccess, '3': ClientAccess, '4': JobsBoard, '5': Website, 'Hosting': Hosting})
        $('yourprice').set('tween', {duration: 2000});
        $('yourprice').highlight('#faecae');
	
	new Request.HTML({
		url: "javascript/tailoredquote_ajax.php",
		update: $('youhaveselected')
	}).post({'1': Bookings, '2': CanididateAccess, '3': ClientAccess, '4': JobsBoard, '5': Website, 'Hosting': Hosting});
}