$(document).ready(function(){

// Initiate fancybox
// $('.fancybox').fancybox();


// Twitter feed
$('#twitter-feed').tweetGrab({
			animateHeightDuration: 1000,
			animateHeightEasing: 'easeOutExpo',
			user: 'HurricaneBldrs',
			tweetCount: '3',
			style: 'custom'
		});

// Animate map names (small map) on neighborhoods page
$('#sumter-star').mouseover(function(){
	$('.sumter-name').stop(true, true).animate({ opacity: "show", 'filter': ''  }, "500");
});
$('#sumter-star').mouseleave(function(){
	$('.sumter-name').stop(true, true).animate({ opacity: "hide", 'filter': ''  }, "500");
});
$('#columbia-star').mouseover(function(){
	$('.cola-name').stop(true, true).animate({ opacity: "show", 'filter': ''  }, "500");
});
$('#columbia-star').mouseleave(function(){
	$('.cola-name').stop(true, true).animate({ opacity: "hide", 'filter': ''  }, "500");
});

// Smooth Horizontal Scroll
$('#columbia-star, #cola-btn').click(function(event) {		  
	$('#slider-content').stop().animate({"left" : "-970px"}, {"duration" : 1200 , "easing": "easeOutBack"});	
	event.preventDefault();	    
});

$('#sumter-star, #sumter-btn').click(function(event) {		   
	$('#slider-content').stop().animate({"left" : "-1940px"}, {"duration" : 1200 , "easing": "easeOutBack"});	  
	event.preventDefault(); 
});

// Adjust .content-right height on neighborhoods page to match .content-left
leftHght = $('.content-left').height();
$('.content-right').css('height', leftHght);

// Input and textarea field value (disappear and re-appear)
$('input:not(.read-only), textarea').each(function() {
    var default_value = this.value;
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
            $(this).toggleClass("value-color");
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            this.value = default_value;
            $(this).toggleClass("value-color");
        }
    });
});

// Zebra stripe table rows
// $('#internal .content tbody tr:even').addClass('even');

// Map Rollover
$("#prefooter a.state-small, #social li a").mouseover(function () {
$(this).stop(true, true).animate({bottom: "3px"}, "fast");
});

$("#prefooter a.state-small, #social li a").mouseleave(function () {
$(this).stop(true, true).animate({bottom: "0px"}, "fast");
});

// Social rollovers
$("#social li").mouseover(function () {
$(this).stop(true, true).animate({marginTop: "-3px"}, "fast");
});

$("#social li").mouseleave(function () {
$(this).stop(true, true).animate({marginTop: "0px"}, "fast");
});

// Disclaimer pop-up
$('a#disclaimer').qtip(
   {
      content: {
         title: {
            text: 'Disclaimer/Disclosure',
            button: 'Close'
         },
         text: "<p>Prices and terms are subject to change, prior sale, selected lot premiums and/or predetermined options. Prices shown refer to the base house and do not include any optional features. Photos and/or drawings of homes may not represent the lowest-priced homes in the community.</p><p>Hurricane Construction/Home Builders reserves the right to make changes to its home designs and to build more or fewer homes than currently planned. Square footage numbers are approximate and may vary depending on the standard measurement used. Models display many decorator items and furniture which are not available for purchase. All renderings and floor plans in these materials are an artists' conceptual drawings and will vary from the actual plans and homes as built. Hurricane Construction/Home Builders reserves the right to make changes to its home designs at any time without notice.</p><p>All information on this website is deemed accurate but not reliable. Check with onsite agent for the most up-to-date information. Purchaser or purchaser's agent must confirm all features and incentives with onsite agent.</p>"
      },
      position: {
         target: $(document.body), // Position it via the document body...
         corner: 'center' // ...at the center of the viewport
      },
      show: {
         when: 'click', // Show it on click
         solo: true // And hide all other tooltips
      },
      hide: false,
      style: {
         width: { max: 650 },
         padding: '14px',
         border: {
            width: 9,
            radius: 9,
            color: '#666666'
         },
         name: 'light'
      },
      api: {
         beforeShow: function()
         {
            // Fade in the modal "blanket" using the defined show speed
            $('#qtip-blanket').fadeIn(this.options.show.effect.length);
         },
         beforeHide: function()
         {
            // Fade out the modal "blanket" using the defined hide speed
            $('#qtip-blanket').fadeOut(this.options.hide.effect.length);
         }
      }
});

// Sidebar match height of content
leftHght = $('#contact .content-left').height();
$('#contact .content-right').css('height', leftHght);

   // Create the modal backdrop on document load so all modal tooltips can use it
   $('<div id="qtip-blanket">')
      .css({
         position: 'absolute',
         top: $(document).scrollTop(), // Use document scrollTop so it's on-screen even if the window is scrolled
         left: 0,
         height: $(document).height(), // Span the full document height...
         width: '100%', // ...and full width

         opacity: 0.7, // Make it slightly transparent
         backgroundColor: 'black',
         zIndex: 5000  // Make sure the zIndex is below 6000 to keep it below tooltips!
      })
      .appendTo(document.body) // Append to the document body
      .hide(); // Hide it initially


//$(".read-more, .read-less").click(function(){
//	$(".read-more").toggleClass("hide");
//	$(".more-content").toggleClass("hide");
//	return false;
//});

});
