var typeNav='';
if (navigator.appName=='Netscape')
{ 
      if (parseFloat(navigator.appVersion.substring(0,3)) > 4 )
      {
      typeNav = 'supNS4';
      }
      else 
      {
      typeNav = 'infNS4';
      }
}

if (navigator.appName=='Microsoft Internet Explorer')
{ 
      if (parseFloat(navigator.appVersion.substring(0,3)) > 4 )
      {
      typeNav = 'supMS4';
      }
      else 
      {
      typeNav = 'infMS4';
      }
}

function csvsubmit()
{
	if (window.document.frmfind != null) {
		document.frmfind.target = "_BLANK";
		document.frmfind.FORMATCSV.value = true;
		document.frmfind.submit();
		document.frmfind.target = "";
		document.frmfind.FORMATCSV.value = "";
	}
}


function vempty (entered, alertbox) {
	with (entered) {
		if (value==null || value=="") {
			if (alertbox!="") {
				alert('Le champ "' + alertbox + '" doit être complété !');
				} 
			return false;
		}
		else {return true;}
	}
};

function tempty (entered, alertbox) {
	with (entered) {
		if (length <= 0) {
			if (alertbox!="") {
				alert('Le champ "' + alertbox + '" doit être complété !');
				} 
			return false;
		}
		else {return true;}
	}
};

function sempty (entered, alertbox) {
	with (entered) {
		if (entered.options[selectedIndex].value==0) {
			if (alertbox!="") {
				alert('Le champ "' + alertbox + '" doit être sélectionné !');
				} 
			return false;
		}
		else {return true;}
	}
};

function valideEmail(email) {
	if (email.indexOf("@") != -1) {
		if (email.indexOf(".") != -1) {
			if (email.indexOf(" ") == -1) {
				return true;
			}
		}
	}
	alert('Email "' + email + '" non valide !');
	return false;
}

function confirmgo(message, urloui, urlnon)
{
        var conf;

        conf = confirm(message);
        if (conf == true) {
                window.document.location=urloui;
        }
        else
                if (urlnon != "") {
                        window.document.location=urlnon;
                }
};

function collapse(id) {
	if (typeNav != 'infNS4') {
		var obj = window.document.getElementById(id);
		if (obj.style.display == 'none')
		obj.style.display = 'block';
		else obj.style.display = 'none';
	}
}

function hide(id) {
	if (typeNav != 'infNS4') {
		var obj = window.document.getElementById(id);
		if (obj.style.display == 'none')
		obj.style.display = 'inline';
		else obj.style.display = 'none';
	}
}

function expand(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
	el.style.display = 'none';
	}
	else {
	el.style.display = '';
	}
}

function getvarval(myvar)
{
        try{
                if(myvar.type.indexOf("select")>-1)
                        return (myvar.options[myvar.selectedIndex].value);
        } catch (error) {}
        try{
                if(myvar.length > 0) {
                        for (var i = 0; i < myvar.length; i++) {
                                if(myvar[i].checked == "1") {
                                        return (myvar[i].value);
                                }
                        }
                }
        } catch (error) {}
        try{
                if(myvar.type == "text" || myvar.type == "password" || myvar.type == "textarea" || myvar.type == "hidden" || (myvar.type == "checkbox" && myvar.checked == "1"))
                        return (myvar.value);
        } catch (error) {}
}
