/***************************************************************************************************
* Requirements:
* - Prototype API: http://www.prototypejs.org/api
*
* This file holds the JavaScript that is used globally throughout the site.
*
* Author: J.P. Daniel
* Date: 04/02/09
***************************************************************************************************/

function includeJS(file) {
	document.write('<script type="text/javascript" src="' + file + '"></script>');
}

document.observe('dom:loaded', function() {
	elem = $('quick-links');
	elem.enable();
	elem.observe('change', function(event) {
		event.stop();
		if ($F(elem) != '#') { window.location = $F(elem); }
	});
	
	$$('[rel~=liveChat]', '.liveChat').each(function(elem) {
	
		var width = 475;
		var height = 400;
		
		var attrib = [
			'width=' + width,
			'height=' + height,
			//'left=' + (screen.availWidth - width) / 2,
			//'top=' + (screen.availHeight - height) / 2,
			'resizable=yes'
		];
		attrib = attrib.join(',');
			
		elem.observe('click', function(event) {
			event.stop();			
			window.open('http://server.iad.liveperson.net/hc/21882319/?cmd=file&file=visitorWantsToChat&site=21882319&SESSIONVAR!visitor_profile=RR_profile&SESSIONVAR!skill=RapidRun&referrer=http://www.rapidrun.com','chat21882319',attrib);
		});
	});
});	