jQuery(function($) {
	$(document.body).removeClass("jsOff").addClass("jsOn");

	if (getBodyId() == 'index') {
		swfobject.embedSWF("swf/SpaHome.swf", "flashShow", "338", "209", "8.0.0","expressInstall.swf", {}, {wmode: "transparent"});
		
		$('#dateInput').calendar({
			parentElement: '#dateInput',
			firstDayOfWeek: 0
		});

		$('#contentRightBot').append($('#seoWrap').html());
		
		$('#seoWrap').remove();
		
		$('#contentRightBotSpecials a.toClone').clone().attr('id','specialsCloned').addClass('am-hoverShw').appendTo($('#contentRightBotSpecials'));
		$('#googleMap').clone().attr('id','googleMapCloned').addClass('am-hoverShw').appendTo($('#contentRightBotTwo'));
	}
	
	$('#contentRight').height($('#contentWrap').height());
	
	$('#servSubMenu').hover(function() { 
		$(this).toggleClass("over"); },function() {
		$(this).toggleClass("over"); }
	);
	
	$('div.aArea').hover(function() {
		$(this).addClass("blockOver").find('a').addClass("blockOver");		
	}, function() {
		$(this).removeClass("blockOver").find('a').removeClass("blockOver");
	}) ;
		
	$('div.aArea').click(function() {
		location = $(this).find('a').attr("href");
	});
	
	if ($('body').hasClass('tour')) {
		swfobject.embedSWF("swf/TakeATour.swf", "flashTour", "500", "320", "8.0.0","expressInstall.swf", {}, {wmode: "transparent"});
	}
	
	if (getBodyId() == 'appoint') {
		$('.date-pick').datePicker();
	}
	
	if ($('body').attr('id') == 'shop') {
		$('#contentRight .onePage a').append('<span></span>');
	}
		
	if (($('body').attr('id') == 'faq') || ($('body').attr('id') == 'laser')) {

		$('#faqQ a').click(function(e) {
			e.preventDefault();
			var p = $(this).parent(); 
			showFAQ($(this).attr('href'),p); // pass href of the a and it's parent as object
			
			})
	};
	
	if ($('body').attr('id') == 'contact' || $('body').attr('id') == 'gift' || $('body').attr('id') == 'member') {
		if($("#form1")[0]) {
			$("#form1").validate({debug: false, focusInvalidElement: true});
		}
	}
	
});
function getBodyId() {
		return document.body.getAttribute('id');
	};
function showFAQ(_this,p) {
// if answ exist, delete the old, exit if clicked the existing
	if ($('body').attr('id') == 'faq') scroll(0,0);
	if ($('#cur').length == 1) {
		var f = false; if (p.is('.cur')) { f = true; }
		$('#faqQ p').removeClass('cur'); $('#cur').remove();
		if (f) {  return; }
		}
	// show the answ:
	var id = _this.substring(1);
	var t = $(document.getElementById(id)); // find corresp div(answ)
	$(t).find('h2').remove(); // remove h2 from it
	divT = document.createElement( 'div' );// create container for showing answ
	$(divT).attr('id','cur').html(t.html()).insertAfter(p).show('slow');//add id and text to it, then insert it after
	p.addClass('cur');
}