// remap jQuery to $
(function($){})(window.jQuery);


/* trigger when page is ready */
$(document).ready(function (){
	var freezeHeight=false;
	var freezeWidth=false;
// Return boolean TRUE/FALSE

var isiPad = navigator.userAgent.match(/iPad/i) != null;

function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}
	$("skip, a").css("color","#666");
	$(function() {
	// ON MOUSE OVER
	$("skip, a").hover(function () {
	// SET OPACITY TO 100%
	$(this).stop().animate({
	color: '#999'
	}, "fast");
	},
	// ON MOUSE OUT
	function () {
	// SET OPACITY BACK TO 50%
	$(this).stop().animate({
	color: '#666'
	}, "fast");
	});
	});
		
	
	
	$(window).resize(function(){
		if($(window).height() <= 785){
			freezeHeight=true;
		}else{freezeHeight=false;}
				if($(window).width() <= 1216){
					freezeWidth=true;
				}else{freezeWidth=false;}
			
		$('btm_contact').css({
			left: ($(window).width()/2 - $('btm_contact').outerWidth()/2)
		});
		
		$('page_bg').css({
			left: ($(window).width()/2 - 87)
		});
		
		$('.entry').css({
			position:'absolute',
			left: ($('#page-container').outerWidth()/2 - $('.entry').outerWidth()/2),
			top: ($('#page-container').outerHeight()/2 - $('.entry').outerHeight()/2)
		});
			
		if(!freezeHeight){		
	$('#page-container').css({
		top: (($(window).height()/2 - $('#page-container').outerHeight()/2)-3)
	});
		
	$('btm_bar').css({
		top: (($(window).height()/2 + $('#page-container').outerHeight()/2)-3)
	});	
	
	$('top_bar').css({
		height: $('btm_bar').height(),
		'max-height': "none"
	});
}else{
$('#page-container').css({
	top: 92
});
		$('top_bar').css({
		'min-height': 92,
		'max-height': 92
		});
$('btm_bar').css({
	'min-height': 92,
	 top: 691
});	
if(isiPhone() || isiPad){
	$.scrollTo({ top:75, left:0}, 0);
		$('.entry').css({
			top: ($('#page-container').outerHeight()/2 - $('.entry').outerHeight()/2)
		});
//window.location.hash = "i2";
//	window.location.hash = "i";
//	$('html, body').animate({
//	    scrollTop: 75,
//	    scrollLeft: 0
//	}, "fast");
	}
	
}
	});

	// To initially run the function:
	$(window).resize();

	$(window).load(function() {
	/*	if($(window).height() <= 785){
			freezeHeight=true;
		}else{freezeHeight=false;}
				if($(window).width() <= 1216){
					freezeWidth=true;
				}else{freezeWidth=false;}
				*/
		if(!freezeHeight){
	$('.entry').css({
		position:'absolute',
		top: ($('#page-container').outerHeight()/2 - $('.entry').outerHeight()/2)
	});
	}else{
		$('.entry').css({
		position:'absolute',
		top: ($('#page-container').outerHeight()/2)  - ($('.entry').outerHeight()/2)
	});		
	
/*	$('#page-container').css({
		top: 92
	});
		
	$('btm_bar').css({
		'min-height': 92,
		top: 691
	});*/
	}
	if(!freezeWidth){
	$('.entry').css({
		position:'absolute',
		left: ($('#page-container').outerWidth()/2 - $('.entry').outerWidth()/2),
	});
	}else{
		$('.entry').css({
			position:'absolute',
			left: 608 - ($('.entry').outerWidth()/2),
		});
	}
		if(isiPhone() || isiPad){
		setTimeout(function(){
		$('.entry').css({
			position:'absolute',
			left: ($('#page-container').outerWidth()/2 - $('.entry').outerWidth()/2),
			top: ($('#page-container').outerHeight()/2 - $('.entry').outerHeight()/2)
		});},600);
}

	});


});



