// JavaScript Document
var theme = '/wp-content/themes/mirasol/'
var root = 'http://mirasolseniorcommunity.com/'
var template = '/wp-content/themes/mirasol/'

$(document).ready(function(){
  // Reset Font Size
  var originalFontSize = $('html').css('font-size');
    $(".a2").click(function(){
    $('html').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".a1").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
    $('html').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $(".a3").click(function(){
    var currentFontSize = $('html').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
    $('html').css('font-size', newFontSize);
    return false;
  });
 
});


$(document).ready(function(){
	
	$('.sub-menu li').mouseover(function() {
		$('#'+ this.id +' .sub-menu').show(); 
	});
	
	
	$('.nav').mouseout(function() {
		$('.sub-menu .sub-menu').hide(); 
	});

	
	/*
	$('.sideNav li').mouseover(function() {
		var theClass = $(this).attr('class');
		theClass = theClass.replace("page_item ", "")
		theClass = theClass.replace("current_page_item", "")
		theClass = theClass.replace("current_page_ancestor", "")
		theClass = theClass.replace("current_page_parent", "")
		theClass = theClass.replace(" ", "")
		
		//alert(theClass)
		
		$('.'+ theClass +' .children').show(); 
	});
	

	$('.sideNav li').mouseout(function() {
		$('.page_item .children').hide(); 
	});
	*/
	
	
	
});


// Basic form submission
var handlers = '/wp-content/themes/mirasol/handlers/'
function submitForm(theIds, theDiv, theHandler){
	var idArray=theIds.split(",");
	//alert(idArray[2])
	var total = idArray.length
	var count = 0;
	var poststr = ''
	while (count < total){

		if(count == 0){
			poststr = idArray[count]+"=" + encodeURI( document.getElementById(idArray[count]).value )
		} else {
			poststr = poststr+"&"+idArray[count]+"=" + encodeURI( document.getElementById(idArray[count]).value )
		}
		count++
	}
	$(theDiv).load( handlers+theHandler+'?'+poststr, function(response, status, xhr) {
		
		if(theDiv == '.notice'){
			$(theDiv).show();
			setTimeout(function() { $('.notice').slideUp(); }, 5000);
		}
		
		if(theHandler == 'sendTour.php'){
			$('.submitForm').hide();
		}
		
	});
}

