﻿/// <reference path="jquery-1.3-vsdoc.js" />
/*** Page initialization ***/
var pagePendingAction = '';  //  A copy of the current ajax request being serviced for reference

//  Initialization of the RSH object
window.dhtmlHistory.create({
        toJSON: function(o) {
                return JSON.stringify(o);
        }
        , fromJSON: function(s) {
                return JSON.parse(s);
        }
});

//  Disable flash portion of addthis buttons on the site
//  This config may be modified for further customizations of buttons
var addthis_config = {
    data_use_flash: false,
    data_use_cookies: false
}

//  jQuery page load function
//  Used to set up site-wide event handlers
$().ready(function() {
	//setup the rollup error behavior
	setCloseCallout('#ctl00_pnlError');
});

//  Adds a message to the message area from the client
function AddClientMessage(sClass, sText, sHeader) {
    if(sClass == 'hide') {
        $("#ctl00_errorText").html('');
    }
    else {
        if(sHeader.length > 0)
            $("#ctl00_errorText").html('<h4>' + sHeader + '</h4>' + '<p>' + sText + '</p>');
        else
            $("#ctl00_errorText").html('<p>' + sText + '</p>');
    }
    
    $("#ctl00_pnlError").removeClass().addClass(sClass).css('display', 'block');  //  style + show it
}

//  Grabs querystring variables
function QueryString(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i=0;i<gy.length;i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
    }
}

/*** Keyword Highlight functions ***/
function HighlightSearchKeywords(searchWithinSelector) {
    if(true) { //TODO: insert a condition here for keyword highlighting preference
		if( $("#keywordsHighlight").size() > 0 ) {
			var oItems = $("#keywordsHighlight").val().split('|');
			for(var i=0; i < oItems.length; ++i) {
				if(oItems[i].length > 0)
					$(searchWithinSelector).highlight(oItems[i]);
			}
        }
    }
}
/*** END Keyword Highlight functions ***/