<!--

var newWin = null;

function closeWin()
{
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}

function showPopup(strURL,strType,strHeight,strWidth) 
{
	closeWin();

	var strOptions="";
	if (strType=="console")
		strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed")
		strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic")
		strOptions="toolbar=no,menubar=no,scrollbars,location=no,resizable=no,titlebar=no,height="+strHeight+",width="+strWidth;

	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
} 

function trim(stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function postulerForm(form)
{
        var oInput = form.getElementsByTagName("input");
        var ver_inp_n = 0;
        var oReg = new RegExp();
	var limit = 0;

        for(var i=0; i<oInput.length; i++)
        {
                with(oInput[i])
                {
                        if(type == "text")
                        {
				limit += 1;
                                if(id == "email")
                                {
                                        oReg.compile("^(([A-Za-z0-9]+)(([\.\_\-]?[A-Za-z0-9]+)*))([\@])(([A-Za-z0-9]+)(([\.\_\-]?[A-Za-z0-9]+)*))([\.])([a-z]{2,4})$");
                                        if(!oReg.test(value))
                                                document.getElementById(id + '_lbl').style.color = "#E99722";
                                        else
                                        {
                                                document.getElementById(id + '_lbl').style.color = "";
						ver_inp_n ++;
                                        }
                                } else if(id == "codepostal")
				{
					oReg.compile("^([0-9]{5,5})$");
                                        if(!oReg.test(value))
                                                document.getElementById(id + '_lbl').style.color = "#E99722";
                                        else
                                        {
                                                document.getElementById(id + '_lbl').style.color = "";
                                                ver_inp_n ++;
                                        }
				} else
				{
					if(trim(value) == '')
						document.getElementById(id + '_lbl').style.color = "#E99722";
                                        else
                                        {
                                                document.getElementById(id + '_lbl').style.color = "";
                                                ver_inp_n ++;
                                        }
				}
                        } else if(type == "file")
			{
				limit += 1;
				if(trim(value) == '')
                                	document.getElementById(id + '_lbl').style.color = "#E99722";
                                else
                                {
                                	document.getElementById(id + '_lbl').style.color = "";
                                	ver_inp_n ++;
                                }
			}
                }
        }

        if(document.getElementById('datenaissancedd').value == '-1')
                document.getElementById('datenaissance_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('datenaissance_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(document.getElementById('datenaissancemm').value == '-1')
                document.getElementById('datenaissance_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('datenaissance_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(document.getElementById('datenaissanceyyyy').value == '-1')
                document.getElementById('datenaissance_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('datenaissance_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(document.getElementById('titre_sel').value == '-1')
                document.getElementById('titre_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('titre_lbl').style.color = "";
                ver_inp_n ++;
        }

	if(document.getElementById('formation_sel').value == '-1')
		document.getElementById('formation_lbl').style.color = "#E99722";
	else
	{
		document.getElementById('formation_lbl').style.color = "";
		ver_inp_n ++;
	}

        if(document.getElementById('datedisponibilitemm').value == '-1')
                document.getElementById('datedisponibilite_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('datedisponibilite_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(document.getElementById('datedisponibiliteyyyy').value == '-1')
                document.getElementById('datedisponibilite_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('datedisponibilite_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(document.getElementById('connucabinet_sel').value == '-1')
                document.getElementById('connucabinet_lbl').style.color = "#E99722";
        else
        {
                document.getElementById('connucabinet_lbl').style.color = "";
                ver_inp_n ++;
        }

        if(ver_inp_n == (limit+8))
                return(true);
        else {
                alert('Les champs en orange sont manquants ou au mauvais format. Merci de les remplir ou de les corriger.');
                return (false);
        }

	return (false);
}

function checkCarteExpediteur()
{
        var oReg = new RegExp();
        oReg.compile("^(.*)(\@vertone\.com)$");
        if(oReg.test(document.getElementById('expediteur_email').value)) {
                return (true);
        } else {
                alert('Votre email n\'est pas correctement renseign\u00E9.');
                return (false);
        }
}

function getViewportWidth() {
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth
 }
 return viewportwidth;
}

function getViewportHeight() {
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

 if (typeof window.innerWidth != 'undefined')
 {
      viewportheight = window.innerHeight
 }

// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportheight = document.documentElement.clientHeight
 }

 // older versions of IE

 else
 {
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
 return viewportheight;
}

//-->
