
/* 

Affiliate Code fixer - doesn't work in IE6 due to shitty onMouseOut
Copyright GYG - email pete@growyourgame.com
	
*/

var affiliateData = new Array (

	{
		"patterns": ["dglass81.cohypnosis.hop.clickbank.net"],
		"link":     "http://dglass81.cohypnosis.hop.clickbank.net/",
		"display":  "http://www.conversational-hypnosis.com/",
		"tracker":  "afft_convho"
	},

	{
		"patterns": ["dglass81.kkpub707.hop.clickbank.net"],
		"link":     "http://dglass81.kkpub707.hop.clickbank.net/",
		"display":  "http://www.highstatusmale.com/",
		"tracker":  "afft_hsm"
	},

	{
		"patterns": ["doubleyourdating.directtrack", "doubleyourdating.com", "affiliates.hottopicmedia.com/z/96"],
		"link":     "http://affiliates.hottopicmedia.com/z/96/CD192/",
		"display":  "http://www.doubleyourdating.com/",
		"tracker":  "afft_dyd"
	},

	{
		"patterns": ["kbid=19444"],
		"link":     "http://www.themysterymethod.com/magicbullets.html?kbid=19444&m=8",
		"display":  "http://www.themysterymethod.com/",
		"tracker":  "afft_mysterymethod"
	},
	
	{
		"patterns": ["realworldseduction.directtrack", "realworldseduction.com"],
		"link":     "http://realworldseduction.directtrack.com/z/80/CD215/",
		"display":  "http://www.realworldseduction.com/",
		"tracker":  "afft_rws"
	}

);

function fixAff () {

	$ES("a").each(
		function (affLink) {
		
		// Get the href
		
			var href = affLink.getProperty('href');
			
		// Cycle through our patterns
		
			affiliateData.each( function (affiliate) {
			
				var foundMatch;
				
				affiliate.patterns.each( function (pattern) {
				
					if ( href.indexOf( pattern ) > 0 ) { foundMatch = 1 }
				
				});
				
				if ( foundMatch ) {
				
					affLink.setProperty("href", affiliate.link);
					affLink.setProperty("onclick", "javascript:urchinTracker('/ads/" + affiliate.tracker+ "');");
					affLink.setProperty("onmouseover", "window.status='" + affiliate.display + "'; return true");
					affLink.setProperty("onmouseout", "window.status='Done'");
					affLink.setProperty("target", "_blank");

				}
			
			} );
		
		}
	);

}
