
$(function(){
  $("#menu-by-type").corner("16px cc:#f8f8f8");
  $("#menu-by-sort").corner("16px cc:#f8f8f8");
  $("#menu-weather").corner("16px cc:#f8f8f8");
  

  if($("#contentleft").height() > $("#contentright").height()) {
        $("#contentright").height($("#contentleft").height())
    }
    if($("#contentleft").height() < $("#contentright").height()) {
        $("#contentleft").height($("#contentright").height())
    }	
  $("#sectionmainimage").corner("16px cc:#f8f8f8");
  $("#detailimage").corner("16px cc:#f8f8f8");    
  $("#detail-google-map").corner("16px cc:#f8f8f8");
  
  
  
  $.fn.jweather = function(options) {
    var me = $(this);
	$.ajax({
        type: "GET",
	    url: "/xmlpocasi",
	    dataType: "xml",
	    success: function(xml) {
		 var ocode = '';
		 $(xml).find('den').each(function(){
             ocode += '<div class="weatherday">';
			 ocode += '<div class="weatherdayheading">'+$(this).attr('slovem')+':</div>';
			 $(this).find('teplota').each(function(){
			   ocode += '<div class="weathertempday"><strong>Teplota přes den: '+$(this).attr('den')+'&ordm;</strong></div>';
			   ocode += '<div class="weathertempnight">&nbsp;&nbsp;&nbsp;&nbsp; <strong>V noci: '+$(this).attr('noc')+'&ordm;</strong></div>';
			 })
			 ocode += '<div class="clearboth"></div>';
			 $(this).find('stav').each(function(){
			   var convname = $(this).text();
			   if (convname=='zatazeno') convname = 'Zataženo';
			   if (convname=='oblacno') convname = 'Oblačno';
			   if (convname=='skorojasno') convname = 'Skorojasno';
			   if (convname=='jasno') convname = 'Jasno';
			   if (convname=='obcasny-dest') convname = 'Občasný déšť';
			   if (convname=='prehanky-snih-dest') convname = 'Přeháňky-Sníh-Déšť';
			   var daynight = '-day';
			   var textday = 'Přes den ';
			   if ($(this).attr('id')=='noc') daynight = '-night';
			   if ($(this).attr('id')=='noc') textday = 'V noci ';
			   if ($(this).attr('id')=='rano') textday = 'Ráno ';
			   if ($(this).attr('id')=='dopoledne') textday = 'Dopoledne ';
			   if ($(this).attr('id')=='odpoledne') textday = 'Odpoledne ';
			   ocode += '<div class="watherstate watherstate'+$(this).text()+daynight+'" >'+textday+'</div>';
			 })		 
			 ocode += '<div class="clearboth"></div>';
			 ocode += '</div>';
         });
		 me.html(ocode);
		if($("#contentleft").height() > $("#contentright").height()) {
			$("#contentright").height($("#contentleft").height())
		}				 
 	  }  
    })
	return true;
  }

  $("#weatherel").jweather();

  
});

