$(document).ready(function(){

	// stabilisco variabili //
	
	var deviceAgent = navigator.userAgent.toLowerCase();
	var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
	var hashes = window.location.href.slice(window.location.href.indexOf('#') + 1)
		
	var ImmagineNext=0;
	var ImmaginePrev=0;
	
	var avanzo_orizzontale = 0;
	var avanzo_verticale = 0;
	
	var OpenSliding=false;
	
	// stabilisco variabili //
	
	$(".gallery span,.gallery br").remove();
	$("#HowToNavigate").fadeOut("0")
	$("#PleaseRotate").fadeOut("0")
	
	$(".Rollover>.Over").css("opacity", "0");
	$('.Text').slideToggle("0");
	$('#Fullscreen').fadeOut("0");
	
	$("#HowToNavigate .Container").css("height", $(window).height()-85)
	$("#HowToNavigate .Container .Scrollbar").css("height", $(window).height()-103)
	
	$('#Scrollbar1, #Scrollbar2, #Scrollbar3, #Scrollbar4, #Scrollbar5, #Scrollbar6, #Scrollbar7, #Scrollbar8, #Scrollbar9, #Scrollbar10, #Scrollbar_Gallery').tinyscrollbar();
	
	$(".Image").prepend('<img src="wp-content/themes/orciani/images/rollover_img.png" alt="" class="Over"/>').append('<div class="segnaposto"></div>')
	$(".Buy").prepend('<img src="wp-content/themes/orciani/images/rollover_img.png" alt="" class="Over"/>').append('<div class="segnaposto"></div>')
	$(".Video").prepend('<img src="wp-content/themes/orciani/images/rollover_video.png" alt="" class="Over"/>').append('<div class="segnaposto"></div>')
	
	$(".Rollover>.Over").css("opacity","0")
	
	$(".gallery-icon a").prepend('<img src="wp-content/themes/orciani/images/rollover_img.png" alt="" class="Over"/>').append('<div class="segnaposto"></div>')
	
	$(".gallery-icon a>.Over").css('opacity', 0);
	
	Cufon.replace('.FuturaStd', {hover:true});
	Cufon.replace('h3, h4, .ReadMore, #Language');
	
	$('#BigImage>.Center>.BuyNow, #BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeOut("0");
	
	// posiziona div all'apertura //
	
	if(hashes=="1"){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*(hashes-1))}, 0);
				
		var numero=hashes;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 0);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 0);
		}
		
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	}else if(hashes=="2"){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*(hashes-1))}, 0);
				
		var numero=hashes;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 0);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 0);
		}
		
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	}else if(hashes=="3"){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*(hashes-1))}, 0);
				
		var numero=hashes;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 0);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 0);
		}
		
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	}else if(hashes=="4"){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*(hashes-1))}, 0);
				
		var numero=hashes;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 0);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 0);
		}
		
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	}else{
		
	}
	
	// posiziona div all'apertura //
	
	$('#live-demo').fbWall({
		id:'192141070816301',
		accessToken:'AAAC7gAoWDQ0BAGcjmjaC3ndL6OkkNmM4RrGzKmf8CtzruCrqvNDZAuQddzsRkg9t978EQU9zaFZAzuLpoqlZCnjpZCvLQgZANSnXTpmxLbgZDZD',
		showGuestEntries:false,
		showComments:false,
		max:10,
		timeConversion:12
	})
	
	$("#HowTo").click(function(e){
		$('#BigImage').stop().animate({"height": "0px"}, 500, function(){
			$("#HowToNavigate").fadeIn(500)
			
			$('#SlidingPanel').animate({height: "0"}, 500, function(){
				OpenSliding=false;
				
			});
			
			OpenSliding=false;
			$('#QuickNavigation').removeClass('Open').addClass('Close')
		});
	})
	
	$("#Contact").click(function(e){
		$('#ContactDiv').stop().animate({"height": 587 + "px"}, 500);
	})
	
	$("#B2b").click(function(e){
		$('#B2bDiv').stop().animate({"height": 587 + "px"}, 500);
		e.preventDefault();
	})
	
	$("#HowToNavigate").click(function(e){
		$("#HowToNavigate").fadeOut(500)
	})
	$("#Container").css("height", $(window).height()-100)
	$(window).resize(function(e){
		$("#Container").css("height", $(window).height()-100)
		$("#HowToNavigate .Container").css("height", $(window).height()-85)
		$("#HowToNavigate .Container .ScrollbarIta").css("height", $(window).height()-103)
		$("#HowToNavigate .Container .ScrollbarEng").css("height", $(window).height()-103)
	})
	
    $('#live-demo').resize(function(e){
		$('#Scrollbar1').tinyscrollbar_update();
	});
	
	$('#Scrollbar_Gallery .Overview').resize(function(e){
		$('#Scrollbar_Gallery').tinyscrollbar_update();
	});
	
	$(".gallery-icon a").hover(
		function(){
			if($(this).find('.attachment-medium').attr("title")=="vuoto"){
				
			}else{
				$(this).find('.Over').stop().animate({"opacity": 1}, 500);
				$(this).find('.attachment-medium').stop().animate({"opacity": .5}, 500);
			}
		},
		function(){
			if($(this).find('.attachment-medium').attr("title")=="vuoto"){
				
			}else{
				$(this).find('.Over').stop().animate({"opacity": 0}, 500);
				$(this).find('.attachment-medium').stop().animate({"opacity": 1}, 500);
			}
		}
	);
	
	// chiusura immagini - video - buy //
	
    $("#BigImage>.Center>.Close").click(function(e){
  		$("#BigImage>.Center>.Content").fadeIn("0");
		$('#BigImage').stop().animate({"height": "0px"}, 500, function(){
			$('#BigImage>.Center>.BuyNow, #BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeOut("0");
			$("#BigImage>.Center>.Content, #BigImage>.Center>.Footer, #BigImage>.Center>.Article").empty();
		});
		e.preventDefault();
	})
	
	$("#ContactDiv>.Center>.Close").click(function(e){
		$('#ContactDiv').stop().animate({"height": "0px"}, 500, function(){
			$('#BigImage>.Center>.BuyNow, #BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeOut("0");
			$("#BigImage>.Center>.Content, #BigImage>.Center>.Footer, #BigImage>.Center>.Article").empty();
		});
		e.preventDefault();
	})
	
	$("#B2bDiv>.Center>.Close").click(function(e){
		$('#B2bDiv').stop().animate({"height": "0px"}, 500, function(){
			$('#BigImage>.Center>.BuyNow, #BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeOut("0");
			$("#BigImage>.Center>.Content, #BigImage>.Center>.Footer, #BigImage>.Center>.Article").empty();
		});
		e.preventDefault();
	})
	
	// chiusura immagini - video - buy //
	
	// apertura immagini - video - buy //
	
	$(".Video").click(function(e){
		$('#BigImage>.Center>.BoxWhite').fadeOut("0");
		
		if($('#BigImage').height()==0){
			$("#BigImage>.Center>.Content").stop().animate({"height": "646px"}, 500);
			$('#BigImage').stop().animate({"height": "653px"}, 500, function(){
				$('#BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeIn("500");
			});
			
			$("#BigImage>.Center>.Content").append('<iframe src="http://player.vimeo.com/video/'+$(this).attr("href")+'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff" width="700" height="394" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
		
			$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
			$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
		}else{
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Article").fadeOut("500")
			$("#BigImage>.Center>.Content").children().fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").stop().animate({"height": "646px"}, 500);
				$('#BigImage').stop().animate({"height": "653px"}, 500);
				$("#BigImage>.Center>.Content").append('<iframe src="http://player.vimeo.com/video/'+NewImmagine+'?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff" width="700" height="394" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
			})
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").fadeIn(0)
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
			})
		}
		
		e.preventDefault();
	})
	
	$(".Buy").click(function(e){
		$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).attr("title"))
		
		/*if($(this).attr("title")==undefined){
			$("#BigImage>.Center>.BuyNow").fadeOut("250")
		}else{
			$("#BigImage>.Center>.BuyNow").fadeIn("250")
			$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).attr("title"))
		}*/
		
		if($('#BigImage').height()==0){
			$('#BigImage>.Center>.Content, #BigImage>.Center>.Footer').empty();
			$('#BigImage').stop().animate({"height": "100px"}, 500);
			$('#BigImage>.Center>.Content').stop().animate({"height": "93px"},500);
		
			$("#BigImage>.Center>.Article").html($(this).find('.ImageAlpha').attr("title"))
			Cufon.refresh();
			
			$("#BigImage>.Center>.Content").append('<img src="'+$(this).attr("href")+ '?' + (new Date()).getTime() +'" alt=""/>')
			$("#BigImage>.Center>.Content>img").css("opacity", "0");
			$("#BigImage>.Center>.Content>img").load(function(){
				$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
				$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
				$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+"px"}, 500);
				
				$('#BigImage>.Center>.Article, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeIn("500");
			});
			
			$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
			$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
			
			e.preventDefault();
		}else{
			var ArticleName=$(this).find('.ImageAlpha').attr("title")
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html(ArticleName)
				Cufon.refresh();
			})
			
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Content").children().fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", "0");
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
					
					$("#BigImage>.Center>.Article").fadeIn("500")
				})
			})
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(500);
			})
			
			e.preventDefault();
		}
	})
	
	$(".Image").click(function(e){
		//$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).find('.ImageAlpha').attr("alt"))
		
		if($('#BigImage').height()==0){
			$('#BigImage>.Center>.Content, #BigImage>.Center>.Footer').empty();
			$('#BigImage').stop().animate({"height": "100px"}, 500);
			$('#BigImage>.Center>.Content').stop().animate({"height": "93px"},500);
			
			Cufon.refresh();
			
			$("#BigImage>.Center>.Content").append('<img src="'+$(this).attr("href")+ '?' + (new Date()).getTime() +'" alt=""/>')
			$("#BigImage>.Center>.Content>img").css("opacity", "0");
			$("#BigImage>.Center>.Content>img").load(function(){
				$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
				$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
				$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+"px"}, 500);
				
				$('#BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeIn("500");
			});
			
			$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
			$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
			
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			e.preventDefault();
		}else{
			var ArticleName=$(this).find('.ImageAlpha').attr("title")
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html(ArticleName)
				Cufon.refresh();
			})
			
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Content").children().fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", "0");
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
				})
			})
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(500);
			})
			
			e.preventDefault();
		}
	})
	
	$("#Scrollbar_Gallery .Article a").click(function(e){
		/*if($(this).find('.attachment-medium').attr("alt")==$(this).find('.attachment-medium').attr("title")){
			$("#BigImage>.Center>.BuyNow").fadeOut("250")
		}else{
			$("#BigImage>.Center>.BuyNow").fadeIn("250")
			$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).find('.attachment-medium').attr("alt"))
		}*/
		
		if($('#BigImage').height()==0){
			$('#BigImage>.Center>.Content, #BigImage>.Center>.Footer').empty();
			$('#BigImage').stop().animate({"height": "100px"}, 500);
			$('#BigImage>.Center>.Content').stop().animate({"height": "93px"},500);
		
			ImmagineNext=$(this).parent().parent().index()+1;
			ImmaginePrev=$(this).parent().parent().index()-1;
			
			$("#BigImage>.Center>.Article").html($(this).find('.attachment-medium').attr("title"))
			Cufon.refresh();
			
			$("#BigImage>.Center>.Content").append('<img src="'+$(this).attr("href")+ '?' + (new Date()).getTime() +'" alt=""/>')
			$("#BigImage>.Center>.Content>img").css("opacity", "0");
			$("#BigImage>.Center>.Content>img").load(function(){
				$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
				$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
				$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+"px"}, 500);
				
				$('#BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeIn("500");
			});
			
			$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
			$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
			
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"))
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"))
			
			e.preventDefault();
		}else{
			ImmagineNext=$(this).parent().parent().index()+1;
			ImmaginePrev=$(this).parent().parent().index()-1;	
			
			var ArticleName=$(this).find('.attachment-medium').attr("title")
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html(ArticleName)
				Cufon.refresh();
			})
			
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Content>img").fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", "0");
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content").children().stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
					
					$("#BigImage>.Center>.Article").fadeIn("500")
				})
			})
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(500);
			})
			
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"))
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"))
			
			e.preventDefault();
		}
	})
	
	$("#Scrollbar_Gallery .Press a").click(function(e){	
		if($('#BigImage').height()==0){
			$('#BigImage>.Center>.Content, #BigImage>.Center>.Footer').empty();
			$('#BigImage').stop().animate({"height": "100px"}, 500);
			$('#BigImage>.Center>.Content').stop().animate({"height": "93px"},500);
		
			ImmagineNext=$(this).parent().parent().index()+1;
			ImmaginePrev=$(this).parent().parent().index()-1;
			
			//$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).attr("title"))
			$("#BigImage>.Center>.Article").html($(this).find('.attachment-medium').attr("alt"))
			Cufon.refresh();
			
			$("#BigImage>.Center>.Content").append('<img src="'+$(this).attr("href")+ '?' + (new Date()).getTime() +'" alt=""/>')
			$("#BigImage>.Center>.Content>img").css("opacity", "0");
			$("#BigImage>.Center>.Content>img").load(function(){
				$("#BigImage>.Center>.Content>img").stop().animate({"opacity": "1"}, 500);
				$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
				$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+"px"}, 500);
				
				$('#BigImage>.Center>.Article, #BigImage>.Center>.Next, #BigImage>.Center>.Prev, #BigImage>.Center>.Footer, #BigImage>.Center>.Close').fadeIn("500");
			});
			
			$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+$(this).attr("href")+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
			$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+$(this).attr("href")+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
			
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"))
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"))
			
			e.preventDefault();
		}else{
			ImmagineNext=$(this).parent().parent().index()+1;
			ImmaginePrev=$(this).parent().parent().index()-1;	
			
			//$("#BigImage>.Center>.BuyNow>a").attr("href", $(this).attr("title"))
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html($(this).find('.attachment-medium').attr("alt"))
				Cufon.refresh();
			})
			
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Content>img").fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", "0");
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content").children().stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
					
					$("#BigImage>.Center>.Article").fadeIn("500")
				})
			})
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(500);
			})
			
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"))
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"))
			
			e.preventDefault();
		}
	})
	
	// apertura immagini - video - buy //
	
	// frecce destra - sinistra //
	
	$("#BigImage>.Center>.Next>a").click(function(e){
		if(ImmagineNext==$(".gallery-item").size()+1){
		
		}else{
		
			/*if($(".gallery-item:nth-child("+ImmagineNext+")").find('.attachment-medium').attr("alt")==$(".gallery-item:nth-child("+ImmagineNext+")").find('.attachment-medium').attr("title")){
				$("#BigImage>.Center>.BuyNow").fadeOut("250")
			}else{
				$("#BigImage>.Center>.BuyNow").fadeIn("250")
				$("#BigImage>.Center>.BuyNow>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+")").find('.attachment-medium').attr("alt"))
			}*/
					
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html($(".gallery-item:nth-child("+(ImmagineNext-1)+")").find('.attachment-medium').attr("title"));
				Cufon.refresh();
			})
			
			$("#BigImage>.Center>.Content>img").fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", 0);
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content").children().stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
					
					$("#BigImage>.Center>.Article").fadeIn("500")
				})
			})
		
			ImmagineNext=ImmagineNext+1;
			ImmaginePrev=ImmaginePrev+1;
			
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"));
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"));
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(0);
			})
		}
		e.preventDefault();
	})
	
	$("#BigImage>.Center>.Prev>a").click(function(e){
		if(ImmaginePrev==-1){

		}else{
		
			/*if($(".gallery-item:nth-child("+ImmaginePrev+")").find('.attachment-medium').attr("alt")==$(".gallery-item:nth-child("+ImmaginePrev+")").find('.attachment-medium').attr("title")){
				$("#BigImage>.Center>.BuyNow").fadeOut("250")
			}else{
				$("#BigImage>.Center>.BuyNow").fadeIn("250")
				$("#BigImage>.Center>.BuyNow>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+")").find('.attachment-medium').attr("alt"))
			}*/
					
			var NewImmagine=$(this).attr("href");
			
			$("#BigImage>.Center>.Article").fadeOut("500", function(){
				$("#BigImage>.Center>.Article").html($(".gallery-item:nth-child("+(ImmaginePrev+1)+")").find('.attachment-medium').attr("title"));
				Cufon.refresh();
			})
			
			$("#BigImage>.Center>.Content>img").fadeOut(500, function(){
				$("#BigImage>.Center>.Content").empty();
				$("#BigImage>.Center>.Content").append('<img src="'+NewImmagine+ '?' + (new Date()).getTime() +'" alt=""/>');
				$("#BigImage>.Center>.Content>img").css("opacity", 0);
				$("#BigImage>.Center>.Content>img").load(function(){
					$("#BigImage>.Center>.Content").children().stop().animate({"opacity": "1"}, 500);
					$("#BigImage>.Center>.Content").stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+"px"}, 500);
					$('#BigImage').stop().animate({"height": $("#BigImage>.Center>.Content>img").height()+7+ "px"}, 500);
					
					$("#BigImage>.Center>.Article").fadeIn("500")
				})
			})
		
			ImmagineNext=ImmagineNext-1;
			ImmaginePrev=ImmaginePrev-1;			
					
			$("#BigImage>.Center>.Next>a").attr("href", $(".gallery-item:nth-child("+ImmagineNext+") a").attr("href"));
			$("#BigImage>.Center>.Prev>a").attr("href", $(".gallery-item:nth-child("+ImmaginePrev+") a").attr("href"));
			
			$("#BigImage .Footer").fadeOut(500, function(){
				$("#BigImage .Footer").empty();
				$("#BigImage .Footer").append('<iframe src="//www.facebook.com/plugins/like.php?href='+NewImmagine+'&amp;t=test;&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=143903002372612" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:21px;" allowTransparency="true"></iframe><br>');
				$("#BigImage .Footer").append('<iframe class="twitter-share-button twitter-count-horizontal" scrolling="no" frameborder="0" allowtransparency="true" src="https://platform.twitter.com/widgets/tweet_button.html#_=1324036902618&_version=2&count=horizontal&enableNewSizing=false&id=twitter-widget-12&lang=en&original_referer=https%3A%2F%2Fdev.twitter.com%2Fdocs%2Ftweet-button&size=m&text=ORCIANI%20SS%202012%20-%20&url="'+NewImmagine+'"&via=your_screen_name" style="width: 110px; height: 20px;" title="Twitter Tweet Button">');
				$("#BigImage .Footer").fadeIn(500);
			})
		}
		e.preventDefault();
	})
	
	// frecce destra - sinistra //
	
	$(".Rollover").hover(
		function(){
			$(this).find('.Over').stop().animate({"opacity": 1}, 500);
			$(this).find('.ImageAlpha').stop().animate({"opacity": .5}, 500);
		},
		function(){
			$(this).find('.Over').stop().animate({"opacity": 0}, 500);
			$(this).find('.ImageAlpha').stop().animate({"opacity": 1}, 500);
		}
	);
	
	$(".Video").hover(
		function(){
			$(this).find('.attachment-news-Thumb').stop().animate({"opacity": .5}, 500);
		},
		function(){
			$(this).find('.attachment-news-Thumb').stop().animate({"opacity": 1}, 500);
		}
	);
	
	$('#SlideMenu li').click(function(){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*($(this).attr('title')-1))}, 1500);
				
		var numero=$(this).attr('title');
		
		window.location = "#"+numero;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 1500);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 1500);
		}
		
		$(this).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	})
	
	$('.PositionBig').click(function(e){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*($(this).attr('title')-1))}, 1500);
		
		var numero=$(this).attr('title');
		
		var str = numero;
		var substr = str.split('*');
		
		if(substr[0]==""){
			window.location = "#"+numero;
		}else if(substr[0]==numero){
			window.location = "#"+numero;
		}else{
			window.location = substr[0]+"/#"+substr[1];
		}
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 1500);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 1500);
		}
		
		$(this).addClass('Selected');
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		if(OpenSliding==false){
			$('#SlidingPanel').animate({height: "350px"}, 500, function(){
				OpenSliding=true;
			});
			//$('#QuickNavigation').append('<a href="#" class="Open"><?php _e("<!--:en-->CLOSE MENU<!--:--><!--:it-->CHIUDI MENU<!--:-->"); ?></a></a>')
			$('#QuickNavigation').removeClass('Close').addClass('Open')
		}else{
			$('#SlidingPanel').animate({height: "0"}, 500, function(){
				OpenSliding=false;
			});
			$('#QuickNavigation').removeClass('Open').addClass('Close')
			//$('#QuickNavigation').append('<a href="#" class="Open"><?php _e("<!--:en-->OPEN MENU<!--:--><!--:it-->APRI MENU<!--:-->"); ?></a></a>')
		}
		
		Cufon.refresh();
		e.preventDefault();
	})
	
	
	$('.NumberColumn').click(function(){
		$('#SlideMenu li').removeClass('Selected');
		$('.PositionBig').removeClass('Selected');
		
		$('#Sliding').animate({marginLeft: (-1005*($(this).attr('title')-1))}, 1500);
		
		
		var numero=$(this).attr('title');
		window.location = "#"+numero;
		
		if(numero==4){
			$('#Position').animate({marginLeft: 18*(numero-1), width: 4}, 1500);
		}else{
			$('#Position').animate({marginLeft: 18*(numero-1), width: 15}, 1500);
		}
		
		$('#Number'+numero).addClass('Selected');
		$('#NumberBig'+numero).addClass('Selected');
		
		Cufon.refresh();
	})
	
	
	$('.ReadMore').click(function(){
		var ScrollBarSelected = $(this).parent().parent().parent().parent().parent().attr("id");
		
		$(this).parent().find('.Text').slideToggle('slow', function(){
			$('#'+ScrollBarSelected).tinyscrollbar_update();
			$('#'+ScrollBarSelected).tinyscrollbar_scroll();
  		});
	})
	
	$('#QuickNavigation').click(function(){
		if(OpenSliding==false){
			$('#SlidingPanel').animate({height: "350px"}, 500, function(){
				OpenSliding=true;
			});
			//$('#QuickNavigation').append('<a href="#" class="Open"><?php _e("<!--:en-->CLOSE MENU<!--:--><!--:it-->CHIUDI MENU<!--:-->"); ?></a></a>')
			$('#QuickNavigation').removeClass('Close').addClass('Open')
		}else{
			$('#SlidingPanel').animate({height: "0"}, 500, function(){
				OpenSliding=false;
			});
			$('#QuickNavigation').removeClass('Open').addClass('Close')
			//$('#QuickNavigation').append('<a href="#" class="Open"><?php _e("<!--:en-->OPEN MENU<!--:--><!--:it-->APRI MENU<!--:-->"); ?></a></a>')
		}
	})
	
	if (agentID) {
	
	}else{
		$('#Scrollbar1, #Scrollbar2, #Scrollbar3, #Scrollbar4, #Scrollbar5, #Scrollbar6, #Scrollbar7, #Scrollbar8, #Scrollbar9, #Scrollbar10, #Scrollbar_Gallery').hover(
			function(){
				if($(this).find(".Overview").height()<$(this).find(".Viewport").height()){
		
				}else{
					$(this).find('.Scrollbar').stop().animate({"opacity": 1}, 500);
				}
			},
			function(){
				if($(this).find(".Overview").height()<$(this).find(".Viewport").height()){
		
				}else{
					$(this).find('.Scrollbar').stop().animate({"opacity": 0}, 500);
				}
			}
		);
	}
	
	if (agentID) {
		window.onorientationchange = detectIPadOrientation;
		detectIPadOrientation();
		
		function detectIPadOrientation () {
			if ( orientation == 0 ) {
				$("#PleaseRotate").fadeIn("500")
				//alert ('Portrait Mode, Home Button bottom');
			}else if ( orientation == 90 ) {
				$("#PleaseRotate").fadeOut("500")
				//alert ('Landscape Mode, Home Button right');
			}else if ( orientation == -90 ) {
				$("#PleaseRotate").fadeOut("500")
				//salert ('Landscape Mode, Home Button left');
			}else if ( orientation == 180 ) {
				$("#PleaseRotate").fadeIn("500")
				//alert ('Portrait Mode, Home Button top');
    		}
 		}
 	}else{
 	
 	}
	
	jQuery.fn.oneFingerScroll = function() {
		var scrollStartPos = 0;
		
		$(this).bind('touchstart', function(event) {
			var e = event.originalEvent;
			scrollStartPos = $(this).scrollTop() + e.touches[0].pageY;
		});
		
		$(this).bind('touchmove', function(event) {
			var e = event.originalEvent;
			$(this).scrollTop(scrollStartPos - e.touches[0].pageY);
			e.preventDefault();
		});
		
		return this;
	};
	
	if (agentID) {
 		$('#Scrollbar1 .Viewport, #Scrollbar2 .Viewport, #Scrollbar3 .Viewport, #Scrollbar4 .Viewport, #Scrollbar5 .Viewport, #Scrollbar6 .Viewport, #Scrollbar7 .Viewport, #Scrollbar8 .Viewport, #Scrollbar9 .Viewport, #Scrollbar_Gallery .Viewport').oneFingerScroll();
	}else{
	
	}
});
