// JavaScript Document
function showImgGr(src) {
	_Elem('grImg').src=src;

	Show('grImgDv');
	_Elem('grImgDv').style.top = document.body.scrollTop+10;
	if (_Elem('grImgDv').style.top.replace(/px/,'') < 232) _Elem('grImgDv').style.top = 232;
}
var selectDefVal = new Array();
function doSelect(nom, optObj){
	strNew = '';
  aryOpt = getElementsByClass('opt'+nom, _Elem('opt'+nom));

	for (ii = 0 ; ii < aryOpt.length; ii++) {
			if (aryOpt[ii].checked == true) {
        	HTMLStr = aryOpt[ii].parentNode.innerHTML.split('&nbsp;') ;
					strNew += ', '+HTMLStr[1];
			}
		}
	_Elem('input'+nom).value=strNew.replace(/^, /,'');
  if (!_Elem('input'+nom).value) _Elem('input'+nom).value = selectDefVal[nom];
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
// insere du code html avant un element de la page..
function _InsertHtmlBefore( html, element ) {
    	if ( element.insertAdjacentHTML )	// IE
    	{
    		element.insertAdjacentHTML( 'beforeBegin', html ) ;
    	}
    	else								// Gecko
    	{
    		var oRange = document.createRange() ;
    		oRange.setStartBefore( element ) ;
    		var oFragment = oRange.createContextualFragment( html );
    		element.parentNode.insertBefore( oFragment, element ) ;
    	}
  }

// surcharge de la fonction getElementById pour simplifer le codage
function _Elem(id) {
  return document.getElementById(id);
}

// modifier simplement le style d'un id..
function _Style(id) {
  return _Elem(id).style ;
}

function activate() {
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).disabled = false;
	}
}

function desactivate() {
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).disabled = true;
	}
}

function HideByTagName(tag) {
         var tags = document.getElementsByTagName(tag);
         for (i=0; i<tags.length; i++) {
           if (_Elem(tags[i].id))
          _Elem(tags[i].id).style.visibility = 'hidden';
         }
}

function HideByClassName(classe) {
         var tags = getElementsByClass(classe);
         for (i=0; i<tags.length; i++) {
           if (_Elem(tags[i].id))
          _Elem(tags[i].id).style.visibility = 'hidden';
         }
}

function ShowByTagName(tag) {
         var tags = document.getElementsByTagName(tag);
         
         for (i=0; i<tags.length; i++) {
             if (_Elem(tags[i].id))
             _Elem(tags[i].id).style.visibility = 'visible';
         }
}

function Show() {    
    var sAgent = navigator.userAgent.toLowerCase() ;
    if (sAgent.indexOf("msie 6.0") > 0) {
    // c'est IE 6 on cache les objets select
    HideByTagName("select")
    }
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).style.display = 'block';
		_Elem(arguments[i]).style.visibility = 'visible';
	}
}

function Hide() {
      var sAgent = navigator.userAgent.toLowerCase() ;
    if (sAgent.indexOf("msie 6.0") > 0) {
    // c'est IE 6 on remontre les objets select
    ShowByTagName("select")
    }
	for (var i = 0; i < arguments.length; ++i) {
		_Elem(arguments[i]).style.display = 'none';
		_Elem(arguments[i]).style.visibility = 'hidden';
	}
}

function ShowHide(id) {
	if (_Elem(id).style.display != 'none')
		Hide(id);
	else
		Show(id);
		
}
function doNothing() { void(0); }
function hideML() {
	if (!insideML && _Elem('activites_box').style.display == 'block') ShowHideML('activites_box');
	}
var insideML = false;
function ShowHideML(id) {
	if (_Elem(id).style.display != 'none') {
		Hide(id);
		document.body.onclick = doNothing;
	} else {
		Show(id);
		setTimeout('document.body.onclick = hideML',5);
	}
}

function bindDivs (id, idDst) {

		var sAgent = navigator.userAgent.toLowerCase() ;
       if (sAgent.indexOf("msie") == -1) {
          offsets = 1 ;
       } else {offsets = 0 }

       myTop = _Elem(idDst).offsetTop;
       myLeft = _Elem(idDst).offsetLeft;
       myHeight = Math.round(_Elem(idDst).clientHeight/10)*10;
       myWidth = Math.round(_Elem(idDst).clientWidth/10)*10;
       //showEditor(myTop, myLeft, myWidth, myHeight);
       _Elem(id).style.top = myTop+offsets ;
       _Elem(id).style.left = myLeft+offsets ;
       _Elem(id).style.width = myWidth ;
       _Elem(id).style.height = myHeight ;

       Show(id);
}

