function activVid(which, switcher)
{
	switch(switcher)
	{
		case 'vids':
			str 	= "v";
			rep_str = 'act';
			counter = 4;
			i		= 0;
		break;
		
		case 'titles':
			str 	= "t";
			rep_str = 'sel';
			counter = 3;
			i		= 0;
		break;
		
		case 'faq':
			str 	= "fQuest_img_";
			rep_str = 'sel';
			counter = 4;
			i		= 1;
		break;
	}
	for(i=i; i<=counter; i++)
	{
		if( (document.getElementById(str+i).id == which.id && document.getElementById(str+i).className.search("selected") != -1 && switcher != 'vids') || document.getElementById(str+i).id != which.id)
		{
			
			if(document.getElementById(str+i).src.search("_"+rep_str) != -1)
			{
				document.getElementById(str+i).src = document.getElementById(str+i).src.replace("_"+rep_str, "_of");
			}
			document.getElementById(str+i).parentNode.style.fontWeight = 'normal';
			document.getElementById(str+i).className = document.getElementById(str+i).className.replace("selected", "");
		}
		else if(document.getElementById(str+i).id == which.id && document.getElementById(str+i).className.search("selected") == -1)
		{
			which.src = which.src.replace("_ov","_"+rep_str);
			which.parentNode.style.fontWeight = 'bold';
			which.className += " selected";
		}
		
		
		/*
		if(document.getElementById(str+i).id == which.id)
		{
			if(which.className.search("selected") != -1 && switcher != 'vids')
			{
				//alert("selected");
				which.src = which.src.replace("_"+rep_str,"_ov");
				which.className = which.className.replace(" selected", "");
			}
			else
			{
				which.src = which.src.replace("_ov","_"+rep_str);
				which.className += " selected";
				which.parentNode.style.fontWeight = 'bold';
			}
		}
		else
		{
			document.getElementById(str+i).src = document.getElementById(str+i).src.replace("_"+rep_str, "_of");
			document.getElementById(str+i).parentNode.style.fontWeight = 'normal';
			document.getElementById(str+i).className = document.getElementById(str+i).className.replace(" selected", "");
		}
		*/
	}
}

function addClickHandler() 
{
	/*
	document.getElementById("remove").onclick = function() {
		if (document.getElementById("myFlashContent")) {
			swfobject.removeSWF("myFlashContent");
		}
		return false;
	};
	
	document.getElementById("stop").onclick = function() {
		if (document.getElementById("myFlashContent")) {
			jsWatch();
		}
		return false;
	};
	
	document.getElementById("play").onclick = function() {
		if (document.getElementById("myFlashContent")) {
			jsWatchplay();
		}
		return false;
	};
	*/
	document.getElementById("skiplink").onclick = function() {
		if (document.getElementById("myFlashContent")) {
			jsWatch();
		}
		toggle_visible_layers();
		return false;
	};
}

function deselect(this_array)
{
	for(i=0; i<this_array.length; i++)
	{
		if(document.getElementById('let_'+this_array[i]).className.search('selected') != -1)
		{
			document.getElementById('let_'+this_array[i]).className = document.getElementById('let_'+this_array[i]).className.replace('selected', '');
		}
	}
}

function fade_images(this_img, this_layer, action, displ_type)
{
	for(compteur=0; compteur<array_prodNums.length; compteur++)
	{
		show_hide_layer(this_layer, action, displ_type);
		my_element = document.getElementById(array_prodNums[compteur]);

		if( ( array_prodNums[compteur] != this_img) && my_element.style.display != 'none')
		{
			my_element.style.display = 'none';
		}
		else if(array_prodNums[compteur] == this_img && my_element.style.display == 'none')
		{
			Effect.Appear(this_img, {duration:1})
		}
	}
}

function fill_field(visible_field, visible_value, hidden_field, hidden_value, list_to_hide)
{
	document.getElementById(visible_field).value = visible_value;
	document.getElementById(hidden_field).value = hidden_value;
	document.getElementById(list_to_hide).style.display = 'none';
}

