function ajaxPageLoad(args) { args.append = (args.append == null) ? "" : args.append; if(loading != true) { previousPage = currentPage; loading = true; if(gMap == true) { GUnload(); gMap = false; $('#map').remove(); } $('#dottedLineContainer > .dottedLine').fadeOut(300, function() { $(this).remove(); }); //todo requires this section of the page to be loaded to click any link.... maybe add some kind of timeout? if(!args.tln) { $('#page'+previousPage).fadeOut(300, function() { $('#page'+previousPage).remove(); ajaxExecute(args); }); } else { $('#pageContentBody').fadeOut(300, function() { $(this).empty(); args.append += "&tln=true"; loadType = "tln"; ajaxExecute(args); }); } } } function ajaxExecute(args) { $.ajax({ url: $(args.link).attr('href'), dataType: 'xml', data: 'noLayout=true&'+args.append, success: function (data, textStatus) { if(textStatus == 'success') { loadedData = data; dataLoaded = true; } else { loadedData = 'We were unable to load the requested page.'; dataLoaded = true; } restoreContent(args); }, error: function () { loadedData = 'We were unable to load the requested page.'; dataLoaded = true; restoreContent(args); } }); } function restoreContent(args) { if(loading == true) { var pageContent = ""; $(loadedData).find("pageContent").each(function() { pageContent = $(this).text(); }); var scripts = ""; $(loadedData).find("scripts").each(function() { scripts = $(this).text(); }); $('#scriptContainer').html(scripts); if(loadType == "tln") { var pageHeadline = ""; $(loadedData).find("pageHeadline").each(function() { pageHeadline = $(this).text(); }); $('#pageContentBody').html(pageContent); $('#page'+previousPage).attr('id', 'page'+currentPage); $('.thirdLevelNavItem > .pageHeadline').fadeOut(300, function() { var elementParent = $(this).parent(); $(elementParent).css('display', 'none'); $(elementParent).html("
" + "
 
" + "
 
" + "
 
" + "
"+URLDecode($(this).attr('alt'))+"
" + "
" ); $('a', elementParent).click(function() { return false; }); $('.thirdLevelNavClicker', elementParent).click(function() { ajaxPageLoad({link: this, tln: true}); }); $(elementParent).fadeIn(300); }); $(args.link).parent().parent().fadeOut(300, function() { $(this).html(pageHeadline); $(this).fadeIn(300); }); } else { $('#pageContent').html(pageContent); $('#pageContentBackgroundContainer > div').addClass('oldPageContentBackground'); $('#pageContentBackgroundContainer').append(''); $('.oldPageContentBackground').fadeOut(300, function() {$(this).remove();}); $('.newPageContentBackground').fadeIn(300, function() {$(this).removeClass('newPageContentBackground');}); } window.location.href = "#"+windowFragment; window.document.title = pageTitle; //hack for ie7 setTimeout(function() { window.document.title = pageTitle; }, 100); var dottedLineContainer = $('#dottedLineContainer'); $(dottedLineContainer).attr('finalWidth', $(dottedLineContainer).width()) .attr('currentInterval', 0) .css('width', '1px') .html('
 
'); loadSiteByNichez(); progressBar(dottedLineContainer); loadedData = ""; } } function progressBar(dottedLineContainer) { var allImages = $('img', $('#page'+currentPage)); if(allImages.length > 0) { //doing it this slow way instead of doing onLoad flags allows for the bar to progress... var increment = $(dottedLineContainer).attr('finalWidth') / allImages.length; var currentInterval = $(dottedLineContainer).attr('currentInterval'); //alert(currentInterval); if(currentInterval < allImages.length) { if(allImages[currentInterval].complete) { var newWidth = $(dottedLineContainer).width() + increment; if(newWidth > 800) newWidth = 800; currentInterval++; $(dottedLineContainer).attr('currentInterval', currentInterval); $(dottedLineContainer).animate({'width': newWidth+'px'}, 100, 'linear', function() { progressBar(this); }); } else setTimeout(function() { progressBar(dottedLineContainer); }, 25); } else loadCurrentPageContent(); } else { loadCurrentPageContent(); } } function loadCurrentPageContent() { if(loadType == "tln") $('#pageContentBody').fadeIn(500, function() {loading = false;loadGuruVideo();}); else $('#page'+currentPage).fadeIn(500, function() {loading = false;loadGuruVideo();}); loadType = ""; } function isDataLoaded() { return dataLoaded; } function loadSiteByNichez() { $('#rightContentContainer').append($('#footerContainer').html()); $('#siteByNichez').bind('mouseenter', function() { if(!$(this).hasClass("animating")) { $(this).addClass("animating"); var parentDiv = this; $(".siteByNichezImage", parentDiv).animate({left: '15px'}, 200, 'linear', function() { $(".siteByNichezText", parentDiv).animate({top: '11px'}, 200, 'linear', function() { $(parentDiv).removeClass("animating"); }); if($(parentDiv).hasClass("animateOut")) { $(".siteByNichezText", parentDiv).animate({top: '35px'}, 200, 'linear', function() { $(".siteByNichezImage", parentDiv).animate({left: '96px'}, 200, 'linear', function() { $(parentDiv).removeClass("animateOut"); }); }); } }); } }); $('#siteByNichez').bind('mouseleave', function() { if(!$(this).hasClass("animating")) { var parentDiv = this; $(this).addClass("animating"); $(".siteByNichezText", parentDiv).animate({top: '35px'}, 200, 'linear', function() { $(".siteByNichezImage", parentDiv).animate({left: '96px'}, 200, 'linear', function() { $(parentDiv).removeClass("animating"); }); }); } else { $(this).addClass("animateOut"); } }); $('#siteByNichez').click(function() { $(".siteByNichezText a").click(); }); } function submitForm(id) { var data = ""; var mod = false; $('input, textarea', $('#'+id)).each(function() { if(mod) data += "&"; data += $(this).attr('name')+"="+$(this).val(); mod = true; }); data += "&Submit=true"; $.ajax({ url: baseUrl+"/emailProcess.php", data: data, dataType: 'xml', type: 'POST', success: function (data, textStatus) { var result = ""; $(data).find("result").each(function() { result = $(this).text(); }); var message = ""; $(data).find("message").each(function() { message = $(this).text(); }); if(textStatus == 'success' && result == 'success') { $('#returnMessage').html(" "); $('#'+id).html(message); } else { $('#returnMessage').html(message); } }, error: function () { $('#returnMessage').html("There was an error submitting your message."); //error processing } }); } function replaceTextWithImageNT(element, color, bgColor, fontSize) { if(!$('img', element).length) { var text = $(element).attr('alt'); text = text.replace(/%26/, "||AND||"); text = text.replace(/&/, "||AND||"); $(element).html(''); } } function replaceTextWithImageWT(element, color, bgColor, fontSize, width, height) { if(!$('img', element).length) { var text = $(element).attr('alt'); text = text.replace(/%26/, "||AND||"); text = text.replace(/&/, "||AND||"); $(element).html(''); } } function URLEncode(url) {var SAFECHARS = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()"; var HEX = "0123456789ABCDEF";var plaintext = url;var encoded = "";for (var i = 0; i < plaintext.length; i++ ) {var ch = plaintext.charAt(i);if (ch == " ") {encoded += "+"; } else if (SAFECHARS.indexOf(ch) != -1) {encoded += ch;} else {var charCode = ch.charCodeAt(0);if (charCode > 255) {alert( "Unicode Character '"+ ch+ "' cannot be encoded using standard URL encoding.\n" +"(URL encoding only supports 8-bit characters.)\n" +"A space (+) will be substituted." );encoded += "+";} else {encoded += "%";encoded += HEX.charAt((charCode >> 4) & 0xF);encoded += HEX.charAt(charCode & 0xF);}}}return encoded;} function URLDecode(url) {var HEXCHARS = "0123456789ABCDEFabcdef";var encoded = url;var plaintext = "";var i = 0;while (i < encoded.length) {var ch = encoded.charAt(i);if (ch == "+") {plaintext += " ";i++;} else if (ch == "%") {if (i < (encoded.length-2)&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {plaintext += unescape( encoded.substr(i,3) );i += 3;} else {alert( 'Bad escape combination near ...' + encoded.substr(i) );plaintext += "%[ERROR]";i++;}} else {plaintext += ch;i++;}} return plaintext;} function readMoreBox(container, preHeader, header, preShortHeader, summary, details) { $(container).html( '
'+ '
 
 
 
'+ '
 
 
 
'+ '
'+ '
'+ '
'+ '
'+preHeader+'
'+ '
'+ '

'+header+'

'+ '
'+preShortHeader+'
'+ '
'+ '
'+ '
'+ '
 
'+ '
 
'+ '
 
'+ '
 
'+ '
'+ '
'+summary+'
'+ '
'+details+'
'+ '
'+ '
'+ '
 
'+ '
 
'+ ''+ '
'+ '
'+ ''+ '
'+ '
'+ '
' ); } function readMoreBoxMini(container, preHeader, header, preShortHeader, summary, details) { $(container).html( '
'+ '
 
 
 
'+ '
 
 
 
'+ '
'+ '
'+ '
'+ '
'+preHeader+'
'+ '
'+ ''+ '
'+preShortHeader+'
'+ '
'+ '
'+ ''+ '
'+ '
 
'+ '
 
'+ ''+ '
'+ '
'+ '
'+ '
' ); } function displayReadMore(link) { var innerBoxContainer = $(link).parent().parent(); if($(innerBoxContainer).attr('alt') == 'summary') { hideReadMore(innerBoxContainer); } else { showReadMore(innerBoxContainer); } } function hideReadMore(innerBoxContainer) { var boxContent = $(innerBoxContainer).parent(); if($(boxContent).attr("showingMore") != "true") { $(boxContent).attr("showingMore", "true"); $('.readMore', innerBoxContainer).fadeOut(300, function() { $('.readMoreLink', this).html("- Hide More"); $(innerBoxContainer).attr('alt', 'details'); $(this).fadeIn(300); }); var eventsPageMask = $('#eventsPageMask'); $(eventsPageMask).attr('previousHeight', $(eventsPageMask).height()); var height = parseFloat($('.innerBoxDetails', innerBoxContainer).height()); $(boxContent).attr('altHeight', height+115); $(boxContent).animate({height: (height+115)+'px'}, 300, 'linear', function() {}); $(eventsPageMask).css('height', ($(eventsPageMask).height() + height)+'px'); $('.innerBoxContent', innerBoxContainer).animate({height: height}, 300); $('.innerBoxSummary', innerBoxContainer).fadeOut(300, function() { $('.innerBoxDetails', innerBoxContainer).fadeIn(300); }); } } function showReadMore(innerBoxContainer) { var boxContent = $(innerBoxContainer).parent(); if($(boxContent).attr("showingMore") == "true") { var eventsPageMask = $('#eventsPageMask'); $(boxContent).attr('altHeight', ''); $('.readMore', innerBoxContainer).fadeOut(300, function() { $('.readMoreLink', this).html("- Read More"); $(innerBoxContainer).attr('alt', 'summary'); $(this).fadeIn(300); }); var height = 44; $('.innerBoxDetails', innerBoxContainer).fadeOut(300, function() { $(boxContent).animate({height: '159px'}, 300, 'linear', function() {}); $('.innerBoxContent', innerBoxContainer).animate({height: height}, 300, function() { $('.innerBoxSummary', innerBoxContainer).fadeIn(300); $(eventsPageMask).css('height', $(eventsPageMask).attr('previousHeight')+'px'); $(eventsPageMask).attr('previousHeight', ''); $(boxContent).attr("showingMore", "false"); }); }); } } function buildEvents () { var eventsPageMask = $('#eventsPageMask'); $(eventsPageMask).css('overflow', 'hidden'); var eventsPageContainer = $('#eventsPageContainer'); $(eventsPageContainer).css('position', 'absolute'); $(eventsPageContainer).attr('active', '0'); var height = 0; $(".eventsMonth").each(function(i, val) { $(this).attr('position', i); $(this).attr('eventCount', $('.event', this).length); if($(this).attr('active') == 'true') { $(this).addClass("eventsActiveMonth"); $('.event', this).each(function() { readMoreBox(this, $('.eventDate', this).html(), $('.eventTitle', this).html(), $('.eventShortTitle', this).html(), $('.eventSummary', this).html(), $('.eventDetails', this).html()); }); } else { $('.event', this).each(function() { readMoreBoxMini(this, $('.eventDate', this).html(), $('.eventTitle', this).html(), $('.eventShortTitle', this).html(), $('.eventSummary', this).html(), $('.eventDetails', this).html()); $(".boxContainer", this).fadeTo(1, .6); }); } $(this).css('float', 'left'); }); setEventPageMaskHeight(eventsPageMask, $(".eventsMonth")[0], 0); $($(eventsPageMask).parent()).append('