﻿
var PROSPECT_TYPE_PRO 	= 'Pro'
var PROSPECT_TYPE_PERSO = 'Perso'

//#################################################################################################################
function HighlightScenario(ps_idElement,ps_idImg)
{
	//if ($defined($('Div_Img'))) $('Div_Img').setHTML('<img src="images/UPLOAD/HD/1/'+ ga_Images[Math.floor(Math.random()*9)]+'" alt="" width="721" height="100" />');
	$$('td.subMenu').each(function(item){item.setStyle('font-weight', 'normal')});
	$$('img.Img').each(function(item){item.setStyle('display', 'none')});
	document.getElementById(ps_idElement).style.fontWeight = "bold";
	document.getElementById(ps_idImg).style.display = "block";

}
//#################################################################################################################

function setColorMenu(id,max)
{
	for (var i = 1; i<=max;i++)
	{
		$('a_menu_' + i).style.color='white';
	}
	$('a_menu_' + id).style.color='#00CC00';
}
//#################################################################################################################

function utf8_decode ( str_data ) {
    // Converts a string with ISO-8859-1 characters encoded with UTF-8   to single-byte
    // ISO-8859-1
    //
    // +    discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_utf8_decode/
    // +       version: 805.821
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +      input by: Aman Gupta
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'

    var tmp_arr = [], i = ac = c = c1 = c2 = 0;

    while ( i < str_data.length ) {
        c = str_data.charCodeAt(i);
        if (c < 128) {
            tmp_arr[ac++] = String.fromCharCode(c);
            i++;
        } else if ((c > 191) && (c < 224)) {
            c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);
            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    }

    return tmp_arr.join('');
}

//#################################################################################################################

function SendResultForm(id,page,articleid,placeholder)
{
	myAjaxObjSendForm.setProperty('articleid',articleid);
	myAjaxObjSendForm.setProperty('placeholder',placeholder);
	myAjaxObjSendForm.SendFormAjax(id);
	myAjaxObjSendForm.sendRequest2(page,myAjaxObjSendForm.param_name_array,myAjaxObjSendForm.param_value_array,'post')
}
var myAjaxObjSendForm = new AjaxObj();
function handleResponseSendForm() {
	if(myAjaxObjSendForm.http.readyState == 4){
		var response = myAjaxObjSendForm.http.responseText;
		if(response.indexOf("#RELOADPAGECONNECTIONERROR#")==-1)//permet de savoir si il faut retourner a la login page
		{
			if($('div_article_' + myAjaxObjSendForm.placeholder))
			{
				display_article(myAjaxObjSendForm.articleid,myAjaxObjSendForm.placeholder);
			}
		}
		else
		{
			document.location.href = document.location.href;
		}
	}
}
myAjaxObjSendForm.setProperty("handle", handleResponseSendForm);



//#####################################################################################################################
var ms_RecentHash = '';
var mb_LoadingFromHash = false;
var mb_DisplayArticle = false;
var ms_RemainHash = '';

function initializeStateFromURL()
{
/*	document.getElementById("DebugDIV").innerHTML = new Date() + '<br/>ms_RecentHash ; ' + ms_RecentHash +
																	'<br/>window.location.hash ; ' + window.location.hash +
																	'<br/>mb_DisplayArticle : ' + mb_DisplayArticle +
																	'<br/>mb_LoadingFromHash : ' + mb_LoadingFromHash;
*/
	if (mb_DisplayArticle)
	{	// We are in the middle of a display_article. Don't do anything

		return;
	}

	if (mb_LoadingFromHash)
	{
		return;
	}

	if (window.location.hash.replace('~', '') == ms_RecentHash.replace('~', ''))
	{
		ms_RecentHash = window.location.hash;

		return;
	}

	if ((window.location.hash == ''))
	{
		ms_RecentHash = window.location.hash;
		window.location.reload(false);

		return;
	}

	mb_LoadingFromHash = true;
	ms_RemainHash = window.location.hash.substring(1);
	//document.getElementById("DebugDIV").innerHTML = document.getElementById("DebugDIV").innerHTML + '<br/>Start LoadingFromHash';
	LoadFromHash();
	return;
}
//#####################################################################################################################
var ms_RecentHash = '';
function LoadFromHash()
{
	var ls_Article_Id;

	if (ms_RemainHash == '')
	{
		mb_LoadingFromHash = false;
		return;
	}

	if (ms_RemainHash.lastIndexOf('~'))
	{	// This means that we might not need to fully reload the path to article
		if (ms_RemainHash.substring(0, ms_RemainHash.lastIndexOf('~')-1) == ms_RecentHash.substring(1, ms_RemainHash.lastIndexOf('~')))
		{
			ms_RemainHash = ms_RemainHash.substring(ms_RemainHash.lastIndexOf('~'));
		}
	}

	var la_Article_Id = ms_RemainHash.split('/');
	ls_Article_Id = la_Article_Id[0];

	if (ls_Article_Id.substring(0, 1) == '~')
	{
		ls_Article_Id = ls_Article_Id.substring(1);
	}
	la_Article_Id.splice(0, 1);
	ms_RemainHash = la_Article_Id.join('/');

	var ls_onClick= $$('.ArticleLink' + ls_Article_Id)[0].getAttribute('onclick');
	var ls_hRef = $$('.ArticleLink' + ls_Article_Id)[0].href;

	if ((ls_onClick != '') && (ls_onClick != undefined))
	{
		if (Browser.Engine.trident)
		{
			eval(ls_onClick + ' anonymous();');
		}
		else
		{
			eval(ls_onClick);
		}
	}

	if ((ls_hRef != '') && (ls_hRef != undefined))
	{
		eval($$('.ArticleLink' + ls_Article_Id)[0].href);
	}

	if (ms_RemainHash != '')
	{
		LoadFromHash();
	}
	else
	{
		mb_LoadingFromHash = false;
	}
	return;
}

