function show_close()
{
	document.getElementById('show_article').style.display='none';
	document.getElementById('cacheShow').style.display='none';
	document.getElementById('fermerShow').style.display='none';
}

function movepage()
{

var gauche = Math.round((w-920) / 2);
alert(gauche);
document.getElementById('page').style.Left=''+gauche+'px';
//document.getElementById('page').style.display='block';
//document.getElementById('page').style.visibility='visible';
}

function  showhelp()
{
	document.getElementById('help').style.visibility='visible';
}

function  voir(id)
{
	document.getElementById(id).style.display='block';
	document.getElementById(id).style.visibility='visible';
	
}	

function  cache(id)
{
	document.getElementById(id).style.visibility='hidden';
	document.getElementById(id).style.display='none';
}	

function  voirPic(id, num, numoffer)
{
	var leftval;
	var topval;
	var opacite=0;
	
	if (num==1) leftval=100;
	else if (num==2) leftval=404;
	else  leftval=707;
	
	if (numoffer>=6 && numoffer<9) topval='-40';
	else topval=0;
	
	topval=0;
	
	
	
	document.getElementById(id).style.left=leftval+'px';
	document.getElementById(id).style.top=topval+'px';
	/*document.getElementById(id).style.display='block';
	document.getElementById(id).style.visibility='visible';*/
	//opacite=100;
	//document.getElementById(id).style.filter = 'alpha(opacity=' + opacite + ')';
	
	//$('#'+id).fadeIn("10000");
	voir(id);
	
	//document.getElementById(id).style.display='block';
	//document.getElementById(id).style.visibility='visible';
	
}	

function  cachePic(id, num, numoffer)
{
	var opacite=0;
	/*document.getElementById(id).style.filter = 'alpha(opacity=' + opacite + ')';*/
	//document.getElementById(id).style.display='none';
	cache(id);
	/*$('#'+id).fadeOut("1");*/
	
	
}


function  hidehelp()
{
	document.getElementById('help').style.visibility='hidden';
}	

function showpage()
{
	document.body.style.visibility='visible';
}

function showmain()
{
	//hidecache();
	document.getElementById('main').style.display='block';
	document.getElementById('main').style.visibility='visible';

}	

function hidecache()
{
	document.getElementById('cache').style.visibility='hidden';
	document.getElementById('cache').style.display='none';

}	

function hidecacheanim()
{
	document.getElementById('cacheanim').style.visibility='hidden';
	document.getElementById('cacheanim').style.display='none';

}	

function hidecachebis()
{
	document.getElementById('cachebis').style.visibility='hidden';
	document.getElementById('cachebis').style.display='none';

}			

function wait()
{
 var a=0;
}

function selectmenu(id)
{
		document.getElementById(id).style.backgroundImage="";
		document.getElementById(id).style.backgroundRepeat='no-repeat';
}

function unselectmenu(id)
{
		document.getElementById(id).style.backgroundImage="";
}

var nbcadres=4;

function zoomin()
{
		
		
		for (i=1; i<nbcadres; i++)
		{
			var id = 'cadre_'+i;
			document.getElementById(id).style.overflowY='scroll';
		}
		
		document.body.style.fontSize='120%';

}

function zoomout()
{
	document.body.style.fontSize='83.5%';
		
		
		for (i=1; i<nbcadres; i++)
		{
			var id = 'cadre_'+i;
			document.getElementById(id).style.overflowY='hidden';
		}		
}	

function contactForm()
{
	voir('cache');
	voir('SendEmail');
}

function Callback()
{
	voir('cache');
	voir('callMeBack');
}

function closeCallback()
{
	
}

function sendCallback()
{
	alert('Post callback data !');
}

function sendContactForm()
{
	alert('Kontakt daten senden !');
}




function limite(textarea, maxi, show)
{
    if(textarea.value.length >= maxi)
    {
        textarea.value = textarea.value.substring(0,maxi);
    }
    var reste = maxi - textarea.value.length;
    var affichage_reste =  reste + ' caractères restants';
    document.getElementById(show).innerHTML = affichage_reste;
}

function movetourl(url)
{
	window.location.href=url;
}

