var scrollcurrentScrollIndex = 1;
var scrolltxtArray;
var scrollfirstDiv;
var scrollsecondDiv;
var scrollwidth=0;
var scrollheight=0;
var scrollrefHeight=100;
var scrollpause=2000;
var scrolltopDiv ;
var scrollbottomDiv;
var scrollinterval;
var scrollstep=1;
var scrollincrement=60;

function scrollText(texte, parentDiv, pause, increment, step)
{
  if( pause ) scrollpause=pause;
  if( increment ) scrollincrement = increment; 
  if( step ) scrollstep = step;
	scrolltxtArray = texte;
	scrollwidth=parentDiv.style.pixelWidth;
	scrollrefHeight = parentDiv.style.pixelHeight +1;
  	
	scrollfirstDiv = document.createElement("DIV");
	scrollsecondDiv = document.createElement("DIV");
	scrollfirstDiv.style.position='absolute';
	scrollfirstDiv.style.width=scrollwidth+'px';
	scrollfirstDiv.style.left='0px'
	scrollfirstDiv.style.top='0px';
	scrollfirstDiv.innerHTML=scrolltxtArray[0];

	scrolltopDiv = scrollfirstDiv;
	parentDiv.appendChild(scrollfirstDiv);
	scrollheight=Math.max(scrollfirstDiv.offsetHeight, scrollrefHeight);
	
	if( scrolltxtArray.length == 1 )
		scrolltxtArray[1] = scrolltxtArray[0];
		
	if( scrolltxtArray.length > 1 )
	{
	  	scrollsecondDiv.style.position='absolute';
	  	scrollsecondDiv.style.width=scrollwidth+'px';
	  	scrollsecondDiv.style.left='0px'
	  	scrollsecondDiv.style.top= scrollheight + 'px';
	  	scrollsecondDiv.innerHTML=scrolltxtArray[1];

		parentDiv.appendChild(scrollsecondDiv);
		scrollbottomDiv = scrollsecondDiv;
		scrollinterval = setTimeout("scroll(false)",scrollpause);
	}
}

function scroll(change, speed)
{
	if( change == true )
	{
		if( parseInt(scrollfirstDiv.style.top) == 0 )
		{
			scrolltopDiv = scrollfirstDiv; scrollbottomDiv = scrollsecondDiv;
		}
		else
		{
			scrolltopDiv = scrollsecondDiv; scrollbottomDiv = scrollfirstDiv;
		}
	}
	
	//if( top is not yet in view, scroll it
	if (parseInt(scrollbottomDiv.style.top) > 0 )
	{ 	
		scrolltopDiv.style.top=(parseInt(scrolltopDiv.style.top)-scrollstep) +'px';
		scrollbottomDiv.style.top=(parseInt(scrollbottomDiv.style.top)-scrollstep)+'px';
		scrollinterval = setTimeout("scroll(false)",scrollincrement);
	}
	else
	{	//top is in view
		scrollcurrentScrollIndex ++;
		if( scrollcurrentScrollIndex >= scrolltxtArray.length )
			scrollcurrentScrollIndex = 0; 
		scrollheight=Math.max(scrollbottomDiv.offsetHeight, scrollrefHeight);
		scrolltopDiv.style.top=parseInt(scrollheight)+'px';
		scrolltopDiv.innerHTML=scrolltxtArray[scrollcurrentScrollIndex];
		scrolltopDiv.style.height=scrollrefHeight+'px';	// set min height if content is too small
		scrollinterval = setTimeout("scroll(true)",scrollpause);
	}
}

function strtrim() 
{
//Match spaces at beginning and end of text and replace
//with null strings
    return this.replace(/^\s+/,'').replace(/\s+$/,'');
}
String.prototype.trim = strtrim;

String.leftPad = function (val, size, ch)
{
    var result = new String(val);
    if (ch == null) {
        ch = " ";
    }
    while (result.length < size) {
        result = ch + result;
    }
    return result;
}
String.rightPad = function (val, size, ch)
{
    var result = new String(val);
    if (ch == null) {
        ch = " ";
    }
    while (result.length < size) {
        result = result + ch;
    }
    return result;
}

function capFirst(value) {
    var a = value.split(/\s+/g); // split the sentence into an array of words
    var firstLetter;
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    return a.join(' '); // join it back together
}

function capFirstExt(value,isAllWord)
{
	if(typeof(isAllWord) != 'undefined' && isAllWord == false && value && value.length > 0)
		return value.substring(0,1).toUpperCase()+(value.length>1?value.substring(1):'');
		
	if( value != value.toUpperCase() &&  value != value.toLowerCase() )
		return value;
		
    var a = value.split(/\s+/g); // split the sentence into an array of words
    var firstLetter;
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join(' '); // join it back together
    
    a = value.split('\''); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('\''); // join it back together
    
    a = value.split('\-'); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('\-'); // join it back together

    a = value.split('mc'); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('Mc'); // join it back together
    
    a = value.split('Mc'); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('Mc'); // join it back together
    
    a = value.split('mac'); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('Mac'); // join it back together
    
    a = value.split('Mac'); // split the sentence into an array of words
    for (i = 0 ; i < a.length ; i ++ ) 
    {
        firstLetter = a[i].substring(0, 1).toUpperCase();
        a[i] = firstLetter + a[i].substring(1); // re-assign it back to the array and move on
    }
    value =  a.join('Mac'); // join it back together

    return value;
}

var horlogeElt;
function updateHorloge()
{
	var thetime=new Date();

	var nhours=thetime.getHours();
	var nmins=thetime.getMinutes();
	var nmonth=thetime.getMonth();
	var ntoday=thetime.getDate();
	var nyear=thetime.getYear();
	if (nmins<10)
	 nmins="0"+nmins;

	nmonth+=1;

	if (nyear<=99)
	  nyear= "19"+nyear;

	if ((nyear>99) && (nyear<2000))
	 nyear+=1900;

	horlogeElt.innerHTML='<b>' + simpleFormatHeure(nhours+':'+nmins) +'</b> '+ntoday+'/'+nmonth+'/'+nyear;

	setTimeout('updateHorloge()',30000);
}

