var MM_p = new Array();
MM_p[0] = '../images/concept_french_f2.gif';
MM_p[1] = '../images/product_french_f2.gif';
MM_p[2] = '../images/enquiries_french_f2.gif';
MM_p[3] = '../images/german.gif';
MM_p[4] = '../images/blog_f2.gif';
MM_p[5] = '../images/competition_french_f2.gif';
MM_p[6] = '../images/buy_french_f2.gif';
MM_p[7] = '../images/gallery_french_f2.gif';
MM_p[8] = '../images/casestudy_french_f2.gif';
MM_p[9] = '../images/english.gif';
MM_p[10] = '../gallery/loading.gif';




function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	  var d=document; 
	  if(d.images){ 
		if(!d.MM_p2) d.MM_p2=new Array();  //create a new array MM_p
		var i,j=d.MM_p2.length,a=MM_p; 
		//alert(a.length);
		for(i=0; i<a.length; i++)
		if (a[i].charAt(0)!="#"){ 
			d.MM_p2[j]=new Image;  
			d.MM_p2[j++].src=a[i];
			//alert(a[i]);
		}
	}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){
		document.MM_sr[j++]=x; 
		if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}


var slideInUse = new Array();

function Slide(objId, options) {
	this.obj = document.getElementById(objId);
	this.duration = 1;
	this.height = parseInt(this.obj.style.height);

	if(typeof options != 'undefined') { this.options = options; } else { this.options = {}; }
	if(this.options.duration) { this.duration = this.options.duration; }
	
		
	this.up = function() {
		this.curHeight = this.height;
		this.newHeight = '1';
		if(slideInUse[objId] != true) {
			var finishTime = this.slide();
			window.setTimeout("Slide('"+objId+"').finishup("+this.height+");",finishTime);
		}
		//this.obj.style.height = '1px';
	}
	

	
	this.down = function() {
		if (this.obj.style.display == 'block'){	
			this.up(); 
		}else{
			//this.newHeight = this.height;
			//NEW
			this.obj.style.display = 'block';
			this.newHeight = document.getElementById(objId).offsetHeight;
			this.obj.style.display = 'none';
			//
			this.curHeight = '1';
			if(slideInUse[objId] != true) {
				this.obj.style.height = '1px';
				this.obj.style.display = 'block';
				this.slide();
			}
		}
	}
	
	this.slide = function() {
		slideInUse[objId] = true;
		var frames = 30 * duration; // Running at 30 fps

		var tIncrement = (duration*1000) / frames;
		tIncrement = Math.round(tIncrement);
		var sIncrement = (this.curHeight-this.newHeight) / frames;

		var frameSizes = new Array();
		for(var i=0; i < frames; i++) {
			if(i < frames/2) {
				frameSizes[i] = (sIncrement * (i/frames))*4;
			} else {
				frameSizes[i] = (sIncrement * (1-(i/frames)))*4;
			}
		}
		
		for(var i=0; i < frames; i++) {
			this.curHeight = this.curHeight - frameSizes[i];
			window.setTimeout("document.getElementById('"+objId+"').style.height='"+Math.round(this.curHeight)+"px';",tIncrement * i);
		}
		
		window.setTimeout("delete(slideInUse['"+objId+"']);",tIncrement * i);
		
		if(this.options.onComplete) {
			window.setTimeout(this.options.onComplete, tIncrement * (i-2));
		}
		
		//if do not care about safari or redraw
		/*if(this.options.onComplete) {
			window.setTimeout(this.options.onComplete, tIncrement * i);
		}*/

		
		return tIncrement * i;
	}
	
	this.finishup = function(height) {
		this.obj.style.display = 'none';
		this.obj.style.height = height + 'px';
	}
	
	return this;
}



function checkBuy(myForm){
	var msg = "";
 //	var msgTop = "The field(s) listed below still need to be entered correctly\n\n";

	if(!myForm.agree_terms.checked){
		msg += "Veuillez accepter les conditions avant d'acheter cette objet\n";
	}
	
	if (msg != ""){
		alert(msg);
		return false;
	}
}









