$(document).ready(function(){
    $('#eventCalendarMonth').jqueryCal({
        xmlPath: '',
        noEvents: 'нет событий',
        monthText: ' ',
        getXMLmonthly: true,
        toolTipBigPrev: "Предыдущий год",
        toolTipSmallPrev: "Предыдущий месяц",
        toolTipSmallNext: "Следующий месяц",
        toolTipBigNext: "Следующий год"
    });
   //load city by partners
	  $("select#partners-country").change(function(){
    $.getJSON("/partners/show/cityajaxpartners",{countryId: $(this).val()}, function(j){
      var options = '';
      for (var i = 0; i < j.length; i++) {
        options += '<option value="' + j[i].cityId + '">' + j[i].cityName + '</option>';
      }
      $("select#partners-city").html(options);
    })
  })
  function fillCity(){
    $.getJSON("/partners/show/cityajax",{countryId: $("select#country").val()}, function(j){
      var options = '';
      $( "#cityName" ).autocomplete({
        source: j,
        minLength: 3
      })});
  }
  //pre fill city
  fillCity();
  //load all city by counry id
  $("select#country").change(function(){
    $( "#cityName" ).val('');
    fillCity();
  });
  //date picker shows
  //$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd' });
	  $('input.datepicker').datepicker({
		  	yearRange: '-60:+5',
			changeMonth: true,
			changeYear: true,
			dateFormat: 'yy-mm-dd'
		});
	  //$("img").fullsize({shadow: false, iconOffset: 2, extraTrigger: ".myClass", parentSteps: 2});
	  $('input#youtub_id').change(function() {
		  var newVal = "javascript:openpopup('/administration/servis/watch/youtubeId/" + $('input#youtub_id').val() + "')";
		  $(".watch-video").attr("href", newVal);
	  });
})