//#################################################################################################################

var mi_LastArticle_Id, ms_LastPlaceHolder;

function display_article(pi_Article_Id, ps_PlaceHolder, pi_Level, pb_DoNotReloadParent)
{
	//alert(pi_Article_Id);
	if ((mi_LastArticle_Id == pi_Article_Id) && (ms_LastPlaceHolder == ps_PlaceHolder))
	{
		// alert('Avoid duplicate load of display_article() triggered on OnLoad');
		return;
	}
	mi_LastArticle_Id = pi_Article_Id;
	ms_LastPlaceHolder = ps_PlaceHolder;

	imgLoading('div_article_' + ps_PlaceHolder);

	mb_DisplayArticle = true;

	var lo_NW_Request;

	lo_NW_Request = new NW_Request.HTML({url: '/DisplayArticle.asp',
													 'data': {'Article_Id': pi_Article_Id, 'Visitor_Id': gi_VisitorId, 'Tracking_Id': gi_Tracking_Id, 'PlaceHolder_Id': ps_PlaceHolder },
													 method: 'get',
													 async: false,
													 evalScripts: true,
													 onSuccess: function()
													 				{
																		//console.log('PlaceHolder: ', ps_PlaceHolder, ' ', 'div_article_' + ps_PlaceHolder, $('div_article_' + ps_PlaceHolder));
																		if ($defined($('div_article_' + ps_PlaceHolder)))
																		{
																			if (Browser.Engine.webkit)
																			{	// For Safari, an extra UTF8 decoding is required
																				$('div_article_' + ps_PlaceHolder).innerHTML = utf8_decode(lo_NW_Request.response.text);
																			}
																			else
																			{
																				$('div_article_' + ps_PlaceHolder).innerHTML = lo_NW_Request.response.text;
																			}
																		}
																		else if($defined($(ps_PlaceHolder)))
																		{
																			if (Browser.Engine.webkit)
																			{	// For Safari, an extra UTF8 decoding is required
																				$(ps_PlaceHolder).innerHTML = utf8_decode(lo_NW_Request.response.text);
																			}
																			else
																			{
																				$(ps_PlaceHolder).innerHTML = lo_NW_Request.response.text;
																			}
																		}

														 				return;
														 			}
													 });
	lo_NW_Request.send();

	if (pi_Level != undefined)
	{
		var ls_Hash;
		var la_Hash;

		ls_Hash = window.location.hash;
		if (ls_Hash != '')
		{
			ls_Hash = ls_Hash.substring(1);
		}

		la_Hash = ls_Hash.split('/');

		if (pb_DoNotReloadParent)
		{
			la_Hash[pi_Level] = '~' + pi_Article_Id;
		}
		else
		{
			la_Hash[pi_Level] = pi_Article_Id;
		}
		while (la_Hash.length > pi_Level + 1)
		{
			la_Hash.pop();
		}
		var ls_hRef;

		ls_hRef = window.location.href;

		if (ls_hRef.indexOf('#') > 0)
		{
			ls_hRef = ls_hRef.substring(0, ls_hRef.indexOf('#'));
		}
		ls_hRef = ls_hRef + '#' + la_Hash.join('/');

		ms_RecentHash = '#' + la_Hash.join('/');

		if (mb_LoadingFromHash == false)
		{
			window.location.hash = '#' + la_Hash.join('/');

			if (Browser.Engine.trident)
			{

				var doc = document.getElementById("historyFrame").contentWindow.document;
				doc.write('<html><head><scrip' + 't type="text/javascript">parent.onFrameLoaded(\''+ '#' + la_Hash.join('/') + '\');</scri' + 'pt></head><body>' + '#' + la_Hash.join('/') + '</body></html>');
				doc.close();
			}
		}
	}

	mb_DisplayArticle = false;
	if(pi_Article_Id == '57' )
		{
			$('div_contact').style.display = 'none';
			$('div_newsletters').style.display = '';
		}
	else
	if($('div_contact'))
	{
		$('div_contact').style.display = "";
	}

	if(pi_Article_Id == '106' )
	{
		if($('div_newsletters'))
		{
			$('div_newsletters').style.display = 'none';
		}
	}
	else
	{
		if($('div_newsletters'))
		{
			$('div_newsletters').style.display = "";
		}
	}
	if(pi_Article_Id == '475' || pi_Article_Id == '456' || pi_Article_Id == '368' || pi_Article_Id == '314' || pi_Article_Id == '316' || pi_Article_Id == '369' || pi_Article_Id == '318' || pi_Article_Id == '312' || pi_Article_Id == '332')
	{
		if($('div_clients'))
		{
			$('div_clients').style.display = "none";
		}
		if($('div_contact'))
		{
			$('div_contact').style.display = '';
		}

	}
	else
	{

		if($('div_clients'))
		{
			$('div_clients').style.display = "";
		}
	}

	return;
}

