function modulo(arg) {
	
	arg = arg.replace(/\{proto\}/g,		'http://');
	arg = arg.replace(/\{site\}/g,     	'www');
	arg = arg.replace(/\{factory\}/g,  	'selectronic');
	arg = arg.replace(/\{dyna\}/g,  	'php');
	arg = arg.replace(/\{static\}/g,  	'html');
	arg = arg.replace(/\{\#\}/g,   	    '/');

	arg = arg.replace(/\{~\}/g,   	    '.');
	arg = arg.replace(/\{&\}/g,   	    '?');

	document.location=arg;
	return true;
}

var topOffset = 15;
var leftOffset = 50;
var showBlock=true;
var timer;
var blockCurrent=null;

/**
 * Fonction permettant d'afficher le bloc popup lors du survol du menu
 */
function showPopup(bloc)
{
	//On retire toutes les classes "selected".
	$j('#nav').children("div").children("ul").children("li").children("span").removeClass("selected");
	if(blockCurrent!=null){
		blockCurrent.removeClass("selected");
		hidePopup(blockCurrent, bloc);
		return;
	}
	
	blockCurrent=bloc;
	var positionNav = bloc.parents("#nav").position();
	var topBloc = bloc.parents("#nav").height()+positionNav.top;
	var leftBloc = positionNav.left;
	var widthBloc = $j('#'+bloc.attr('id')+'_1').width();
	var heightBloc = $j('#'+bloc.attr('id')+'_1').height();
	
	//On considère que la largeur maximum est la largeur du site, donc du DIV ayant l'id nav
	var limit = bloc.parents("#nav").width()+positionNav.left-6;

	//Si cette limite est dépassée, on recul la position du bloc à afficher.
	if(leftBloc+widthBloc>limit)
	{
		leftBloc=limit-widthBloc;
	}
	bloc.children('span').addClass("selected");
	$j('#'+bloc.attr('id')+'_1').height("0px");
	$j('#'+bloc.attr('id')+'_1').children("#nav_n1_general").children("ul").addClass(bloc.parents("div").attr('class'));
	//$j('#'+bloc.attr('id')+'_1').find('button.close').click(function(){hidePopup(bloc);});
	$j('#'+bloc.attr('id')+'_1').show();
	$j('#'+bloc.attr('id')+'_1').animate({
		height: heightBloc
	}, 200);
	

}

/**
 * Fonction permettant de cacher le bloc popup lors du survol du menu
 */
function hidePopup(bloc, newBloc)
{
	
	clearTimeout(timer) ;
	showBlock=false;
	//On sauvegarde la taille courante du bloc avant de la diminuer
	var heightBloc = $j('#'+bloc.attr('id')+'_1').height();	
	if(newBloc!=null){
		newBloc.children('span').addClass("selected");
		$j('#'+bloc.attr('id')+'_1').animate({
			height: "0px"
		}, 200, "", function(){
			$j('#'+bloc.attr('id')+'_1').hide();
			$j('#'+bloc.attr('id')+'_1').height(heightBloc);
			bloc.children('a').children('span').removeClass('hover');
			blockCurrent=null;
			showPopup(newBloc);
		});
	}else{
		$j('#'+bloc.attr('id')+'_1').animate({
			height: "0px"
		}, 200, "", function(){
			$j('#'+bloc.attr('id')+'_1').hide();
			$j('#'+bloc.attr('id')+'_1').height(heightBloc);
			bloc.children('a').children('span').removeClass('hover');
			blockCurrent=null;
		});
	}
	
	
}

var show_newsletter=1;
/**
 * Fonction permettant d'afficher la popup de newsletter
 * @param bloc
 */
function showNewsletter(bloc, text)
{
	$j("#newsletter").click(function(){
		if($j(this).val() == text){
			$j(this).val('');
			$j(this).css('color', '#000000');
		}
	});
	position_left = ($j(".page").width()/2)-($j(".header").width()/2);
	if(show_newsletter){
		$j("#newsletter_form").css('top', bloc.position().top+bloc.height()+11);
		$j("#newsletter_form").css('left', position_left+bloc.position().left);
		$j("#newsletter_form").css('z-index', '3000');
		$j("#newsletter").val(text);
		$j("#newsletter").css('color', '#CCCCCC');
		$j("#newsletter_form").animate({
		    height: 'toggle'
		  }, 100, function() {
		    // Animation complete.
		  });
		show_newsletter=0;
	}
	else{
		$j("#newsletter_form").animate({
		    height: 'toggle'
		  }, 100, function() {
		    // Animation complete.
		  });
		$j("#newsletter").val(text);
		show_newsletter=1;
	}
}

