jQuery(document).ready(function() {
    jQuery('img').each(function() {
            jQuery(this).hover(function() {
                jQuery(this).stop().animate({ opacity: 0.7 }, 250);
            },
           function() {
               jQuery(this).stop().animate({ opacity: 1.0 }, 250);
           });
    });
});

// global broser variables
var myGlobals = {
	//True if device is an iPhone
	uaiphone:   (navigator.userAgent.toLowerCase().indexOf('iphone')!='-1'),
	//True if device is an iPad
	uaipad:     (navigator.userAgent.toLowerCase().indexOf('ipad')!='-1'),
    //True if device is Android-based
    uadroid:     (navigator.userAgent.toLowerCase().indexOf('android')!='-1'),
}

jQuery(document).ready(function () {
if(myGlobals.uaiphone || myGlobals.uadroid){
	jQuery("#nav").css("top", "129px");
} else {
    jQuery("#nav").css("top", "17px");
    var menuDown = false;
    var menuPause = 500;
    var waiting = false;
    jQuery("#nav-hitarea").mouseover(function () {
        if (!waiting) {
            if (!menuDown) {
                menuDown = true;
                jQuery("#nav,#nav-hitarea").animate({
                    "top": "+=112px"
                }, "fast")
            } else {
                menuDown = false;
                waiting = true;
                setTimeout(function () {
                    jQuery("#nav,#nav-hitarea").animate({
                        "top": "-=112px"
                    }, "slow", "swing", function () {
                        waiting = false
                    })
                }, menuPause)
            }
        }
        return false
    })
}
});

jQuery(document).ready(function () {
    jQuery('ul.folio-nav a').click(function () {
        jQuery('ul.folio-nav .current').removeClass('current');
        jQuery(this).parent().addClass('current');
        var filterVal = jQuery(this).text().toLowerCase().replace(' ', '-');
        if (filterVal == 'all') {
            jQuery('ul.folio-list li.hidden').fadeTo("1000", 1).removeClass('hidden')
        } else {
            jQuery('ul.folio-list li').each(function () {
                if (!jQuery(this).hasClass(filterVal)) {
                    jQuery(this).fadeTo("1000", 0.1).addClass('hidden')
                } else {
                    jQuery(this).fadeTo("1000", 1).removeClass('hidden')
                }
            })
        }
        return false
    })
});

if(myGlobals.uaiphone || myGlobals.uaipad  || myGlobals.uadroid){
	jQuery(document).ready(function () {
		jQuery('.work-txt').show();
		jQuery('.folio-txt').show();
		jQuery('.blog-txt').show();
		jQuery('.photo-txt').show();
	});
} else {

jQuery(document).ready(function() {
    jQuery('.work-fade').each(function() {
            jQuery(this).hover(function() {
                jQuery('.work-txt').fadeIn("slow");
            },
           function() {
               jQuery('.work-txt').fadeOut("slow");
           });
    });
});
jQuery(document).ready(function() {
    jQuery('.folio-fade').each(function() {
            jQuery(this).hover(function() {
                jQuery('.folio-txt').fadeIn("slow");
            },
           function() {
               jQuery('.folio-txt').fadeOut("slow");
           });
    });
});
jQuery(document).ready(function() {
    jQuery('.blog-fade').each(function() {
            jQuery(this).hover(function() {
                jQuery('.blog-txt').fadeIn("slow");
            },
           function() {
               jQuery('.blog-txt').fadeOut("slow");
           });
    });
});
jQuery(document).ready(function() {
    jQuery('.photo-fade').each(function() {
            jQuery(this).hover(function() {
                jQuery('.photo-txt').fadeIn("slow");
            },
           function() {
               jQuery('.photo-txt').fadeOut("slow");
           });
    });
});
}