// JavaScript Document

var supports = (function() {
   var div = document.createElement('div'),
      vendors = 'Khtml Ms O Moz Webkit'.split(' '),
      len = vendors.length;

   return function(prop) {
      if ( prop in div.style ) return true;

      prop = prop.replace(/^[a-z]/, function(val) {
         return val.toUpperCase();
      });

      while(len--) {
         if ( vendors[len] + prop in div.style ) {
            // browser supports box-shadow. Do what you need.
            // Or use a bang (!) to test if the browser doesn't.
            return true;
         } 
      }
      return false;
   };
})();




document.viewAllB= false;
document.viewZommed= false;

if (!document.viewZommed) document.pos_h = 250;
else  document.pos_h = 350;
		
function viewAll(h){

if (!document.viewZommed) document.pos_h = 250;
else  document.pos_h = 350;


		


		var a=document.getElementById("slider");
		document.count = 1;
		$("#elenco_slider").animate({
						top:0
					}, 250, "swing");	
				
				
		
		if (document.viewAllB){
			// chiudere
				$("#slider").animate({
					height:document.pos_h
				}, 250, "swing");
				
				$('#create').addClass("link_menu").removeClass("link_menu_on");
				$('#see_all').attr('class','slider_tool_btn');
				
			}
		else {
			// aprire
				$("#slider").animate({
				height:h + 20 
				}, 500, "swing");
				 $('#create').addClass("link_menu_on").removeClass("link_menu");
				$('#scrll_dwn').attr('class','slider_off_btn');
				$('#scrll_up').attr('class','slider_off_btn');
				$('#see_all').attr('class','slider_on_btn');
			
			}
		
			document.viewAllB = !document.viewAllB;
			toolSlider()
}



document.count = 1;
 
function scrll(dir) {

		var tot_righe = document.tot_righe;
			
	if (dir == "dwn" && !document.viewAllB) {	
	
		if (!document.viewZommed) var pos_top = "-=247px";
		else  var pos_top = "-=330px";
	
		if ( document.count < tot_righe && !document.viewAllB){
					document.count++
					$("#elenco_slider").animate({
						"top": pos_top
					}, 250, "swing");		
								
		}
		
	}
	else if (dir == "up" && !document.viewAllB) {
		
		
		if (!document.viewZommed) var pos_top = "+=247px"
		else  var pos_top = "+=330px"
		
		if (document.count > 1 && !document.viewAllB){
			
			document.count--
				
				$("#elenco_slider").animate({
					"top": pos_top
				}, 250, "swing");		
				
			}
		
	}
		 toolSlider()
	
}
	
	
	
function toolSlider() {
				
				
			var h = $("#elenco_slider").height() ;
			var a = h/document.pos_h;
			var tot_righe = Math.ceil(a);
			
			document.tot_righe = tot_righe;
	
	if  (document.count == 1  && tot_righe >1  && !document.viewAllB){
			$('#scrll_dwn').attr('class','slider_tool_btn');
			$('#scrll_up').attr('class','slider_off_btn');
	}
	else if  (document.count == tot_righe  && tot_righe >1  && !document.viewAllB){
				$('#scrll_dwn').attr('class','slider_off_btn');
				$('#scrll_up').attr('class','slider_tool_btn');
	}
	else if  (tot_righe == 1  && !document.viewAllB){
				$('#scrll_dwn').attr('class','slider_off_btn');
				$('#scrll_up').attr('class','slider_off_btn');
	}
	else {
			if(!document.viewAllB){					
				$('#scrll_dwn').attr('class','slider_tool_btn');
				$('#scrll_up').attr('class','slider_tool_btn');
			}
	}
	
	
}
	
	
	
	function zoomCreate(){
				
				if (!document.viewZommed){
					document.viewZommed = true;
					$('.work_small').removeClass('work_small').addClass('work_big');
					$('.img_work_small').removeClass('img_work_small').addClass('img_work_big');
					$('.autors').removeClass('autors_small').addClass('autors_big');
					$('.title_work').removeClass('title_work_small').addClass('title_work_big');
				}
				else {
						document.viewZommed = false;
						$('.work_big').removeClass('work_big').addClass('work_small');
						$('.img_work_big').removeClass('img_work_big').addClass('img_work_small');
						$('.autors').removeClass('autors_big').addClass('autors_small');
				                $('.title_work').removeClass('title_work_big').addClass('title_work_small');
					}
		 toolSlider()
		}
	

	
