// JavaScript Document
$(document).ready(
	function() {
		
//chose witch site to view (cubo or editora)
	//get pathname
	var pathname = window.location.pathname;
	
		//if pathname is the "pure" pathname on the browser adress bar (like http://cubomultimidia.com.br) and nothing else, show the site selection screen
		//   remoto               local
		if ((pathname == "/") || (pathname == "/MagnoSites/hostcentral/cmsa/public/")){		
			$('#shadow-site-choice').animate({
				"opacity":"show"						
			}, 500);
			
			$('#site-choice').animate({
				"opacity":"show"						
			}, 500);	
			
			//when someone click on the "cubomultimidia" option to stay at this site, hide the screen
			$('#cubomultimidia').click(function(){
				$('#site-choice').animate({
					"opacity":"hide"						
				}, 200);
				
				$('#shadow-site-choice').animate({
					"opacity":"hide"						
				}, 600);	
				
				//put "index" in front of the actual pathname so that if users reload the page, the selection screen will not appear anymore
				window.location += "index";
			})
			
			//if they select "editoracubo", so the script will hide the selection 
			$('#editoracubo').click(function(){
				$('#site-choice').animate({
					"opacity":"hide"					
				}, 300);
					
				//redirect to editoracubo's site	
				window.location.href ='http://www.editoracubo.com.br';
			})		
		}
	
	
		//screen transition
		//put jQuery fade effect on the main content everytime a page is load
		$( ".fade" ).animate({
			"opacity": "show"
		}, 500);
			
			
/* CLIENTS
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨*/		
//clients category change functions
var href = window.location.href;
var url = window.location.protocol + "//" + window.location.host + "" + window.location.pathname;

if((href == (url + "#submit"))){
	$('.clientsNav a').removeClass('active');
	$('#cmdSubmit').addClass('active');					
	$('#slider1').fadeOut(200, function(){					
		$('#congress').hide(); $('#host').hide(); $('#portal').hide(); $('#cdrom').hide();
		$('#submit').show();
	});				
	$('#slider1').fadeIn(300);
	
}else if((href == (url + "#congress"))){
	$('.clientsNav a').removeClass('active');
	$('#cmdCongress').addClass('active');					
	$('#slider1').fadeOut(200, function(){					
		$('#submit').hide(); $('#host').hide(); $('#portal').hide(); $('#cdrom').hide();
		$('#congress').show();
	});				
	$('#slider1').fadeIn(300);
		
}else if((href == (url + "#host"))){
	$('.clientsNav a').removeClass('active');
	$('#cmdHost').addClass('active');					
	$('#slider1').fadeOut(200, function(){
		$('#submit').hide(); $('#congress').hide(); $('#portal').hide(); $('#cdrom').hide();	
		$('#host').show();
	});				
	$('#slider1').fadeIn(300);	
		
}else if((href == (url + "#portal"))){
	$('.clientsNav a').removeClass('active');
	$('#cmdPortal').addClass('active');					
	$('#slider1').fadeOut(200, function(){					
		$('#submit').hide(); $('#congress').hide(); $('#host').hide(); $('#cdrom').hide();	
		$('#portal').show();
	});				
	$('#slider1').fadeIn(300);
		
}else if((href == (url + "#cdrom"))){
	$('.clientsNav a').removeClass('active');
	$('#cmdCDrom').addClass('active');					
	$('#slider1').fadeOut(200, function(){					
		$('#submit').hide(); $('#congress').hide(); $('#host').hide(); $('#portal').hide();
		$('#cdrom').show();
	});				
	$('#slider1').fadeIn(300);
}

		//make the Submit service active
		$('#cmdSubmit').click(
			function(){		
				$('.clientsNav a').removeClass('active');
				$(this).addClass('active');					
				$('#slider1').fadeOut(200, function(){					
					$('#congress').hide(); $('#host').hide(); $('#portal').hide(); $('#cdrom').hide();	
					$('#submit').show();
				});				
				$('#slider1').fadeIn(300);						
			}		
		); 		
		//make the Congress service active
		$('#cmdCongress').click(
			function(){		
				$('.clientsNav a').removeClass('active');
				$(this).addClass('active');					
				$('#slider1').fadeOut(200, function(){
					$('#submit').hide(); $('#host').hide(); $('#portal').hide(); $('#cdrom').hide();	
					$('#congress').show();	
				});				
				$('#slider1').fadeIn(300);						
			}		
		); 		
		//make the Host service active
		$('#cmdHost').click(
			function(){		
				$('.clientsNav a').removeClass('active');
				$(this).addClass('active');					
				$('#slider1').fadeOut(200, function(){
					$('#submit').hide(); $('#congress').hide(); $('#portal').hide(); $('#cdrom').hide();	
					$('#host').show();
				});				
				$('#slider1').fadeIn(300);						
			}		
		); 		
		//make the Portal service active
		$('#cmdPortal').click(
			function(){		
				$('.clientsNav a').removeClass('active');	
				$(this).addClass('active');			
				$('#slider1').fadeOut(200, function(){
					$('#submit').hide(); $('#congress').hide(); $('#host').hide(); $('#cdrom').hide();	
					$('#portal').show();									
				});				
				$('#slider1').fadeIn(300);						
			}		
		); 
		//make the cdRom service active
		$('#cmdCDrom').click(
			function(){			
				$('.clientsNav a').removeClass('active');
				$(this).addClass('active');					
				$('#slider2').fadeOut(200, function(){
					$('#submit').hide(); $('#congress').hide(); $('#host').hide(); $('#portal').hide();
					$('#cdrom').show();									
				});				
				$('#slider2').fadeIn(300);						
			}		
		); 
		
		
/* JOBS
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨*/				
//make the animation on the jobs at the "vagas" page.
//$(this).find('.bgArrow').fadeIn(300);	
	
		$('.job-programador-show').click(function(){
			$(this).text($(this).text() == 'Leia Mais' ? 'Leia Menos' : 'Leia Mais'); 			
			$('.job-programador-text').toggleSlide(10);					
		});
		
		$('.job-programador2-show').click(function(){
			$(this).text($(this).text() == 'Leia Mais' ? 'Leia Menos' : 'Leia Mais'); 			
			$('.job-programador2-text').toggleSlide(10);					
		});
		
		$('.job-support-show').click(function(){
			$(this).text($(this).text() == 'Leia Mais' ? 'Leia Menos' : 'Leia Mais'); 			
			$('.job-support-text').toggleSlide(10);					
		});
		
		$('.job-developer-show').click(function(){
			$(this).text($(this).text() == 'Leia Mais' ? 'Leia Menos' : 'Leia Mais'); 			
			$('.job-developer-text').toggleSlide(10);					
		});
		
//home's services animation  
		$( ".service1" ).animate({
			"opacity": "show"
		}, 500, function(){
				$( ".service2" ).animate({
				"opacity": "show"
			}, 500, function(){
				$( ".service3" ).animate({
					"opacity": "show"
				}, 500, function(){
					$( ".service4" ).animate({
						"opacity": "show"
					}, 500 )		
				} )				
			})	
		} )
		
//clients slider	
		//set witch controlls the clients slider will have		
		$('#slider1').bxSlider({
			auto: false,
			autoControls: false,
			autoHover: true,
			pager: false,
			controls: true
		});
		
		$('#slider2').bxSlider({
			auto: false,
			autoControls: false,
			autoHover: true,
			pager: false,
			controls: true
		});
		
		$('#slider3').bxSlider({
			auto: false,
			autoControls: false,
			autoHover: true,
			pager: false,
			controls: true
		});

		
			
			
			
	} // <- END document.ready() function
);