var emailCheckPatt = /^[ ]*[\-\_\&\!\#\$\%\'\*\+\/\=\?\^\`\{\|\}\~A-Za-z0-9]+(\.[\-\_\&\!\#\$\%\'\*\+\/\=\?\^\`\{\|\}\~A-Za-z0-9]+)*@[\-\_\&\!\#\$\%\'\*\+\/\=\?\^\`\{\|\}\~A-Za-z0-9]+(\.[\-\_\&\!\#\$\%\'\*\+\/\=\?\^\`\{\|\}\~A-Za-z0-9]+)*\.([\-\_\&\!\#\$\%\'\*\+\/\=\?\^\`\{\|\}\~A-Za-z0-9]){2,4}[ ]*$/i;
function checkEmailAddress(value, isMultiple)
{
  if(value.length == 0)
     return null;

 	var allAddresses = new Array(1);
 	allAddresses[0] = value;
	if( isMultiple && isMultiple == true && ( value.indexOf(',') != -1 || value.indexOf(';') != -1) )
  		allAddresses = value.split(/[,;]/g);

 	for(i=0; i< allAddresses.length; i++)
 	{ 	
 		allAddresses[i] = (allAddresses[i]!=null ? allAddresses[i].trim() : '');
 		if(allAddresses[i].length > 0 && emailCheckPatt.test(allAddresses[i])==false)
 			return allAddresses[i];
 	}
  
	return null;
}

function verifyEmailAddress(element, isMultiple) 
{
	element.value = element.value.trim();
	if( element.value.length > 0 && element.value != ',')
	{
		badEmail = checkEmailAddress(element.value, isMultiple);
		if( badEmail != null) 
		{
			alert(badEmailMsg+'\n'+ badEmail); 
			var r = element.createTextRange();
			r.findText(badEmail);
			r.select();
			element.focus(); 
			return false;
		}
	}
	else
		element.value='';
	return true;
}

function hover(elttag) 
{ 
	var srcElt = window.event.srcElement; 
	if( !elttag) elttag = 'TD'; 
	else elttag = elttag.toUpperCase();
	while(srcElt.tagName != elttag ) srcElt = srcElt.parentElement; 
	var cname = srcElt.className; 
	if( (idx = cname.indexOf('hover')) != -1 ) srcElt.className = cname.substring(0, idx); 
	else srcElt.className = cname + 'hover'; 
	window.event.cancelBubble=true; 
	window.event.returnValue=false; 
	return false;
}
function MM_swapImgRestore() { var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_preloadImages() { var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image(); d.MM_p[j++].src=a[i];}}}
function MM_findObj(n, d) { var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_swapImage() {var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}
var targetTxtfield; var targetId;var targets;var targetsId;
function setSelector(obj, objId, path, select) 
{
	targetTxtfield = obj; 
	targetId = objId; 
	targets = select;
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
	return launch(path,'m_SelectorPopup',450,770,'resizable=no,scrollbars=no');
}
var emailTarget; var emailTargetId; 
function setEmailSelector(obj, objId, path) 
{
	emailTarget = obj;
	emailTargetId = objId;
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
	return launch(path,'m_EmailSelectorPopup',450,770,'resizable=no,scrollbars=no'); 
}   
var inscTarget; var inscTargetId; 
function setInscriptionSelector(obj, objId, path) {         
	inscTarget = obj;         
	inscTargetId= objId;         
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
	return launch(path,'m_InscSelectorPopup',450,800,'resizable=no,scrollbars=no'); 
}  
var oCISelector = new Object(); var oCISelectorId; 
function setContactInscriptionSelector(obj, objId, path) {         
	oCISelector = obj;         
	oCISelectorId = objId;         
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
	return launch(path,'m_InscContactPopup',450,770,'resizable=no,scrollbars=yes'); 
}   
var munTarget; var munTargetId; 
function setMunicipaliteSelector(obj, objId, path) {         
	munTarget = obj;
	munTargetId= objId;  
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
	return launch(path,'m_MunSelectorPopup',450,770,'resizable=no,scrollbars=yes'); 
}
var empTarget; var empTargetId; 
function setEmplacementSelector(obj, objId, index, path) {
    empTarget = obj; 
    empTargetId= objId;
	showWaiting(document.body, (obj&&obj.title?obj.title:''));
    return launch(path,'m_EmpSelectorPopup',370,550,'resizable=no,scrollbars=yes');
} 
var popupblockerMsg="Pour pouvoir utiliser Prospects Web confortablement, vous devez desactiver le 'blocage des fenetres intempestives' dans votre configuration d'Internet Explorer, ou ajouter ce site dans la liste de sites non bloques.\n\nIn order to use Prospects Web comfortably, you must disable the 'popup blocker' function of your Internet Explorer browser, or add the current site to the list of unblocked sites.";

function launch(url, child_window_name, height, width, attribute, win) 
{ var remote = null;
  if (!win) win = window;
  if( height > 0 && width > 0 )
  {
	  var lg = (screen.width-width)/2;   
	  var ht = (screen.height-height)/2;   
	  remote = win.open( url, child_window_name, "height=" + height + ",width=" + width + ", left="+lg+",top="+ht+"," + attribute);    
	  remote.opener = window;
  }
  else
  {
  	  remote = win.open( url, child_window_name, attribute);
  	  remote.opener = window;
  }
  	  
try{
  if(typeof(remote) != 'undefined' && remote != null )remote.focus();
  else 
  {
  	hideWaiting();
  	alert(popupblockerMsg); 
	if(window.opener && !window.opener.closed ) 
	{
		window.opener.location.replace('/prospects/logoff.do');
		dirty = false;
		window.close();
	}
	else
	{
		dirty=false;
		window.location.replace('/prospects/logoff.do');
	}
  }}
catch(e){} 
  return remote; 
} 
 
var configPopup; 
function submitInConfigPopup(form) 
{   
    if( window.event ) window.event.cancelBubble = true;     
    if( configPopup == null || configPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        configPopup = launch (requestPath+
        '/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'') +'.html', 'm_ConfigPopup',585, 750,'resizable=no,scrollbars=yes');         
    }
    
    form.target="m_ConfigPopup";    
    form.submit();       
    return false;
}

var matchPopup; 
function submitInMatchPopup(form) 
{   
    if( window.event )  
        window.event.cancelBubble = true;     
    if( matchPopup == null || matchPopup.closed ) 
    {var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        matchPopup = launch (requestPath+
        '/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'') +'.html', 'm_MatchPopup',550,1000,'resizable=no,scrollbars=yes');         
    }
    form.target="m_MatchPopup";    
    form.submit();       
    return false;
}

var surveyPopup; 
function submitInSurveyPopup(form) 
{   
    if( window.event )  
        window.event.cancelBubble = true;     
    if( surveyPopup == null || surveyPopup.closed ) 
    {var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        surveyPopup = launch (requestPath+
		'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SurveyPopup',550,1000,'resizable=no,scrollbars=yes');         
    }
    form.target="m_SurveyPopup";    
    form.submit();       
    return false;
}

var surveyQuestionPopup; 
function submitInSurveyQuestionPopup(form) 
{   
    if( window.event )  
        window.event.cancelBubble = true;     
    if( surveyQuestionPopup == null || surveyQuestionPopup.closed ) 
    {var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        surveyQuestionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SurveyQuestionPopup',485,650,'resizable=no,scrollbars=yes');         
    }
    form.target="m_SurveyQuestionPopup";    
    form.submit();       
    return false;
}

var aidePopup; 
function submitInAidePopup(type, isPro, langue,replacementPath) 
{   
    if( window.event )  
        window.event.cancelBubble = true;
    
    url = 'http://www.prospects.com/Manuel/';
    if(langue)
    	url += langue + '_CA/';
    else
    {
    	url += 'fr_CA/';
    	langue = 'fr';
    }
    if(replacementPath)
    	url += replacementPath;
    	
    if(isPro)
    	url += 'PRO/';
    else
    	url += 'CI/';

    switch (type)
	{
	  case 'mesoutils':
		  	url += 'mytools.htm';
	  	break;	  	
	  case 'activites/view':
	  		url += 'act.htm';
	  	break;	  	
	  case 'carte/view':
	  		url += 'mailing_postcards.htm';
	  	break;	  		  	
	  case 'modele/view':
	  		url += 'letter.htm';
	  	break;	  	
	  case 'agents/import':
	  		url += 'contacts_import_office.htm';
	  	break;	  	
	  case 'objectif/edit':
	  		url += 'analysis_obj.htm';
	  	break;	  	
	  case 'planAction/view':
	  		url += 'actionplan.htm';
	  	break;	  	
	  case 'rapport/conf':
	  		url += 'rapportsconf.htm';
	  	break;	  	
	  case 'contacts/afaire':
	  case 'contacts/courriels':
	  case 'contacts/inscriptions':
	  case 'contacts/reglees':
	  case 'contacts/ventes':
  	case 'contacts/view':
	  	url += 'contacts.htm';
	  	break;	  	
	  case 'contacts/import':	  	
	  		url += 'contacts_import.htm';
	  	break;	  	
	  case 'contacts/add_link':	  	
	  		url += 'contacts_listing_link.htm';
	  	break;	  	
	  case 'contacts/globaledit/globaledit_1':
	  		url += 'contacts_global_edit.htm';
	  	break;	  	
	  case 'contacts/merge':	  	
	  		url += 'contacts_merge.htm';
	  	break;	  	
	  case 'etiquettes/config':
	  		url += 'mailing_labels_env.htm';
	  	break;	  	
	  case 'inscriptions/afaire':
	  case 'inscriptions/courriels':
	  case 'inscriptions/contact':
	  case 'inscriptions/publicites':
	  case 'inscriptions/reglees':
	  case 'inscriptions/ventes':
	  case 'inscriptions/view':
	  		url += 'listings.htm';
	  	break;	  	
	  case 'inscriptions/add_link':
	  		url += 'Listings_linkcontact.htm';
	  	break;	  	
	  case 'inscriptions/merge':
	  		url += 'listings_merge.htm';
	  	break;	  	
	  case 'inscriptions/create/view':
	  		url += 'listings_add.htm';
	  	break;	  	
	  case 'config/general':
	  		url += 'setup.htm';
	  	break;	  	
	  case 'config/compte':	  
	  case 'config/usager':
	  		url += 'option_menu.htm';
	  	break;	  	
	  case 'config/stat':	  	
	  		url += 'overview_stats.htm';
	  	break;	  	
	  case 'config/images':
	  		url += 'setup_pict.htm';
	  	break;	  	
	  case 'ventes/view':
	  		url += 'sales.htm';
	  	break;	  	
	  case 'notes/view':
	  		url += 'notes.htm';
	  	break;	  	
	  case 'courriels/view':
	  		url += 'email.htm';
	  	break;	  	
	  case '/calendar':
	  		url += 'calendar.htm';
	  	break;	  	
	  case '/inscriptions/list':
	  		url += 'listings.htm';
	  	break;	  	
	  case '/contacts/list':
	  	url += 'contacts.htm';
	  	break;	  	
	  case '/courriels/list':
	  		url += 'email.htm';
	  	break;	  	
	  case '/visites/list':	  
	  case 'visites/view':
	  		url += 'showings.htm';
	  	break;	  	
	  case '/marketing/pub':
	  		url += 'ads.htm';
	  	break;	  	
	  case '/marketing/cma':
	  		url += 'cma.htm';
	  	break;	  	
	  case '/match/list':
	  		url += 'match.htm';
	  	break;	  	
	  case '/ventes/list':
	  		url += 'sales.htm';
	  	break;	  	
	  case '/notes/list':
	  		url += 'notes.htm';
	  	break;	  	
	  case '/analyse/general':
	  		url += 'analysis.htm';
	  	break;
	}
    
    aidePopup = launch (url, 'm_AidePopup',650,950,'resizable=no,scrollbars=yes,toolbar=yes,menubar=yes');                
    return false;
}


function submitInConfigPopupTopMenu(thePath) 
{
     if( window.event )  
        window.event.cancelBubble = true;     
     if( configPopup == null || configPopup.closed )         
     
     configPopup = launch (thePath, 'm_ConfigPopup',585, 750,'resizable=no,scrollbars=yes');     
     return false;    
}

var importPopup; 
function submitInImportPopup(thePath) {     
if( window.event )  window.event.cancelBubble = true;     
if( importPopup == null || importPopup.closed )         
importPopup = launch (thePath, 'm_ImportPopup',565, 750,'resizable=no,scrollbars=yes');     
return false; } 

var importAgentPopup; 
function submitInImportAgentPopup(thePath) {     
if( window.event )  window.event.cancelBubble = true;     
if( importAgentPopup == null || importAgentPopup.closed )         
importAgentPopup = launch (thePath, 'm_ImportAgentPopup',550,600,'resizable=yes,scrollbars=yes');     
return false; } 

var fullWin;
function submitInFullWindow(form) 
{
	if( window.event )  window.event.cancelBubble = true;     
	if( fullWin == null || fullWin.closed )         
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		fullWin = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_FullWindow',565, 750,'resizable=yes,scrollbars=yes');     
		}
	form.target="m_FullWindow";
	form.submit();
	return false; 
} 
var importPopup;         
var planPopup; function submitInPlanListPopup(thePath) {
if( window.event )  window.event.cancelBubble = true;
if( planPopup == null || planPopup.closed )
planPopup = launch (thePath, 'm_PlanPopup',550, 700,'resizable=no,scrollbars=yes');
return false; } 

var courrielFolderPopup; 
function submitInCourrielFolderListPopup(thePath) 
{
if( window.event )  window.event.cancelBubble = true;
if( courrielFolderPopup == null || courrielFolderPopup.closed )
courrielFolderPopup = launch (thePath, 'm_CourrielFolderPopup',550, 700,'resizable=no,scrollbars=yes,status=yes');
return false; 
}
var comptePopup; function submitInComptePopup(form) {     if( window.event )  window.event.cancelBubble = true;     if( comptePopup == null || comptePopup.closed )
{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); comptePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ComptePopup',550, 850,'resizable=no,scrollbars=yes');} form.target="m_ComptePopup"; form.submit();     return false; }  
var facturePopup; function submitInFacturePopup(form) {     if( window.event )  window.event.cancelBubble = true;     if( facturePopup == null || facturePopup.closed )
{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); facturePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_FacturePopup',550, 850,'resizable=no,scrollbars=yes');}
form.target="m_FacturePopup";     form.submit();          return false; }  
 
var labelPopup; function submitInEtiquettePopup(form) 
{     
    if( window.event )  
        window.event.cancelBubble = true;     
    if( labelPopup == null || labelPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        labelPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_LabelPopup',720, 700,'resizable=yes,scrollbars=yes,menubar=no,status=no');     
        }
    form.target="m_LabelPopup";    
    form.submit();       
    return false;     
}

var rapportURLPopup; function submitInRapportURLPopup(form) 
{     
    if( window.event )  
        window.event.cancelBubble = true;     
    if( rapportURLPopup == null || rapportURLPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        rapportURLPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_RapportURLPopup',325, 500,'resizable=no,scrollbars=yes');     
        }
    form.target="m_RapportURLPopup";    
    form.submit();       
    return false; 
} 
var contactPopup; function submitInContactPopup(form) 
{     
	if( window.event )  
		window.event.cancelBubble = true;     
	if( contactPopup == null || contactPopup.closed )
	{   var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		contactPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ContactPopup',570, 800,'resizable=no,scrollbars=yes');
	}
	
	form.target="m_ContactPopup";     
	form.submit();       
	return false; 
}

var contactExportPopup; function submitInContactExportPopup(form) 
{     
	if( window.event )  
		window.event.cancelBubble = true;     
	if( contactExportPopup == null || contactExportPopup.closed )
	{   var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		contactExportPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ContactExportPopup',480, 600,'resizable=no,scrollbars=yes');
	}
	
	form.target="m_ContactExportPopup";     
	form.submit();       
	return false; 
}

var campagnePopup; function submitInCampagnePopup(form) 
{     
	if( window.event )  
		window.event.cancelBubble = true;     
	if( campagnePopup == null || campagnePopup.closed )
	{   var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		campagnePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CampagnePopup',570, 800,'resizable=no,scrollbars=yes');
	}
	
	form.target="m_CampagnePopup";     
	form.submit();       
	return false; 
}

var sourcePopup; function submitInSourcePopup(form) 
{     
	if( window.event )  
		window.event.cancelBubble = true;     
	if( sourcePopup == null || sourcePopup.closed )
	{   var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		sourcePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SourcePopup',570, 800,'resizable=no,scrollbars=yes');
	}
	
	form.target="m_SourcePopup";     
	form.submit();       
	return false; 
}

var actionPopup; function submitInActionPopup(form) 
{     
	if( window.event )  
		window.event.cancelBubble = true;     
	if( actionPopup == null || actionPopup.closed )
	{   var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		actionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ActionPopup',570, 800,'resizable=no,scrollbars=yes');
	}
	
	form.target="m_ActionPopup";     
	form.submit();       
	return false; 
}
 

var printPopup; function submitInPrintPopup(form) 
{    
    if( window.event )  window.event.cancelBubble = true;
	if( printPopup == null || printPopup.closed ) 
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
    	printPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PrintPopup',580, 760,'toolbar=no,resizable=yes,scrollbars=yes,menubar=yes,status=no');    
    }
	form.target="m_PrintPopup";
	form.submit();
	return false;
}
function submitInPrintPDFPopup(form) 
{    
    if( window.event )  window.event.cancelBubble = true;
    var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
    printPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PrintPopup',580, 760,'toobar=no,resizable=yes,scrollbars=yes,menubar=yes,status=no');    
	form.target="m_PrintPopup";
	form.submit();
	return false;
}


var usagerPopup; function submitInUsagerPopup(form) {     if( window.event )  window.event.cancelBubble = true;     if( usagerPopup == null || usagerPopup.closed )
{var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); usagerPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_UsagerPopup',500, 820,'resizable=no,scrollbars=yes');} form.target="m_UsagerPopup";     form.submit();       return false; } 
var listPopup; function submitInListPopup(form, win) {     if( window.event )  window.event.cancelBubble = true;     if( listPopup == null || listPopup.closed ) 
{var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); listPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ListPopup',380, 550,'resizable=no,scrollbars=no', win);}      form.target="m_ListPopup";     form.submit();       return false; } 
var agentPopup; function submitInAgentPopup(form) {     if( window.event )  window.event.cancelBubble = true;     if( agentPopup == null || agentPopup.closed )
{var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); agentPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_AgentPopup',500, 665,'resizable=no,scrollbars=no');}      form.target="m_AgentPopup";     form.submit();      return false; }  
var globalEPopup; function submitInGlobalEditPopup(form) { if( window.event )  window.event.cancelBubble = true;  if( globalEPopup == null || globalEPopup.closed )
{var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); globalEPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_GlobalEditPopup',560, 720,'resizable=no,scrollbars=yes');}  form.target="m_GlobalEditPopup"; form.submit();  return false; }  

var objectifPopup; function submitInObjectifPopup(thePath) {
if( window.event )  window.event.cancelBubble = true;
if( objectifPopup == null || objectifPopup.closed ) 
objectifPopup = launch (thePath, 'm_ObjectifPopup',538, 670,'resizable=no,scrollbars=yes');
return false; }

function submitSelf(form) 
{     
try{
    if( window.event )  
        window.event.cancelBubble = true; 
    form.target = '_self'; 
    if(document.body) {
	    if( typeof(pleaseWait) == 'undefined' )
	    	pleaseWait = 'Please wait / Veuillez patienter';
	    showWaiting(document.body, pleaseWait);
    }
    try{form.submit()}catch(err){};  
    }
    catch(ex) {alert('SubmitSelf('+form.action+') Error when submitting form:'+ ex.message);}
    return false; 
}  

function submitInModelePopup(thePath) {
if( window.event )  window.event.cancelBubble = true; 
activitePopup = launch (thePath, 'm_ActivitePopup',650, 875,'resizable=yes,scrollbars=yes');
return false; }

function submitInModeleViewPopup(form) { submitInActivitePopup(form) }
var activitePopup; function submitInActivitePopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( activitePopup == null || activitePopup.closed )     
	{var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		activitePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ActivitePopup',670, 895,'resizable=yes,scrollbars=yes');  
	}	
	form.target="m_ActivitePopup"; 
	form.submit();  
	return false; 
}

function submitInSupportItemPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( activitePopup == null || activitePopup.closed )     
	{
	var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		activitePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SupportPopup',700, 800,'resizable=yes,scrollbars=yes');  
		}
	form.target="m_SupportPopup"; 
	form.submit();  
	return false; 
}
     
var planPopup;
function submitInPlanViewPopup(form)
{   
    if( window.event )  
        window.event.cancelBubble = true;  
    if( planPopup == null || planPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        planPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PlanPopup',500, 700,'resizable=no,scrollbars=yes');
    }
    form.target="m_PlanPopup";
    form.submit();
    return false;
}

var deletePopup;
function submitInDeletePopup(appPath,mdArray)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
        
    return window.showModalDialog(appPath +'/md_confirmDelete.do', mdArray, 'scroll: no; dialogHeight: 350px; dialogWidth: 600px; resizable: No; status: No;') ;        
}

var cmaTypePopup;
function submitInTypeCMAPopup(appPath,mdArray)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
        
    return window.showModalDialog(appPath + '/md_selectTypeCMA.do', mdArray, 'scroll: no; dialogHeight: 330px; dialogWidth: 700px; resizable: No; status: No;') ;        
}


var mergePopup;
function submitInMergePopup(form)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
    if( mergePopup == null || mergePopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        mergePopupPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_MergePopup',350, 700,'resizable=no,scrollbars=no');
        }
    form.target="m_MergePopup";
    form.submit();
    return false;
}

var confirmPopup;
function submitInConfirmPopup(appPath,arrayItm,msg,btnInfo)
{ 
    var md = new Array(3);
    md[0] = arrayItm;
    md[1] = msg;
    md[2] = btnInfo; //Parametre seulement passe lors de exception.limite.limitreached.js
                     //Pour afficher un bouton OK plutot que OUI et NON
    
    if( window.event )  
        window.event.cancelBubble = true;  

    return window.showModalDialog(appPath + '/md_confirm.do', md, 'scroll: no; dialogHeight: 370px; dialogWidth: 600px; resizable: No; status: No;') ;        
}

function submitInGenericMsgPopup(appPath, height, width,isModal)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  

	if( isModal && isModal == true )
	    return window.showModalDialog('/prospects/md_genericMsg.do' + appPath, null, 'scroll: no; dialogHeight: '+height+'; dialogWidth: '+width+'; resizable: No; status: No;') ;        
	else
        return launch ('/prospects/md_genericMsg.do' + appPath, null,height, width,'resizable=no,scrollbars=no');
}

