
/** Small Search Form Javascript **/





var originalSmallSearchFormAction = '';

/**
 * This function opens a popup window to display the search tips
 */

function launchSearchTips() {

	var urlToOpen = wcms_global_siteurl + "/searchtips.html";
	var day = new Date();
	var id = day.getTime();
	window.open(urlToOpen, "'" + id + "'", 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=600,height=500');
}

$(document).ready(function() {
	var url = '';
	url = document.location.href;
	if(url.substr(-1, 1) == '/'){
		url = url.substr(0, (url.length - 1));
	}

	// @TODO: Add in a fix for finding the current URL for links that are using /site/path instead of http://www.example.com/site/path
	url = url.replace(wcms_global_siteurl, '');

	if(url == '') {
		url= wcms_global_siteurl + '/';
	}

	$('.tplIsCurrentItem:has(>a[href$='+url+'])').each(function(){
		$(this).addClass('currentItem');
	});

	$('.tplIsCurrentItem:has(>a[href$='+url+'/])').each(function(){
		$(this).addClass('currentItem');
	});
});

var wcms = {};

wcms.Vars = function () {
	var self = this;

	self.vars = {};

	self.get = function (name) {
		if (typeof self.vars[name] == 'undefined') {
			return '[Undefined JS Variable: ' + name + ']';
		}

		return self.vars[name];
	};

	self.set = function (name, val) {
		if (typeof(name) == 'object') {
			for (i in name) {
				self.vars[i] = name[i];
			}

		} else {
			self.vars[name] = val;
		}
	};
};

wcms.lang = new wcms.Vars();

wcms.config = new wcms.Vars();
