function openWindow(theURL,winName,features) {
	window.open(theURL,winName,"width=760,height=640,left=200,top=150,scrollbars=1,menubar=0");
}

function openLayer(name){
	skn = document.getElementById(name).style;
	skn.display = "block";
}
	
function closeLayer(name){
	skn = document.getElementById(name).style;
	skn.display = "none";
}
	
function closeLayerLanding(){
	document.getElementById("landing_texte1").style.display = "none";
	document.getElementById("landing_texte2").style.display = "none";
	document.getElementById("landing_texte3").style.display = "none";
	
	document.getElementById("bt1").style.backgroundPosition = "0 0";
	document.getElementById("bt2").style.backgroundPosition = "0 0";
	document.getElementById("bt3").style.backgroundPosition = "0 0";
}

function searchSave(){
	
	if (trim(document.getElementById('searchField').value) != '')
	{
		var xhr; 
		var searchWord;
		var amount;
		
		searchWord = document.getElementById('searchField').value;
		amount = document.getElementById('amount').value;
		try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
		catch (e) 
		{
			try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
			catch (e2) 
			{
			  try {  xhr = new XMLHttpRequest();     }
			  catch (e3) {  xhr = false;   }
			}
		 }
		 
	   xhr.open( "GET", 'searchSave.asp?searchWord='+ searchWord + '&amount=' +  amount,  true); 
	   xhr.send(null); 
   }
} 

function trim(myString)
{
	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
} 

// GESTION DE L'AFFICHAGE DES LIGHTBOX
function dimensionLayer(nLay){
	$(document).ready(function(){
		
		$('#opac_layer').css({left:0});
		$('#opac_layer').animate({opacity:0.5}, 0,function(){
			$('#'+nLay).animate({opacity:1}, 0);
		});
		
		
		var windowWidth  = $(window).width();	
		var windowHeight = $(window).height();
		var windowScroolTop = $(window).scrollTop();
		var divWidth = $('#'+nLay).width();
		var divHeight = $('#'+nLay).height();
				
		var totalWidth = windowWidth/2 - divWidth/2;
		var totalHeight = windowHeight/2 - divHeight/2 + windowScroolTop;	
		
		
		$('#'+nLay).css({'left':totalWidth});
		$('#'+nLay).css({'top':totalHeight});
		
		$('#opac_layer').width($(document).width());
		$('#opac_layer').height($(window).height());
		
		openLayer(nLay);
		openLayer('opac_layer');
		
	});	
}


function closeLightBox(nLay){
	$(document).ready(function(){
		$('#'+nLay).animate({opacity:0},0,function(){
			$('#'+nLay).css({display:'none'});
			$('#opac_layer').animate({opacity:0},0,function(){
				$('#opac_layer').css({display:'none'})
			});			
		});
	});		 
}

// Popup
function openPopup(theURL,winName,features){
	window.open(theURL,winName,features);
}

//modif nf 080609
function getParamSimulation(a,b,c,d)
{
	document.getElementById("span_montant").innerHTML=a;
	document.getElementById("span_remboursement").innerHTML=b;
	document.getElementById("span_type_remboursement").innerHTML=c;
	document.getElementById("span_offre").innerHTML=d;
}

function clickSub()
{
	a=document.getElementById("span_montant").innerHTML;
	b=document.getElementById("span_remboursement").innerHTML;
	c=document.getElementById("span_type_remboursement").innerHTML;
	d=document.getElementById("span_offre").innerHTML;
	
	validSimulation(a,b,d,c,1);
}