function ucFirst(str) {
   return str.substr(0,1).toUpperCase() + str.substr(1,str.length);
}

function swapWidth(dvObj) {
	newWidth = dvObj.style.width;
	if (newWidth == '90%') dvObj.style.width = "10%";
	else dvObj.style.width = "90%";
}

function swapIDContents(id1,id2) {
	tmpid = id2 ;
	tmpidc = _Elem(id2).innerHTML;

	// swap du contenu
	_Elem(id2).innerHTML = _Elem(id1).innerHTML;
	_Elem(id1).innerHTML = tmpidc ;

	// swap des id
	_Elem(id2).id = id1;
	_Elem(id1).id = id2;
}

function selectAddOption(sId, oText, oVal, where) {
	sTmp = _Elem(sId);
	nbOptions = sTmp.options.length;
	
	if (where == 'top') {
		for(i=nbOptions; i >= 1  ; i--) {
			sTmp.options[i] = new Option (sTmp.options[i-1].innerHTML, sTmp.options[i-1].value);
		}
		sTmp.options[0] = new Option(oText, oVal);
	} else {
		sTmp.options[nbOptions] = new Option(oText, oVal);
	}
}

function checkMail(adresse){

var regEx = /([a-z0-9]+([-_]?[a-z0-9]+)*.)*[a-z0-9]+([-_]?[a-z0-9]+)*@([a-z0-9]+([-_]?[a-z0-9]+)*.)+[a-z]{1,4}/gi;  

if (adresse.match(regEx) != adresse ) {
 return false;
} else {

 return true;

}

}

var cp = '';
var old_cp = '';
var villePrx = '';
function doVilles(prx) {
  //var remoteVilles = new villes(villesCallBack);
  cp = _Elem(prx+'code_postal').value;
  if (cp != old_cp){
    //if (cp) { remoteVilles.getvilles(cp); }
    if (cp) { AkisiJax('/ville.php?cp='+cp); }
    old_cp = cp ;
	villePrx = prx;
    AkisiAjaxDst = prx+'ville_id';
  }
}
var naf_cat_id = '';
var nafPrx = '';
var AkisiAjaxDst = '';
function getNaf(prx) {
  naf_cat_id = _Elem(prx+'naf_cat_id').value;
    if (naf_cat_id) { AkisiJax('naf.php?id='+naf_cat_id); }
    old_cp = cp ;
	nafPrx = prx;
    AkisiAjaxDst = prx+'naf_id';
}

function AkisiJax(what) {
    var xjs=document.createElement('script');
    xjs.src=what;
    xjs.id = 'AkisiJax';
    document.getElementsByTagName('head')[0].appendChild(xjs);
}

function removeAkisiJaxScript() {
      document.getElementsByTagName("head").item(0).removeChild(_Elem('AkisiJax'));
}

function marquerVu(id) {
    AkisiJax('devis.php?a=marquerVu&id='+id);
}

function marquerVuCallBack(id,vu) {
    if (vu == 1) {
        _Elem('devis'+id).className = _Elem('devis'+id).className.replace(/vu/,'nouveau');
        _Elem('btn_devis'+id).value = 'marquer comme vu';
    } else {
        _Elem('devis'+id).className = _Elem('devis'+id).className.replace(/nouveau/,'vu');
        _Elem('btn_devis'+id).value = 'marquer comme nouveau';
    }
    //removeAkisiJaxScript();
}

function fillSelect(ary) {
    var sel = _Elem(AkisiAjaxDst);
    sel.length=0;

	if (!ary) {
		var res = document.createElement('option');
        res.value=0;
        res.innerHTML='...';
        sel.appendChild(res);
	}
    else {
      for (var i = 0; i < ary.length; ++i) {
        var res = document.createElement('option');
        res.value=ary[i]['id'];
        res.innerHTML=ary[i]['nom'];
        sel.appendChild(res);
      }
    }
    removeAkisiJaxScript();
    AkisiAjaxDst = '';
  }

