/* READY */
$(window).ready(function() {

	// Remove Skype	
	window.setTimeout(function() {
			$('.skype_pnh_container').html('');
			$('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
		}, 800);
	
	
	$('.scroll-pane-arrows').jScrollPane(
			{
				showArrows: true,
				horizontalGutter: 10
			}
		);
		
		
		
	
	//$('body').css({opacity : 0 });
	//$('header.top').css({opacity : 0 });
	//$('nav#menu').css({opacity : 0 });
	
	/* Scroll top */
	
	$('.scroll_top').click( function(){
		$('html, body').animate({scrollTop: 0}, 900);
	});
	
	$('footer .instant_call').mouseover( function(){
		$(this).addClass('over');
	});
	
	$('footer .instant_call').mouseleave( function(){
		$(this).removeClass('over');
	});
	
	/* --------------------------------------------------------------------------*/
	/* Menu */
	
	$("#menu > ul > li").mouseover(function(e){

		$(this).find(".submenu").stop(true, true).css({'display': 'block'});
	});
	
	$("#menu > ul > li").mouseleave(function(){			
				
		$(this).find(".submenu").stop(true, true).css({'display': 'none'});
	});
	
	/* ----------------------------------------------------------------------------------- */
	/**/
	

	
	/* VIDEO */
	if ($('.video_box').length > 0) {
	
		/* SHOW VIDEO*/
		$('.video_box, .video_icon').live('click', function(){

			$(this).parent().find('.video').addClass('show');			
		});
		
		
		$('.video .close').live('click', function(){
			$(this).parent().removeClass('show');			
		});		
		
		/*$('.grid .article').live('mouseover', function(){
			if( $('.video ').css('display') == 'none')
				$(this).addClass('show_description');
		});
		
		$('.grid .article').live('mouseout',function(){
					
			$(this).removeClass('show_description');
			
		});*/
		
	}
	
	
	/* --------------------------------------------------------------------------*/
  /* --------------------------------------------------------------------------*/

	
	/*  PAGES  */
	
	/* --------------------------------------------------------------------------*/
	// Branding Page
				if ($('.branding').length > 0 ){
		
					var current_page = location.pathname.substring(location.pathname.lastIndexOf('/') + 1 );
					
					var anchor, link_page;
				
				// scrollTo Anchor						
				$('.list-clients a').click(function(e){				

					 anchor = $(this).attr('href').substr( $(this).attr('href').indexOf('#') +1 );
					
					 link_page = $(this).attr('href').substr( 0, $(this).attr('href').indexOf('#')  ) ;
					
					if(link_page == current_page) {
						e.preventDefault();
					
						$('html,body').animate({scrollTop: $('a[name='+ anchor + ']' ).offset().top },'slow');
					
					}
					
				});
			}
	/* --------------------------------------------------------------------------*/
	// home	
		
	var random_case = 0;	
	if ( $('.home').length > 0){
		
			// Random Cases
    	$('a.random_cases').click(function(e){
      	e.preventDefault();
      	
      	max = $(this).attr('title');
      	
      	
      	//random_case = Math.floor((Math.random() * max +1));
		random_case++;

		
        $.ajax({
            url: 'random/random-case-' + random_case + '.html',
            success: function(data) {    
                $('#random-case').html(innerShiv(data));
				
            }
        });

    	});
    }			
			
	/* --------------------------------------------------------------------------*/
  /* --------------------------------------------------------------------------*/

	
	
}); // END OF DOM

/* ----------------------------------------------------------------------------------- */
/* LOAD */
$(window).load(function() {

	$('#slide').find('figcaption, div.box, div.controls a').css({opacity: 0.9});
	
	/* slide */
	$('#slide').mouseover(function(e){
		$(".submenu").stop(true, true).slideUp('slow');
		
		$(this).find(".move").stop(false,true);
		
		$(this).find('div.box, div.controls a').stop().animate({			
			opacity: 0.9
			
		},1000);	
	});
	
	$('#slide').mouseout(function(e){
		$('#slide .move').dequeue();
	
		$(this).find('div.box, div.controls a').stop().delay(2000).animate({
			opacity: 0			
		},1000);			
	});
	
	
	
	
	
	

});


