	(function($) {
		var cache = [];
		$.preLoadImages = function() {
			var args_len = arguments.length;
			for (var i = args_len; i--;) {
				var cacheImage = document.createElement('img');
				cacheImage.src = arguments[i];
				cache.push(cacheImage);
			}
		}
	})(jQuery)


function MM_preloadImages() { //v3.0
    var d = document;
    if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length,
            a = MM_preloadImages.arguments;
        for (i = 0; i < a.length; i++)
        if (a[i].indexOf("#") != 0) {
            d.MM_p[j] = new Image;
            d.MM_p[j++].src = a[i];
        }
    }
}

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr;
    for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x;
    if (!d) d = document;
    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document;
        n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n];
    for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n);
    return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0,
        x, a = MM_swapImage.arguments;
    document.MM_sr = new Array;
    for (i = 0; i < (a.length - 2); i += 3)
    if ((x = MM_findObj(a[i])) != null) {
        document.MM_sr[j++] = x;
        if (!x.oSrc) x.oSrc = x.src;
        x.src = a[i + 2];
    }
}
$(document).ready(function() {
	/* A better rollover method than the above 
	$("img.rollover").hover(
		function() { this.src = this.src.replace("_off", "_on"); },
		function() { this.src = this.src.replace("_on", "_off"); }
	);
	*/

	  $("#slider").slideshow({
	    width      : 708,
	    height     : 287,
	    transition : 'SquareRandom',
		pauseOnHover: true,
		loop: true,
		slideshow: true,
		delay: 6000,
		selector: false,
		columns : 14,
		rows : 6
	  });
	
      /* $("#slider").SexySlider({
        width     : 708,
        height    : 287,
        delay     : 6000,
        strips    : 20,
        auto : true,
		effect : 'fountain',
        navigation: '#navigation',
        control   : '#control'
      }); */
      
      jQuery.preLoadImages('../_images/Logo_applestoreOVER.png','../_images/logo_youTubeOVER.png',
		'../_images/Logo_facebookOVER.png','../_images/Logo-twitter-plus-reflectionOVER.png',
		'../_images/Logo_flickr_bigOVER.png','../images/header_movement.png','../images/header_magnify.png',
		'../images/header_mobilize.png','../images/header_maximum.png','../images/header_media360.png',
		'../images/header_give.png','../images/header_contact.png','../images/header_events.png',
		'../images/header_newhere.png','../images/header_revradio.png','../images/header_gethere.png',
		'../images/header_getinformed.png','../images/header_getconnected.png','../images/header_booking.png',
		'../images/header_bookingleadinglady.png','../images/header_prayer_salvation.png',
		'../images/experienceOver_img.png','../_images/explorePictOver.png','../_images/engagePictOver.png');
		
    $("a[class^='prettyPhoto']").prettyPhoto({
	animation_speed: 'fast', /* fast/slow/normal */
	slideshow: 5000, /* false OR interval time in ms */
	autoplay_slideshow: false, /* true/false */
	opacity: 0.80, /* Value between 0 and 1 */
	show_title: false, /* true/false */
	allow_resize: true, /* Resize the photos bigger than viewport. true/false */
	default_width: 343,
	counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
	theme: 'revo_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
	horizontal_padding: 0, /* The padding on each side of the picture */
	hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
	wmode: 'opaque', /* Set the flash wmode attribute */
	autoplay: false, /* Automatically start videos: True/False */
	modal: true, /* If set to true, only the close button will close the window */
	deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */
	overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
	keyboard_shortcuts: false, /* Set to false if you open forms inside prettyPhoto */
	changepicturecallback: function(){ 
		/* $('input[type=text]').one('focus', function() { $(this).val(''); }); */
		$('input[type=text]').focus(function(){
			var fval = $(this).val();
			var ftitle = $(this).attr('title');
			if (fval == ftitle)
			{
				$(this).val('');
			}
		});

		$('input[type=text]').blur(function(){
			var fval = $(this).val();
			var ftitle = $(this).attr('title');
			if (fval == '')
			{
				$(this).val(ftitle);
			}
		});
	}, /* Called everytime an item is shown/changed */
	callback: function(){}, /* Called when prettyPhoto is closed */
	ie6_fallback: false,
	social_tools: false, /* html or false to disable */
	markup: '<div class="pp_pic_holder"> \
		    <div class="pp_content_container"> \
			<div class="pp_content"> \
			<a class="pp_close" href="#">Close</a> \
			    <div class="pp_loaderIcon"></div> \
			    <div class="pp_fade"> \
				<div id="pp_full_res"></div> \
				<div class="pp_details"> \
				</div> \
			    </div> \
			</div> \
		    </div> \
		</div> \
		<div class="pp_overlay"></div>',
    });

    $('body').css("display", "none");
    $('body').fadeIn(1500);
    
	$.mbBgndGallery.buildGallery({
		containment: "#wrapper",
		timer: 50000,
		effTimer: 1000,
		controls: "#controls",
		grayScale: false,
		folderPath: "../_images/backgrounds/",
	});

	$('.kwicks').kwicks({ max: 365, spacing: 5 });

	//REV RADIO DROP DOWN//
	$('#rev_radio_btn').click(function(e) { e.stopPropagation(); $("#rev_radio").slideDown(500); });
	$('#rev_radio_contemp').click(function(e) { e.stopPropagation(); $("#rev_radio").slideUp(500); });
	$('#rev_radio_wp').click(function(e) { e.stopPropagation(); $("#rev_radio").slideUp(500); });
	$('#rev_radio_rb').click(function(e) { e.stopPropagation(); $("#rev_radio").slideUp(500); });
	$('#rev_radio_rap').click(function(e) { e.stopPropagation(); $("#rev_radio").slideUp(500); });
	$('#rev_radio_close_btn').click(function(e) { e.stopPropagation(); $("#rev_radio").slideUp(500); return false; });

	$("#movement_btn").mouseover(function() { $("#fourMsSummaryMovement").fadeIn(250);  });
	$("#movement_btn").mouseout(function()  { $("#fourMsSummaryMovement").fadeOut(250); });
	$("#magnify_btn").mouseover(function()  { $("#fourMsSummaryMagnify").fadeIn(250);   });
	$("#magnify_btn").mouseout(function()   { $("#fourMsSummaryMagnify").fadeOut(250);  });
	$("#mobilize_btn").mouseover(function() { $("#fourMsSummaryMobilize").fadeIn(250);  });
	$("#mobilize_btn").mouseout(function()  { $("#fourMsSummaryMobilize").fadeOut(250); });
	$("#maximum_btn").mouseover(function()  { $("#fourMsSummaryMaximum").fadeIn(250);   });
	$("#maximum_btn").mouseout(function()   { $("#fourMsSummaryMaximum").fadeOut(250);  });


	$(".sub_links_button").mouseover(function() { 
		theID = $(this).attr('id');
		theItem = $('#'+theID.replace("_link", ""));
		$(theItem).fadeIn(250);
	});
	$(".sub_links_button").mouseout(function() { 
		theID = $(this).attr('id');
		theItem = $('#'+theID.replace("_link", ""));
		$(theItem).fadeOut(250);
	});
});