//###########################################################################

    function onFrameLoaded(ps_Hash)
    {
		if (!Browser.Engine.trident)
		{
			return;
		}

		window.location.hash = ps_Hash;

		initializeStateFromURL();
		return;
    }

//###########################################################################

function Newsletter_Subscribe()
{

	if (IsEmail_AddressPro($('txtEmail').value))
	{
		SendResultForm('Newsletter_Subscribe_Form','/specific/netways/Forms/NewsletterRequest.asp','','');
		window.location.hash = '#261/448';
	}
	else if (IsEmail_Address($('txtEmail').value))
	{
		//SendResultForm('Newsletter_Subscribe_Form','/specific/netways/Forms/NewsletterRequest.asp','','');
		window.location.hash = '#261/453';
	}
	else
	{
		alert('Veuillez saisir votre E-mail');
	}


	return;
}
//###########################################################################
function LiveDemo_Subscribe()
{
	$('email').value = $('email').value.toLowerCase()
	if (IsEmpty($('nom')))
	{
		alert('Veuillez remplir le champ: Nom');
		$('nom').focus();
	}
	else if (IsEmpty($('prenom')))
	{
		alert('Veuillez remplir le champ: Prénom');
		$('prenom').focus();
	}
	else if (IsEmpty($('societe')))
	{
		alert('Veuillez remplir le champ: Société');
		$('societe').focus();
	}
	else if (IsEmpty($('fonction')))
	{
		alert('Veuillez remplir le champ: Fonction');
		$('fonction').focus();
	}
	else if (IsEmpty($('email')))
	{
		alert('Veuillez remplir le champ: E-mail');
		$('email').focus();
	}
	else if (!IsEmail_Address($('email').value))
	{
		alert('Veuillez saisir une adresse E-mail valide.');
		$('email').focus();
	}
	else if ($('telephone').value == '')
	{
		alert('Veuillez remplir le champ: Téléphone');
		$('telephone').focus();
	}
	/*else if (!Verif_PhoneField($('telephone').value) )
	{
		alert('Veuillez saisir un numero de téléphone valide .')
		$('telephone').focus();
	}*/
	else if ($('date').value == "-1")
	{
		alert('Veuillez selectionner le champ: Date souhaité');
	}
	else
	{
		SendResultForm('prospect','/specific/netways/forms/sendrequest.asp','619','20');
		$('div_article_21').innerHTML = '';
	}
}
//###########################################################################
function InfoSite_Subscribe(ps_ProspectType)
{

var lb_ckecked;

switch(ps_ProspectType)
{
	case PROSPECT_TYPE_PRO:
		if (IsEmpty(document.InfoSite_Subscribe_Form[1]))
		{
			alert('Veuillez remplir le champ: Nom');
			document.InfoSite_Subscribe_Form[1].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[2]))
		{
			alert('Veuillez remplir le champ: Prénom');
			document.InfoSite_Subscribe_Form[2].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[3]))
		{
			alert('Veuillez remplir le champ: Société');
			document.InfoSite_Subscribe_Form[3].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[5]))
		{
			alert('Veuillez remplir le champ: Email');
			document.InfoSite_Subscribe_Form[5].focus();
		}
		else if (!IsEmail_AddressPro(document.InfoSite_Subscribe_Form[5].value))
		{
			alert('Veuillez saisir votre "E-mail" professionelle et valide svp.');
			document.InfoSite_Subscribe_Form[5].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[6]))
		{
			alert('Veuillez remplir le champ: Téléphone');
			document.InfoSite_Subscribe_Form[6].focus();
		}
		else if (!Verif_PhoneField(document.InfoSite_Subscribe_Form[6].value) )
		{
			alert('Veuillez saisir un numero de téléphone valide svp.')
			document.InfoSite_Subscribe_Form[6].focus();
		}

		else if  (IsEmpty(document.InfoSite_Subscribe_Form[8]))
		{
			alert('Veuillez remplir le champ: Pays');
			document.InfoSite_Subscribe_Form[8].focus();

		}

		else if  (document.InfoSite_Subscribe_Form[11].value== "-1")
		{
			alert('Veuillez séléctionner le champ :Fonction');
		}
		else if (document.InfoSite_Subscribe_Form[11].value == "Other_Function"  && IsEmpty(document.InfoSite_Subscribe_Form[12]))
		{
			alert('Veuillez présicer votre fonction');

		}
		else
		{
			for (i=13; i<= 19; i++)
			{
				if (!document.InfoSite_Subscribe_Form[i].checked)
				{
					lb_ckecked = false;
				}
				else
				{
					lb_ckecked = true;
					break;
				}
			}

			if (lb_ckecked)
			{

				SendResultForm('InfoSite_Subscribe_Form','/specific/netways/forms/DemoRequest.asp','106','11');

			}
			else
			{
				alert('Veuillez choisir au moins un champ')
				return;
			}
		}
		break;

	case PROSPECT_TYPE_PERSO:

		if (IsEmpty(document.InfoSite_Subscribe_Form[1]))
		{
			alert('Veuillez remplir le champ: Nom');
			document.InfoSite_Subscribe_Form[1].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[2]))
		{
			alert('Veuillez remplir le champ: Prénom');
			document.InfoSite_Subscribe_Form[2].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[3]))
		{
			alert('Veuillez remplir le champ: Société');
			document.InfoSite_Subscribe_Form[3].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[5]))
		{
			alert('Veuillez remplir le champ: Email');
			document.InfoSite_Subscribe_Form[5].focus();
		}
		else if (!IsEmail_Address(document.InfoSite_Subscribe_Form[5].value))
		{
			alert('Veuillez saisir une adresse "E-mail" professionelle et valide svp.');
			document.InfoSite_Subscribe_Form[5].focus();
		}
		else if (IsEmpty(document.InfoSite_Subscribe_Form[6]))
		{
			alert('Veuillez remplir le champ: Téléphone');
			document.InfoSite_Subscribe_Form[6].focus();
		}
		else if (!Verif_PhoneField(document.InfoSite_Subscribe_Form[6].value) )
		{
			alert('Veuillez saisir un numero de téléphone valide svp.')
			document.InfoSite_Subscribe_Form[6].focus();
		}
		else if  (IsEmpty(document.InfoSite_Subscribe_Form[7]))
		{
			alert('Veuillez remplir le champ: Ville');
			document.InfoSite_Subscribe_Form[7].focus();
		}
		else if  (IsEmpty(document.InfoSite_Subscribe_Form[8]))
		{
			alert('Veuillez remplir le champ: Pays');
			document.InfoSite_Subscribe_Form[8].focus();

		}
		else if (document.InfoSite_Subscribe_Form[9].value == "-1")
		{
			alert('Veuillez séléctionner le champ :Activité');
		}
		else if (document.InfoSite_Subscribe_Form[9].value == "Other_Activity" && IsEmpty(document.InfoSite_Subscribe_Form[10]))
		{
			alert('Veuillez présicer votre activité');
		}
		else if  (document.InfoSite_Subscribe_Form[11].value== "-1")
		{
			alert('Veuillez séléctionner le champ :Fonction');
		}
		else if (document.InfoSite_Subscribe_Form[11].value == "Other_Function"  && IsEmpty(document.InfoSite_Subscribe_Form[12]))
		{
			alert('Veuillez présicer votre fonction');

		}
		else if (document.InfoSite_Subscribe_Form[20].checked && IsEmpty(document.InfoSite_Subscribe_Form[21]))
			{
				alert('Veuillez présicer votre besoin');
			}

		else
		{
			for (i=13; i<= 19; i++)
			{
				if (!document.InfoSite_Subscribe_Form[i].checked)
				{
					lb_ckecked = false;
				}
				else
				{
					lb_ckecked = true;
					break;
				}
			}

			if (lb_ckecked)
			{
				SendResultForm('InfoSite_Subscribe_Form','/specific/netways/forms/DemoRequest.asp','106','11');
			}
			else
			{
				alert('Veuillez choisir au moins un champ')
				return;
			}
		}
		break;
	}
}



