/*!
 * 
 * Portamento  v1.1.1 - 2011-09-02
 * http://simianstudios.com/portamento
 *   
 * Copyright 2011 Kris Noble except where noted.
 * 
 * Dual-licensed under the GPLv3 and Apache 2.0 licenses: 
 * http://www.gnu.org/licenses/gpl-3.0.html
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 */
/**
 * 
 * Creates a sliding panel that respects the boundaries of
 * a given wrapper, and also has sensible behaviour if the
 * viewport is too small to display the whole panel.
 * 
 * Full documentation at http://simianstudios.com/portamento
 * 
 * ----
 * 
 * Uses the viewportOffset plugin by Ben Alman aka Cowboy:
 * http://benalman.com/projects/jquery-misc-plugins/#viewportoffset
 * 
 * Uses a portion of CFT by Juriy Zaytsev aka Kangax:
 * http://kangax.github.com/cft/#IS_POSITION_FIXED_SUPPORTED
 * 
 * Uses code by Matthew Eernisse:
 * http://www.fleegix.org/articles/2006-05-30-getting-the-scrollbar-width-in-pixels
 * 
 * Builds on work by Remy Sharp:
 * http://jqueryfordesigners.com/fixed-floating-elements/
 * 
 */
(function($){
 
			$(function( ) { 
				$('.box').hover( function( ) {
					$(this).stop().animate( {backgroundPositionX: '-400px' }, 200 );
				} );
				$('.box').mouseleave( function( ) {
					$(this).stop().animate( {backgroundPositionX: '0px' }, 200 );
				});
				$("select").change(function() {
					calculate();
				});
			
				$("input").change(function() {
					calculate();
				});
				calculate( );
				// Datepicker
				$('#datepicker').datepicker({ dateFormat: 'dd/mm/yy' });
			} );
			
})(jQuery);

function calculate() {
			var dat = $("#getstarted").serialize();
			
			$.ajax({
			type: "POST",
			url: "ajax.php",
			data: dat,
			success: function(msg){
				$("#quotation").html(msg);
			}
			});
			return false;
}

function ShowHide(inputname, layername) {
	var value = $('input:radio[name='+inputname+']:checked').val();

	if (value == 'yes')
		$('#' + layername).css('display', 'block' );
	else
		$('#' + layername).hide(0);

	
	/*   

	*/
}

// swap layers depending radio values
function ShowHideSwap(inputname, layername1, layername2) {
	var value = $('input:radio[name='+inputname+']:checked').val();

	if (value == 'yes') {
		$('#' + layername2).hide();
		$('#' + layername1).show();
	}
	else
	{
		$('#' + layername1).hide();
		$('#' + layername2).show();
	}
}
function ResetForm() 
{
   $("#rb").click();
   calculate();
}
