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("
" ); $('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('
');
}
}
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(
'