function clearfont()
{
	if (familleSelected!='x')
	{
		id='item_'+familleSelected;
		
		if (blocage==0)
		{
		
			/*document.getElementById(id).style.fontStyle='normal';
			document.getElementById(id).style.fontWeight='normal';
			document.getElementById(id).style.backgroundColor='';*/
			document.getElementById(id).style.letterSpacing='0pt';
			document.getElementById(id).style.backgroundImage=listimage;
			/*document.getElementById(id).style.listStyleImage=listimage;*/
		}
	}
}

function setfont()
{
	if (familleSelected!='x')
	{
		id='item_'+familleSelected;
		
		if (blocage==0)
		{
		
			/*document.getElementById(id).style.fontStyle='italic';*/
			/*document.getElementById(id).style.fontWeight='bold';*/
			document.getElementById(id).style.letterSpacing='1pt';
			document.getElementById(id).style.backgroundColor='';
			/*document.getElementById(id).style.backgroundImage='';*/
		}
	}
}


var blocage=0;
var familleSelected='x';
var immobile=0;
var listimage='';

function Setfamille(id)
{
	familleSelected=id;
	var itemid = 'item_'+id;
	/*listimage = document.getElementById(itemid).style.listStyleImage;
	document.getElementById(itemid).style.listStyleImage='url(../images/boutons/btnW.png)';*/
	listimage = document.getElementById(itemid).style.backgroundImage;
	document.getElementById(itemid).style.backgroundImage='url(../images/boutons/btnW.png)';	

}

function coche(x)
{
	document.getElementById(x).checked=true;
	/*if (x=='f_ccc') document.getElementById('cachebis').innerHTML = '<img src="images/coeur.gif" width="50" height="32" alt="image_coupcoeur" align="top">';
	else document.getElementById('cachebis').innerHTML = '<img src="images/loading.gif" width="50" height="50" alt="loading">';*/
} 

function selectFamilleGoto()
{
	immobile=1;
	coche('f_'+familleSelected);
	if (familleSelected!='x') {get_radio_value('family','famille',1,'item_'+familleSelected)}
}

function get_radio_value(form,name,send,id_bg)
{
	var rad_val = '';
	
	if (send==1 && blocage==0) blocage=1;
	
	if (send==1 || (send==0 && blocage==0)) {document.getElementById(id_bg).style.fontStyle='italic'; document.getElementById(id_bg).style.fontWeight='bold';}
	/*if (send!=1 && blocage==0) document.getElementById(id_bg).style.backgroundImage='url(images/accueil_fond_870vert_over.png)';*/
	
	
	for (var i=0; i < document.forms[form].elements[name].length; i++)
   	{
   		if (document.forms[form].elements[name][i].checked)
	  	{
	  		rad_val = document.forms[form].elements[name][i].value;

	  	}
   	}


	//alert(datum);

	//if (send==1) rad_val = datum;
	if (send==1 && blocage==1) 
	{
		/*setTimeout("selectFamille('"+rad_val+"')", 1000);*/
		/*alert(id_bg);*/
		/*document.getElementById(id_bg).style.backgroundImage='';
		document.getElementById(id_bg).style.backgroundPosition='center left';
		document.getElementById(id_bg).style.backgroundImage='url(images/miniloader.gif)';*/
		

		var url = 'http://www.loiseau-darmorique.fr/offres_de_voyage-cat-'+rad_val+'.html';
		blocage=2;
		$('#redirige').fadeIn("slow");
		setTimeout("movetourl('"+url+"')", 1500);
		
		
	}
	else return rad_val;
}

