//--------------------------------------------------------------------------
// Check des formulaires
//--------------------------------------------------------------------------
function validationIndex (){
	if (!checkEmail(document.formulaire.email,'Invalid e-mail format. Start again.',true)){
		
	} else{
		MM_openBrWindow('/newsletter.asp?email=' + document.formulaire.email.value,'','scrollbars=yes,width=800');
	}
}

function ControlePaysCp (){
	if (document.formulaire.pays.value=="France"){
		if (!checkCP(document.formulaire.cp,'Vous devez correctement renseigner le champ \'Code postal\'.\n5 chiffres sans espaces.',true)) return false;
		return true;
	}else{
			return true;
	}
}

function checkCP(champ,message) {
	var nArgs = checkCP.arguments.length;
	var necessaire = (nArgs>2)?checkCP.arguments[2]:false;
	var checkStr = new String(champ.value);
	var i;
	if (checkStr.length!=5 && necessaire) return erreurCheck(champ, message);
	for (i=0;i<checkStr.length;i++) if (isNaN(checkStr.charAt(i))) return erreurCheck(champ, message);
	return true;
}

function validationLandingPage (){
	if (!checkText(document.formulaire.ct_nom,'The field \'Name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.ct_prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkText(document.formulaire.ct_societe,'The field \'Company name\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.ct_email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.ct_tel,'The field \'Telephone\' must be fill in.')) return false;

	return true;
}