//###########################################################################
//////////function to load Date In Web_Conf Form article////////////////////
//###########################################################################

function Fill_Dates(pi_Element_Date_Id)
{
	if(!pi_Element_Date_Id)
	{
		pi_Element_Date_Id = 'Webconf_Selected_Date'
	}
	var pd_Date = new Date();
	if (pd_Date.getDay() >= 3 )
	{
		if (pd_Date.getDay() == 3 && pd_Date.getHours <= 11 )
		{
			$(pi_Element_Date_Id).options[0].text = pd_Date;
		}
		else
		{
			pd_DateDiff =  pd_Date.getDay() - 3;
			pd_Date_nextweek = addDay(pd_Date ,7 - pd_DateDiff );
			pd_Date_nextweek_formated = formatDate(pd_Date_nextweek, 'dd/MM/yyyy');
			$(pi_Element_Date_Id).options[1] = new Option(pd_Date_nextweek_formated + ' de 11:30 à 12:00', pd_Date_nextweek_formated, false, false);
			$(pi_Element_Date_Id).options[2] = new Option(formatDate(addDay(pd_Date_nextweek,7),'dd/MM/yyyy') + ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,7),'dd/MM/yyyy'), false, false);
			$(pi_Element_Date_Id).options[3] = new Option(formatDate(addDay(pd_Date_nextweek,14),'dd/MM/yyyy')+ ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,14),'dd/MM/yyyy'), false, false);
			$(pi_Element_Date_Id).options[4] = new Option(formatDate(addDay(pd_Date_nextweek,21),'dd/MM/yyyy') + ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,21),'dd/MM/yyyy'), false, false);

		}
	}
	else
	{
		pd_DateDiff = 3 - pd_Date.getDay()
		pd_Date_nextweek = addDay(pd_Date , pd_DateDiff );
		pd_Date_nextweek_formated = formatDate(pd_Date_nextweek, 'dd/MM/yyyy');

		$(pi_Element_Date_Id).options[1] = new Option(pd_Date_nextweek_formated + ' de 11:30 à 12:00', pd_Date_nextweek_formated, false, false);
		$(pi_Element_Date_Id).options[2] = new Option(formatDate(addDay(pd_Date_nextweek,7),'dd/MM/yyyy') + ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,7),'dd/MM/yyyy'), false, false);
		$(pi_Element_Date_Id).options[3] = new Option(formatDate(addDay(pd_Date_nextweek,14),'dd/MM/yyyy')+ ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,14),'dd/MM/yyyy'), false, false);
		$(pi_Element_Date_Id).options[4] = new Option(formatDate(addDay(pd_Date_nextweek,21),'dd/MM/yyyy') + ' de 11:30 à 12:00', formatDate(addDay(pd_Date_nextweek,21),'dd/MM/yyyy'), false, false);
	}

}
//###########################################################################