function selectFamille(val)
{	
	var xhr; // on déclare l'instance
	if (window.XMLHttpRequest) xhr = new XMLHttpRequest(); // Firefox, Opera, Konqueror, Safari, ...
	else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP'); //	Internet Explorer
	else alert('JavaScript : votre navigateur ne supporte pas les objets XMLHttpRequest...'); // Navigateur ancien

	xhr.open('POST','offres_produits_init.php',true);
	
	var data = 'f='+escape(val)+'&ipctrl='+escape(ipval);
	
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	xhr.send(data);
	
	xhr.onreadystatechange = function() // attribution de la fonction
        {
        if (xhr.readyState == 4)
                {
                // mettre ici ce que nous voulons faire de responseText
                
				
				  
					 var myString = '';
					 var myStringArray = '';
					 
					 myString = xhr.responseText;  
					 myStringArray = myString.split("###RAWR###");  
					 
					 freeze=0;
					
					 if (myString!='' && myStringArray[0]!='BAJAX' && myStringArray[0]!='' && myStringArray[1]!='' && myStringArray[2]!='')
					 {
					 
						 document.getElementById('recherche').innerHTML = myStringArray[0];
						 document.getElementById('MiniPicsBloc').innerHTML = myStringArray[1];
						 document.getElementById('Titres').innerHTML = myStringArray[2];
						 currentOfferId=myStringArray[3];
						 currentFiche=currentOfferId;
						 backupid=currentFiche;
						 quantite=myStringArray[4];
						 //alert(quantite);
						 displayPub(quantite);
						 
						 $(document).ready(function (){ 
								$('.ceebox').ceebox();
						  }); 				 
					 
						 Zoom(currentOfferId, 1);

						/*setTimeout("Zoom("+currentOfferId+", 1)", 3500);*/
						Zoom(currentOfferId, 1);
					 }
					 else if (myStringArray[0]!='BAJAX') alert('Petite lenteur réseau, merci de bien vouloir renouveler votre demande');
					 else {alert('Erreur serveur, merci de bien vouloir renouveler votre demande'); window.location.href='voyages.php';}
	 
					 
                }
				//else alert('Petite lenteur réseau, merci de bien vouloir renouveler votre demande');
				
        }

	setTimeout("cache('cachebis')", 1000);
}

function isready()
{
	alert(xhr.readyState);
}

function majFamily()
{
	var idfam = 'f_'+familleselected;
	document.getElementById(idfam).value=familleselected;
	document.getElementById(idfam).checked=true;
	var fam = get_radio_value('famille',0);
}

function coeurinit()
{
	document.getElementById('coeur').innerHTML = '<img src="images/pixel.gif" width="25" height="16" alt="image_coupcoeur" align="top">';
}

function coeuranim()
{
	//document.getElementById('coeur').innerHTML = '<img src="images/coeur2.gif" width="25" height="16" alt="image_coupcoeur" align="top">';
	document.getElementById('coeur').innerHTML = '<img src="images/coeur.gif" width="25" height="16" alt="image_coupcoeur" align="top">';
}

/*function marqueur(posX, status)
{
	
	var newposX = posX + offsetMarqueur;
	
	if (status==true)
	{
	document.getElementById('marqueur').style.top = newposX+'px';
	document.getElementById('marqueur').style.display='block';
	}
	else 
	{
		if (!marqueurPos) document.getElementById('marqueur').style.display='none';
		else document.getElementById('marqueur').style.top = marqueurPos+'px';
	
	}
}*/

var couleur='#333333';

function bgimage(id)
{
	document.getElementById(id).style.backgroundImage = 'url(images/item_fond.png)';
}