function submitInSystemMsgPopup(appPath, height, width)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  

    return window.showModalDialog('/prospects/md_systemMsg.do' + appPath, null, 'scroll: no; dialogHeight: '+height+'; dialogWidth: '+width+'; resizable: No; status: No;') ;        
}
var inputPopup;
function submitInInputPopup(appPath,arrayItm,msg,btnInfo, selected)
{ 
    var md = new Array(4);
    md[0] = arrayItm;
    md[1] = msg;
    md[2] = btnInfo; //Parametre seulement passe lors de exception.limite.limitreached.js
                     //Pour afficher un bouton OK plutot que OUI et NON
    md[3] = selected;
    
    if( window.event )  
        window.event.cancelBubble = true;  

    return window.showModalDialog(appPath + '/md_input.do', md, 'scroll: no; dialogHeight: 350px; dialogWidth: 600px; resizable: No; status: No;') ;        
}

var attachmentPopup;
function submitInAttachmentPopup(form)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
//    if( conditionPopup == null || conditionPopup.closed )
//        conditionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ConditionPopup',300, 400,'resizable=no,scrollbars=no');
//    form.target="m_ConditionPopup";
    form.target="_new";
    form.submit();
    return false;
}

var conditionPopup;
function submitInConditionPopup(form)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
    if( conditionPopup == null || conditionPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        conditionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ConditionPopup',390, 500,'resizable=no,scrollbars=no');
        }
    form.target="m_ConditionPopup";
    form.submit();
    return false;
}
var pop3ConfigPopup;
function submitInPop3ConfigPopup(form)
{
    if( window.event )  
        window.event.cancelBubble = true;  
    if( pop3ConfigPopup == null || pop3ConfigPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        pop3ConfigPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_Pop3ConfigPopup',490, 700,'resizable=no,scrollbars=yes');
        }
    form.target="m_Pop3ConfigPopup";
    form.submit();
    return false;
}

