var domain = "http://www.altis.be";
$('document').ready(function(){
	$('.fancy').fancybox();
     //width total des li
   var width_li =0;
   var nbrLi = 0;
   $('#menuUl>li').each(function(){
       //pour chaque li on additionne son width
       width_li+=$(this).width();          
       nbrLi++;
   });
     var paddingLi = (950-width_li)/nbrLi;
         
      $('#menuUl>li').each(function(){
      	var newWidth = $(this).width()+paddingLi;
       $(this).css({width:newWidth+"px"});
   });
  swfImplements();
  
  parseForm();
  
  $('.customCheck').click(function(){
	
	var img= $(this).css('backgroundImage');
	var values = $(this).attr('rel').split('-');
	//alert(img.substr(img.lastIndexOf("/")+1));
	if (img.substr(img.lastIndexOf("/")+1)=="customChecked.jpg)" ||img.substr(img.lastIndexOf("/")+1)=='customChecked.jpg")'){
		$(this).css({backgroundImage:"url("+domain+"/files/design/customCheck.jpg)"});
		$(this).html(values[2]);
	}else{
		$(this).css({backgroundImage:"url("+domain+"/files/design/customChecked.jpg)"});
		$(this).html('<input type="hidden" name="'+values[0]+'" value="'+values[1]+'" />'+values[2]);
	}
  
  });
  blocks();
  $("#slider").wslide({width: 495,height: 120,horiz: true,pos:1,duration:1000});
  
});
  
function blocks(){
	var width=0;
	$('#blocs>ul>li').each(function(){
		width+=$(this).width()+9;
		$(this).find("a.txt").width($(this).width()-5);
	});
	var diff=979-width;
	//alert(diff);
	
	$('li.blocOrange').width($('li.blocOrange').width()+diff);
}  
  
function parseForm(){
	$('ul.searchForm').each(function(){
		
		$(this).find('li').each(function(){
		
			var name = $(this).find('input').attr('name');
			var val =$(this).find('input').attr('value');
			var texte = $(this).find('label').html();
			//alert(texte);
			$(this).html(
				'<div class="customCheck" rel="'+name+'-'+val+'-'+texte+'">'+texte+'</div>'
			);
			
		});
	});

}
 
function swfImplements(){
	var flashvars ={};
	var params = {wmode:'transparent'};
	var attributes = {};

 swfobject.embedSWF("files/flash/altis_banner_v2.swf", "flash", "970", "140", "9.0.0", "files/flash/expressInstall.swf", flashvars, params, attributes);

 
 }


