// JavaScript Document
function activateHistory(hash) {
	var flash = jQuery('#flashSite').get(0);
	if (flash && flash.jsChangeSection) {
		flash.jsChangeSection(hash);
		/*if (pageTracker._trackPageview) {
			pageTracker._trackPageview(hash);
		}*/
	}
}

function change(hash){
	$.historyLoad(hash);
	return false;
}

function trackGAPage(hash) {
	if (pageTracker._trackPageview) {
		//console.log(hash)
		pageTracker._trackPageview(hash);
	}
	//alert(hash);
}

function trackGAEvent(category, action, opt_label) {
	if (pageTracker._trackEvent) {
		if(typeof(opt_label) != 'undefined' ){
			pageTracker._trackEvent(category, action, opt_label);
		}else{
			pageTracker._trackEvent(category, action);
		}
		//console.log("category:"+category+", action:"+action+", label:"+(typeof(opt_label) == 'undefined' ? "" : opt_label))
	}
	//alert("category:"+category+", action:"+action+", label:"+opt_label);
}

function flashInit(){
	$.historyInit(activateHistory);	
}

function detectBrowser(brw) {
	var agent = navigator.userAgent.toLowerCase();
	this.browser = agent.indexOf(String(brw)) > 0;
	return this.browser;
}