var signatureConfigPopup;
function submitInSignatureConfigPopup(form)
{
    if( window.event )  
        window.event.cancelBubble = true;  
    if( signatureConfigPopup == null || signatureConfigPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        signatureConfigPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SignatureConfigPopup',490, 775,'resizable=no,scrollbars=no');
        }
    form.target="m_SignatureConfigPopup";
    form.submit();
    return false;
}


var notClientPopup;
function submitInNotClientPopup(form)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
    if( notClientPopup == null || notClientPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        notClientPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_NotClientPopup',450, 690,'resizable=no,scrollbars=no');
        }
    form.target="m_NotClientPopup";
    form.submit();
    return false;
}

var pwdPopup;
function submitInPwdPopup(form)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
    if( pwdPopup == null || pwdPopup.closed )
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        pwdPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PwdPopup',500, 600,'resizable=no,scrollbars=yes');
        }
    form.target="m_PwdPopup";
    form.submit();
    return false;
}

function submitInSubFrame(form, subFrame)
{ 
    if( window.event )  
        window.event.cancelBubble = true;  
    form.target=subFrame.name;
    form.submit();
    return false;
}
 
var ventePopup; function submitInVentePopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( ventePopup == null || ventePopup.closed ) 
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
	 ventePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_VentePopup',690, 800,'resizable=no,scrollbars=yes');  
	}
	form.target="m_VentePopup"; form.submit();  return false; 
}  
var repetitionPopup; function submitInRepetitionPopup(form) { if( window.event )  window.event.cancelBubble = true;  if( repetitionPopup == null || repetitionPopup.closed )
{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); repetitionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_RepetitionPopup',350, 600,'resizable=no,scrollbars=yes');}  form.target="m_RepetitionPopup"; form.submit();  return false; }
var confirmationPopup; function submitInConfirmationPopup(form) { if( window.event )  window.event.cancelBubble = true;  if( confirmationPopup == null || confirmationPopup.closed )
{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); confirmationPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ConfirmationPopup',500, 600,'resizable=no,scrollbars=yes');}  form.target="m_ConfirmationPopup"; form.submit();  return false; }

var immoContactPopup; function submitInImmoContactPopup(form) 
{ if( window.event )  window.event.cancelBubble = true;  
  if( immoContactPopup == null || immoContactPopup.closed )     
  {
     if( form.immoFromCodeAgent && form.immoFromCodeAgent.value.indexOf('MT')==0)
     	immoContactPopup = launch ('/prospects/blank.html', 'm_ImmoContactPopup',550, 885,'resizable=yes,scrollbars=yes');  
	else
		immoContactPopup = launch ('/prospects/blank.html', 'm_ImmoContactPopup',550, 800,'resizable=yes,scrollbars=yes');  
  }
form.target="m_ImmoContactPopup"; form.submit();  return false; 
}

var imagePopup; function submitInImagePopup(form) { if( window.event )  window.event.cancelBubble = true;  if( imagePopup == null || imagePopup.closed )
{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1)); imagePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ImagePopup',200, 250,'resizable=no,scrollbars=yes');}
  form.target="m_ImagePopup"; form.submit();  return false; }  
var courrielPopup; 
function submitInCourrielPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( courrielPopup == null || courrielPopup.closed ) 
	{var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
	    courrielPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CourrielPopup',680, 850,'resizable=yes,scrollbars=yes');  
	    }
	form.target="m_CourrielPopup"; 
	form.submit();  
	return false; 
}  
var courrielFolderPopup; 
function submitInCourrielFolderPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( courrielFolderPopup == null || courrielFolderPopup.closed ) 
	{var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
	    courrielFolderPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CourrielFolderPopup',400, 700,'resizable=yes,scrollbars=yes');  
	    }
	form.target="m_CourrielFolderPopup"; 
	form.submit();  
	return false; 
}  
var courrielConfigPopup; 
function submitInCourrielConfigPopup(form) 
{ 
    if( window.event )  window.event.cancelBubble = true;  
    if( courrielConfigPopup == null || courrielConfigPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        courrielConfigPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CourrielConfigPopup',670, 610,'resizable=no,scrollbars=yes');  
        }
    form.target="m_CourrielConfigPopup"; 
    form.submit();  
    return false; 
}  

