
var ck4t_client = {

	tag :	'*',
  classname :	'canoe_hyperklix_text',
  mode : 'zonegraph',
  linked_words : ['chaine de securite','lincoln','vendeur dodge','croisi','viper','auto usage','retrocaveuse','se ville','cherokee','explorer','saturn','bonneville','srx','buick','infiniti','main hydraulique','envoy','sangle','honda','xl-7','frein gmc','dodge','solstice','diplome','auto belt','frein good wrench','activateur','frein hummer','ancan h gregoire','trailblazer','tondeuse','ptcruiser','utilitaire sport','frein saturn','truck','trailer','berline','ford','cadillac','liberty','cheroke','sebring','voiture usag','crv','si','trotinette','garage','jaguar','garage buick','aspen','cr-v usag','kia','mazda','sportage','pontiac usage','tune up','jacquet moto','silverado','metaux','acier','awd','oldsmobile','mag','sunrunner','x-terra','fifth weel','audi','moto de route','vus volkswagen','roue','man','caliber','famille','sylverado','moteur','scooter','tires','gabriel g','mini van','springs','seebring','neuf','roue motrice','tiburon','garage automobile','aston martin','son premium','santafe','pentures','pret','voiture usage','sun runner','radeau','ti','wheels','pneu moto','occasion','twin turbo','vieux montreal','hydravion','feu position','porte','pontiac','coffre plastic','tracker','hjc','camionnette','autonet','plymouth','rdx','casque','deuxieme chance','fun','vehicule','association professionnelle','pi','montana','domicile','regal','electric brake','mongolfiere','tundra','casque moto','rio','son surround','chargeuse','mercedes','portes','gm','guide auto','pacifica','trailer box','surge brake','4x4','protege','freestar','draw bars','montreal quoi faire','financement','fillage','ancan','trans port','porsche','suv volkswagen','v','sunruner','saab','descente','utilitaire sportif','frein','automobile','suburban','pontiac usager','credit auto','good year','guide','seville','passat','michelin','tahoe','pick-up','hitch balls','assurance','denis duquette','occassion','location auto','pick up','impala','nissan','moto custom','sprinter','taux credit vus','motocross','seal','mise point','zx5','frein good ranch','venture','pipe','gant moto','moto sport','moto custum','vehicule d occasion usag','frein goodranch','skateboard','hyundai','tj','maison','x5','sonoma','compagnie assurance','sortie scolaire','ssr','camion','tribute','sienna','goodyear','moto tourisme','malibu','pintle hooks','voilier','m','fourgonette','pneu','ski','vente','assurance groupe','livre','renovation','couplers','fourgonnette','elantra','enterrement vie garcon','assureur','auto bougie','boutique moto','hybrides','attache auto','vieux port','mod','light trailer','town country','vendeur chrysler','canot','camion usag','vtt','charger srt8','assurer','alpinestar','annonce auto','newbeetle','anneau de remorque','familiale','torrent','sortie bureau','suzuki','caron guay','aventure','syst','rafting','ratchet','ram','sorento','pickup','toyota','stealth','suv','universit','frein d urgence','kayak','touareg','sts','usag','eclairage','durango','yukon','spindle','bottes moto','rampe pliante','auto','snowboard','wheel base','wave','caravan','fenetre','frein saab','seabring','boeing','en famille','attache remorque','flexiride','roues','vehicule utilitaire sport','srt10','2eme chance','pare-brise moto','assurance auto','auto huile','joe rocket','frein saturne','acheter','acura','voiture luxueuse','pontiac occasion','gaudreau','devis','fleuve','auto123','traction int','chrysler','attraction touristique','safety chain','accord','volkswagen touareg','volvo','ocassion','torflex','lexus','vw touareg','pontiac usag','construction','sun runer','vente de garage','main','deltaplane','sierra','voiture','touareg v8','suround','fox','vibe','rafraichissant','hibrydes','tout terrain','char','rapide lachine','cadenas','frein pontiac','axle','2e credit','mitsubishi','c','fenders','formule','chevrolet','windstar','frein goodrench','chassis','stratus','st laurent','mini-van','fer','hydraulic brakes','train','taco','auto usag','credit automobile','concessionnaire','uplander','xterra','m6','voiture occassion','mini pelle','rampe','camionette','performance moto','cr-v occasion','piscine','locataire','santa fe','habitation','boule de remorquage','xc90','control de frein','becyk','roman','bmw','la ronde','subaru','brouette','pathfinder','shoei','frein good rench','demonstrateur','louer auto','avion','2e chance','charger','propri','pepine','entre amis','hitch','gpf','personnes','banana boat','4x4 volkswagen','vendre auto','transport','xlr','vehicule usage','pantalon moto','sport utilitaire','comparaison auto','vendre voiture','accouplement','vw','vendeur jeep','vendre','barre de tire','sunfire','helicoptere','accent','tire','annonce','minivan','saint laurent','srt','jeep','traction','sonata','torsion','lumiere marine','escape','tucson','test','vus','van','icon','prime','parapente','frein goodwrench','credit','helmet','moto','touareg v6','dakota','joint d etancheite','accessoire moto','volkswagen','encan','coll','winches'],
		
	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?20643799394b7151ef15e0a&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();

