/*
	SCRIPT FOR THE OVERLAY HEADER
*/

$(document).ready(function() {
	
	var isiPad = navigator.userAgent.match(/iPad/i) !== null;	
	if(isiPad){$('#slider').addClass('iPadSlider');}	
	var clickEvent = (isiPad) ? 'touchstart' : 'click';
	
    $(".topMenuAction").click( function() {
        if ($("#openCloseIdentifier").is(":hidden")) {
            $("#slider").animate({
                marginTop: "-307px"
                }, 500, function(){
					
					$('body').unbind(clickEvent);
					
				});
            $("#topMenuImage").html('<div id="contact-hotspot"></div>');
            $("#openCloseIdentifier").show();
        } else {
            $("#slider").animate({
                marginTop: "0px"
                }, 500,
				function(){	
					$('body').bind(clickEvent, function(e){
						var yPos = e.pageY;
						if(yPos > 307){
			            
							$("#slider").animate({marginTop: "-307px"}, 500, function(){
								$('body').unbind(clickEvent);
							});
							$("#topMenuImage").html('<div id="contact-hotspot"></div>');
							$("#openCloseIdentifier").show();
						}
					})
					
				});
				
            $("#topMenuImage").html('<div id="contact-hotspot-close"></div>');
            $("#openCloseIdentifier").hide();
        }
    }); 
});