var inscriptionPopup; 
function submitInInscriptionPopup(form) { 
	if( window.event )  window.event.cancelBubble = true;  
	if( inscriptionPopup == null || inscriptionPopup.closed ) 
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		inscriptionPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_InscriptionPopup',620,1000,'resizable=no,scrollbars=yes');  
		}
	form.target="m_InscriptionPopup"; 
	form.submit();  
	return false; 
}

var CMAPopup; 
function submitInCMAPopup(form) { 
    if( window.event )  window.event.cancelBubble = true;  
    if( CMAPopup == null || CMAPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        CMAPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CMAPopup',620,1000,'resizable=yes,scrollbars=yes');  
        }
    form.target="m_CMAPopup"; 
    form.submit();  
    return false; 
}

var notePopup; 
function submitInNotePopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( notePopup == null || notePopup.closed )     
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		notePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_NotePopup',400, 650,'resizable=no,scrollbars=yes');  
		}
	form.target="m_NotePopup"; 
	form.submit();  
	return false; 
}  
var forumPopup; 
function submitInForumPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( notePopup == null || notePopup.closed )     
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		notePopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_ForumPopup',400, 670,'resizable=no,scrollbars=no');  
		}
	form.target="m_ForumPopup"; 
	form.submit();  
	return false; 
}  

var commPopup; 
function submitInCommPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( commPopup == null || commPopup )     
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		commPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CommPopup',500, 800,'resizable=yes,scrollbars=yes');  
		}
	form.target="m_CommPopup"; 
	form.submit();  
	return false; 
}  
var commTargetPopup; 
function submitInCommTargetPopup(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( commPopup == null || commPopup )     
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		commPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_CommTargetPopup',400, 550,'resizable=yes,scrollbars=yes');  
	}
	form.target="m_CommTargetPopup"; 
	form.submit();  
	return false; 
}  
     
var selectContInsPopup; 
function submitInSelectContIns(form) 
{ 
	if( window.event )  window.event.cancelBubble = true;  
	if( selectContInsPopup == null || selectContInsPopup.closed ) 
	{ var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
		selectContInsPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_SelectContIns',450,600,'resizable=no,scrollbars=no');  
		}
	form.target="m_SelectContIns"; 
	form.submit();  
	return false; 
}  

var paiementPopup; 
function submitInPaiementPopup(form) 
{ 
    if( window.event )  window.event.cancelBubble = true;  
    if( paiementPopup == null || paiementPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        paiementPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PaiementPopup',650,860,'resizable=no,scrollbars=yes,status=yes');  
        }
    form.target="m_PaiementPopup"; 
    form.submit();  
    return false; 
} 

var rpOnlinePopup; 
function submitInRPOnlinePopup(thePath) 
{     
    if( window.event )  
        window.event.cancelBubble = true;     
    if( rpOnlinePopup == null || rpOnlinePopup.closed ) 
        rpOnlinePopup = launch (thePath, 'm_RPOnlinePopup',650, 860,'resizable=no,scrollbars=yes,status=no');
    return false; 
}

