/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);


$(function() {   
			var theWindow        = $(window),
			    $bg              = $("#bg"),
			    aspectRatio      = $bg.width() / $bg.height();
			    			    		
			function resizeBg() {
				if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
				    $bg
				    	.removeClass()
				    	.addClass('bgheight');
				} else {
				    $bg
				    	.removeClass()
				    	.addClass('bgwidth');
				}
			}
			theWindow.resize(function() {
				resizeBg();
			}).trigger("resize");
		});

$('ducument').ready(function() {
	$("#facebook, #partners li").hover(function() {$(this).fadeTo(200, 0.7)}, function() {$(this).fadeTo(200, 1)});
	
	//NAVIGATION
	var mainNav = $("#mainNav li");
	mainNav.not("#mainNav li:last-child").css({'margin-right':'14px'});
	mainNav.hover(function() {$(this).animate({'color':'#CCC'}, 250)}, function() {$(this).animate({'color':'#FFF'}, 250)});
	mainNav.click(function() {window.location = $(this).find('a').attr('href'); return false;});
	
	//HOME
	$(".part-marg").css({'margin-right':'8px'});
	$("#partners li a").attr({'target':'_blank'});
	
	//CONTACT
	$("#contactFormTable tr").attr({'valign':'top'});
	$(":input").not(":input[name=submit]").focusin(function() {
		var inptParent = $(this).parent('td');
		var parentRow = inptParent.parent('tr')
		parentRow.css({'background-color':'#f2f2f2'}).addClass('currentFormRow')});
	$(":input").not(":input[name=submit]").focusout(function() {
		var inptParent = $(this).parent('td');
		var parentRow = inptParent.parent('tr')
		parentRow.css({'background':'none'}).removeClass('currentFormRow')});
	$("#contactFormTable tr td:first-child").attr({'width':'150px'}).css({'padding-top':'7px'});
	
	var dtpick = $(":input[name=weddingDate], :input[name=appointmentDate]");
	dtpick.datepicker({dateFormat:'d MM yy'});
	
	$(".btn1, a[name=moreReviews] h2").hover(function() {$(this).animate({'color':'#999'}, 250)}, function() {$(this).animate({'color':'#900'}, 250)});
	
	$(".formVal").hide();
	
	
	//CHROME SPECIFIC
	$(".chrome #mainNav li").css({'font-size':'1.45em'})
	$(".chrome #mainNav").css({'left':'29px'});
	
	//IE SPECIFIC
	$(".ie #mainNav li").css({'font-size':'1.45em'})
	$(".ie #mainNav").css({'left':'27px'});
	
})
