
Varien.DOBSelect = Class.create();
Varien.DOBSelect.prototype = {
    initialize: function(selector, required) {
        var el = $$(selector)[0];
		this.day = $(el).getElementsBySelector('.dob-day select')[0];
        this.month = $(el).getElementsBySelector('.dob-month select')[0];
		this.year = $(el).getElementsBySelector('.dob-year select')[0];
        this.dob = $(el).getElementsBySelector('.dob-full input')[0];
        this.advice = $(el).getElementsBySelector('.validation-advice')[0];
        this.required = required;

        this.day.validate = this.validate.bind(this);
        this.month.validate = this.validate.bind(this);
        this.year.validate = this.validate.bind(this);

        this.advice.hide();
    },

    validate: function() {
        var error = false;
		if (this.day.value !=='none' && this.month.value !=='none' && this.year.value !=='none') {	 
	         this.dob.value = this.day.value+'/'+this.month.value+'/'+this.year.value;
	         var test = new Date(this.year.value,this.month.value,this.day.value);
			 
			  var amin=1910; // année mini
		      var amax=2008; // année maxi   
		      var j=(this.dob.value.substring(0,2));
		      var m=(this.dob.value.substring(3,5));
		      var a=(this.dob.value.substring(6));
		      var 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) ) {
					error='Please enter a valid date.';
				}			
		}
		
        if (error !== false) {
            this.advice.innerHTML = Translator.translate(error);
            this.advice.show();
            return false;
        }

        this.advice.hide();
        return true;
	}
}

Validation.addAllThese([
    ['validate-zip-mrose', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
                return Validation.get('IsEmpty').test(v) ||  /^[a-z0-9 -]+$/.test(v);
	}],
	['validate-phone-mrose', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
			return Validation.get('IsEmpty').test(v) || /^[0-9 + ( )]+$/.test(v);
		}]
]);


function toggleMenuClick(el)
	{
		
		aFirstChild = document.getElementById(el).getElementsByTagName('a')[1];	
		hrefFirstChild = jQuery(aFirstChild).attr("href");
		window.location.href=hrefFirstChild;
	
	}

   