var $j = jQuery.noConflict();

$j(document).ready(function() {

  $j(document).pngFix();
 
/* Doc : http://www.gruppo4.com/~tobia/cross-slide.shtml  */
if($j('#slContainer').html()!=null){
 $j('#slContainer').crossSlide({
   sleep: 3,
   fade: 1
 },
  [
    { src: 'assets/templates/eco/images/eco_intro_1.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_2.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_3.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_4.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_5.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_6.jpg' },
    { src: 'assets/templates/eco/images/eco_intro_7.jpg' }
   ]
 ); 
}


 $j("#logo").click( function(){  window.location='./index.php'; });
 
 $j(".linkBaner").hoverIntent( function(){								
							 $j(this).parent().animate({left:'60px'},300);
							 },
							   function(){
							 $j(this).parent().animate({left:'40px'},150);
 });
 $j("#bat").hoverIntent( function(){								
							 $j(this).animate({opacity:0.9, marginTop:'1px'},280); $j(this).animate({ marginTop:'6px'},80);
							 },
							   function(){ 
							 $j(this).fadeTo(90,1);
 });
 
 $j(".tick").each( function() {
							
							if($j(this).html()==1)
							{
								 $j(this).html("<img src='assets/templates/eco/images/tick.gif' alt='Vegetarian' /> ");
						    }
							else if($j(this).html()==11)
							{
								$j(this).html("<img src='assets/templates/eco/images/whiteWine.gif' alt='White wine' /> ");
							} 
							else if($j(this).html()==12)
							{
								$j(this).html("<img src='assets/templates/eco/images/redWine.gif' alt='Red wine' /> ");
							}else
							{
								$j(this).html("  ");
							}
							
  });
 
  $j(".price").each( function() {
							if($j(this).html().length==1){$j(this).html('');}
  });
/*  $j('.reserv').each( function() { $j(this).attr('title','Click to book >'); });   */
  $j('.lm').fadeTo(1,0.3);
  $j('.lm').hoverIntent( function(e){	
							$j('#photoV').css( {
			
								     	left: e.pageX-200,
					 					top: e.pageY+32
                 
				  		    },1);
							
			  				$j().mousemove(function(e){
			
		    					  $j('#photoV').css( {
			
								     	left: e.pageX-200,
					 					top: e.pageY+32
                 
				  				   },1);

			  
             				 });					  
								  
							 $j("#photoV").attr('src', $j(this).attr('href'));
							 $j("#photoV").fadeIn(300);
							 },
							   function(){
							 $j("#photoV").fadeOut(100);
  });
  $j('.lm').click( function() { return false;  });
  
  
  if($j("input[name=table]").val()!= '') {$j("#tabFieldInfo").html($j("input[name=table]").val());}
  $j('.reserv').click( function() {
								
								 // Reservation table
								 switch($j(this).attr('class')) 
								 {
									case 'lm eco11 reserv': 
									   $j("input[name=table]").val('');
									   $j("#tabFieldInfo").html('17-20');
									break;
									case 'lm eco39 reserv':
									   $j("input[name=table]").val('21-23');
									   $j("#tabFieldInfo").html('21-23');
									break;
									case 'lm eco40 reserv':
									   $j("input[name=table]").val('1-3, 14-16');
									   $j("#tabFieldInfo").html('1-3, 14-16');
									break;
									case 'lm eco41 reserv':
									   $j("input[name=table]").val('4-6');
									   $j("#tabFieldInfo").html('4-6');
									break;
									case 'lm eco41b reserv':
									   $j("input[name=table]").val('4-6');
									   $j("#tabFieldInfo").html('4-6');
									break;
									case 'lm eco42 reserv':
									   $j("input[name=table]").val('7-12');
									   $j("#tabFieldInfo").html('7-12');
									break;
									
									default: break;
								 }

								 
								 
								 
								 
								 
								 $j('.reserv').each( function() { $j(this).animate({opacity:0.3},100); });
								 
								 
								 
								 if($j(this).attr('class')=="lm eco41 reserv" || $j(this).attr('class')=="lm eco41b reserv") {
								       	 $j('.eco41b , .eco41').animate({ opacity: 0.5 },100);
								 }else {
									     $j(this).animate({ opacity: 0.5 },100);
								 }
  });
  
  $j().mousemove(function(e){

		      $j('.cloud').css( {

			     left: e.pageX,

				 top: e.pageY-90

			  },1);

			  
  });
  
  $j('.flag, .tick img').hoverIntent( function(){				
							 $j('.cloud').html($j(this).attr('alt'));
							 $j('.cloud').fadeIn();
							 },
							   function(){
							 $j('.cloud').fadeOut();
  });
  
  $j(".smallPrice").each( function() {
							if($j(this).html().length>0){$j(this).html('<small>small</small> '+$j(this).html());}
  });

	  


  $j("#cfContact").click( function() {
								   
								   if($j(this).attr('value')=='Send') { 
								       if($j("input[name=table]").val()==''){ alert('Choose a table'); return false; }
									  // if($j("#cfTable").attr('value').length()>-1) {alert('aa');}   
								   }
								   
								   
								   });

}); 