$(function(){
	makeSlider('#slider', 'boxRainGrow', 1000, 4000, 'num', 0);	
	//makeSlider('#tour', 'sliceDown', 2000, 10000, 'thumbs', 0);
	
	$('a#pause-for-pose').click(function(){
		$('#pause-pose-container').modal();
		var bigMonth = $('#simplemodal-container #pause-pose-container span.month').text();
		$('#simplemodal-container #pause-pose-container span.month').hide();
		$('#simplemodal-container #pause-pose-container li.pause-for-a-pose').prepend("<h4>"+bigMonth+"'s Pause for a Pose</h4>");
	});
	var month = $('a#pause-for-pose span.month').text();
	$('a#pause-for-pose span.month').text(month + "'s Pause for a Pose").prepend('<span class="click-for">Click here for</span><br />');

	//accessing the flick api for the photo gallery
	flickrFeedAPI_set('34704721aa595e29363bbc4f7fe60907', '72157627634232129', '#gallery', 100);
	 //flickrFeed_set("67840120@N02", "72157627634232129", "#gallery", 100);
	
	var hotText = $('#hot-text .textareaw p').html();
	
	if ($('#hot-text .textareaw').length > 0) {
		$('#hot-text .textareaw').html(hotText.substring(0,400)+"...");
	}
	if($('#hot-text ul li').children('img').length > 0) {
		$('#hot-text ul li').children('img').remove();
	}
	
	// testimonials slider
	$('#slider1 ul').bxSlider();
	$('#bx li.testimonials').each(function() {
		var testBody =$(this).children('span.testimonial-body');
		var testText = "<p class='test-body'>"+testBody.children('p:first-child').html().substring(0,250)+"&hellip;</p>";
		testBody.children('p').remove();
		$(testText).prependTo(testBody);
		$('<span class="title">Testimonial</span>').prependTo(testBody);
		$(this).children('span.testimonial-author-name').appendTo(testBody);
		$("<span>&ndash;</span>").prependTo(testBody.children('span.testimonial-author-name'));
		$('<a href="testimonials">Read more</a>').appendTo(testBody.children('p'));
	});
	
	$('#testimonials-all ul li').each(function() {
		$(this).children('span.testimonial-author-name').prepend("-").appendTo($(this));
	});
});

(function () {

      /*
          1. Inject CSS which makes iframe invisible
      */

    var div = document.createElement('div'),
        ref = document.getElementsByTagName('base')[0] ||
              document.getElementsByTagName('script')[0];

    div.innerHTML = '&shy;<style> iframe { visibility: hidden; } </style>';

    ref.parentNode.insertBefore(div, ref);

    /*
        2. When window loads, remove that CSS,
           making iframe visible again
    */

    window.onload = function() {
        div.parentNode.removeChild(div);
    }

})();