function marqueur(id, status)
{
	
	var id_u = id+'_u';
	
	
	if (status==1 && id!='item_coeur')
	{
	document.getElementById(marqueurPos).style.backgroundImage = '';
	document.getElementById(marqueurPos+'_u').style.backgroundImage = '';
	document.getElementById(marqueurPos+'_u').style.display = 'none';
	
	document.getElementById(marqueurPos).style.color = '#ffffff';
	
	/*document.getElementById(marqueurPos).style.backgroundColor = '';*/
	document.getElementById(initmarqueurPos).style.backgroundImage = '';
	document.getElementById(initmarqueurPos+'_u').style.backgroundImage = '';
	document.getElementById(initmarqueurPos+'_u').style.display = 'none';
	
	document.getElementById(initmarqueurPos).style.color = '#ffffff';
	
	/*document.getElementById(initmarqueurPos).style.backgroundColor = '';*/
	
	document.getElementById(id).style.backgroundImage = 'url(images/marqueur.png)';
	document.getElementById(id).style.color = couleur;
	
	document.getElementById(id_u).style.display = 'none';
	bgimage(id_u);	
	$('#'+id_u).fadeIn("1000");

	/*document.getElementById(id_u).style.backgroundImage = 'url(images/item_fond.png)';*/
	/*document.getElementById(id).style.backgroundColor = '#D5D2F2';*/
	marqueurPos=id;
	}
	else if  (status==0)
	{
		if (initmarqueurPos)
		{
				var image='marqueur.png';
	
				if (initmarqueurPos=='item_coeur') image = 'coeur.gif';

				
				document.getElementById(marqueurPos).style.backgroundImage = '';
				document.getElementById(marqueurPos+'_u').style.backgroundImage = '';
				document.getElementById(marqueurPos+'_u').style.display = 'none';
				
				
				document.getElementById(marqueurPos).style.color = '#ffffff';
				
				/*document.getElementById(marqueurPos).style.backgroundColor = '';*/
				document.getElementById(initmarqueurPos).style.backgroundImage = 'url(images/'+image+')';
				
				
				
				
				
				
				
				/*document.getElementById(initmarqueurPos+'_u').style.backgroundImage = 'url(images/item_fond.png)';*/
				
				var positionmark = initmarqueurPos+'_u';
				
	document.getElementById(positionmark).style.display = 'none';
	/*$('#'+positionmark).fadeOut("0");*/
	bgimage(positionmark);	
	$('#'+positionmark).fadeIn("1000");
		
				
				
				
				
				
				
				
				
				
				
				
				/*document.getElementById(initmarqueurPos).style.backgroundColor = '#D5D2F2';*/
				document.getElementById(initmarqueurPos).style.color = couleur;
		}
	
	}
	else if  (status==2 || id=='item_coeur')
	{
	document.getElementById(marqueurPos).style.backgroundImage = '';
	document.getElementById(marqueurPos+'_u').style.backgroundImage = '';
	document.getElementById(marqueurPos+'_u').style.display = 'none';
	
	document.getElementById(marqueurPos).style.color = '#ffffff';
	
	/*document.getElementById(marqueurPos).style.backgroundColor = '';*/
	document.getElementById(initmarqueurPos).style.backgroundImage = '';
	document.getElementById(initmarqueurPos+'_u').style.backgroundImage = '';
	document.getElementById(initmarqueurPos+'_u').style.display = 'none';
	
	document.getElementById(initmarqueurPos).style.color = '#ffffff';
	
	/*document.getElementById(initmarqueurPos).style.backgroundColor = '';*/
	document.getElementById(id).style.backgroundImage = 'url(images/coeur.gif)';
	
	
	
	
	/*document.getElementById(id_u).style.backgroundImage = 'url(images/item_fond.png)';*/
	
	
	document.getElementById(id_u).style.display = 'none';
	
	bgimage(id_u);	
	$('#'+id_u).fadeIn("1000");

	
	
	
	
	
	
	
	
	document.getElementById(id).style.color = couleur;
	
	/*document.getElementById(id).style.backgroundColor = '#D5D2F2';*/
	marqueurPos=id;
		
	}
}

var marqueurPos='';
var initmarqueurPos= '';



/*function init_marqueur(posX)
{
	
	var newposX = posX + offsetMarqueur;
	

	
	document.getElementById('marqueur').style.top = newposX+'px';
	
	document.getElementById('marqueur').style.display='none'; /*desactivation*//*
	
	marqueurPos=newposX;
}*/

function init_marqueur(id)
{
	
	var image='marqueur.png';
	
	var id_u = id+'_u';
	
	if (id=='item_coeur') image = 'coeur.gif';
	
	document.getElementById(id).style.backgroundImage = 'url(images/'+image+')';
	
	
	/*document.getElementById(id_u).style.backgroundImage = 'url(images/item_fond.png)';*/
	
	
	document.getElementById(id_u).style.display = 'none';
	bgimage(id_u);	
	$('#'+id_u).fadeIn("1000");
	
	
	
	
	
	
	document.getElementById(id).style.color = couleur;
	/*document.getElementById(id).style.backgroundColor = '#D5D2F2';*/
	
	initmarqueurPos=id;
	marqueurPos=id;
}

function goback()
{
	$('#MiniPicsBloc').fadeOut("10000");
	$('#MiniPicsBloc').fadeIn("10000");
}

function forward()
{
	$('#MiniPicsBloc').fadeOut("10000");
	$('#MiniPicsBloc').fadeIn("10000");	
}

function goTarget(target, name, id, alternate)
{
	var ok = confirm('Pour atteindre ce service, une nouvelle fenêtre doit être ouverte dans votre navigateur, voulez-vous continuer ?');
	
	if (!name) name='window';
	
	if (ok) window.open(target,name,'menubar=no, status=no, scrollbars=yes, resizable=yes, width=700, height=600');
	else if (alternate==1)
	{
		document.getElementById(id).innerHTML = 'Lien à recopier dans votre navigateur : <strong>'+target+'</strong>';
	}
}
