/* --- start eac::Framework JavaScript include --- */
	// eac::Framework variables
	if (typeof EAC == 'undefined') var EAC = {};
	if (EAC.defaults) EAC.defaults.trans_sid = "";
	
	EAC.FW = {
		CompanyID     : "CHA",
		ProductID     : "CHA",
		CompanyName   : "Charesume",
		CompanyDomain : "charesume.com",
		isNewSession  : true,
		isInternalIP  : false,
		isTestMode    : false,
		SessionID     : "e121e93463dac110551e76cdab55b4e9",
		Sourcing      : {urlkey:"",KeyCode:"00000",Source:"CHA00000",Medium:"direct",Campaign:"",Creative:"",Segment:"",TagCode:"",Tracking:"1",Description:"Default source code",Referral:"",Keywords:"",urlverb:"key",gaCampaign:"CHA00000 [Default source code] (campaign not set)"}
	}
	EAC.Framework = EAC.FW; // depreciated
	EAC.altContent = function(element,content) {
		if (!element) return;
		var keyid = EAC.FW.Sourcing.urlkey || EAC.FW.Sourcing.KeyCode;
		var x = new Ajax.Updater(element,'altContent.php',{ 
						parameters: {
							key: 		keyid, 
							content: 	content, 
							keyfileid: 	EAC.FW.Sourcing.KeyFileID || '(none)'},
						evalScripts:true
					});
	}
	window['altContent'] = EAC.altContent;
	// end eac::Framework variables
	// start Google Analytics support
	EAC.getUTMValue = function(utmName,cookie) {
		if (utmName) {
			if (utmName != 'gclid') utmName = 'utm_'+utmName;
			var re = new RegExp('(\\?|&)('+utmName+')=([^&]+)','i');
			var searchq = re.exec(document.location.search);
			if (searchq) return searchq[3];
		}
		var utmz = EAC.cookie.get('__utmz');
		if (cookie && utmz) {
			var re = new RegExp('(\\.|\\|)('+cookie+')=([^&]+)','i');
			var searchq = re.exec(utmz);
			if (searchq) return searchq[3];
		}
		return null;
	}
	// GA cookies - __utmb	30 minute session cookies
	// 				__utmc	session cookie (no time set)
	// 				__utma	2 year visitor cookie
	// 				__utmz	6 month tracking cookie (w/utm_ values)
	// 				__utmv	2 year user defined value
	// 				__utmx	2 year website optimizer
	// see: http://code.google.com/apis/analytics/docs/concepts/gaConceptsCookies.html
	EAC.trigger_gaSupport = function(onLoad_or_path) {
		if (document.getElementById('eac_ga_iframe')) return;
		if (document.cookie.indexOf('__utmc') == -1) EAC.FW.isNewSession = true;
		EAC.FW.gaAccount1 = "UA-6586272-1";EAC.FW.gaAccount2 = "UA-6586272-1";EAC.FW.gaAccount3 = "";
		var utm_source, utm_medium, utm_campaign, utm_content, utm_term;
		var url = EAC.defaults.helperPath + 'eac_scripts.ga.html?eac=t';
		if (document.location.search.indexOf('gclid=') != -1) {			// if we have an AdWords gclid, pass it
			url += '&gclid='+EAC.getUTMValue('gclid');
		} else if (document.location.search.indexOf('utm_') != -1) {	// if we have utm_ values, pass them
			utm_source   = EAC.getUTMValue('source');
			utm_medium   = EAC.getUTMValue('medium');
			utm_campaign = EAC.getUTMValue('campaign');
			utm_content  = EAC.getUTMValue('content');
			utm_term     = EAC.getUTMValue('term');
		} else {														// format the campaign values
			// for a new session or no utmz cookie or we have a 'key=' value in the url, get sourcing values
			if (EAC.FW.isNewSession || document.cookie.indexOf('__utmz') == -1 || document.location.search.indexOf(EAC.FW.Sourcing.urlverb+'=') != -1) {
				if (EAC.FW.Sourcing.Referral)
					var utm_source = EAC.FW.Sourcing.Referral;
				else
					var utm_source = (document.referrer && EAC.FW.Sourcing.Medium != 'direct') 
										? EAC.parseURL(document.referrer)['domain'] 
										: document.location.host || document.location.hostname;
				utm_medium   = EAC.FW.Sourcing.Medium;
				utm_campaign = encodeURIComponent(EAC.FW.Sourcing.gaCampaign);
				utm_content  = EAC.FW.Sourcing.Creative;
				if (utm_medium != 'direct' && utm_medium != 'organic' && utm_medium != 'ppc' && utm_medium != 'cpc' && 
					document.referrer && !EAC.FW.Sourcing.Creative)
					utm_content = EAC.parseURL(document.referrer)['path'];
				if (EAC.FW.Sourcing.Keywords) {
					utm_term = encodeURIComponent(unescape(EAC.FW.Sourcing.Keywords));
				} else {
					var re = /(\?|&)(q|p|query|encquery|qt|terms|rdata|qs|wd|text|szukaj|k|searchExpr|search_for|string|search_query|searchfor)=([^&]+)/;
					var searchq = re.exec(document.referrer);
					if (searchq) utm_term = encodeURIComponent(unescape(searchq[3]));
				}
				EAC.cookie.erase('__utmz','__utmv');
			}
			if (!EAC.FW.Sourcing.gaCampaign) {
				utm_campaign = utm_content = null;
			}
		}
		if (utm_source)   url += '&utm_souce='+utm_source;
		if (utm_medium)   url += '&utm_medium='+utm_medium;
		if (utm_campaign) url += '&utm_campaign='+utm_campaign;
		if (utm_content)  url += '&utm_content='+utm_content;
		if (utm_term)     url += '&utm_term='+utm_term;
		url += (typeof onLoad_or_path == 'string') ? '#'+onLoad_or_path : '#'+document.location.pathname;
		if (document.getElementById('eac_ga_support')) onLoad_or_path = true;
		if (onLoad_or_path === true) {
			var d = document.getElementById('eac_ga_support') || document.body || document.getElementsByTagName("body")[0];
			var e = document.createElement("iframe");
			e.setAttribute("id", 'eac_ga_iframe');
			e.setAttribute("src", url);
			e.setAttribute("width", "0");
			e.setAttribute("height", "0");
			e.setAttribute("frameborder", "0");
			e.style.visiblity = 'hidden';
			d.appendChild(e);
		} else {
			document.write("<iframe id='eac_ga_iframe' style='width:0px;height:0px;visibility:hidden;' src='"+url+"'></iframe>");
		}
		EAC.console.log('GA Triggered '+url);
		EAC.trigger_gaSupport = function(){};
	}
	// if we haven't trigger_gaSupport() by the time the document has loaded, make sure we do
