var noanchor = true;
function loadPage(page) {
    $('#content-formatting').fadeOut('slow', function() {$('#content-formatting').load('pages/' + page + '.html', function() {    $('#content-formatting').fadeIn('slow');});});
    $('#banner-picture').fadeOut('slow', function() {document.getElementById('banner-picture').style.backgroundImage = "url(pages/" + page + ".jpg)";});
    $('#banner-picture').fadeIn('slow');
    document.title = "Greater Life Church - " + page.charAt(0).toUpperCase() + page.substr(1).toLowerCase();
    noanchor = false;
}

function preload(images) {
    if (document.images) {
        var i = 0;
        var imageArray = new Array();
        imageArray = images.split(',');
        var imageObj = new Image();
        for(i=0; i<=imageArray.length-1; i++) {
            imageObj.src=images[i];
        }
    }
}

$(document).ready(function(){
	$.get("menu-unflair.gif");
	$.get("menu-flair.gif");
	$.historyInit(loadPage);
	$(".link").click(function(){
		var hash = this.href;
		hash = hash.replace(/^.*#/, ''); 
		$.historyLoad(hash);
		return false;
	});
	if (noanchor === true) {
	    $('#content-formatting').load('pages/home.html');
	}
	$('#sidebar-formatting').load('pages/side.html');
    $('body').hide();
    $('body').fadeIn(1000);
		
    if (jQuery.browser.msie) {
        if (parseInt(jQuery.browser.version) < 7) {
            $("#dialog-modal").dialog({
			    modal: true
		    });
    }}

});

//Copyright Kory Prince 2010

