//function for RSS link tracking (ported from tjx-subscribe-widget.js.php)
	function fireRSSEvent(category) {
		s1 = s_gi("<?php global $s_account; echo $s_account; ?>");
		s1.linkTrackVars="prop11,prop12,eVar13,events";
		s1.prop11 = category.replace("'", "");
		s1.prop12 = "RSS";
		s1.eVar13 = "RSS (Subscription)";
		s1.eVar7  = "Out";
		var s_code1=s1.tl();
		if(s_code1) document.write(s_code1);
	}
	//validation functions
	function validateZipCode(zip) {
		if(zip.length==0)
		{
			return 2;
		}
		else if (zip.length != 5)
		{
			return 3;
		}
		else if (isNaN(zip))
		{
			return 3;
		}
			else if (Number(zip) <= 0 )
		{
			return 3;
		}
		else {return 1;}
	}
	
	function validateEmail(email){
		if(email.length != 0)
		{
			if(isValidEmailAddress(jQuery.trim(email)))
			{
				return 1;
			}
			else {
			return 2;
			}
		}
		else {
			return 3;
		}
	}
	
	// Email validation
	function isValidEmailAddress(emailAddress) {

		var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
     
          
		//Apostrophe email handling
		emailAddress=replaceCharacters("'","",emailAddress);
		if (emailAddress.search(emailRegEx) == -1) 
		return false;
		else
		return true;
	}
	
	function replaceCharacters(inChar,replacewithChar,origString) {
		var newString = origString.split(inChar);
		newString = newString.join(replacewithChar);
		return(newString);
	}
	//Currently on used on the page based email subscribe
	function compareEmailFields(emailFirst,emailSecond) {
		if(emailSecond == emailFirst){
			return true;
		}
		return false;
	}
	
	//First name / Last name validation
	function validateFirstName(name) {	
		if(name.length != 0) {
			if(name.contains(/[^\w-'\s]|-{2,}|'{2,}/)){
				return 3;
			}
			else {
				return 1;
			}
		}
		else {
			return 2;
		}
	}
	function validateLastName(name) {
		if(name.length == 0)
		{
			return 1;
		}
		else {			
			if(name.contains(/[^\w-'\s]|-{2,}|'{2,}/)){
				return 3;
			}
			else {
				return 1;
			}
		}		
	}
	
	String.prototype.contains = function(str) {
		if(str){
			if(str instanceof RegExp){
				return str.test(this);
			}
			else{
				return (this.indexOf(str) > -1);
			}
		}
	}			
