function do_calendar()
{
	$("#cal_inline").datepicker({
		showStatus: false,
		changeFirstDay: false,
		changeMonth: false,
		changeYear: false,
		firstDay: 1,
		prevText: '',
		nextText: '',
		dayNamesMin: ['D', 'L', 'M', 'M', 'G', 'V', 'S'],
		monthNames: ['Gennaio','Febbraio','Marzo',
		'Aprile','Maggio','Giugno','Luglio','Agosto',
		'Settembre','Ottobre','Novembre','Dicembre'],
		onSelect: function(date) {
			var dateFmt = date.substring(6, 10) + date.substring(0, 2) + date.substring(3, 5)
			window.location = "/cmlink/cremonaonline/eventi-e-spettacoli/eventi-calendario?date=" + dateFmt;
		}
	});
};

function do_search_and_video()
{
	var v = $(".video").parent(".teaser");
	v.addClass('videoTeaser');
};

function do_fixBottom()
{
  if (jQuery.browser.msie) {
    var borderAll = $('body > .borderLayout');
    var totHeight = 0;
    var columns = ['.borderLayoutMastHead', '.borderLayout.topheader'];
    for (var idx = 0; idx < columns.length; idx++) {
      var c = columns[idx];
      totHeight += $(c).height();
    }
    var maxHeight = 0;
    var columns = ['#col1', '#col3', '#col4'];
    for (var idx = 0; idx < columns.length; idx++) {
      var c = columns[idx];
      var h = $(c).height();
      if (h > maxHeight) {
        maxHeight = h;
      }
    }
    totHeight += maxHeight;
    if (totHeight > 200) {
      borderAll.height(totHeight);
    }
  }	
};

function do_fixMangia()
{
	if (jQuery.browser.mozilla) {
		$('.TabellaContenutomangiaanustraanLayout_before').remove();
	}
	$('.article_select_list').each(function(i){
		$(this).change(function(){
			var url = $(this).val();
			if (url && url != "") {
				location.href = url;
			}
		});
	});
}; // do_fixMangia

function do_layout_customization()
{
	do_search_and_video();
	do_calendar();
    do_fixBottom();
	do_fixMangia();
};


$(document).ready(do_layout_customization);