month= --month;
dateFuture = new Date(year,month,day,hour,min,sec);

function GetCount(){

        dateNow = new Date();                                                            
        amount = dateFuture.getTime() - dateNow.getTime()+5;               
        delete dateNow;

        /* time is already past */
        if(amount < 0){
               /*  out=
				"<div id='days'><span></span>0<div id='days_text'></div></div>" + 
				"<div id='hours'><span></span>0<div id='hours_text'></div></div>" + 
				"<div id='mins'><span></span>0<div id='mins_text'></div></div>" + 
				"<div id='secs'><span></span>0<div id='secs_text'></div></div>" ; */
	       out = "<p style='width: 100%; text-align: left; font-size: 18px; padding: 0px; margin: 0px; color: #fff;'><a href='http://revolutioncm.tv' style='color: #fff; font-size: 18px;'><img src='/images/on-air.png' alt='On Air Now'></a></p>";	
                document.getElementById('countbox').innerHTML=out;       
        }
        /* date is still good */
        else{
                days=0;hours=0;mins=0;secs=0;out="";

                amount = Math.floor(amount/1000); /* kill the milliseconds */

                days=Math.floor(amount/86400); /* days */
                amount=amount%86400;

                hours=Math.floor(amount/3600); /* hours */
                amount=amount%3600;

                mins=Math.floor(amount/60); /* minutes */
                amount=amount%60;

                
                secs=Math.floor(amount); /* seconds */

		if(days > 6){
		out = "<p style='width: 100%; text-align: left; font-size: 18px; padding: 0px; margin: 0px; color: #fff;'><em><a href='http://revolutioncm.tv' style='color: #fff; font-size: 18px;'>LIVE: ON AIR NOW</a></em></p>";	
		} else {
                out=
				"<div id='days'><span></span>" + days +"<div id='days_text'></div></div>" + 
				"<div id='hours'><span></span>" + hours +"<div id='hours_text'></div></div>" + 
				"<div id='mins'><span></span>" + mins +"<div id='mins_text'></div></div>" + 
				"<div id='secs'><span></span>" + secs +"<div id='secs_text'></div></div>" ;
		}
                document.getElementById('countbox').innerHTML=out;
			

                setTimeout("GetCount()", 1000);
        }
}

window.onload=function(){GetCount();}
