$(document).ready(function() {  
    $('input[type="text"],textarea').focus(function() {  
        $(this).removeClass("idle").addClass("has-focus");  
    });  
    $('input[type="text"],textarea').blur(function() {  
        $(this).removeClass("has-focus").addClass("idle");
    });
    
    $('#work-home .sociable').hide();
    
    var fish_flash = '<object type="application/x-shockwave-flash" data="'+template_directory+'/video/player.swf" width="1280" height="720" style="position: fixed; top: -20px; left: 0; z-index: 1; width: 1280px; height: 700px; overflow: hidden;background:#fff;" id="bg-video-obj">'+
			'<param name="movie" value="'+template_directory+'/video/player.swf" />'+
			'<param name="wmode" value="opaque" />'+
			'<param name="bgcolor" value="#ffffff" />'+
			'<param name="allowFullScreen" value="false" />'+
			'<param name="flashvars" value="flv='+template_directory+'/video/Fish.flv&width=1280&height=720&autoplay=1&loop=true&controls=false" />'+
			'<img src="'+template_directory+'/images/fish.png" width="1280" height="720" title="No video playback capabilities" />'+
		'</object>';
		var fish_html5 = '<video autoplay loop height="720" width="1280" id="bg-video-html5">'+
			'<source type="video/quicktime" src="'+template_directory+'/video/Fish.mov" />'+
   			'<source type="video/ogg" src="'+template_directory+'/video/Fish.ogg" />'+
    		'<source type="video/webm" src="'+template_directory+'/video/Fish.webm" />'+
    	'</video>';
    
    	$('#bg-video').hide();
    	
	    if($.browser.msie || is_chrome()) {
  	    	$('#bg-video').append(fish_flash).fadeIn(6000);
	    }
	    else if (!is_ipad()) {
	    	$('#bg-video').append(fish_html5).fadeIn(6000);
	    }
});

function is_chrome (){
	var is = ( $.browser.safari && /chrome/.test(navigator.userAgent.toLowerCase()) ) ? false : true;
	return !is;
}

function is_ipad () {
	return navigator.userAgent.match(/iPad/i) != null;
}
