/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
// perform JavaScript after the document is scriptable.
$(function() {
    // setup ul.tabs to work as tabs for each div directly under div.panes
    $("ul.tabs").tabs("div.panes > div");
});
function showNext(v) {
    one = getCheckedValue(document.part1.category_one);
    two = getCheckedValue(document.part2_lease.category_two);
    if(two == '') {
        two = getCheckedValue(document.part2_sale.category_two);
    }
    switch (v) {
        case 2:
            $("#part2_sale").hide();
            $("#part2_lease").hide();
            $("#part3").hide();
            document.part2_sale.reset();
            document.part2_lease.reset();
            $("div#part2").fadeIn('slow', function () {});
            $("#part2_"+one).fadeIn('slow', function () {});
            break;
        case 3:
            $("#part3-sale-private").hide();
            $("#part3-lease-private").hide();
            $("#part3-sale-commercial").hide();
            $("#part3-lease-commercial").hide();
            $("#part3-sale-investment").hide();
            $("#part3-lease-holiday").hide();
            $("#part3").fadeIn('slow', function () {
                $("#part3-"+one+'-'+two).fadeIn('slow', function () {});
            });
              break;
    }
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}