// enable jQuery compatiblity mode
jQuery.noConflict();

/** category images (bottom of most pages) fade on hover **/
jQuery(document).ready(function(){
    jQuery('.category-picture img').hover(function() {
        jQuery(this).fadeTo(400, 0.2);
    }, function() {
        jQuery(this).fadeTo(500, 1.0);
    });
});

/** gallery images (top of most pages) fade on hover **/
jQuery(document).ready(function(){
    jQuery('#gallery-content img').hover(function() {
        jQuery(this).fadeTo(400, 0.2);
    }, function() {
        jQuery(this).fadeTo(500, 1.0);
    });
});

/** gallery images (top of most pages) fade on hover **/
jQuery(document).ready(function(){
    jQuery('.sliderGallery li').hover(function() {
        jQuery('img', this).fadeTo(400, 0.2);
		jQuery('.comment', this).stop().css("top", "10px");
    }, function() {
        jQuery('img', this).fadeTo(500, 1.0);
		jQuery('.comment', this).stop().css("top", "400px", 600);
    });
});

jQuery(document).ready(function() {
            var container = jQuery('div.sliderGallery');
            var ul = jQuery('ul', container);
            
            var itemsWidth = ul.innerWidth() - container.outerWidth();
                       
            jQuery('.slider', container).slider({
                min: 0,
                max: itemsWidth,
                handle: '.handle',
                stop: function (event, ui) {                     
                    ul.animate({'left' : ui.value * -1}, 500);
                },
                slide: function (event, ui) {
                    ul.css('left', ui.value * -1);
                }
            });
        });

// handle sliders
jQuery(document).ready(function() {
    var itemWidth = jQuery("#gallery-content ul").innerWidth() - jQuery("#gallery-content").outerWidth();
    jQuery('#bar').slider({
        min: 0,
        max: itemWidth,
        slide: function (event, ui) {
            jQuery("#gallery-content ul").css("left", ui.value * -1);
            jQuery("#handle").css("margin-left", ui.value / itemWidth * -300);
        }
    });
});

/** tools form validation **/
function validate_sw(form) {
    if (form.ratio.value == "") {
        alert("Please select your screen ratio!");
        form.ratio.focus();
        return false;
    }
    if (form.afc.value == "") {
        var choice = false;
        for (counter = 0; counter < form.lightlevel.length; counter++) {
            if (form.lightlevel[counter].checked) choice = true;
        }
        if (!choice) {
            alert("Please select your room light level or enter optional ambient foot candles.");
            return false;
        }
    }
    return true;
}

/* navigation menu dropdown */

jQuery(document).ready(function() {
   jQuery('#navigation ul li').hover(function() {
      jQuery('ul', this).show(); 
   },
   function() {
       jQuery('ul', this).hide();
   });
});
