
// hoverbox functionality
$(document).ready(function(){
	$(".hoverBox").hover(function(){
		$(this).children(".hoverBoxImage").children(".hoverBoxDetails").fadeIn("fast"); 
	},function(){
		$(this).children(".hoverBoxImage").children(".hoverBoxDetails").fadeOut("slow"); 
	});
	$(".hoverBox").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});

});
// pressbox hover functionality
$(document).ready(function(){
	$(".pressBox").hover(function(){
		$(this).children(".pressBoxImage").children(".pressBoxDetails").fadeIn("fast"); 
	},function(){
		 $(this).children(".pressBoxImage").children(".pressBoxDetails").fadeOut("slow"); 
	});
});
$(function() {
	$( "#accordionItems" ).accordion({ active: false, collapsible: true,header: 'h2', autoHeight : false,animated: 'easeslide'});
});


if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
  /*
    $(".hoverBox").bind('touchstart', function(){
		$(this).children(".hoverBoxImage").children(".hoverBoxDetails").fadeIn("fast"); 
    });
    $(".hoverBox").bind('touchend', function(){
		$(this).children(".hoverBoxImage").children(".hoverBoxDetails").fadeOut("slow"); 
    });
	*/
	$(".pressBox").each(function() { 
	               var onClick; // this will be a function
                    var firstClick = function() {
								$(this).children(".hoverBoxImage").children(".hoverBoxDetails").fadeIn("fast"); 

                        onClick = secondClick;
                        return false;
                    };
                    var secondClick = function() {
                        onClick = firstClick;
                        return true;
                    };
                    onClick = firstClick;
                    $(this).click(function() {
                        return onClick();
                    });
     });

}
