
	var ContentHeight=360;
	
	function PreLoader(){
 		var i = 0;
     	imageObj = new Image();
		images 	= new Array();
     	images[0]="http://s2t.it/img/tit_chi.png";
     	images[1]="http://s2t.it/img/tit_contatti.png";
     	images[2]="http://s2t.it/img/tit_grafica.png";
     	images[3]="http://s2t.it/img/tit_home.png";
     	images[4]="http://s2t.it/img/tit_hosting.png";
     	images[5]="http://s2t.it/img/tit_portfolioweb.png";
     	images[6]="http://s2t.it/img/tit_servizi.png";
     	for(i=0; i<=6; i++){
			imageObj.src=images[i];
     	}
	} 	
	
	function RightFromSubStringToEndOfFullString(fullString, subString) { 
		if (fullString.lastIndexOf(subString) == -1) { 
			return ""; 
		} 
		else { 
			return fullString.substring(fullString.lastIndexOf(subString)+1, fullString.length); 
		} 
	}

	function SetHeight(dt){
		NewHeight=$(window).height()-dt;
		$("#pages").css({'min-height':NewHeight});
	}		


	$(window).bind("load", function() {
		SetHeight(ContentHeight);				
	});	
		
	$(window).bind("resize", function() {
		SetHeight(ContentHeight);		
	});
	
	PreLoader();
	
	$(document).ready(function(){
	
		PathName = window.location.pathname;
		DocName 	= RightFromSubStringToEndOfFullString(PathName,'/');
		DocName 	= DocName.toLowerCase();

		SetHeight(ContentHeight);
		
		$("a[rel=external]").click(function(){
      	window.open(this.href);
       	return false;
   	});

		$("#slider").easySlider({
			auto: true,
			continuous: true,
			controlsShow: false,
			pause: 4000
		});
		
		$("#news").load('news.html');
		
				
		
		switch(DocName){
			case 'index.html':{				
				$("#titolo").hide();						
				$("#titolo").slideDown('slow');	
				break;
			}

			case 'portfolio_web.html':{
				$("#titolo").slideDown('slow');		
				$("div.scrollable").scrollable({
					vertical:true, 
					size: 2
				}).mousewheel().circular().autoscroll({autoplay: true, steps: 1});				
				break;
			}

			case 'portfolio_grafica.html':{
				$("#titolo").slideDown('slow');
				$("div.scrollable").scrollable({
					vertical:true, 
					size: 2
				}).mousewheel().circular().autoscroll({autoplay: true, steps: 1});						
				break;
			}

  				
			default:{
				$("#titolo").slideDown('slow');		
				break;
			}  
		}

		
	});