function PopUpCenterNoToolbar(url,x,y,ps_WindowName)
{
	PopUpCenterOptions(url,x,y, 'resizable=yes,scrollbars=yes,toolbar=no',ps_WindowName)
}
//###########################################################################

function PopUpCenterToolbar(url,x,y,ps_WindowName)
{
	PopUpCenterOptions(url,x,y, 'resizable=yes,scrollbars=yes,toolbar=no,menubar=yes',ps_WindowName)
}
//###########################################################################

function PopUpCenterOptions(url,x,y,options,ps_WindowName)
{
	var  screenX, screenY,sx,sy;
	screenX = screen.width;
	screenY = screen.height;
	sx = screenX/2 - x/2;
	sy = screenY/2 - y/2;

	if(!ps_WindowName)
	{
		ps_WindowName = 'mywindow';
	}

	var winpu = window.open(url,ps_WindowName, 'width=' +  x + ',height='+ y + ',left=' + sx + ',top=' + sy + ',' + options)
	winpu.focus();
}

//###########################################################################

function PopUp_SiteOptions(url,x,y,ps_WindowName)
{
	var  screenX, screenY,sx,sy;
	screenX = screen.width;
	screenY = screen.height;
	sx = screenX/2 - x/2;
	sy = screenY/2 - y/2;

	if(!ps_WindowName)
	{
		ps_WindowName = 'mywindow';
	}

	var winpu = window.open(url,ps_WindowName, 'width=' +  x + ',height='+ y + ',left=' + sx + ',top=' + sy + ',resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes')
	winpu.focus();
}
//###########################################################################