function get_window_sizes()
{
	this.windowX 	= (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth;
	this.windowY 	= (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;
	this.scrollX 	= (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;
	this.scrollY 	= (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
	this.pageX 		= (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth;
	this.pageY 		= (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
	//content_height 	= (document.getElementById('main_content').clientHeight ? document.getElementById('main_content').clientHeight + 88 : (document.getElementById('main_content').offsetHeight ? document.getElementById('main_content').offsetHeight + 88 : document.getElementById('main_content').scrollHeight) );
}

function hide_all_block() 
{
	for ( i = 1; i <= 6; i++ ) 
	{
		layer = "description_block" + i;
		if (document.getElementById(layer) != null) {
			document.getElementById(layer).style.display = 'none';
		}
	}
	
}

function initScroll(bScroll) 
{
	scr = new scrollerObj("scr");
	scr.scrollContent= "scrContent";
	scr.scrollerImg= "images/scroller/scroller.gif";
	scr.scrollerBGImg= "images/scroller/scrollerTrack.gif";
	scr.scrollBtnWidth= 15;
	scr.scrollerFixedWidth = 11;
	scr.scrollerFixedHeight = 27;
	scr.trackHideOnDisabled = true;
	if ( !bScroll )
	{
		scr.trackHideOnDisabled = true;
	}
	scr.init();
}

function is_in_array(my_str, my_array)
{
	//alert(my_str+'; '+my_array)
	var myJoin = "|" + my_array.join("|") + "|";
	return myJoin.indexOf("|"+my_str+"|");
}

function jsSwitch(flvlink)
{
	thisMovie("appFlash").jsSwitch(flvlink);
}

function jsWatch()
{
	thisMovie("appFlash").stopAnim();
	if(document.getElementById('flashborders') != null)
	{
		document.getElementById('flashborders').style.display='none'
	}
}

function jsWatchplay()
{
	thisFlash = thisMovie("appFlash");
	setTimeout('thisFlash.playAnim()', 1000);
}

function list_array(letter, div_id)
{
	switch(div_id)
	{
		case 'product_names':
			this_array  = new Array();
			ids			= 'prod';
			filter		= 'names';
			
			if(letter == '1-9')
			{
				for(i = 0; i < array_content.length; i++)
				{
					if(!isNaN(array_content[i].substring(0,1)))
					{
						this_array.push(array_content[i]);
					}
				}
			}
			else
			{
				for(i = 0; i < array_content.length; i++)
				{
					if(letter == array_content[i].substring(0,1))
					{
						this_array.push(array_content[i]);
					}
				}
			}
		break;
		
		case 'product_functions':
			this_array	= array_functions;
			ids			= 'func';
			filter		= 'functions';
		break;
		
		case 'product_ingredients':
			this_array 	= array_ingredients;
			ids			= 'ingr';
			filter		= 'ingredients';
		break;
	}
	col			= 0;
	nbr_col		= Math.ceil(this_array.length / 6);
	this_width	= Math.ceil(this_array.length / 6) * 175 - 25;
	//alert(Math.ceil(this_array.length / 6));
	//alert(document.getElementById('mainbody').style.width);
	compteur = 0;
	document.getElementById(div_id).style.width = this_width+'px';
	document.getElementById(div_id).innerHTML = '';
	inner_html = '';
	
	inner_html += '\n\t<li>\n';
	next_item = false;
	for(i = 0; i < this_array.length; i++)
	{
		//alert("compteur = "  +compteur + " & this_array = " + this_array[i])
		if(compteur == 0)
		{
			inner_html += '\t\t<ul'+(col+1 == nbr_col ? ' style="margin-right:0px"' : '')+'>\n';
		}
		if(letter == 'all' || this_array.length <= 5 || this_array[i].substring(0, 1) == letter || !isNaN(this_array[i].substring(0, 1)))
		{
			tag_class_name = '';
			a_class_name	= '';
			
			/*
			if(this_array[i] )
			{
				tag_class_name = 'bold selected';
			}
			else 
			*/
			if(next_item == true)
			{
				a_class_name += 'sel_top_border';
			}
			
			
			
			inner_html += '\t\t\t<li class="'+tag_class_name+'">';
			inner_html += '<a id="'+ids+i+'" href="product.php?filter='+filter+'&section='+escape(this_array[i])+'&sortBy='+this_array[i].substring(0,1)+'" ';
			inner_html += 'onmouseover="show_hide_border('+i+', \''+ids+'\', \'over\');"'
			inner_html += 'onmouseout="show_hide_border('+i+', \''+ids+'\', \'out\');"'
			if((compteur == 5 && document.getElementById('products_content') != null) || i == (this_array.length -1))
			{
				if(tag_class_name == 'bold selected')
				{
					a_class_name += 'sel_bottom_border';
				}
				else
				{
					a_class_name += 'bottom_border';
				}
			}
			inner_html += ' class="'+a_class_name+'">';
			//inner_html += '>';
			//inner_html += array_content[i].toUpperCase();
			//inner_html += new_img(array_content[i]);
			//inner_html += this_array[i];
			inner_html += '<span>'+unescape(this_array[i]).substring(0,1)+'</span>'+unescape(this_array[i]).substring(1,this_array[i].length);
			inner_html += '</a>';
			inner_html += '</li>\n';
			
			if(i == (this_array.length -1))
			{
				next_item = true;
			}
			else
			{
				next_item = false;
			}
			
		}
		if( (compteur == 5 && document.getElementById('products_content') != null) || i == (this_array.length -1) )
		{
			//alert('compteur == 5 || i == (array_content.length -1)');
			inner_html += '\t\t</ul>\n';
			compteur = 0;
			col++;
		}
		else
		{
			compteur++;
		}
	}
	inner_html += '\t</li>\n';
	document.getElementById(div_id).innerHTML = inner_html;
	Viewport();
}

function lost_focus(has_focus)
{
	var my_timer;

	switch(has_focus)
	{
		case false:
			if(my_timer)
				clearTimeout(my_timer);
		break;
		
		case true:
			my_timer = setTimeout("show_hide_layer('product_filter_list','hide', 'none')", 2000);
		break;
	}
}

function reset_classnames(this_id, loops)
{
	for(i=1; i<=loops; i++)
	{
		if(i != this_id)
		{
			document.getElementById('pimg'+i).className = '';
		}
	}
}

function resize_div(this_div, action, do_it)
{
	if(do_it)
	{
		setTimeout("timed_resize('"+this_div+"', '"+action+"')", 1000);
	}
}

function rollOver(which)
{ 
	which.src = which.src.replace("_of","_ov"); 
}

function rollOut(which)
{ 
	which.src = which.src.replace("_ov","_of"); 
}

function rollOver_sp(which, action, sel)
{
	switch(action)
	{
		case 'over':
			switch(sel)
			{
				case -1:
					which.src = which.src.replace("_of","_ov"); 
				break;
				
				default:
					which.src = which.src.replace("_sel","_ov"); 
				break;
			}
		break;
		
		case 'out':
			switch(sel)
			{
				case -1:
					which.src = which.src.replace("_ov","_of"); 
				break;
				
				default:
					which.src = which.src.replace("_ov","_sel"); 
				break;
			}
		break;
	}
}

function roll_title(this_title, this_text, this_style )
{
	//alert(this_title);
	element = document.getElementById(this_title);
	element.src = "images/gdfont-renderer-20/font.php?text="+this_text+"&style="+this_style;
}

function show_hide_border(this_id, ids, action)
{
	next_id = this_id+1;
	prev_id = this_id-1;
	my_classname = trim(document.getElementById(ids+this_id).className);
	//alert(document.getElementById().className);
	
	switch(action)
	{
		case 'over':
			//alert(my_classname);
			if(my_classname == 'bottom_border')
			{
				//alert('if');
				document.getElementById(ids+this_id).style.borderTop = '1px solid #542da5';
				document.getElementById(ids+this_id).style.borderBottom = '1px solid #542da5';
			}
			
			else if(document.getElementById(ids+next_id))
			{
				if(document.getElementById(ids+this_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #666';
				}
				else
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #542da5';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #542da5';
				}
			}
			else
			{
				//alert('else')
				if(document.getElementById(ids+this_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #666';
				}
				else
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #542da5';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #542da5';
				}
			
			}
		break;
		
		case 'out':
			if(my_classname == 'bottom_border')
			{
				if(document.getElementById(ids+this_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #666';
				}
				else
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #b2b2b2';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #b2b2b2';
				}
			}

			else if(document.getElementById(ids+next_id))
			{
				if(document.getElementById(ids+this_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #666';
				}
				else if(document.getElementById(ids+next_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #b2b2b2';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #666';
				}
				else if(document.getElementById(ids+prev_id) && document.getElementById(ids+prev_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #b2b2b2';
				}
				else
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #b2b2b2';
					document.getElementById(ids+next_id).style.borderTop = '1px solid #b2b2b2';
				}
			}
			else
			{
				if(document.getElementById(ids+this_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #666';
				}
				else if(document.getElementById(ids+prev_id) && document.getElementById(ids+prev_id).parentNode.className.indexOf('bold selected') != -1)
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #666';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #b2b2b2';
				}
				else
				{
					document.getElementById(ids+this_id).style.borderTop = '1px solid #b2b2b2';
					document.getElementById(ids+this_id).style.borderBottom = '1px solid #b2b2b2';
				}
			}
		break;
	}
}

function show_hide_layer(this_layer, action, displ_type)
{
	layer = document.getElementById(this_layer);
	
	switch(action)
	{
		case 'show':
			layer.style.display = displ_type;
		break;
		
		case 'hide':
			layer.style.display = 'none';
		break
	}
}

function show_list(thislist)
{
	lists_arr = new Array('product_filter_list')
	//alert(document.getElementById('size_list').style.display);
	if(document.getElementById(thislist))
	{
		objStyle = document.getElementById(thislist).style;
	}
	
	for(i=0; i<lists_arr.length; i++)
	{
		if(thislist == lists_arr[i] && objStyle.display != 'block')
		{
			document.getElementById(thislist).style.display = 'block';
		}
		
		else
		{
			document.getElementById(lists_arr[i]).style.display = 'none';
		}
	}
}

function thisMovie(movieName) 
{
	if (document.all) 
	{
		//alert(window[movieName]);
		return window[movieName]
	}
	else 
	{
		return document[movieName]
	}
}

function timed_resize(this_div, action)
{
	//myDivs 	= new Array('content_wrapper', 'products_content', 'functionalab_content', 'approach_content', 'find_content', 'footer');
	myDivs 	= new Array('content_wrapper', 'footer');
	if(document.getElementById('content_wrapper'))
	{
		switch(action)
		{
			case 'blindDown':
				document.getElementById(this_div).style.overflow = 'visible';
			break;
			
			case 'blindUp':
				document.getElementById(this_div).style.overflow = 'hidden';
			break;
		}
	
		get_window_sizes()	
		for(counter=0; counter < myDivs.length; counter++)
		{
			//document.getElementById(myDivs[counter]).style.width = this.windowX + 'px' ;
			if(myDivs[counter] == 'footer')
			{
				document.getElementById(myDivs[counter]).style.minWidth = (parseInt(this.windowX) -40) +'px';
			}
			else
			{
				document.getElementById(myDivs[counter]).style.minWidth = (parseInt(this.windowX)) +'px';
			}
		}
		
		get_window_sizes()	
	
		for(counter=0; counter < myDivs.length; counter++)
		{
			if(myDivs[counter] == 'footer')
			{
				document.getElementById(myDivs[counter]).style.minWidth = (parseInt(this.pageX) -40) +'px';
			}
			else
			{
				document.getElementById(myDivs[counter]).style.minWidth = (parseInt(this.pageX)) +'px';
			}
		}
	}

}

function toggle_visible(show_this, which, switcher, this_effect)
{
	available_divs 	= new Array('products_content', 'functionalab_content', 'approach_content', 'find_content');
	available_uls	= new Array('product_categories', 'product_names', 'product_functions', 'product_ingredients');
	faq_array 		= new Array('fAns1','fAns2','fAns3','fAns4');
	
	get_window_sizes()

	in_array = is_in_array(show_this, available_divs)

	if(in_array >= 0) // array ==> available_divs
	{
		if(clicable == true)
		{
			clicable = false;
			activVid(which, switcher);
			for(tvi=0; tvi<available_divs.length; tvi++)
			{
				my_element = document.getElementById(available_divs[tvi]);
				my_element_vis = my_element.style.display;
				
				if( (available_divs[tvi] != show_this) || (available_divs[tvi] == show_this && my_element.style.display != 'none') ) 
				{
					//alert(available_divs[i] + ' if');
					Effect.BlindUp(available_divs[tvi],{duration:0.5,
														afterFinish: resize_div(available_divs[tvi], 'blindUp', true)
													 } );
					if(my_element.style.display != 'none')
					{
						open_tab = false;
					}
				}
				else if(available_divs[tvi] == show_this)
				{
					//alert(available_divs[i] + ' else');
					Effect.BlindDown(show_this, {duration:0.5,
												 afterFinish:resize_div(show_this, 'blindDown', true)
												});
					open_tab = true;
				}
			}
			setTimeout("clicable = true;Viewport();", 1000);
			//setTimeout('', 1000);
		}
	}
	else if(is_in_array(show_this, available_uls) >= 0) //array ==> available_uls
	{
		//alert('available_uls')
		for(tvi=0; tvi<available_uls.length; tvi++)
		{
			my_element = document.getElementById(available_uls[tvi]);
			my_element_vis = my_element.style.display;
			
			switch(this_effect)
			{
				case 'appear':
					if( ( available_uls[tvi] != show_this) && my_element.style.display != 'none')
					{
						my_element.style.display = 'none';
					}
					else if(available_uls[tvi] == show_this && my_element.style.display == 'none')
					{
						Effect.Appear(show_this, {duration:0.5})
					}
				break;
				
				default:
					if( available_uls[tvi] != show_this && my_element.style.display != 'none') 
					{
						Effect.BlindUp(available_uls[tvi],{	duration:0.5,
															afterFinish:resize_div(available_uls[tvi], 'blindUp', true)
														});	
					}
					else if(available_uls[tvi] == show_this && my_element.style.display == 'none')
					{
						Effect.BlindDown(show_this, {	duration:0.5,
														afterFinish:resize_div(show_this, 'blindDown', true)
													});	
					}
				break;
			}
			//if( (available_uls[i] != show_this) || (available_uls[i] == show_this && my_element.style.display != 'none') ) 
			//alert(available_uls[i] +' != ' + show_this)
		}
	}
	else // array ==> faq_array
	{
		if(clicable == true)
		{
			clicable = false;
			for(tvi=0; tvi<faq_array.length; tvi++)
			{
				my_img_id		= 'fQuest'+(tvi+1)+'_img'
				my_img			= document.getElementById(my_img_id);
				my_element		= document.getElementById(faq_array[tvi]);
				my_element_vis	= my_element.style.display;
			
				//if( (faq_array[i] != show_this) || (faq_array[i] == show_this && my_element.style.display != 'none') ) 
				if( available_divs[tvi] != show_this && my_element.style.display != 'none') 
				{
					Effect.BlindUp(faq_array[tvi], {duration:0.5});	
					document.getElementById('q'+(tvi+1)).className = '';
				}
				else if(faq_array[tvi] == show_this)
				{
					Effect.BlindDown(show_this, {duration:0.5});
					document.getElementById('q'+(tvi+1)).className = 'white_border';
					
				}
			}
			setTimeout("clicable = true", 1000);
		}
	}
	
	if(document.getElementById('scrTrack'))
	{
		//alert(scr);
		setTimeout("scr.refresh()", 600);
	}
}

function toggle_visible_layers()
{
	document.getElementById("skiplink").style.display='none'; 
	if (document.getElementById("myFlashContent") != null) {
		DIVtoRemove = document.getElementById("myFlashContent");
		jsWatch();
		Effect.BlindUp('myFlashContent', {duration:1});
	}
	if (document.getElementById('myAlternativeContent') != null)
	{
		Effect.BlindUp('myAlternativeContent', {duration:1});
	}
	Effect.BlindDown("content_wrapper", {duration:1});

	if(BrowserDetect.browser == 'Safari' && BrowserDetect.OS == 'Mac')
	{
		swfobject.removeSWF("myFlashContent");
	}
	Viewport();
}

function trim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function ltrim(stringToTrim) 
{
	return stringToTrim.replace(/^\s+/,"");
}

function rtrim(stringToTrim) 
{
	return stringToTrim.replace(/\s+$/,"");
}

function check_myFlashContent()
{
	if(document.getElementById('myFlashContent') != null)
	{
		document.getElementById('myFlashContent').style.display='none';
	}
}

function unfold_opening(unfold)
{
	switch(unfold)
	{
		case true:
			document.getElementById("skiplink").style.display='none'; 
			document.getElementById('content_wrapper').style.display='block';
			
			if(document.getElementById('flashborders') != null)
			{
				document.getElementById('flashborders').style.display='none';
			}
			if(document.getElementById('myFlashContent') != null)
			{
				document.getElementById('myFlashContent').style.display='none';
			}
			if(document.getElementById('myAlternativeContent') != null)
			{
				document.getElementById('myAlternativeContent').style.display='none';
			}
			//if(BrowserDetect.browser == 'Safari' && BrowserDetect.OS == 'Mac')
			//{
				swfobject.removeSWF("myFlashContent");
			//}
		setTimeout("check_myFlashContent()", 300);
		break;
		
		case false:
			/*
			if(unfold_timer)
			{
				unfold_timer = clearTimeout(unfold_timer);
			}
			*/
			//alert(viewport_timer);
			document.getElementById('opening').style.display = 'none';
			setTimeout(function()
						{
							if(document.getElementById('myFlashContent') != null)
							{
								document.getElementById('myFlashContent').style.display='block'
								document.getElementById('myFlashContent').style.visibility='visible';
								jsWatchplay(); 
							}
							else if(document.getElementById('myAlternativeContent') != null)
							{
								//document.getElementById('content_wrapper').style.display='block'
								document.getElementById('myAlternativeContent').style.display='block';
								document.getElementById('myAlternativeContent').style.visibility='visible';
							}
						}, 300);
			//alert(viewport_timer);
		break;
	}
	Viewport();
	//alert(document.getElementById('myFlashContent'));
	//DIVtoRemove = document.getElementById("myFlashContent");
	
}

function Viewport()
{ 
	get_window_sizes();
	str_resize		= 'false';
	window_height	= this.windowY;
	
	// verification si la page a ete redimensionnee
	min_height		= 600;
	max_height		= 800;
	
	// taille de la zone de contenus
	document.getElementById('main_content').style.borderTop = "none";
	if(this.windowY < min_height)
	{
		//alert('if')
		//document.getElementById('main_content').style.height = min_height * ( this.windowY / min_height)+"px";
		document.getElementById('main_content').style.height = min_height+"px";
		mainbody_value = min_height;
	}
	else if(this.windowY >= min_height && this.windowY <= max_height)
	{
		//alert('else if')
		document.getElementById('main_content').style.height = min_height * ( this.windowY / min_height)+"px";
		mainbody_value = min_height * ( this.windowY / min_height);
	}
	else
	{
		//alert('else')
		document.getElementById('main_content').style.height = max_height +"px";
		document.getElementById('main_content').style.borderTop = "1px solid #b2b2b2";
		mainbody_value = max_height;
	}

	wrapper_height = (document.getElementById('wrapper').clientHeight ? document.getElementById('wrapper').clientHeight : (document.getElementById('wrapper').offsetHeight ? document.getElementById('wrapper').offsetHeight : document.getElementById('wrapper').scrollHeight) );
	if (document.getElementById('colF') != null)
	{
		colF_height = (document.getElementById('colF').clientHeight ? document.getElementById('colF').clientHeight : (document.getElementById('colF').offsetHeight ? document.getElementById('colF').offsetHeight : document.getElementById('colF').scrollHeight) );
		wrapper_height -= colF_height;
	}

	true_height = wrapper_height;

	if(wrapper_height < 536)
	{
		wrapper_height = 536;
	}

	if(document.getElementById('sect_products') != null)
	{
		wrapper_height = (document.getElementById('wrapper').clientHeight ? document.getElementById('wrapper').clientHeight : (document.getElementById('wrapper').offsetHeight ? document.getElementById('wrapper').offsetHeight : document.getElementById('wrapper').scrollHeight) );
		if(wrapper_height > 400)
		{
			wrapper_height = 455;
		}
	}
	
	
	if(Get_Cookie('window_height') != window_height || Get_Cookie('window_height') == null)
	{
		//alert(Get_Cookie('window_height')+', '+window_height);
		if(Get_Cookie('window_height') != null)
		{
			document.getElementById('main_content').style.top = Get_Cookie('main_content') + "px"; 	// margin from top
		}
		main_content_pos = Math.floor( ( window_height - mainbody_value ) / 2);
		
		if(main_content_pos < 0)
		{
			main_content_pos = 0;
		}
		
		new Effect.Move('main_content', { x: 0, y: main_content_pos , mode: 'absolute' });
		Set_Cookie('window_height', window_height);
		Set_Cookie('main_content', main_content_pos);
	}
	else
	{
		document.getElementById('main_content').style.top = Get_Cookie('main_content') + "px"; 	// margin from top
	}
	
	available_room 	= mainbody_value - (wrapper_height + 114 );
	wrapper_pos 	= Math.floor(available_room / 2);// +55;

	if(wrapper_pos < 0)
	{
		wrapper_pos = 0;
	}
	
	/*
	alert(Get_Cookie('wrapper') != wrapper_pos)
	alert(Get_Cookie('wrapper') == null)
	alert(document.getElementById('sect_products') != null)
	*/
	if(Get_Cookie('wrapper') != wrapper_pos || Get_Cookie('wrapper') == null || document.getElementById('sect_products') != null)
	{
		if(Get_Cookie('wrapper') != null)
		{
			document.getElementById('wrapper').style.top = Get_Cookie('wrapper') + "px"; 	// margin from top
		}
		Set_Cookie('wrapper', wrapper_pos);
		new Effect.Move('wrapper', { x: 0, y: wrapper_pos, mode: 'absolute' });
	}
	else
	{
		document.getElementById('wrapper').style.top = Get_Cookie('wrapper') + "px"; 	// margin from top
	}
	//alert(Get_Cookie('wrapper'));
	//alert(true_height);
	//if(mainbody_value < (true_height + 114) )
	if(mainbody_value < (wrapper_height + 114) )
	{
		document.getElementById('footer').style.position = 'relative';
	}
	else
	{
		document.getElementById('footer').style.position = 'absolute';
	}

	if (document.getElementById('colF') != null)
	{
		natural_contact_height = (document.getElementById('colF').clientHeight ? document.getElementById('colF').clientHeight : (document.getElementById('colF').offsetHeight ? document.getElementById('colF').offsetHeight : document.getElementById('colF').scrollHeight) );
		content_height = (document.getElementById('Content').clientHeight ? document.getElementById('Content').clientHeight : (document.getElementById('Content').offsetHeight ? document.getElementById('Content').offsetHeight : document.getElementById('Content').scrollHeight) );
		logo_height = (document.getElementById('logo_functionalab').clientHeight ? document.getElementById('logo_functionalab').clientHeight : (document.getElementById('logo_functionalab').offsetHeight ? document.getElementById('logo_functionalab').offsetHeight : document.getElementById('logo_functionalab').scrollHeight) );
		logo_height += parseInt(document.getElementById('logo_functionalab').style.marginTop) + parseInt(document.getElementById('logo_functionalab').style.marginBottom);
		footer_height = (document.getElementById('footer').clientHeight ? document.getElementById('footer').clientHeight : (document.getElementById('footer').offsetHeight ? document.getElementById('footer').offsetHeight : document.getElementById('footer').scrollHeight) );
		
		total_height = logo_height + wrapper_pos + content_height + footer_height;
		contact_height = mainbody_value - total_height;
		//alert(footer_height);
		
		if(BrowserDetect.OS == 'Mac')
		{
			//alert(BrowserDetect.OS);
			contact_height = mainbody_value - (total_height - 10);
		}
		//contact_height = Math.round(0.90*(mainbody_value -218));

		document.getElementById('colF').style.height =  contact_height+'px';
	}

	footer_pos = 0;
	document.getElementById('footer').style.bottom = footer_pos+'px';
	//alert(mainbody_value+', '+ (content_height + 92));
}

