/*
@description General JS for WRAP

@author Victoria Chan
@created 2009-01

Notes: Requires jQuery 1.2.6
*/

//Onload actions
jQuery(function(){
	initWRAPPriNavDropDown();
	actionsForIE6();
	
	jQuery('#aboutmenu a').click(function(){
		eventTrackedLink('Nav - quick links',jQuery(this));
	})
	
	jQuery('#logo').click(function(){
		eventTrackedLink('Nav - WRAP logo',jQuery(this));
	})
	
});


//----------------------------
// Add IE6 specific code here:
//----------------------------
function actionsForIE6(){
	if(jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7)){
	};
}

//----------------------------
// Functions:
//----------------------------

//Primary nav dropdown
function initWRAPPriNavDropDown(){
	jQuery("#primary-nav li").hoverIntent({
		over: function () {jQuery(this).addClass('over');}, 
		out: function () {jQuery(this).removeClass('over');},
		interval:100,
		timeout:100
	});
	
	//attach GA event tracking to primary nav links links
	jQuery('#primary-nav .submenu a').click(function(){
		eventTrackedLink('Nav - dropdown',jQuery(this));
	})	
}

function eventTrackedLink(description,element){
	try{
		wrapTracker._trackEvent(description, 'To: '+jQuery(element).html().replace(/\'/g,"")+' - ' +jQuery(element).attr("href"), 'From: '+jQuery('title').html().replace(/\'/g,"")+ ' - ' + document.location.href);
	}catch(err){}	
}
