<!--
function popup_open(){
	var popup_win;
	var popup_url='<?=$popup_url?>';
	if(popup_url!=''){
		if(popup_win){
			popup_win.close();
		}
		popup_win = window.open(popup_url,'Popup','width=<?=$popup_width?>, height=<?=$popup_height?>, menubar=0, scrolling=no');
	}
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		btn_accueil_over = newImage("images/btn_accueil-over.gif");
		btn_photo_over = newImage("images/btn_photo-over.gif");
		btn_camescope_over = newImage("images/btn_camescope-over.gif");
		btntvvideo_over = newImage("images/btntvvideo-over.gif");
		btn_son_over = newImage("images/btn_son-over.gif");
		preloadFlag = true;
	}
}

mac45Flg = 0;
if ( ( navigator.appVersion.indexOf("MSIE 4.5", 0) ) != -1 ) {
	mac45Flg = 1;
}

function fWriteswf(movieName, width, height) {	// Mac IE4.5
	var loop = true;
	
	if( mac45Flg == 0 ) {
		document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
		document.write('CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/' );
		document.write('flash/swflash.cab#version=4,0,2,0"');
		document.write(' WIDTH="',width,'"');
		document.write(' HEIGHT="',height,'"');
		document.write(' BORDER="0">');
		document.write('<PARAM NAME=movie VALUE="',movieName,'">');
		document.write('<PARAM NAME=quality VALUE=high>');
		document.write('<PARAM NAME=LOOP VALUE=',loop,'>');
		document.write('<PARAM NAME=menu VALUE=false>');
	}
	document.write( '<EMBED SRC="',movieName,'" QUALITY=high ' );
	document.write( 'PLUGINSPAGE="http://www.macromedia.com/jp/shockwave/' );
	document.write( 'download/index.cgi?P1_Prod_Version=ShockwaveFlash" ' );
	document.write( 'TYPE="application/x-shockwave-flash" WIDTH="' );
	document.write( width,'" HEIGHT="',height,'" BORDER="0" LOOP="',loop,'" ' );
	document.write( 'menu=false></embed>' );

	if(mac45Flg == 0)
	{
		document.write('</object>');
	}
}

function valid_mail() {
        email = document.newsletter.email_newsletter.value;
        verification_mail = emailCheck(email);
        if (verification_mail != "") {
                alert(verification_mail);
        }else{
                document.newsletter.submit();
        }
}

/*
Vérification de l'adresse mail
*/
function emailCheck (emailStr) {
    var emailPat = /^(.+)@(.+)$/
    var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]éèàîïäâëêçùü"
    var validChars = "\[^\\s" + specialChars + "\]"
    var quotedUser = "(\"[^\"]*\")"
    var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    var atom = validChars + '+'
    var word = "(" + atom + "|" + quotedUser + ")"
    var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$");
    var matchArray = emailStr.match(emailPat);

    if (matchArray == null) {
        return("L'adresse email semble incorrecte (verifier @ et .'s)");
    };
    var user = matchArray[1];
    var domain = matchArray[2];

    if (user.match(userPat) == null) {
        return("Le nom dans l'adresse email est invalide.");
    };

    var IPArray = domain.match(ipDomainPat)
    if (IPArray != null) {
        for (var i=1; i<=4; i++) {
            if (IPArray[i] > 255) {
                return("L'IP de l'adresse email est invalide !");
            };
        };
        return("");
    };

    var domainArray = domain.match(domainPat);
    if (domainArray == null) {
        return("Le nom de domaine de l'email est invalide.");
    };

    var atomPat = new RegExp(atom,"g");
    var domArr = domain.match(atomPat);
    var len = domArr.length;
    if (domArr[domArr.length-1].length < 2 ||
        domArr[domArr.length-1].length > 4) {
        return("L'adresse email doit finir par trois lettres, ou deux lettres pour les pays.");
    };

    if (len < 2) {
        return("Il manque le nom d'hôte à l'adresse email !");
    };

    return("");
}

/*
        verifie que le num de tel ou fax contient bien 10 chiffres.
*/
function telCheck ( telStr ) {

        var str = telNum( telStr );
        //alert( str);
        if ( str.length != 10 ) {
                return "Les numéros de tel doivent contenir 10 chiffres !";
        };
        return "";
}

/*
        vérifie un format de date
*/
function isDate(dateStr) {
    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
    var matchArray = dateStr.match(datePat); // is the format ok?
    if (matchArray == null) {
        //alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
            return false;
        }
    month = matchArray[3]; // parse date into variables
    day = matchArray[1];
    year = matchArray[5];
    if (month < 1 || month > 12) {
                // check month range
        //alert("Month must be between 1 and 12.");
        return false;
    }
    if (day < 1 || day > 31) {
        //alert("Day must be between 1 and 31.");
        return false;
    }
    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
        //alert("Month "+month+" doesn't have 31 days!")
        return false;
    }
    if (month == 2) { // check for february 29th
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
                if (day > 29 || (day==29 && !isleap)) {
                    //alert("February " + year + " doesn't have " + day + " days!");
                    return false;
                }
        }
    return true; // date is valid
}


//-->
