function omniLinkCall(element,omniTag) {
	setOmniValues(element,'o',omniTag,'','','',0,'','');
	}

/*** QUICKNAV CODE ***/
var quickNav = new Class({
    initialize: function(containerID,eTrigger){
		this.navBox = $(containerID);
		if(!this.navBox) {
			return;	
		}		
		this.trigger = this.navBox.getElement('.starter');
		this.menu = this.navBox.getElement('.secondary');
		this.outerMenu = this.navBox.getElement('.triggerBox');
		this.menu.style.visibility = "visible";

		this.menuEffect = new Fx.Slide(this.menu, {
			duration: 300,
			transition: Fx.Transitions.Cubic.easeIn
		});

		this.menuEffect.hide();

		if (eTrigger == "hover") {

			this.trigger.addEvent("mouseenter", function(e) {
				this.menuEffect.stop();		
				this.outerMenu.addClass('openTrigger');
				if(!this.trigger.hasClass('isActive')){
					this.trigger.addClass('isActive');
				}
				this.menuEffect.slideIn();
			}.bind(this));

			this.outerMenu.addEvent("mouseleave", function(e) {
				this.menuEffect.stop();										   
				this.menuEffect.slideOut().chain(function() {
					this.outerMenu.removeClass('openTrigger');
				}.bind(this));
				if(this.trigger.hasClass('isActive')){
					this.trigger.removeClass('isActive');
				}
			}.bind(this));

		} else if (eTrigger == "click") {

			this.trigger.addEvent("click", function(e) {
				e = new Event(e);													
				this.menuEffect.toggle();
				e.stop();
			}.bind(this));

		}


	}

});


/*** IE HOVER FIX ***/
var ieHoverFix = new Class({
    initialize: function(containerID){
		this.container = $(containerID);
		this.navItems = this.container.getElements('.hoverfix');
		this.navItems.each(function(navItem, index) {
			navItem.addEvent("mouseenter", function(event) {
				navItem.addClass("hover");
			}.bind(this));
			navItem.addEvent("mouseleave", function(event) {
				navItem.removeClass("hover");
			}.bind(this));
		}.bind(this));
	}
});


window.addEvent('domready', function() {
	if ($defined($('gus_ea'))) {
		var gusNavEAMenu = new quickNav('gus_ea','click');
	}
	if ($defined($('gus_welcome')) && $defined($('gusWelcome'))) {
		if (loggedinMenuActive) var gusNavWelcomeMenu = new quickNav('gus_welcome','click');
	}
});


// function for showing poll results
function submitPollVote() {
	$('pollform').send({
		onSuccess: function(html) {
			$('pollQuestion').innerHTML = html;
		},
		onFailure: function(html) {
			console.log("I'd be displaying an error now");
		},
		onUpdate: function() {
			$('pollQuestion').innerHTML = '<p>Loading...</p>';
		}
	});
}


// gus functions

function personaRedirect() {
     var returnTo = encodeURIComponent(this.document.location);
     var personaLink = $('gusChangePersona').getProperty('href');
     if (personaLink.indexOf('?') > -1) {
           if (personaLink.indexOf('&') > -1) {
                personaLink = personaLink + "&";
           }
     } else {
           personaLink = personaLink + "?";
     }
     this.document.location = personaLink + "surl=" + returnTo;
}

function euLogoutRedirect(locale) {
	var returnTo = encodeURIComponent(this.document.location);
	var logoutLink = $('gus-plBtnLogout-' + locale).getProperty('href');
	if (logoutLink.indexOf('?') > -1) {
	      if (logoutLink.indexOf('&') > -1) {
	           logoutLink = logoutLink + "&";
	      }
	} else {
	      logoutLink = logoutLink + "?";
	}
	
	this.document.location = logoutLink + "&surl=" + returnTo;
}

function logoutRedirect() {
     var returnTo = encodeURIComponent(this.document.location);
     var logoutLink = $('gus_logout_link').getProperty('href');
     if (logoutLink.indexOf('?') > -1) {
           if (logoutLink.indexOf('&') > -1) {
                logoutLink = logoutLink + "&";
           }
     } else {
           logoutLink = logoutLink + "?";
     }
     this.document.location = logoutLink + "&surl=" + returnTo;
}

function euLoginRedirect(locale) {
     var returnTo = encodeURIComponent(this.document.location);
     var loginLink = $('gus-nationLoginLink-' + locale).getProperty('href');
     this.document.location = loginLink + "&surl=" + returnTo;

}

function loginRedirect() {
     var returnTo = encodeURIComponent(this.document.location);
     var loginLink = $('gus_login_link').getProperty('href');
     this.document.location = loginLink + "&surl=" + returnTo;

}

function euRegisterRedirect(locale) {
     var returnTo = encodeURIComponent(this.document.location);
     var regLink = $('gus-nationRegisterLink-' + locale).getProperty('href');
     this.document.location = regLink + "&surl=" + returnTo;
}

function registerRedirect() {

     var returnTo = encodeURIComponent(this.document.location);

     var regLink = $('gus_register_link').getProperty('href');

     this.document.location = regLink + "&surl=" + returnTo;

}