function villesSelect(aryVilles) {
    var sel = _Elem(villePrx+'ville_id');
    sel.length=0;

	if (!aryVilles) {
		var res = document.createElement('option');
        res.value=0;
        res.innerHTML='Pas de villes pour ce Code postal';
        sel.appendChild(res);
	}
    else {
      for (var i = 0; i < aryVilles.length; ++i) {
        var res = document.createElement('option');
        res.value=aryVilles[i]['ville_id'];
        res.innerHTML=aryVilles[i]['commune'];
        sel.appendChild(res);
      }
    }
    removeAkisiJaxScript();
  }
  
var multiSelectArray = new Array();
function multiSelectAjouter(quoi,def) {
	 // si la liste des catégories n'existe pas il faut la créer !
	 if (!multiSelectArray.quoi) { multiSelectArray.quoi = new Array() ; }
     //alert(def);
     if (!def) def = textes['T_CHOISISSEZ'];
	 var str = new Array();
	 var strid = new Array();
	 var ii = 0;
	 var ids = getElementsByClass(quoi);
	 for (var i=0; i<ids.length; i++) {
	  if (ids[i].checked) {
		tmp = ids[i].value.split(':')
		str[ii] = tmp[1];
		strid[ii++] = tmp[0];
		
	  }
	 }
	 _Elem(quoi+'_str').innerHTML = (str.length > 0)?str.join(', '):def;
	 _Elem(quoi+'_input').value = strid.join(',');
    }

function checkArray(required) {
    var nbErr = 0;
    for (i=0; i < required.length; i++) {
        if (required[i].indexOf('|') > 0 ) {
            var tmp = required[i].split('|');
            var eee = 0;
            for (j=0; j<tmp.length; j++) {
                if (_Elem(tmp[j]) && (_Elem(tmp[j]).value.length > 0 || _Elem(tmp[j]).value > 0)) {
                    eee++;
                }
            }
            for (j=0; j<tmp.length; j++) {
                if (eee) {
                // ok
                _Valid(tmp[j]);
                } else {
                // ko
                _Error(tmp[j]);
                nbErr++;
                }
            }
        } else if (required[i].indexOf('&') > 0 ) {
            var tmp = required[i].split('&');
            var eee = 0;
            var a = _Elem(tmp[0]).value;
            for (j=0; j<tmp.length; j++) {
                if ( _Elem(tmp[j]) && (_Elem(tmp[j]).value.length == 0 || _Elem(tmp[j]).value != a)) eee++;
            }
            
            for (j=0; j<tmp.length; j++) {
                if (eee) {
                // ko
                _Error(tmp[j]);
                nbErr++;
                } else {
                // ok
                _Valid(tmp[j]);
                }
            }
        } else if (required[i] == 'email') {
			if (checkMail(_Elem(required[i]).value)) {
				_Valid(required[i]);
			} else {
				nbErr++;
              _Error(required[i]);
			}
		} else {
            if (_Elem(required[i]).value == 0 || _Elem(required[i]).value == '') {
              nbErr++;
              _Error(required[i]);
            } else {
             _Valid(required[i]);
            }
        }
	}
    return nbErr;
}
function checkInscriptionPro() {
	var required = new Array('email','pass1&pass2','P_raison_sociale', 'C_nom', 'C_prenom', 'C_fonction', 'P_siret','P_adresse','P_code_postal','P_ville','P_email','P_telephone','P_portable','P_depts');
    
    var nbErr = checkArray(required);
	
	nbC = 0;
	ids = getElementsByClass('cbbb');
	for (i in ids) {
		if (_Elem(ids[i].id).checked) {
			nbC++;
		}
	}
    
	if (nbC == 0) { alert('Vous devez choisir au moins une activité'); nbErr++; }
	if (_Elem('cbcgu').checked == false) { nbErr++; _Elem('cbcgu').parentNode.style.color = '#f00';}
	else _Elem('cbcgu').parentNode.style.color = '#000';
	
    return nbErr == 0;
}
function checkInscription() {
	if (_Elem('blog_nom') && _Elem('blog_url'))
    var required = new Array('email','pass1&pass2','nom', 'adresse', 'code_postal', 'ville','blog_nom','blog_url');
	else
    var required = new Array('email','pass1&pass2','nom', 'adresse', 'code_postal', 'ville');
    
    var nbErr = checkArray(required);
    
	if (_Elem('cbcgu').checked == false) { nbErr++; _Elem('cbcgu').parentNode.style.color = '#f00';}
	else _Elem('cbcgu').parentNode.style.color = '#000';
	
    return nbErr == 0;
}

