
var ck4t_client = {

	tag :	'*',
  classname :	'canoe_hyperklix_text',
  mode : 'zonegraph',
  linked_words : ['rafting','suv','accent','moto sport','passat','trailblazer','hydravion','traction','alpinestar','moteur','michelin','twin turbo','sonoma','solstice','transport','oldsmobile','tucson','utilitaire sportif','volkswagen','performance moto','acheter auto','jetta','civic','assurances','uplander','sun runner','seville','lincoln','4wd','universit','accessoire moto','mitsubishi','aerio','jacquet moto','entre amis','van','helmet','credit auto','dodge','sortie scolaire','awd','nissan','frein d urgence','vieux port','incendie','moto','scooter','pontiac usager','minivan','pi','srx','son premium','ski','toyota','axle','vendeur dodge','louer auto','pontiac usage','deuxieme chance','sunfire','fourgonnette','touareg v6','location auto','berline','vendre auto','mise point','suround','radeau','pickup','coll','syst','pret','liberty','charger srt8','gm','vw touareg','brouette','srt10','assurer','pathfinder','casque','tiburon','locataire','freestar','buick','shoei','infiniti','son surround','attraction touristique','viper','durango','hjc','goodyear','trans port','sentra','chevrolet','v','cayenne','icon','auto123','piscine','yukon','gant moto','2e chance','hibrydes','ti','auto','vehicule utilitaire sport','tune up','torrent','porsche','vendre voiture','tahoe','sunruner','automobile','sonata','fleuve','rdx','aspen','cr-v occasion','chrysler','si','suburban','jeep','train','deltaplane','mazda','vol','camionnette','crv','touareg v8','caliber','neuf','voiture luxueuse','honda','mag','cheroke','dealer','fourgonette','tire','sebring','acura','hybrides','vibe','subaru','vieux montreal','financement','assurance ssq','diplome','golf','test','pick-up','char','x-terra','sportage','achat auto','assurance vol','ram','xc90','camion usag','man','anti gel','mongolfiere','camion','moto de route','wheel base','acheter','pacifica','taux credit vus','occassion','accord','croisi','pare-brise moto','tribute','hyundai','wave','touareg','lexus','assurance groupe','voiture','en famille','x5','mini van','bottes moto','soumission assurance habitation','vus volkswagen','truck','vendeur jeep','suzuki','vtt','voiture occassion','pneu moto','avion','stealth','2wd','demonstrateur','roue','moto custom','all wheel drive','kayak','compagnie assurance','elantra','saab','camionette','pipe','2eme chance','cadillac','se ville','st laurent','aventure','cherokee','propri','assurance','mini-van','fox','auto ocasion','ocassion','focus','malibu','assureur','snowboard','volvo','auto usag','la ronde','ptcruiser','auto occasion','enterrement vie garcon','hitch balls','moto tourisme','vw','tj','hitch','antigel','activit','casque moto','town country','plymouth','sun runer','santa fe','vendre','auto usage','srt','santafe','vus','regal','becyk','usag','echo','joe rocket','tout terrain','formule','vehicule usage','soumission automobile','kia','soumissions','renouvellement assurance','silverado','cavalier','mercedes','roue motrice','seebring','4x4 volkswagen','sylverado','feu','sport utilitaire','cr-v usag','familiale','auto bougie','pantalon moto','xterra','suv volkswagen','jaguar','rapide lachine','sunrunner','occasion','utilitaire sport','assurance auto','envoy','helicoptere','concessionnaire','montreal quoi faire','banana boat','habitation','cayene','protege','voiture usag','2e credit','boule de remorquage','bmw','xl-7','vendeur chrysler','encan','dakota','parapente','pontiac','safety chain','escape','boutique moto','auto huile','canot','auto belt','charger','pontiac usag','devis','fun','stratus','boeing','autonet','skateboard','audi','cadenas','motocross','trotinette','caravan','famille','sts','ford','rafraichissant','draw bars','4x4','ssr','pick up','credit automobile','moto custum','descente','voiture usage','explorer','volkswagen touareg','ancan','taurus','saturn','sierra','voilier','saint laurent','tundra','sprinter','sortie bureau','traction int','annonce auto','soumission','altima','good year','vehicule','taco','maison','impala','sorento','pontiac occasion','pneu','prime','xlr','association professionnelle','barre de tire','seabring','ancan h gregoire','credit'],
		
	loadCSS :	function(file_url)
	{		
	  var css = document.createElement('link');
	  css.rel = 'stylesheet';
	  css.type = 'text/css';
	  css.href = file_url;
	  
	  document.body.appendChild(css);
	},
	
	start :	 function() {
	  var oldonload = window.onload;
	  var self = this;
	  if (typeof (window.onload) != 'function') {
	    window.onload = function(){self._onload.call(self);}
	  }
	  else {
	    window.onload = function(){oldonload(); self._onload.call(self);}	
	  }
	},
	
	_browserHacks : function()
	{	
    if ( this.tag && this.tag != '*' ) {
      if ( window.ActiveXObject ) {
        var tag = this.tag.split(':');
        var prefix = tag[1]? tag[0] :	'canoeklix';
        document.body.innerHTML = '<html xmlns:'+ prefix + '>' + document.body.innerHTML;
	    
        if ( !tag[1] ) {
          var r1 = new RegExp('<'+ this.tag +'>', 'gi');
          var r2 = new RegExp('<\/'+ this.tag +'>', 'gi');
          document.body.innerHTML = document.body.innerHTML.replace(r1, "<canoeklix:"+ this.tag +">").replace(r2, "</canoeklix:"+ this.tag +">");
        }	
        else
          this.tag = tag[1];
      }
      else if ( typeof document.loadBindingDocument == 'function' ) {
        if ( document.getElementsByTagName(this.tag)[0] )
          this.tag = 'body';	
      }
    }
	},
	
	_onload :function()
	{
		this._browserHacks();
	
	  this.loadCSS('http://static.search.canoe.ca/s-ppc/css/hyperklix/default.css');

    var script = document.createElement('script');
    script.src = 'http://static.search.canoe.ca/s-ppc/js/hyperklix/HyperklixParser.js?v2';
    script.type = 'text/javascript';
	
		document.body.appendChild(script);
	},
	
	callback : function()
	{ 
		var parser = new HyperklixParser(this.tag, this.classname);

    if ( this.mode == 'zonegraph' ) {
      parser.findWords(this.linked_words);
    }
    else {
	    parser.parseDocument();
    }

    this.callServer(parser.wordlist);    
	},

  callServer : function(words)
  {
    var strw = '';
    for(var i=0; i < words.length; i++)
      strw += 'ch[' + i + ']=' + words[i] + '&';

    var script = document.createElement('script');
		script.src = 'http://www.canoeklix.com/hyperklix_server?6111051954c806644e2fca&src=positext:autonetfr&lg=fr&charset=cp1252&tag='+this.tag+'&classname='+this.classname+'&filter=autonet&nads=2' + '&' + strw ;
		script.type = 'text/javascript';
		script.id = 'loadScript';
		document.body.appendChild(script);
  }
}	

ck4t_client.start();

