var newwindow = '';
function popitup(link) {
	if( $(link) && $($(link).id + '-code')) {
		//setTimeout("merchantwindowfocus('"+url+"')", 3000);
		url = $(link).href;
		$($(link).id + '-code').style.display = 'block';
		if (!newwindow.closed && newwindow.location) newwindow.location.href = url;
		else {
			newwindow=window.open(url,'name');
			if (!newwindow.opener) newwindow.opener = self;
		}
		//if (window.focus) {newwindow.focus()}
		//window.focus();
		if(newwindow.focus) window.focus();
	} else alert('code depasse');

	return false;
}




// Create namespace ------------------------------------------------------------
if (at == undefined) var at = {};
if (at.bartelme == undefined) at.bartelme = {};

// Search Hilite class ---------------------------------------------------------
at.bartelme.searchHilite = Class.create();
	at.bartelme.searchHilite.prototype = {
initialize: function()
			{
				this.hlclass = "hilite";
				this.items = $A(document.getElementsByClassName(this.hlclass));
				if (this.items.length == 0) return false;
				this.items.each(function(item)
						{
						new Effect.Highlight(item, {startcolor:'#fff799', endcolor:'#ffffff', duration: 2});
						});
			}
	}


at.bartelme.searchField = Class.create();
	at.bartelme.searchField.prototype = {
		initialize: function()
			{
				this.search_field  = $("keywords");
				this.default_value = "Rechercher...";
				this.is_safari     = ((parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1));
				if (this.is_safari) {
					Element.addClassName(this.search_field, "issafari");
					this.replace();      
				} else {
					if (this.search_field.value == "") this.search_field.value = this.default_value;
				}
				Event.observe(this.search_field, "focus", this.focus.bindAsEventListener(this), false);
				Event.observe(this.search_field, "blur",  this.blur.bindAsEventListener(this),  false);
			},
		replace: function()
		 {
			 this.search_field.setAttribute('type', 'search');
			 this.search_field.setAttribute('autosave', 'at.bartelme.search');
			 this.search_field.setAttribute('results', '5');
			 this.search_field.setAttribute('placeholder', this.default_value);
		 },
		focus: function()
	   {
		   if (this.search_field.value == this.default_value) {
			   this.search_field.value = "";
			   Element.addClassName(this.search_field, "focus");
		   }
	   },
	blur: function() {
		if (this.search_field.value == "") {
			if (this.is_safari) {
				this.search_field.value = "";        
			} else {
				this.search_field.value = this.default_value;
				Element.removeClassName(this.search_field, "focus");
			}
		}
	}
}

// Event.observe(window, "load", function(){new at.bartelme.searchHilite()}, false);
//Event.observe(window, "load", function(){new at.bartelme.searchField()}, false);