function validationNewsletter (){
	if (!checkSelect(document.formulaire.civilite,'The field \'Marital status\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;	

	return true;
}

function validationContact (){
	if (!checkText(document.formulaire.message,'The field \'Your question\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.service,'The field \'Department\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;

	return true;
}

function validationDistributeur (){
	if (!checkSelect(document.formulaire.civilite,'The field \'Marital status\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;

	return true;
}

function validationDistributeurNews (){
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkText(document.formulaire.mobile,'The field \'Mobile\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;

	return true;
}

function validationDevis (){
	
	if (!checkRadio(document.formulaire.besoin,'You must choose your request.')) return false;
	if (!checkSelect(document.formulaire.produit1,'You must choose a product.')) return false;
	if (!checkSelect(document.formulaire.quantite1,'You must choose a quantity for product 1.')) return false;
	if (!checkSelect(document.formulaire.civilite,'The field \'Marital status\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.service,'The field \'Department\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;

	return true;
}

function validationDevisAmbiance (){
	if (!checkSelect(document.formulaire.civilite,'The field \'Marital status\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.service,'The field \'Department\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;

	return true;
}

function validationcataloguehome (page_cat){
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	//MM_openBrWindow('http://ebook.centralweb.fr/buronomic/pricelist2009/','PriceList2009','width=1000,height=600,resizable=1');
	return true;
}

function validationCatalogue (){
	if (!checkSelect(document.formulaire.civilite,'The field \'Marital status\' must be fill in.')) return false;
	if (!checkText(document.formulaire.nom,'The field \'Surname\' must be fill in.')) return false;
	if (!checkText(document.formulaire.prenom,'The field \'Forename\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.fonction,'The field \'Job Title\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.service,'The field \'Department\' must be fill in.')) return false;
	if (!checkText(document.formulaire.telephone,'The field \'Telephone\' must be fill in.')) return false;
	if (!checkEmail(document.formulaire.email,'The field \'E-mail\' must be fill in.',true)) return false;
	if (!checkText(document.formulaire.raison_sociale,'The field \'Company name\' must be fill in.')) return false;
	if (!checkText(document.formulaire.adresse1,'The field \'Address 1\' must be fill in.')) return false;
	if (!checkText(document.formulaire.cp,'The field \'Post Code\' must be fill in.')) return false;
	if (!ControlePaysCp ()) return false;
	if (!checkText(document.formulaire.ville,'The field \'Town\' must be fill in.')) return false;
	if (!checkSelect(document.formulaire.pays,'The field \'Country\' must be fill in.')) return false;
	
	return true;
}

//--------------------------------------------------------------------------
// Fonctions utiles Check des formulaires
//--------------------------------------------------------------------------

function erreurCheck(champ, message) {
    if (message) {                              // Si on ne donne pas de message, on reste silencieux...
        alert(message);
        if ( champ.type && champ.type != "[object]" && champ.type != "hidden") champ.focus();     // Les boutons radios sont multiples : on ne peut pas leur apporter le focus globalenent
    }
    return false;
}

function checkText(champ, message) {
    var nArgs = checkText.arguments.length;
    var valid=true;
   if (nArgs<=2) {
			switch(champ.value.length) {
				case 0 :
				
					valid	= false;
					break;
				case 1 :
					valid	= false;
					break;
				case 2 :
					if (champ.value.charAt(0)==champ.value.charAt(1)){
					valid	= false;
					}
				default :
					if (champ.value.charAt(0)==champ.value.charAt(1) && champ.value.charAt(1)==champ.value.charAt(2)){
						valid	= false;
					}
			}
			if (!valid)
				return erreurCheck(champ, message);
		}
		else {
		if (champ.value==checkText.arguments[2]) {
			
			return erreurCheck(champ, message);
		}
	}
	
	return true;
}

function checkPassword(champ, message) {
    var checkStr = String(champ.value);
    var nArgs = checkPassword.arguments.length;
	var necessaire = (nArgs>2)?checkPassword.arguments[2]:false;
	if (checkStr=='' && necessaire) {
		return erreurCheck(champ, message);
	}
	if (checkStr=='' && !necessaire) return true;
	if (checkStr.length<6) return erreurCheck(champ, 'Le mot de passe doit avoir au moins 6 caractères');
	if (nArgs>3 && champ.value!=checkPassword.arguments[3].value) return erreurCheck(checkPassword.arguments[3], 'Vous devez entrer 2 fois le même mot de passe.');
	return true;
}

function checkNumber(champ, message, decimales) {
    var nArgs = checkNumber.arguments.length;
    var checkStr = champ.value;
    var pos;
	var necessaire = (nArgs>3)?checkNumber.arguments[3]:false;
	var val_min = (nArgs>4)?checkNumber.arguments[4]:NaN;
	var val_max = (nArgs>5)?checkNumber.arguments[5]:NaN;

	if (checkStr=='') {
		if (necessaire) return erreurCheck(champ, message);
		else return true;
	}

    // Remplace les ',' par des '.', de maniere a utiliser parseFloat
    while ((pos = checkStr.indexOf(',')) > -1) {
        checkStr = checkStr.substring(0, pos) + '.' + checkStr.substring(pos + 1);
    }

    // Supprime les 0 de fin apres le point decimal, afin de ne pas perturber la comparaison
    while ((checkStr.length > 1) && (checkStr.indexOf('.') > -1) && (checkStr.charAt(checkStr.length - 1) == '0')) {
        checkStr = checkStr.substring(0, checkStr.length - 1);
    }
    // Supprime le point decimal s'il se retrouve tout seul a la fin
    if ((checkStr.length > 1) && (checkStr.charAt(checkStr.length - 1) == '.')) checkStr = checkStr.substring(0, checkStr.length - 1);

    // Supprime les 0 de tete, afin de ne pas perturber la comparaison
    while ((checkStr.length > 1) && (checkStr.charAt(0) == '0')) {
        checkStr = checkStr.substring(1);
    }
    // Remet un 0 si le caractere suivant est un point decimal
    if (checkStr.charAt(0) == '.') checkStr = '0' + checkStr;
    
    // Convertis le champ en flottant, puis conversion retour : on pourra comparer les deux
    var checkFloat = parseFloat(checkStr);
    var reCheckStr = String(checkFloat);

    // Mesure le nombre de decimales effectif du nombre convertis en flottant
    pos = reCheckStr.indexOf('.');
    var nbDec = (pos > -1 ? reCheckStr.length - pos - 1 : 0);

    champ.value = checkStr;
    if (!isNaN(val_min)) {
		if (checkStr<=val_min) return erreurCheck(champ, message+'\n(Nombre supérieur à '+val_min+')');
	}
    if (!isNaN(val_max)) {
		if (checkStr>=val_max) return erreurCheck(champ, message+'\n(Nombre inférieur à '+val_max+')');
	}
    if ((reCheckStr == checkStr) && ((nArgs < 3) || (nbDec <= decimales))) {
        return true;
    } else {
        return erreurCheck(champ, message);
    }
}

function checkPrix(champ, message) {
	return checkNumber(champ, message, 2, true, 0.01)
}

function checkEmail(champ, message) {
    var checkStr = champ.value.toLowerCase();
    var checkOK = "0123456789abcdefghijklmnopqrstuvwxyz-_/.@";
    var pos, car, valide = true, posAt = -1, posDot = -1;
	var necessaire = (checkEmail.arguments.length>=2)?checkEmail.arguments[2]:false;
	if (checkStr=='') {
		if (necessaire) return erreurCheck(champ, message);
		else return true;
	}

    for (pos = 0; pos < checkStr.length; pos++) {
        if (checkStr.charAt(pos) == '@') {
            posAt = pos;
            continue;
        }
        if (checkStr.charAt(pos) == '.') {
            posDot = pos;
            continue;
        }
        if (checkOK.indexOf(checkStr.charAt(pos)) == -1) {
            valide = false;
            break;
        }
    }

    if (valide && (posAt > -1) && (posDot > posAt + 1) && (posDot < checkStr.length - 1)) {
        return true;
    } else {
        return erreurCheck(champ, message);
    }

}

function checkChamp(champ, message) {
    
   var checkStr = champ.value.toLowerCase();
    var checkOK = "0123456789abcdefghijklmnopqrstuvwxyz ";
    var pos, car, valide = true;
	var necessaire = (checkChamp.arguments.length>2)?checkChamp.arguments[2]:false;
	if (checkStr=='') {
		if (necessaire) return erreurCheck(champ, message);
		else return true;
	}

    for (pos = 0; pos < checkStr.length; pos++) {
        if (checkOK.indexOf(checkStr.charAt(pos)) == -1) {
            valide = false;
            break;
        }
    }

    if (valide) {
        return true;
    } else {
        return erreurCheck(champ, message);
    }

}

function checkSelect(champ, message) {
	var nArgs = checkSelect.arguments.length;
	var firstCheckElement = 1;
	if (nArgs>2) firstCheckElement = checkSelect.arguments[2];
	if (champ.selectedIndex < firstCheckElement) return erreurCheck(champ, message);
	else return true;
}

function checkRadio(champ, message) {
	if (champ.length) {
		for (var i=0; i<champ.length; i++) {
			if (champ[i].checked) return true;
		}
	} else if (champ.checked) return true;
	return erreurCheck(champ, message);
}

function checkUpload(champ, message, extensions) {
    var checkOK = 'abcdefghijklmnopqrstuvwxyz0123456789_-.';
    var checkStr = String(champ.value);
    var nArgs = checkUpload.arguments.length;
	var necessaire = (nArgs>3)?checkUpload.arguments[3]:false;
	if (checkStr=='' && necessaire) {
		return erreurCheck(champ, message);
	}
	if (checkStr=='' && !necessaire) return true;

	checkStr = checkStr.toLowerCase();

    for (pos = checkStr.lastIndexOf('\\')+1; pos < checkStr.length; pos++) {
        if (checkOK.indexOf(checkStr.charAt(pos)) == -1) {
			return erreurCheck(champ, 'Vous ne pouvez utiliser de caractères spéciaux (espace, accents...) dans les noms de fichiers. Veuillez renommer ce fichier.');
        }
    }

	var ext = String(extensions);
	ext = ext.toLowerCase();
	var splitExt = ext.split(",");
	for (var i=0; i<splitExt.length; i++) {
		if (checkStr.indexOf(splitExt[i])>-1) return true;
	}
	return erreurCheck(champ, message);
}

function checkDate(jour, mois, annee, message) {
    var nArgs = checkDate.arguments.length;
	var necessaire = (nArgs>4)?checkDate.arguments[4]:false;
	if (!necessaire && jour.value=='' && mois.value=='' && annee.value=='') {
		if (nArgs>5) affecteDate(jour, mois, annee, arguments[5]);
		return true;
	}
	var dateJ = new Date(annee.value, mois.value-1, jour.value);
	if (dateJ.getDate()!=jour.value || dateJ.getMonth()+1!=mois.value || dateJ.getFullYear()!=annee.value) {
		return erreurCheck(annee, message);
	}
	if (nArgs>5) affecteDate(jour, mois, annee, arguments[5]);
	return true;
	
}

function isDate(d,message) {
      // Cette fonction vérifie le format JJ/MM/AAAA saisi et la validité de la date.
      // Le séparateur est défini dans la variable separateur
      var necessaire = (isDate.arguments.length>2)?isDate.arguments[2]:false;
			if (d=='') {
				if (necessaire) return erreurCheck(d, message);
				else return true;
			}
      var amin=1960; // année mini
      var amax=2200; // année maxi
      var separateur="/"; // separateur entre jour/mois/annee
      var j=(d.substring(0,2));
      var m=(d.substring(3,5));
      var a=(d.substring(6));
      var ok=1;
      if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) {
         ok=0;
      }
      if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) {
         ok=0;
      }
      if ( ((isNaN(a))||(a<amin)||(a>amax)) && (ok==1) ) {
         ok=0;
      }
      if ( ((d.substring(2,3)!=separateur)||(d.substring(5,6)!=separateur)) && (ok==1) ) {
         ok=0;
      }
      if (ok==1) {
         var d2=new Date(a,m-1,j);
         j2=d2.getDate();
         m2=d2.getMonth()+1;
         a2=d2.getFullYear();
         if (a2<=100) {a2=1900+a2}
         if ( (j!=j2)||(m!=m2)||(a!=a2) ) {
            alert("La date "+d+" n'existe pas !");
            ok=0;
         }
      }
      if (ok==1) {
      	return true;
      }
      else {
      	return erreurCheck(d, message);
    	}
      
}

//--------------------------------------------------------------------------
// isInteger : Le paramètre passé est-il un entier ?
//--------------------------------------------------------------------------
function isInteger(inputStr){
var oneChar=' ';for (var i=0;i<inputStr.length;i++){oneChar= inputStr.substring(i,i+1);if ((oneChar<'0'||oneChar>'9')){return false;}}return true;
}

//--------------------------------------------------------------------------
// verifDate : vérifie si la date est valable.
// formName=Nom du formulaire, champ=Nom du champ, message=message affiché si erreur
//--------------------------------------------------------------------------
function verifDate(formName, champ, message){
var days;var dateJour=new Date();var jour=dateJour.getDate();var mois=dateJour.getMonth()+1;var annee=dateJour.getFullYear();var dateVal,tabdateVal;
with(eval('document.'+formName)){dateVal=eval(champ +'.value');}
if(dateVal.length==0){alert(message);return false;}tabdateVal=dateVal.split("/");
if (tabdateVal.length<3){alert(message);return false;}
if(tabdateVal[0].length<1||tabdateVal[0].length>2){alert('erreur sur le jour');return false;}else{if(isInteger(tabdateVal[0])){if(tabdateVal[0]>31||isNaN(tabdateVal[0])||tabdateVal[0]<1){alert('erreur sur le jour');return false;}}else{alert(message);return false;}}
if(tabdateVal[1].length<1||tabdateVal[1].length>2){alert('erreur sur le mois');return false;}else{if(isInteger(tabdateVal[1])){if(tabdateVal[1]>12||isNaN(tabdateVal[1])||tabdateVal[1]<1){alert('erreur sur le mois');return false;}}else{alert(message);return false;}}
if(tabdateVal[2].length!=4){alert('erreur sur l\'année');return false;}else{if(isInteger(tabdateVal[2])){if(isNaN(tabdateVal[2])||tabdateVal[2]<1){alert('erreur sur l\'année');return false;}}else{alert(message);return false;}}
var LaDate=new Date(tabdateVal[2],tabdateVal[1]-1,tabdateVal[0],00,00,00,00);if (LaDate.getDate()!=tabdateVal[0]||LaDate.getMonth()+1!=tabdateVal[1]||LaDate.getFullYear()!=tabdateVal[2]){alert('Cette date n\'existe pas');return false;}
return true;
}
//--------------------------------------------------------------------------
// CompareDate : compare deux dates afin de s'assurer que la 1ere n'est pas inférieure à la 2eme
//--------------------------------------------------------------------------
function compareDate(date1,date2,message) {
var tabdateVal1=date1.split("/");
var tabdateVal2=date2.split("/");
var date1MS=Date.UTC(tabdateVal1[2],tabdateVal1[1]-1,tabdateVal1[0]);
var date2MS=Date.UTC(tabdateVal2[2],tabdateVal2[1]-1,tabdateVal2[0]);	
if(date1MS>date2MS) {alert(message);return false;}if(date1MS==date2MS) return true;return true;
}

function affecteDate(jour, mois, annee, D_daten) {
	if (jour.value.length>0)
		D_daten.value = jour.value + '/' + mois.value + '/' + annee.value;
	else
		D_daten.value = '';
	return true;
}

function retourneExtension(image) {
    var checkStr = new String(image.value);
	checkStr.toLowerCase();
	var ret = checkStr.lastIndexOf('.');
	if (ret>-1 && ret<checkStr.length) {
		return checkStr.substr(ret+1);
	} else return '';
}

function retourneNomFichier(image) {
    var checkStr = new String(image.value);
	checkStr.toLowerCase();
	var ret = checkStr.lastIndexOf('/');
	if (ret>-1 && ret<checkStr.length) {
		return checkStr.substr(ret+1);
	} else {
		var ret = checkStr.lastIndexOf('\\');
		if (ret>-1 && ret<checkStr.length) {
			return checkStr.substr(ret+1);
		} else return '';
	}
}