var lgPopup; 
function submitInLGPopup(thePath) 
{     
    if( window.event )  
        window.event.cancelBubble = true;     
    if( lgPopup == null || lgPopup.closed ) 
        lgPopup = launch (thePath, 'm_LGPopup',650, 860,'resizable=no,scrollbars=yes,status=no');
    return false; 
} 

var planifVisitPopup; 
function submitInPlanifVisitPopup(form) 
{   
    if( window.event )  window.event.cancelBubble = true;     
    if( planifVisitPopup == null || planifVisitPopup.closed ) 
    { var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
        planifVisitPopup = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', 'm_PlanifVisitPopup',450, 530,'resizable=no,scrollbars=yes,status=no');         
        }
    form.target = 'm_PlanifVisitPopup'; 
    form.submit();
    return false;
}
var mlsLiveWindows=new Array();
function submitInOnlineHelp(form, fromIdUsager) 
{   
    if( window.event )  window.event.cancelBubble = true;     
	var winName = 'mlsLive_'+fromIdUsager+'_online_help';
	var winObject = null;
	try{ winObject = eval(winName); } catch(exc){ winObject = null; }
    if( typeof(winObject)=='undefined' || winObject == null || winObject.closed ) 
    { 
    	var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
	    form.usagerSrcId.value=fromIdUsager;
	    form.initiating.value='true';
        winObject = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', winName,675, 500,'resizable=yes,scrollbars=yes,status=no');         
    }
    form.target = winName; 
    form.submit();
    return winObject;
}
function submitInMlsLivePopup(form, fromIdUsager,fromPrenom,fromNom,fromEmail,fromProv, to, toProfilId, listing) 
{   
    if( window.event )  window.event.cancelBubble = true;     
	var winName = 'mlsLive_'+fromIdUsager+'_'+to;
	var winObject = null;
	try{ winObject = eval(winName); } catch(exc){ winObject = null; }
    var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
    form.usagerDestId.value=to; 
    form.usagerDestIdProfil.value=toProfilId; 
	form.idInscription.value=listing;
	form.usagerSrcId.value=fromIdUsager;
	form.usagerSrcPrenom.value=fromPrenom;
	form.usagerSrcNom.value=fromNom;
	form.usagerSrcEmail.value=fromEmail;
	form.usagerSrcProv.value=fromProv;
    if( typeof(winObject)=='undefined' || winObject == null || winObject.closed ) 
    { 
        winObject = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', winName,575, 500,'resizable=yes,scrollbars=yes,status=no');         
    }
    form.dispatch.value='';
    form.target = winName; 
    form.submit();
    return winObject;
}
function receiveInMlsLivePopup(form, fromId,fromPrenom,fromNom,fromEmail, fromProv,fromLang, to, listing, msgId) 
{   
    
    if( window.event )  window.event.cancelBubble = true;     
	var winName = 'mlsLive_'+to+'_'+fromId;
	var winObject = null;
	try{ winObject = eval(winName); } catch(exc){ winObject = null; }
    if( typeof(winObject)=='undefined' || winObject == null || winObject.closed ) 
    { 
    	var requestPath = form.action.substring(0, form.action.indexOf('/', 1));
    	form.usagerDestId.value=fromId;
	    form.usagerDestPrenom.value=fromPrenom;
	    form.usagerDestNom.value=fromNom;
	    form.usagerDestEmail.value=fromEmail;
	    form.usagerDestProv.value=fromProv;
	    form.usagerDestLang.value=fromLang;
	    form.idInscription.value=listing;
	    form.msgId.value=msgId;
        winObject = launch (requestPath+'/blank' + (typeof(langue)!='undefined' && langue.length>0 ? '_'+langue:'')+'.html', winName,575, 500,'resizable=yes,scrollbars=yes,status=no');         
       
    }
    form.dispatch.value='';
    form.target = winName; 
    form.submit();
    return winObject;
}


function checkCardNumWithMod10(cardNum) { 
var i; var cc = new Array(16); var checksum = 0; var validcc;  
for (i = 0; i < cardNum.length; i++) {  
	cc[i] = Math.floor(cardNum.substring(i, i+1)); }
for (i = (cardNum.length % 2); i < cardNum.length; i+=2) {  
	var a = cc[i] * 2;  
	if (a >= 10) {  
		var aStr = a.toString();  var b = aStr.substring(0,1);  
		var c = aStr.substring(1,2);  cc[i] = Math.floor(b) + Math.floor(c);  } 
	else {  
		cc[i] = a;  } }  
for (i = 0; i < cardNum.length; i++) {  
	checksum += Math.floor(cc[i]); }  
validcc = ((checksum % 10) == 0);  
return validcc; 
}
  
function cleanCardNum(cardNum, errMsg) { 
	var i; var ch; var newCard = "";  
	i = 0; 
	while (i < cardNum.length) {  
		ch = cardNum.substring(i, i+1);  
		if ((ch >= "0") && (ch <= "9")) {  
			newCard += ch;  } 
		else { 
			if ((ch != " ") && (ch != "-")) {
			 alert(errMsg);  return "";
			}  
		}  
		i++; }  
	return newCard; }  

function checkCard(cardType, cardNum, errMsgs) {
	var validCard; var cardLength; var cardLengthOK; var cardStart; var cardStartOK;
	//map accepted values
	var cardType = (cardType == "VI" ? "V" : (cardType == "MC" ? "M" : cardType));

	if ((cardType != "V") && (cardType != "M") && (cardType != "A") && (cardType != "D")) 
	{  alert(errMsgs && errMsgs[0] ? errMsgs[0] : "Please select a card type.");  
	return false; }  
	validCard = cleanCardNum(cardNum, (errMsgs && errMsgs[1] ? errMsgs[1] : "The card number contains invalid characters.")); 
	if (validCard != "") {  
		cardStart = validCard.substring(0,1);  
		cardStartOK = ( ((cardType == "V") && (cardStart == "4")) ||  ((cardType == "M") && (cardStart == "5")) ||  ((cardType == "A") && (cardStart == "3")) ||  ((cardType == "D") && (cardStart == "6")) );  
		if (!(cardStartOK)) {  alert(errMsgs && errMsgs[2] ? errMsgs[2] : "Please make sure the card number you've entered matched the card type you selected.");  return false;  }  
		cardLength = validCard.length;   cardLengthOK = ( ((cardType == "V") && ((cardLength == 13) || (cardLength == 16))) ||   ((cardType == "M") && (cardLength == 16)) ||   ((cardType == "A") && (cardLength == 15)) ||   ((cardType == "D") && (cardLength == 16)) );  
		if (!(cardLengthOK)) {  alert(errMsgs && errMsgs[3] ? errMsgs[3] : "Please make sure you've entered all of the digits on your card.");  return false;  } 
		if (checkCardNumWithMod10(validCard)) {  return true;  } 
		else {  alert(errMsgs && errMsgs[4] ? errMsgs[4] : "Please make sure you've entered your card number correctly.");  return false;  } 
	} 
	else 
	{  alert(errMsgs && errMsgs[4] ? errMsgs[4] : "Please make sure you've entered your card number correctly."); return false; } 
}


	var provinces = new Array(2); provinces['CA'] = new Array(13); provinces['CA'][0] = 'AB'; provinces['CA'][1] = 'BC'; provinces['CA'][2] = 'MB'; provinces['CA'][3] = 'NB'; provinces['CA'][4] = 'NL'; provinces['CA'][5] = 'NT'; provinces['CA'][6] = 'NS'; provinces['CA'][7] = 'NU'; provinces['CA'][8] = 'ON'; provinces['CA'][9] = 'PE'; provinces['CA'][10] = 'QC'; provinces['CA'][11] = 'SK'; provinces['CA'][12] = 'YT';  
	provinces['US'] = new Array(51); provinces['US'][0] = 'AL'; provinces['US'][1] = 'AK'; provinces['US'][2] = 'AZ'; provinces['US'][3] = 'AR'; provinces['US'][4] = 'CA'; provinces['US'][5] = 'CO'; provinces['US'][6] = 'CT'; provinces['US'][7] = 'DE'; provinces['US'][8] = 'DC'; provinces['US'][9] = 'FL'; provinces['US'][10] = 'GA'; provinces['US'][11] = 'HI'; provinces['US'][12] = 'ID'; provinces['US'][13] = 'IL'; provinces['US'][14] = 'IN'; provinces['US'][15] = 'IA'; provinces['US'][16] = 'KS'; provinces['US'][17] = 'KY'; provinces['US'][18] = 'LA'; provinces['US'][19] = 'ME'; provinces['US'][20] = 'MD'; provinces['US'][21] = 'MA'; provinces['US'][22] = 'MI'; provinces['US'][23] = 'MN'; provinces['US'][24] = 'MS'; provinces['US'][25] = 'MO'; provinces['US'][26] = 'MT'; provinces['US'][27] = 'NE'; provinces['US'][28] = 'NV'; provinces['US'][29] = 'NH'; provinces['US'][30] = 'NJ'; 
	provinces['US'][31] = 'NM'; provinces['US'][32] = 'NY'; provinces['US'][33] = 'NC'; provinces['US'][34] = 'ND'; provinces['US'][35] = 'OH'; provinces['US'][36] = 'OK'; provinces['US'][37] = 'OR'; provinces['US'][38] = 'PA'; provinces['US'][39] = 'RI'; provinces['US'][40] = 'SC'; provinces['US'][41] = 'SD'; provinces['US'][42] = 'TN'; provinces['US'][43] = 'TX'; provinces['US'][44] = 'UT'; provinces['US'][45] = 'VT'; provinces['US'][46] = 'VA'; provinces['US'][47] = 'WA'; provinces['US'][48] = 'WV'; provinces['US'][49] = 'WI'; provinces['US'][50] = 'WY';  
	var countries = new Array(2); countries[countries.length]='CA'; countries[countries.length]='US';

