/* Science of scams custom Omniture tracking functions */

/**
 *
 * track a click on a link
 *
 **/
 
/**
 *
 * set debugging flag
 *
 * if set to true this will display an alert whenever a click is being tracked
 *
 **/
var debugging = false;  

/**
 *
 * track a link to a social media site
 *
 * @param	string
 * @return	boolean
 *
 **/
function trackLink(description) {
	var s=s_gi(s_account);
	s.trackingServer='stats.scienceofscams.com';
	s.linkTrackVars='prop20,eVar20,prop21,eVar21,events'; 
	s.linkTrackEvents='event16';
	s.events='event16';
	s.prop20='Link to Social Media Site';
	s.eVar20 = s.prop20;
	s.prop21= description;
	s.eVar21 = s.prop21;
	s.tl(this,'o',' Link to Social Media Site');
	if (debugging) 
		alert('trackLink => '+description);
}

/**
 *
 * track a poll vote
 *
 * @param	string
 * @return	boolean
 *
 **/
function trackVote(poll) {
	var vote = _getVote($("input[name='vote_opt_id']:checked").val());  // get abbreviated vote text
	var s=s_gi(s_account);
	s.trackingServer='stats.scienceofscams.com';
	s.linkTrackVars='prop14,eVar14,prop20,eVar20,events';
	s.linkTrackEvents='event8';
	s.events='event8';
	s.prop14 = poll+': '+vote;
	s.eVar14 = s.prop14;
	s.prop20='Vote';
	s.eVar20 = s.prop20;
	s.tl(this,'o','Poll Vote');
	if (debugging) 
		alert('trackVote => '+poll+': '+vote);
}

/**
 *
 * get abbreviated text of vote according to id
 * NOTE: make sure these abbreviations match vote text as defined in the database
 *
 * @param	int
 * @return	string
 *
 **/
function _getVote(id)
{
	switch(id)
	{
		case '1': return 'yes';
		case '2': return 'maybe';
		case '3': return 'no';
	}
	// no text so just return the id
	return id;
}