function checkBlog() {
	if (_Elem('blog_url'))
    var required = new Array('blog_nom','blog_url');
	else
    var required = new Array('blog_nom');

    
    var nbErr = checkArray(required);
    
    return nbErr == 0;
}

function checkArticle() {
    var required = new Array('ba_titre','ba_blog_categorie_id');

    
    var nbErr = checkArray(required);
    if (tinyMCE.get('ba_texte').getContent() == '') { alert('Votre article est vide!'); nbErr++; }
    return nbErr == 0;
}

function checkLogin() {
    var required = new Array('email_client','mdp_client');
    
    var nbErr = checkArray(required);
    
    return nbErr == 0;
}

function checkDevis() {
	if (_Elem('nom')) {
    var required = new Array('nom','code_postal','adresse','ville','email','telephone', 'message', 'type_devis', 'etat_id','adresse_chantier','chantier_id', 'delais_id');
	} else
    var required = new Array('message', 'type_devis', 'etat_id','adresse_chantier','chantier_id', 'delais_id');
	
    var nbErr = checkArray(required);

    if (_Elem('dest')) if (_Elem('dest').value == '') {
		nbErr++;
		alert('Vous devez sélectionner une catégorie !');
	}
if (_Elem('cbcgu').checked == false) { nbErr++; _Elem('cbcgu').parentNode.style.color = '#f00';}
	else _Elem('cbcgu').parentNode.style.color = '#000';
    
    return nbErr == 0;
}

function checkCtc() {
    var required = new Array('nom','telephone', 'message');
	
    var nbErr = checkArray(required);

    if (_Elem('dest')) if (_Elem('dest').value == '') {
		nbErr++;
		alert('Vous devez sélectionner une catégorie !');
	}

    
    return nbErr == 0;
}

function verifTemoignage() {
    var required = new Array('signature','message');
    
    var nbErr = checkArray(required);
    
    return nbErr == 0;
}

function checkCoordonnees() {
	var required = new Array('email','nom', 'adresse', 'code_postal', 'ville');
    
    var nbErr = checkArray(required);
    
    return nbErr == 0;
}

function checkMotDePasse() {
    var required = new Array('pass1&pass2');
    
    var nbErr = checkArray(required);
    
    return nbErr == 0;
}

function _Error(id) {
    if (id.indexOf('_input') > 0) {
        _Elem(id.replace(/_input/,'_str')).style.borderColor = '#FF0000';   
    } else {
    _Elem(id).style.borderColor = '#FF0000';
    }
}
function _Valid(id) {
    if (id.indexOf('_input') > 0) {
        _Elem(id.replace(/_input/,'_str')).style.borderColor = '#2F8EFF';   
    } else {
    _Elem(id).style.borderColor = '#2F8EFF';
    }    
}
function verifAjoutOffre() {
	var required = new Array('nom','telephone','email','pass1&pass2','offre','date_embauche','lieu_travail','type_contrat','texte');
	var nbErr = checkArray(required);
    	
    if (nbErr == 0) return true;
    return false;
}

function verifAjoutAnnonce() {
	var required = new Array('nom','telephone','email','pass1&pass2','titre','rubrique_id','lieu','texte');
	var nbErr = checkArray(required);
    	
	if (_Elem('logo').value != '' && !checkUpload(_Elem('logo').value)) { nbErr++; _Elem('logo').value = ''; }
    if (nbErr == 0) return true;
    return false;
}

