/**
 * jQuery random background changer
 * @name Random Background Changer
 * @author Charles Harvey - http://www.charles-harvey.co.uk
 * @version 0.1
 * @date September 4 2009
 * @category jQuery plugin
 * @copyright (c) 2009 Charles Harvey
 */

(function($) {

	$.cycleThru = {
		defaults: {
			delay: 3000,

		}
	}
    $.fn.extend({
        cycleThru:function(config) {
            var config = $.extend({}, $.cycleThru.defaults, config);
			return this.each(function() {
				var delay = config.delay;
				var ulid = $(this).attr("id");
				var j = 0;
				var jmax = $(this).children("li").length -1;
				
				function cyclee(){
					$("ul#" + ulid + " li:eq(" + j + ")")
						.animate({"opacity" : "1"} ,400)
						.animate({"opacity" : "1"}, delay)
						.animate({"opacity" : "0"}, 400, function(){
							(j == jmax) ? j=0 : j++;
							cyclee();
					});
				};
				cyclee();
            })
        }
    })
})(jQuery);

$("ul#testy1").cycleThru({delay: 2000});
$("ul#testy2").cycleThru({delay: 2500});
$("ul#testy3").cycleThru({delay: 2800});
$("ul#testy4").cycleThru({delay: 3000});
//$("ul#testy5").cycleThru({delay: 2300});
$("ul#testy6").cycleThru({delay: 3300});
$("ul#testy7").cycleThru({delay: 4000});
$("ul#testy8").cycleThru({delay: 3800});
$("ul#testy9").cycleThru({delay: 3500});

$(document).ready(function(){
	$(".slidingDiv1").hide();
	$(".show_hide1").show();
	
	$(".slidingDiv2").hide();
	$(".show_hide2").show();
	 
	$('.show_hide1').click(
		function(){
		$(".slidingDiv1").slideToggle();
	});
	
	$('.show_hide2').click(
		function(){
		$(".slidingDiv2").slideToggle();
	});
});

$("#pageflip").hover(function() { //On hover...
	$("#pageflip img , .msg_block").stop()
		.animate({ //Animate and expand the image and the msg_block (Width + height)
			width: '300px',
			height: '300px'
		}, 500);
	} , function() {
	$("#pageflip img").stop() //On hover out, go back to original size 50x52
		.animate({
			width: '100px',
			height: '100px'
		}, 220);
	$(".msg_block").stop() //On hover out, go back to original size 50x50
		.animate({
			width: '100px',
			height: '100px'
		}, 200); //Note this one retracts a bit faster (to prevent glitching in IE)
});
