// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$.fn.supersized.options = {  
	startwidth: 902,  
	startheight: 443,
	vertical_center: 1,
	slides : [
		{image : '/images/hotel_torre_fiore_at_night.jpg' }
	]
};

$(document).ready(function() {
  
  $('#slides').bxGallery({
  		maxwidth: '650',              // if set, the main image will be no wider than specified value (in pixels)
  		thumbwidth: 35,           // thumbnail width (in pixels)
  		thumbcrop: true,          // if true, thumbnails will be a perfect square and some of the image will be cropped
  		croppercent: .12,          // if thumbcrop: true, the thumbnail will be scaled to this 
  								   // percentage, then cropped to a square
  		thumbplacement: 'bottom',  // placement of thumbnails (top, bottom, left, right)
  		thumbcontainer: '',        // width of the thumbnail container div (in pixels)
  		opacity: .8,               // opacity level of thumbnails           // if set, text will display while images are loading
  		load_image: '/images/loading.png',
  		                           // image to display while images are loading
  		wrapperclass: 'outer'      // classname for outer wrapping div
  	});
  	
  	if ($.browser.msie && $.browser.version=="6.0") {
  	  $('#supersized').supersized();
  	} else {
      $('#supersized').supersized();
  	}
  
    $("#nyt-article-toggle").toggle();
    
    $("#it-trans").click(function(){
      var new_u = window.location.href + "/it" ;
      if ((new_u == "http://localhost:3000//it") || (new_u == "http://torrefiore.com//it") || (new_u == "http://hoteltorrefiore.com//it") || (new_u == "http://torrefiorehotel.com//it") ) {
        window.location.replace(window.location.href + "it");
      } else {
        window.location.replace(window.location.href + "/it");
      }
    })
    
    $("#en-trans").click(function(){
      var href = window.location.href;
      var end_p = href.lastIndexOf("/it");
      window.location.replace(href.substring(0,end_p));
    })
  	
});