function checkUpload(fichier) {
	t = fichier.split('.');
	var extValid = ['gif','jpg','jpeg','png'];
	ext = t[t.length-1];
	ext = ext.toLowerCase();
	ok = false;
	for (i in extValid) {
		if (ext == extValid[i]) {
			ok = true;
			break;
		}
	}
	if (ok == false) { alert('Seuls les fichiers gif, jpg et png sont acceptés'); _Elem('logo').value = ''; return false;}
	return true;	
}
function verifInscription() {
    var required = new Array('email', 'nom', 'prenom', 'code_postal', 'dnJJ', 'dnMM', 'dnAAAA', 'telephone');
	
    var nbErr = checkArray(required);
    
	 
	fieldTofocus = 'none';
   
    // traitements particuliers
	 if (!(checkMail(_Elem('email').value)==true)) {
        _Elem('email').style.borderColor = '#FF0000';
        nbErr ++;
		if (fieldTofocus == 'none') fieldTofocus = 'email';
    } else { _Elem('email').style.borderColor = '#999999'; }
	
	if (_Elem('ville_id').value > 0) {
        _Elem('ville_id').style.borderColor = '#999999';      
	} else {
		_Elem('ville_id').style.borderColor = '#FF0000';
        nbErr ++;
		if (fieldTofocus == 'none') fieldTofocus = 'ville_id';
	}
    
    if (_Elem('dnJJ').value && _Elem('dnMM').value && _Elem('dnAAAA').value) {
        myDate = new Date(_Elem('dnAAAA').value,_Elem('dnMM').value-1,_Elem('dnJJ').value);
        if ( (myDate.getDate() == _Elem('dnJJ').value) &&
            ((myDate.getMonth()+1) == _Elem('dnMM').value) &&
            (myDate.getFullYear() == _Elem('dnAAAA').value) ) {
            _Elem('dnJJ').style.borderColor = '#999999';
            _Elem('dnMM').style.borderColor = '#999999';
            _Elem('dnAAAA').style.borderColor = '#999999';
        } else {
            _Elem('dnJJ').style.borderColor = '#FF0000';
            _Elem('dnMM').style.borderColor = '#FF0000';
            _Elem('dnAAAA').style.borderColor = '#FF0000';
            nbErr++;
			if (fieldTofocus == 'none') fieldTofocus = 'dnJJ';
        }
    }
	
    // CV
    if (_Elem('cv').value != '') {
        tmp = _Elem('cv').value.split('.');
        if (tmp[tmp.length-1] == 'pdf' || tmp[tmp.length-1] == 'doc' || tmp[tmp.length-1] == 'txt') {
            _Elem('cv').parentNode.style.border = "0px";
        } else {
            _Elem('cv').parentNode.style.border = "1px solid #ff0000";
            nbErr++;
            if (fieldTofocus == 'none') fieldTofocus = 'cv';
        }        
    } else {
        //alert(_Elem('cv').value);
        _Elem('cv').parentNode.style.border = "1px solid #ff0000";
        nbErr++;
        if (fieldTofocus == 'none') fieldTofocus = 'cv';
    }
	
	if (fieldTofocus != 'none') _Elem(fieldTofocus).focus();
    if (nbErr == 0) return true;
    return false;
}

function verifCandidature() {
    var required = new Array('email', 'nom', 'prenom', 'code_postal', 'dnJJ', 'dnMM', 'dnAAAA', 'telephone', 'email' );
	
    var nbErr = checkArray(required);
    
	 
	fieldTofocus = 'none';
   
    // traitements particuliers
	 if (!(checkMail(_Elem('email').value)==true)) {
        _Elem('email').style.borderColor = '#FF0000';
        nbErr ++;
		if (fieldTofocus == 'none') fieldTofocus = 'email';
    } else { _Elem('email').style.borderColor = '#999999'; }
	
	if (_Elem('ville_id').value > 0) {
        _Elem('ville_id').style.borderColor = '#999999';      
	} else {
		_Elem('ville_id').style.borderColor = '#FF0000';
        nbErr ++;
		if (fieldTofocus == 'none') fieldTofocus = 'ville_id';
	}
    
    if (_Elem('dnJJ').value && _Elem('dnMM').value && _Elem('dnAAAA').value) {
        myDate = new Date(_Elem('dnAAAA').value,_Elem('dnMM').value-1,_Elem('dnJJ').value);
        if ( (myDate.getDate() == _Elem('dnJJ').value) &&
            ((myDate.getMonth()+1) == _Elem('dnMM').value) &&
            (myDate.getFullYear() == _Elem('dnAAAA').value) ) {
            _Elem('dnJJ').style.borderColor = '#999999';
            _Elem('dnMM').style.borderColor = '#999999';
            _Elem('dnAAAA').style.borderColor = '#999999';
        } else {
            _Elem('dnJJ').style.borderColor = '#FF0000';
            _Elem('dnMM').style.borderColor = '#FF0000';
            _Elem('dnAAAA').style.borderColor = '#FF0000';
            nbErr++;
			if (fieldTofocus == 'none') fieldTofocus = 'dnJJ';
        }
    }
	
    // CV
    if (_Elem('cv').value != '') {
        tmp = _Elem('cv').value.split('.');
        if (tmp[tmp.length-1] == 'pdf' || tmp[tmp.length-1] == 'doc' || tmp[tmp.length-1] == 'txt') {
            _Elem('cv').parentNode.style.border = "0px";
        } else {
            _Elem('cv').parentNode.style.border = "1px solid #ff0000";
            nbErr++;
            if (fieldTofocus == 'none') fieldTofocus = 'cv';
        }        
    } else {
        //alert(_Elem('cv').value);
        _Elem('cv').parentNode.style.border = "1px solid #ff0000";
        nbErr++;
        if (fieldTofocus == 'none') fieldTofocus = 'cv';
    }
	
	if (fieldTofocus != 'none') _Elem(fieldTofocus).focus();
    if (nbErr == 0) return true;
    return false;
}

function favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' ){
window.sidebar.addPanel("Devis-faustin.com","http://www.devis-faustin.com/","");
alert ('Un favori va être créé, il risque de s\'ouvrir dans le panneau latéral de votre navigateur. Pour y remédier faites un clique droit sur le marque-page Akisiweb puis choisissez <Propriétés> et décochez <Charger ce marque-page comme panneau latéral>. Merci')
//_Elem('imgFavoris').src = '/entete-ajouter-favoris-ok.php';
}
else {
window.external.AddFavorite("http://www.devis-faustin.com/","Devis-faustin.com");
//_Elem('imgFavoris').src = '/entete-ajouter-favoris-ok.php';
}
}

var ongletCourant = 't1';
function chTab(id) {
    _Elem(ongletCourant).className = 'ongletInactif';
    _Elem(id).className = 'ongletActif';
    Hide(ongletCourant+'Content');
    Show(id+'Content');
    ongletCourant = id;
}

var ongletCourantByName = Array();
function chTabNamed(name,id) {
    _Elem(ongletCourantByName[name]).className = 'ongletInactif';
    _Elem(id).className = 'ongletActif';
    Hide(ongletCourantByName[name]+'Content');
    Show(id+'Content');
    ongletCourantByName[name] = id;
}

var tinyInitObj ={
		// General options
		mode : "textareas",
		//elements : "texte",
		theme : "advanced",
		language: 'fr',
		//plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
		plugins : "pagebreak,style,layer,table,advhr,advimage,advlink,iespell,inlinepopups,preview,media,contextmenu,paste,directionality,fullscreen,nonbreaking,xhtmlxtras,akisimg",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo",
		theme_advanced_buttons2 : "link,unlink,anchor,image,akisimg,cleanup,code,|,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,visualaid,|,sub,sup,|,charmap,iespell,|,fullscreen",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : false,
		theme_advanced_resizing : false,
		theme_advanced_blockformats : "p,h1,h2,h3,blockquote",


		// Example content CSS (should be your site CSS)
		//content_css : 'http://www.devis-faustin.com/skins/default/css/general.css?'+ new Date().getTime(),

		// Drop lists for link/image/media/template dialogs
		//template_external_list_url : "tiny_mce_lists/template_list.js",
		//external_link_list_url : "tiny_mce_lists/link_list.js.php",
		external_image_list_url : "js/tiny_mce_lists/image_list.js.php",
		//media_external_list_url : "tiny_mce_lists/media_list.js",
        
        editor_selector : "mceEditor",
        editor_deselector : "mceNoEditor",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	};
	
function initText() { if (tinyMCE) tinyMCE.init(tinyInitObj); }

function checkIsNum(o) {
    reg = new RegExp("[^0-9.+ ]",'g');
    o.value = o.value.replace(reg,'');
}

function checkIsAlpha(o) {
    reg = new RegExp("[^a-z0-9-]",'g');
    o.value = o.value.replace(reg,'');
}
