﻿function selectHPItem(index) {


	$('.hpanel').css({ display: "none" });
	$('.hpanel:eq(' + index + ')').fadeIn(500);
	$('#fast li').removeClass("hello");
	$('#fast li:eq(' + index + ')').addClass("hello");


}

$(document).ready(function() {
	$(".IntroVideo").colorbox({ width: "700px", height: "500px", iframe: true });
	$("#fast li:eq(3)").css("background", "none").css("width", "299px");

	$('#fast li').each(function(i) {
		$(this).click(function() {
			selectHPItem(i);
			$(this).blur();
			$("#fast li a").blur();
		});
	});
	$('#fast li:first').click();


	$('.drophandle').bind('Open', function() {
		$('.drop', $(this)).css('display', 'block');
	}).bind('Select', function(event, itemText, itemValue) {
		$('span', $(this)).html(itemText);
		$('input:first', $(this)).val(itemValue);
	}).bind('Close', function() {
		$('.drop', $(this)).css('display', 'none');
	}).click(function(event) {
		if ($('.drop', $(this)).css('display') == "none") {
			$(this).trigger('Open');
		}
		else {
			$(this).trigger('Close');
		}

	}).trigger('Close');

	$('.drophandle').each(function(i) {
		var drophandle = $(this);
		$('li', $(this)).click(function() {
			$(drophandle).trigger('Select', [$('div', $(this)).html(), $('input', $(this)).val()])
		})
	});



	$("body").click
        (
            function(e) {
            	if ($(e.target).parent().attr("class") != "drophandle") {
            		//close drop downs if clicked outside            
            		$('.drophandle').trigger("Close")
            	}
            }
        );



	$(".savchooser li a").each(function(i) {

		$(this).click(function() {
			$(".savchooser li a").removeClass("savons");
			$(".savchooser li a:eq(" + i + ")").addClass("savons");

		})
	})




});