function StyleColorMenuSelected(str)
{
	var mytool_array=str.split(",");
	if(document.getElementById(mytool_array[0]))
		document.getElementById(mytool_array[0]).style.color = '#990000';

	for(var i=1; i < mytool_array.length; i++)
	{
		if(document.getElementById(mytool_array[i]))
			document.getElementById(mytool_array[i]).style.color = '';
	}
}
//###########################################################################

function imgLoading(div)
{
	var img = '<table cellpadding=\'0\' border=\'0\' cellspacing=\'0\'><tr><td><img src=\'/_Images/InProgress/32x32.gif\' border=\'0\'></td><td>&nbsp;Chargement</td></tr></table>';
	if(document.getElementById(div)){

		try{
			document.getElementById(div).innerHTML= img;
		}catch(e){
			alert(img);
			alert(e.message);
			alert(document.getElementById(div));
			var msg="";
			var myObject = document.getElementById(div);
			for( var t in myObject){
				msg += t + ": " + myObject[t];
			}
			alert(msg);
		}

	}
}


//###########################################################################


 function CreateBookmarkLink()
 {
	if ( Browser.Engine.gecko)
	{ // Mozilla Firefox Bookmark

		window.sidebar.addPanel('Net|Ways', window.document.location,'');
	}
	else if( Browser.Engine.trident )
	{ // IE Favorite
		window.external.AddFavorite( window.document.location,' Net|Ways');
	}
	else if (Browser.Engine.webkit)
	{
		///For Safari
		alert("Pour marquer cette page, appuiyez sur la touche 'CTRl+D' ")
	}
	else if(window.opera && window.print)
	{ // Opera Hotlist
		return true;
	}
 }

//###########################################################################

function Populate_Camps()
{
	if($defined($('txtEmail')) && $('txtEmail').value !='' && $('txtEmail').value !='Votre adresse email')
	{
		$('Email').value = $('txtEmail').value;
		$('txtEmail').value = 'Votre adresse email';
	}
	if($defined($('txtName')) && $('txtName').value !='' && $('txtName').value !='Votre nom')
	{
		$('UserName').value = $('txtName').value;
		$('txtName').value = 'Votre nom';
	}
	$('div_newsletters').style.display = "none";
	$('div_contact').style.display = '';

	return;
}
//###########################################################################
function Verif_PhoneField(ps_Numtel)
 {
 // Definition Of motif to match
 var regex = new RegExp(/^(01|02|03|04|05|06|08)[0-9]{8}/gi);

 // Definition boolean match
 var pb_match = false;

 // Test On motif
 if(regex.test(ps_Numtel))
 {
	 pb_match = true;
 }
 else
 {
	 pb_match = false;
}

 // return match
 return pb_match;
 }

//###########################################################################
function Display_ActivityOther(ps_value)
{
	if (ps_value == "Other_Activity" )
		$('OtherActivityElement_Id').style.display='';
	else
		$('OtherActivityElement_Id').style.display='none';
}

function Display_FunctionOther(ps_value)
{
	if (ps_value == "Other_Function" )
		$('OtherFunctionElement_Id').style.display='';
	else
		$('OtherFunctionElement_Id').style.display='none';
}
function Display_FunctionOtherNeed()
{

	if ($('Other_Need').checked)
		$('need_textarea').style.display='';
	else
		$('need_textarea').style.display='none';
}


function limite(zone,max)
{
	if(zone.value.length>=max){zone.value=zone.value.substring(0,max);}
}