function formatPhone(tf)
{
  var num = tf.value.trim();
  if(isNaN(num))
  	return;
  
  if(num.length == 7)
  { 
        var st = num.substring(0,3);
        _return=st+"-";
        var end = num.substring(3,7);
        _return+=end;
        tf.value = _return;
  } 
  else if(num.length == 10)
  { 
        var ini = num.substring(0,3);
        _return="("+ini+") ";
        var st = num.substring(3,6);
        _return+=st+"-";
        var end = num.substring(6,10);
        _return+=end;
        tf.value = _return;
  }
  else if(num.length == 11)
  { 
    var pre = num.substring(0,1);
        _return=pre;
        var ini = num.substring(1,4);
        _return+="("+ini+") ";
        var st = num.substring(4,7);
        _return+=st+"-";
        var end = num.substring(7,11);
        _return+=end;
        tf.value = _return;
  }
}

function formatZip(tf)
{
    var zip = tf.value.trim().toUpperCase();
  
  if(zip.length == 6)
  {
        var st = zip.substring(0,3);
        _return=st+" ";
        var end = zip.substring(3,6);
        _return+=end;
        tf.value = _return;
  }
  else //if(zip.length == 7)
  { 
        tf.value = zip;
  } 
}  
function setFieldsEvents(){
	var inputs= document.getElementsByTagName('INPUT');
	var i;
	var elem;    
	for(i=0; i < inputs.length; i++)
	{
	       elem = inputs.item(i);
	       if( elem.type == "text"){
               //Vefication importante, puisque certain champs on comme valeur textfield_i (Section Suite)            
	           if(elem.className.length <= 0 ){
                   elem.className="textfield";           
	               if(elem.onfocus == null)
	                     elem.onfocus=function() {this.className='textfield_selected'};                              
	               if(elem.onblur == null)
	                   elem.onblur=function() {this.className='textfield'};   
               }                
	       }
	}
}
function confirmDeleteGen(appPath,toDelete,msg,msg2)
{
        var md = new Array(3);
        md[0] = toDelete;
        md[1] = msg;
        md[2] = msg2;
        return submitInDeletePopup(appPath,md);
}

function confirmCloseGen(appPath,arrayItm,msg)
{    
    if( dirty )
    {
        var resp = submitInConfirmPopup(appPath,arrayItm,msg);
        if( resp == true )
        {
            dirty = false;
            return true;
        }
        else
            return false;
    }
    else
        return true;
}


//document.onmousedown = rsStart;
var isResizing = false;
var startVPosition;
var minViewHeight=60;
var maxViewHeight=300;
var viewPaneTopPos;
var sourceDragElement;
var currentDragOffset = 0;
var minVPosition = 0;
var maxVPosition = 0;
function startResize()
{
	sourceDragElement = event.srcElement;
	startVPosition = event.clientY;
	// keep number of pixels dragged
	currentDragOffset = sourceDragElement.style.posTop - startVPosition;
	// get position of view panel's top from top of window
	// (our view panel is tblView, TODO make variable)
	viewPaneTopPos = document.body.clientHeight - tblView.clientHeight;
	// add minimum pane view height
	minVPosition = viewPaneTopPos + minViewHeight;
	maxVPosition = viewPaneTopPos + maxViewHeight;

	document.onmouseup = endResize;
	document.onmousemove = drag;
	isResizing = true;
}

function releaseResize()
{	// release events and reset positions
	document.onmousemove = null;
	document.onmouseup = null;
	sourceDragElement.style.posTop = 0;
	sourceDragElement.style.posLeft = 0;
	sourceDragElement = null;
}

function endResize()
{
	if (!isResizing) 
		return;
	isResizing = false;
	var effectiveDistance = event.clientY - startVPosition;
	// TODO make topList variable
	setViewHeight(parseInt(topList.clientHeight, 10) + effectiveDistance, true);
	releaseResize();
}

function drag()
{
	if (!isResizing)
		return;
	if (event.button != 1)
	{
		endResize();
		return;
	}
	var nNew = event.clientY;
	if (nNew < minVPosition - (topList.scrollWidth > topList.clientWidth? -20:20) )
	{	nNew = minVPosition - (topList.scrollWidth > topList.clientWidth? -20:20); }
	else if (nNew > maxVPosition- (topList.scrollWidth > topList.clientWidth? -20:20))
	{	nNew = maxVPosition - (topList.scrollWidth > topList.clientWidth? -20:20); }


	sourceDragElement.style.posTop = nNew + currentDragOffset;
	return false;
}

