if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
var viewportmeta = document.querySelectorAll('meta[name="viewport"]')[0];
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
document.body.addEventListener('gesturestart', function() {
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
}, false);
}
}
$(window).bind("load", function() {
   $('#content').easytabs();
   	
   $('.tabs a').hover(function() {
   	$(this).animate({marginTop: '10px'}, 200);
   }, function() {
   	$(this).animate({marginTop: '0'}, 300);
   });
   
});	

 // Requires a selector engine for IE 6-7, see above

//contact modal 
//Jplayer min

$(function() {

Cufon.replace('.section ul li', { textShadow: '#fff -1px -1px, #333 1px 1px'}); // Works without a selector engine
Cufon.replace('.super-bold' , { textShadow: '#fff 0px 2px'});
Cufon.replace('#bookmark li a');

$('#doc, #phoneNumber, #sendMessage').hover(
       function(){ $(this).removeClass('ir') },
       function(){ $(this).addClass('ir') }
);
	// load the modal window
	$('a.modal').click(function(){

		// scroll to top
		$('html, body').animate({scrollTop:0}, 'fast');

		// before showing the modal window, reset the form incase of previous use.
		$('.success, .error').hide();
		$('form#contactForm').show();
		

		//show the mask and contact divs
		$('#mask').show().fadeTo('', 0.7);
		$('div#contact').fadeIn();

		// stop the modal link from doing its default action
		return false;
	});

	// close the modal window is close div or mask div are clicked.
	$('div#close, div#mask').click(function() {
		$('div#contact, div#mask').stop().fadeOut('slow');

	});

	
	
	
	
});

$('#contactform').submit(function(){

	var action = $(this).attr('action');
	
	$('#submit').attr('disabled','disabled').after('<img src="img/ajax-loader.gif" class="loader" />');
	
	$("#message").slideUp(750,function() {
	$('#message').hide();			
	
	$.post(action, { 
		name: $('#name').val(),
		email: $('#email').val(),
		phone: $('#phone').val(),
		subject: $('#subject').val(),
		comments: $('#comments').val(),
		verify: $('#verify').val()
	},
		function(data){
			document.getElementById('message').innerHTML = data;
			$('#message').slideDown('slow');
			$('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
			$('#submit').removeAttr('disabled'); 
			if(data.match('success') != null) $('#contactform').slideUp('slow');
			
		}
	);
	
	});
	
	return false; 

});

