function showCategory(value)
{
    $('#Optionvalues-'+value).show('slow');
}

function hideCategory(value)
{
    $('#Optionvalues-'+value).hide('slow');
}

function closeFancybox()
{
    $.fancybox.close();
}

$(document).ready(function() {

    $('#more_btn').click(function() {
      $('#more_payment').show();
    });

    $("#RequestMoreInfo").fancybox();

    $("#ScheduleATestDrive").fancybox();

    $("#TellAFriend").fancybox();

    $("#threesixty").fancybox();

    $("#Similar").fancybox();

    $("#Credit").fancybox();

    $("#CarProof").fancybox();

    $(".option_cat").bind({
    	'click': function() {
    		var cat = $(".option_cat").index(this);
    		if ($(this).find("span").html() == "+")
    		{
	    		$("#option").find("ul:eq("+cat+")").slideDown("slow");
	    		$(this).find("span").html("-");
    		}
    		else
    		{
    			$("#option").find("ul:eq("+cat+")").slideUp("slow");
	    		$(this).find("span").html("+");
    		}
    	},
    	'mouseover': function() {
    		$(this).css({'cursor': 'pointer', 'background':'#ececec'});
    	},
    	'mouseout': function() {
    		$(this).css({'background':"none"})
    	}
    });
    float_boundary(border_left,ext_margin);

    $(".cert_img").tooltip({effect: 'slide'});

    $("#back_top").click(function() {
    	$('html, body').animate({scrollTop:0}, 'slow');
    });
});

$(window).resize(function() {
	float_boundary(border_left, ext_margin);
});

function float_boundary(element, ext_margin) {
	element = (typeof element == 'undefined') ? '#detail':element;
	ext_margin = (typeof element == 'undefined') ? 0:parseInt(ext_margin);

	var boundary_left = $(element).position().left - 80 + ext_margin;
	$("#float_box").css({"left":boundary_left+"px"});

	var top_btn_boundary = $(element).position().left - 120 + ext_margin;
	$("#back_top").css({"left":top_btn_boundary+"px"});

}



var galleryvideostate = 'video';
function showGalleryVideo()
{

    $('#gallery').toggle();
    $('#Videocontent').toggle();
    var gallery = $('#GalleryMenu');
    if (gallery.html() == 'Video') {
        gallery.html('Gallery');
    } else {
        gallery.html('Video');
    }
/*
    if(galleryvideostate == 'video')
    {
        galleryvideostate = 'gallery';
        document.all.gallery.style.display =  'block';
        document.all.Videocontent.style.display = 'none';
        document.all.GalleryMenu.innerHTML = 'Video';

    }
    else
   {
        galleryvideostate = 'video';
        document.all.gallery.style.display =  'none';
        document.all.Videocontent.style.display = 'block';
        document.all.GalleryMenu.innerHTML = 'Gallery';
   }
*/
}
