Cufon.replace('#mainNav li', { fontFamily: 'Futura', hover: true });
Cufon.replace('#mainNavRu li', { fontFamily: 'FuturaTCYMedCon', hover: true });
$(document).ready(function() {
  var d = new Date();
  //ARRIVAL
  // initialise the "Select date" link
	$('#date-pick')
		.datePicker(
			// associate the link with a date picker
			{

				createButton:false,
				startDate:d.getDate()+'/'+( d.getMonth()+1)+'/'+d.getFullYear(),
				endDate:'31/12/2050'
			}
		).bind(
			// when the link is clicked display the date picker
			'click',
			function()
			{
				updateSelects($(this).dpGetSelected()[0]);
				$(this).dpDisplay();
				return false;
			}
		).bind(
			// when a date is selected update the SELECTs
			'dateSelected',
			function(e, selectedDate, $td, state)
			{
				updateSelects(selectedDate);
			}
		).bind(
			'dpClosed',
			function(e, selected)
			{
				updateSelects(selected[0]);
			}
		);

	var updateSelects = function (selectedDate)
	{
		var selectedDate = new Date(selectedDate);
		$('#d option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
		$('#m option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
		$('#y option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
	}
	// listen for when the selects are changed and update the picker
	$('#d, #m, #y')
		.bind(
			'change',
			function()
			{
				var d = new Date(
							$('#y').val(),
							$('#m').val()-1,
							$('#d').val()
						);
				$('#date-pick').dpSetSelected(d.asString());
			}
		);

	// default the position of the selects to today
	var today = new Date();
	updateSelects(today.getTime());

	// and update the datePicker to reflect it...
	$('#d').trigger('change');
  //--------ARRIVAL:END

  //LEAVE
  // initialise the "Select date" link
	$('#date-pick2')
		.datePicker(
			// associate the link with a date picker
			{
				createButton:false,
				startDate:(d.getDate()+1)+'/'+( d.getMonth()+1)+'/'+d.getFullYear(),
				endDate:'31/12/2050'
			}
		).bind(
			// when the link is clicked display the date picker
			'click',
			function()
			{
				updateSelects2($(this).dpGetSelected()[0]);
				$(this).dpDisplay();
				return false;
			}
		).bind(
			// when a date is selected update the SELECTs
			'dateSelected',
			function(e, selectedDate, $td, state)
			{
				updateSelects2(selectedDate);
			}
		).bind(
			'dpClosed',
			function(e, selected)
			{
				updateSelects2(selected[0]);
			}
		);

	var updateSelects2 = function (selectedDate)
	{
		var selectedDate2 = new Date(selectedDate);
		$('#d2 option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
		$('#m2 option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
		$('#y2 option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
	}
	// listen for when the selects are changed and update the picker
	$('#d2, #m2, #y2')
		.bind(
			'change',
			function()
			{
				var d = new Date(
							$('#y2').val(),
							$('#m2').val()-1,
							$('#d2').val()
						);
				$('#date-pick2').dpSetSelected(d.asString());
			}
		);

	// default the position of the selects to today
	var today = new Date();
	updateSelects(today.getTime());

	// and update the datePicker to reflect it...
	$('#d2').trigger('change');
  //LEAVE:END





		venytys();
		$('a#searchBtn').click(function(){
			document.searchFormMain.submit();
		});
		$('a#searchBtnRu').click(function(){
			document.searchFormMain.submit();
		});
		$('a#searchBtnEn').click(function(){
			document.searchFormMain.submit();
		});
    $('#ticker').cycle({
  		fx: 'fade'
  	});
  	$('#videoListScroller').cycle({
  		fx: 'scrollLeft',
      speed: 800, // transition speed
      timeout: 4000, // wait
      slideExpr: 'li',
  		prev: '#videoListScrollLeft',
  		next: '#videoListScrollRight'
  	});
  	$('#videoListScroller').cycle('pause');

	/*var options = {
  		newsList: "#ticker01",
               tickerRate: 40,
 		startDelay: 10,
 		placeHolder1: " |",
 		placeHolder2: " |"
	}
	$().newsTicker(options);*/

            var borderTaulukko = $('table.rowsBorders tr:odd');

            if(borderTaulukko)
            {
                $(borderTaulukko).addClass('row');
            }
	});
	var helvetica = {
		src: 'fonts/helvetica.swf'
	};
	// Apply the Highslide settings
	// 904355fd2514169c6697c8defdcbe91f
  hs.graphicsDir = 'img/highslide/';
  hs.align = 'center';
  hs.wrapperClassName = 'wide-border';
  hs.transitions = ["expand", "crossfade"];
  hs.dimmingOpacity = 0.75;
  hs.dimmingDuration = 100;
  hs.outlineType = null;
  hs.outlineType = 'rounded-white';
  hs.lang = {
  	moveText : '',
  	closeText : 'Sulje',
  	closeTitle : 'Sulje (esc)'
  };
  hs.width = 660;
  hs.height = 450;
  hs.showCredits = false;

