var canoe411_proxy = function(){this.initialize.apply(this, arguments);}
canoe411_proxy.prototype = {
	suggest_count : 0,
	max_suggest : 4,
		
	initialize : function() {
	     this._loadCount();
	},
	 
 	cookieManager :  {
    set: function(name, value, daysToExpire) {
      var expire = '';
      if (daysToExpire != undefined) {
        var d = new Date();
        d.setTime(d.getTime() + (86400000 * parseFloat(daysToExpire)));
        expire = '; expires=' + d.toGMTString();
 					}
      return (document.cookie = escape(name) + '=' + escape(value || '') + expire);
 		 },
		
    get: function(name) {
      var cookie = document.cookie.match(new RegExp('(^|;)\\s*' + escape(name) + '=([^;\\s]*)'));
      return (cookie ? unescape(cookie[2]) : null);
 		 },
		
    erase: function(name) {
      var cookie = Cookie.get(name) || true;
      Cookie.set(name, '', -1);
      return cookie;
 		 }		
 	}, //cookieManager()
	
	 isSuggestLimitReached : function() {
    return this.suggest_count >= this.max_suggest;
	 }, //isSuggestLimitReached()
	
  addSuggestCount : function(url, type411, name411, location411) {
    //Decision d'arreter l'affichage du popup prise le 2008-05-12
	  // if ( !this.isSuggestLimitReached() ) {
		if(false){
      new_count = ++this.suggest_count;
      this.cookieManager.set('canoe411_proxy', new_count, 1000);
		 		this._openPopup(url, type411, name411);
 		 } else {
			this._search411(url, type411, name411, location411);
 		 }
		},//addSuggestCount()
	
 	_openPopup : function(url, type411, name411) {
 		 var type411_f = type411 == true ? 'entr' : 'pers' ;
  	 window.open(url+'popup/canoe411?type411='+type411_f+'&name='+name411+'','_blank', 'width=320,height=250,top=500, left=500, toolbar=no, menubar=no, scrollbars=no');
 	}, //openPopup()
	
	_search411 : function(url, type411, name411, location411) {
	 var type411_e = type411 == true ? 'entr' : 'pers' ;
 	 window.location=url+'search?sen=canoe411&log411=canoe411tlb&name='+name411+'&location='+location411+'&type411='+type411_e+'&lang=fren&q=a';
	}, //search411()
 	
  _loadCount : function() {
    var count = this.cookieManager.get('canoe411_proxy');
    this.suggest_count = count != null? count : 0;
		}//_loadCount()
	
}//canoe411_proxy
