jQuery(function($){
	
	$.getScript = function(url, callback, cache){
		$.ajax({
				type: "GET",
				url: url,
				success: callback,
				dataType: "script",
				cache: cache
		});
	};
	
	$("#googleMap").load('/googleMap.html')

	$('.four-col a').each(function(){
		var picID = $('.four-col').attr('title');
		var qty = $('.four-col a').index(this);
		$(this).append('Pic ID: '+ (picID) + (qty+1)).attr('title','Pic ID: '+ (picID) + (qty+1)).attr('rel',picID);
	});

	if($.browser.msie){
		shadowFX();
	}
	
	$(window).scroll(function() {
		//$('#floatingmenu').css('top', $(this).scrollTop() + 65 + "px");
		var pos = $(this).scrollTop() + 60 + "px";
		$('#floatingmenu').stop().animate({top: pos},500);
	});
	
	if($.browser.msie){
		$("select").css({
			"font-size" : "1.2em",
			"height" : "22px"
		});	
	}
	$("input[type='radio']").css({
		"height":"16px",
		"width":"16px"
	});
	
	$("input[type='text']").addClass('text');
	
	if($(".carousel").length != 0) {
		$.getScript('_js/jquery.jcarousel.min.js', carousel, true);
	}
	
	rollover();
	
	$('.copyright span').text(new Date().getFullYear());
	
	$('.scroll').bind("click", jump);      
		
	$('.textshadow').each(function(){
		var thisShadow = $(this).text();
		var thisColor = $(this).attr('rel');
		$(this).append('<span style="z-index:-1; position:absolute; top:1px; left:1px; color:'+thisColor+'">'+thisShadow+'</span>');
	});
	
});


var jump=function(e){
	e.preventDefault();
	var target = $(this).attr("href");
	$('html,body').animate({ scrollTop: $(target).offset().top },1000,function() { location.hash = target; });
	$(target).effect('highlight', {color:'yellow'}, 4000);
}

function selectElement(){
	$("select").each(function(){
		$("option:selected", this).each(function(){
			$(this).parent().prev().text($(this).text());
		});
	});
}

function rollover(){
	$(".rollover").hover(function(){
		newClass = $(this).attr('rel');
		$("#"+newClass).addClass("onPage").removeClass("offPage");
	},	function(){
		newClass = $(this).attr('rel');
		$("#"+newClass).addClass("offPage").removeClass("onPage");
	});
}

function carousel(){
	$('#home-page .carousel').jcarousel({
		auto: 8,
		scroll: 1,
		animation: "slow",
		wrap: 'circular',
		visible: 1
	});	
}

function curvycorners(){
	//curvyCorners.init()
	jQuery(window).delay(0).show(0, function(){ curvyCorners.init() });
}

function shadowFX(){
	var txt = $(".fn a").html();
	var txt2 = $(".tel").html();
	$(".fn").prepend('<span class="shadow">'+txt+'</span>');	
	$(".tel").prepend('<span class="shadow">'+txt2+'</span>');
	$("#copyright").html(new Date().getFullYear())
}

function pleasewait(){
	$.nyroModalManual({
		width: 300,
		height: 300,
      url: 'pleasewait.html'
    });
}