//	if (EAC.browser.isExplorer) { // "operation aborted" still in IE8
//		Event.observe(window, 'load', function(evt) {EAC.trigger_gaSupport(true);});
//	} else {
		document.observe('dom:loaded', function(evt) {EAC.trigger_gaSupport(true);});
//	}
	// end Google Analytics support
	document.fire('EAC:FW.load');
/* --- end eac::Framework JavaScript include --- */


	// create events (using prototype) to control the left column testimonial cycle
	
	var ajaxLeft,ajaxStop;
	
	var leftColObj = {
	  mouseIn: function(event) {
				document.getElementById('Left-Testimonials').style.borderColor = '#ffffff';
				//document.getElementById('Left-Testimonials').style.backgroundColor = '#ffffff';
				ajaxLeft.stop();
	  },
	  mouseOut: function(event) {
				document.getElementById('Left-Testimonials').style.borderColor = '#555555';
				//document.getElementById('Left-Testimonials').style.backgroundColor = '#D8D1BE';
				ajaxLeft.start();
	  }
	};
	
	// cache event functions for prototype's 'observe' and 'stopObserving'
	leftColObj.mouseInB  = leftColObj.mouseIn.bindAsEventListener(leftColObj);
	leftColObj.mouseOutB = leftColObj.mouseOut.bindAsEventListener(leftColObj);
	
	
	Event.observe(window, "load", function(event) {
		if (document.getElementById('Left-Testimonials')) {
			//$('Left-Testimonials').setOpacity(.5);
	
			// create PeriodicalUpdater to load testimonial
			ajaxLeft = new Ajax.PeriodicalUpdater('Left-Testimonials', '/getpart.php?u=testimonials.php&p=part-t&r=18',
				{ method: 'get', frequency: 20, decay: 1});
	
			// create PeriodicalExecuter to stop loading after x minutes
			ajaxStop = new PeriodicalExecuter(function(pe) {
				// stop PeriodicalUpdater
				ajaxLeft.stop();
				// stop mouse events
				Event.stopObserving(document.getElementById('Left-Testimonials'), "mouseover", leftColObj.mouseInB );
				Event.stopObserving(document.getElementById('Left-Testimonials'), "mouseout", leftColObj.mouseOutB );
				// change testimonial block to show link
				document.getElementById('left').innerHTML = "<p><ul><li><a href='testimonials.php'>Testimonials</a></li></ul></p>";;
				// stop this PeriodicalExecuter
				ajaxStop.stop();
				}, 240);
	
			// create mouse events to pause testimonial block 
			Event.observe(document.getElementById('Left-Testimonials'), "mouseover", leftColObj.mouseInB );
			Event.observe(document.getElementById('Left-Testimonials'), "mouseout", leftColObj.mouseOutB );
		}
	});

