$(function() {
		   var heig=$('.depart_right').height()+20;
		   $('#prog_cont_new').height(heig+'px' );
	
	//code used to go to section according to the url #
	var pathname = window.location;
	pathname=String(pathname);
	pathname=pathname.split('#');
	var right=pathname[1];
	//alert(left);
	if(right!=null && right){
		if(right=='services'){ajax_services()}
		if(right=='depart'){ajax_depart()}
		if(right=='about'){ajax_about()}
		if(right=='destination'){ajax_destination()}
		if(right=='contact'){ajax_contact()}
		if(right=='devis'){ajax_devis()}
		if(right=='terms'){ajax_terms()}
		if(right=='privacy'){ajax_privacy()}
		if(right=='sitemap'){ajax_sitemap()}
	}
	//code used to go to section according to the url #



/*$('.section_title').hover( function(){ 
									//alert('miz');
									$(this).find('.trg1').show();
								},  function(){
									 $(this).find('.trg1').hide();
								})	*/
$('.quick').hover( function(){ 
									//alert('miz');
									$(this).find('.plus').show();
								},  function(){
									 $(this).find('.plus').hide();
								})


trig=1;
$('.car').click( function(){ 
					if(trig==1){ $('.car').animate({left:'180px'},800); $('.car').css('background-position', '0px -27px'); trig=2;}
					else {$('.car').animate({left:'0px'},800); $('.car').css('background-position', '0px 0px'); trig=1;}
			})

var old_sec='';
$('.sub_cont_bottom').hover( function(){ 
									//alert('miz');
									$(this).find('.mini_plus').css('background-position','0 -15px');
								},  function(){
									 $(this).find('.mini_plus').css('background-position','0 0');
								})

$('.sub_cont_bottom').click( function(){ //sub_cont_bot  sub_cont sec
					var sec=$(this).attr('lang');
					
					$('.sec').hide();
					$('.sub_cont_bot').slideUp();
					$('.sub_cont').slideUp();
					$('.mini_plus').show();
					
					if(old_sec==sec){old_sec='';return;}
					 
					$('.pl_'+sec).hide();
					$('.sec_'+sec).slideDown();
					$('.slidemenu_bot_'+sec).slideDown();
					$('.slidemenu_'+sec).slideDown();
					old_sec=sec
					
					 $('.homehow-scroll-pane').jScrollPane({showArrows: true, arrowScrollOnHover:true});  
					 $('.jspPane').css('top','0px');
			})

$('.abt_sub').click( function(){ 
					$('.abt_sub').css('color','#A4B1C4');
					$(this).css('color','#1376d6');

			})
$('.submenu').click( function(){ 
					$('.submenu').css('background-position','0px 24px');
					$(this).css('background-position','right');
			})

$('.big_notice').click( function(){ animate_triAgent_hide();	})
 //animate_triAgent_hide();



animate_home_show();



});


/*$('.right_blue').click( function(){ //alert('miz');
									$('.right_blue').animate({bottom:'-200px',right:'-200px'},1000);
									$('.right_blue').delay(1000).animate({bottom:'0px',right:'0px'},1000);
									})*/

function animate_home_hide(){
	$('.left_blue').animate({left:'-320px',bottom:'-320px'},800);
}
function animate_home_show(){
	$('.left_blue').animate({bottom:'0px',left:'0px'},800);
}


function animate_tri_hide(){
					$('.sec').slideUp();		//this is to hide the sliding menu
					$('.sub_cont_bot').slideUp();
					$('.sub_cont').slideUp();
	
	
	animate_triDevis_hide();
	animate_triContact_hide();
	$('.right_blue').animate({bottom:'-180px',right:'-180px'},800);
}
function animate_tri_show(){
	$('.right_blue').animate({bottom:'0px',right:'0px'},800);
}
function animate_triContact_hide(){
	$('.contact_bk').hide();
	$('.contact_bk').animate({bottom:'-250px',left:'-250px'},800);
}
function animate_triContact_show(){
	$('.contact_bk').show();
	$('.contact_bk').animate({bottom:'0px',left:'0px'},800);
}
function animate_triDevis_hide(){
	//$('.devis_bk').hide();
	$('.devis_bk').animate({bottom:'-700px',left:'-700px'},800);
}
function animate_triDevis_show(){
	//$('.devis_bk').show();
	$('.devis_bk').animate({bottom:'0px',left:'0px'},800);
}
function animate_triAgent_hide(){
	$('.agent_bk').animate({top:'-800px',right:'-800px'},800);
}
function animate_triAgent_show(){
	$('.agent_bk').delay(300).animate({top:'0px',right:'0px'},800);
}


function agentanimation(){
	
	$('.big_notice').click( function(){
						$('.notice_bk').animate({top:'-100px',right:'-100px'},600);			 
						animate_triAgent_show();	
					})
	$('.agent_x').click( function(){
						animate_triAgent_hide();
						$('.notice_bk').delay(300).animate({top:'0px',right:'0px'},600);			 
						
					})
	

	
 //animate_triAgent_hide();
}

function homeanimation(thumbs){
				// We only want these styles applied when javascript is enabled
				the_nbr=$('.noscript').attr('lang');
				if(the_nbr!='' && the_nbr>1){run=true;}else{run=false }
				$('div.navigation').css({'width' : '300px', 'float' : 'left'});
				$('div.content').css('display', 'block');

				// Initially set opacity on thumbs and add
				// additional styling for hover effect on thumbs
				var onMouseOutOpacity = 0.67;
				$('#'+thumbs+' ul.thumbs li').opacityrollover({
					mouseOutOpacity:   onMouseOutOpacity,
					mouseOverOpacity:  1.0,
					fadeSpeed:         'fast',
					exemptionSelector: '.selected'
				});
				
				// Initialize Advanced Galleriffic Gallery
				var gallery = $('#'+thumbs).galleriffic({
					delay:                     4000,
					numThumbs:                 15,
					preloadAhead:              10,
					enableTopPager:            true,
					enableBottomPager:         true,
					maxPagesToShow:            7,
					imageContainerSel:         '#slideshow',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					renderSSControls:          true,
					renderNavControls:         true,
					playLinkText:              'Play Slideshow',
					pauseLinkText:             'Pause Slideshow',
					prevLinkText:              '&lsaquo; Previous Photo',
					nextLinkText:              'Next Photo &rsaquo;',
					nextPageLinkText:          'Next &rsaquo;',
					prevPageLinkText:          '&lsaquo; Prev',
					enableHistory:             false,
					autoStart:                 run,
					syncTransitions:           true,
					defaultTransitionDuration: 900,
					onSlideChange:             function(prevIndex, nextIndex) {
						// 'this' refers to the gallery, which is an extension of $('#thumbs')
						this.find('ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onPageTransitionOut:       function(callback) {
						this.fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
						this.fadeTo('fast', 1.0);
					}
				});
}


var timerDown="";
var timerUp="";
var step = 0;
//var stoper=1000;

//sub_prog_cont
function scrollRig(){
	
	var stoper=$('#tabilov').width() -700;
	//alert(stoper); return;
	step=step-5;
	if(step<-stoper){ step=-stoper; return;}
	$('#sub_prog_cont').stop(true,true).animate({left:step+'px'},1);
	timerDown=setTimeout("scrollRig()",1);
} 
function scrollLef(){
	step=step+5;
	if(step>0){ step=0; return;}
	$('#sub_prog_cont').stop(true,true).animate({left:step+'px'},1);
	timerUp=setTimeout("scrollLef()",1);
} 
function quitScroll(){
	clearTimeout(timerDown);
	clearTimeout(timerUp);
}