function setViewHeight(nHeight, fSave)
{
	if (nHeight < minViewHeight)
		nHeight = minViewHeight;
	else if (nHeight > maxViewHeight)
		nHeight = maxViewHeight;
	topList.height = nHeight;
	mainForm.viewHeight.value=nHeight;
}
var hideWaitingTimeout;
function showWaiting(parentElt,msgWaiting,isTimeout)
{
var wDiv ;
if(!document.getElementById('pleaseWait') || document.getElementById('pleaseWait') == null)
	wDiv = document.createElement('DIV');
else
{
	wDiv = document.getElementById('pleaseWait');
	if(wDiv.style.display == 'block')
	 	return;
}
wDiv.id='pleaseWait' 
wDiv.style.position='absolute';
wDiv.style.left='0px';
wDiv.style.top='0px';
wDiv.style.zIndex='10';
wDiv.style.display='block';
wDiv.style.width='100%';
wDiv.style.height='100%';
wDiv.innerHTML = '<table style="cursor:wait" width="100%" height="100%" cellpadding="0" cellspacing="0" onclick="window.event.cancelBubble=true; '+
'return false;"><tr><td valign="middle" align="center"><table id="pleaseWaitTable" style="background-color:#E3EFF9;color:#003366; border:1px solid #003366" '+
'cellpadding="10" cellspacing="0" width="350"><tr>'+
'<td height="100%" valign="middle" align="center" style="padding-top:20px">' +
msgWaiting + '</td></tr><tr><td valign="middle" align="center" style="padding-bottom:20px">'+
'<img border="0" src="/prospects/images/indicator_blue.gif"/></td></tr></table></td></tr></table>';

if(!document.getElementById('pleaseWait') || document.getElementById('pleaseWait') == null)
	parentElt.appendChild(wDiv);

hideShowCovered(document.getElementById('pleaseWaitTable'));
if(typeof(hideWaitingTimeout)!='undefined')
	clearTimeout(hideWaitingTimeout);
if( isTimeout )
	hideWaitingTimeout = setTimeout('hideWaiting()', 10000);
}
function hideWaiting()
{
var wDiv ;
if(!document.getElementById('pleaseWait') || document.getElementById('pleaseWait') == null)
	{ return;}
wDiv = document.getElementById('pleaseWait');
wDiv.style.display='none';
hideShowCovered(document.getElementById('pleaseWaitTable'));
}

function getAbsolutePos(el) 
{  
  var SL = 0, ST = 0;  
//  var is_div = /^div$/i.test(el.tagName);  
  if (el.scrollLeft)
  	SL = el.scrollLeft; 
  if ( el.scrollTop) 
  	ST = el.scrollTop;  
  var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
  if (el.offsetParent) 
  {  
  	var tmp = getAbsolutePos(el.offsetParent); 
  	r.x += tmp.x;  
  	r.y += tmp.y; 
  } 
  return r; 
};


function hideShowAll(srcMenu) { 
    var self = this; 
    function getVisib(obj){   
        var value = obj.style.visibility; 
        if (!value) {
            if (obj.currentStyle) { 
                value = obj.currentStyle.visibility;}
           else value = ''; }
        return value;
    };
    var tags = new Array("applet",  "select"); 
    var el = srcMenu; 
    for (var k = tags.length; k > 0; ) {
        var ar = document.getElementsByTagName(tags[--k]); 
        var cc = null;
        for (var i = ar.length; i > 0;) { 
            cc = ar[--i];
            if (srcMenu.style.visibility=='hidden') {
                if (!cc.__msh_save_visibility) {
                    cc.__msh_save_visibility = getVisib(cc);}
                cc.style.visibility = cc.__msh_save_visibility;
            } 
            else {
                if (!cc.__msh_save_visibility) {
                    cc.__msh_save_visibility = getVisib(cc);}
                cc.style.visibility = "hidden"; 
            } 
        } 
    } 
};
function hideShowCovered(srcMenu) { 
    var self = this; 
    function getVisib(obj){   
        var value = obj.style.visibility; 
        if (!value) {
            if (obj.currentStyle) { 
                value = obj.currentStyle.visibility;}
           else value = ''; }
        return value;
    };
    var tags = new Array('applet',  'select'); 
    var el = srcMenu; 
    var p = getAbsolutePos(srcMenu); 
    var EX1 = p.x;
    var EX2 = el.offsetWidth + EX1; 
    var EY1 = p.y; 
    var EY2 = el.offsetHeight + EY1; 
    for (var k = tags.length; k > 0; ) {
        var ar = document.getElementsByTagName(tags[--k]); 
        var cc = null;
        for (var i = ar.length; i > 0;) { 
            cc = ar[--i];
            p = getAbsolutePos(cc); 
            var CX1 = p.x; 
            var CX2 = cc.offsetWidth + CX1;
            var CY1 = p.y; 
            var CY2 = cc.offsetHeight + CY1;
            if (srcMenu.style.visibility=='hidden' || (EX1 == EX2 && EY1 == EY2)  || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
                if (!cc.__msh_save_visibility) {
                    cc.__msh_save_visibility = getVisib(cc);}
                cc.style.visibility = cc.__msh_save_visibility;
            } 
            else {
                if (!cc.__msh_save_visibility) {
                    cc.__msh_save_visibility = getVisib(cc);}
                cc.style.visibility='hidden'; 
            } 
        } 
    } 
};

function hasCourriel()
{
	if( hasEmail == false )
	{
		submitInConfirmPopup(rqPath,new Array(),noEmailMsg,'');
		return false;
	}
	return true;
}
function confirmDelete()
{
	mainForm.dispatch.value = confirmDelDispatch;
	submitInSubFrame(mainForm, document.getElementById('iRPCFrame'));
}

function addToFavorite(url, description) 
{
if(window.external)	window.external.AddFavorite(url, description);
}

function createCookie(name,value,days,path) 
{
	var expires = "";
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+escape(value)+expires+ "; path="+(path!=null?path:"/");
}

function readCookie(name) 
{
	if( document.cookie )
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split('; ');
		for (var i=0; i < ca.length; i++)
		  {
		    var aCrumb = ca[i].split("=");
		    if (name == aCrumb[0]) 
		      return unescape(aCrumb[1]);
		  }
	}	
	return null;
}
function eraseCookie(name) 
{
	createCookie(name,"",-1,null);
}

var gmap;
//Google maps script must be included before utils.js
//To set before call:
//var gmapParentName
//var gmapLinkName
//var gmapLinkUrl
//var gmapAddress
//var gmapMarkerTitle	#Optional, address will be taken instead
function loadMap() {
try {
  if (GBrowserIsCompatible()) 
  {
  	if (!(gmapParentName && gmapLinkName && gmapLinkUrl && gmapAddress))
  	{
  		alert("gmapParentName or gmapLinkName or gmapLinkUrl or gmapAddress not set.");
  		return;
  	}
  	else if (!document.getElementById(gmapParentName))
  	{
  		alert("Element '"+gmapParentName+"' does not exist.");
  		return;
  	}
  	else if (!document.getElementById(gmapLinkName))
  	{
  		alert("Link '"+gmapLinkName+"' does not exist.");
  		return;
  	}
  
    gmap = new GMap2(document.getElementById(gmapParentName), {size:new GSize(275,200),mapTypes:[G_NORMAL_MAP]});
    gmap.addControl(new GSmallZoomControl());
    //gmap.addControl(new GScaleControl());
    
    var icon = new GIcon();
    icon.image = "/prospects/images/icomap.png";
    icon.iconSize = new GSize(24, 30);
    icon.iconAnchor = new GPoint(11, 30);
    icon.infoWindowAnchor = new GPoint(12, -5);
    
    var geocoder = new GClientGeocoder();
   	geocoder.getLatLng(gmapAddress,
			function(point) 
			{ 
				if (!point) 
				{ 
					document.getElementById(gmapLinkName).onclick=null;
					document.getElementById(gmapLinkName).href=gmapLinkUrl;
					document.getElementById(gmapLinkName).target='_blank';
				} 
				else 
				{ 
					gmap.setCenter(point, 15);
					var opt = {title:(gmapMarkerTitle?gmapMarkerTitle:gmapAddress),clickable:false,icon:icon};
					var marker = new GMarker(point, opt); 
					gmap.addOverlay(marker);        
				} 
			}  );
  }
}
catch(gExc) { 
  	document.getElementById(gmapLinkName).onclick=null;
	document.getElementById(gmapLinkName).href=gmapLinkUrl;
	document.getElementById(gmapLinkName).target='_blank';
}
}
