
$(document).ready(function(){
	//setWeather();//on load/reload
	//setweather from jQuery.valentinApps is used now
	$('#country').change(setWeather);//on change
    ////////////////////////////// init
	$.valentinApps.init();
    setModul();
    setP_A();
    //////////////////// submit
    $('#submit_div').click(function(event){
        $.valentinApps.calculate('/calculation/pvonline/pv_system/calculation');
    });
    ////////////////// P_A //////////////////////////

     $('#area_div').click(setP_A);
 	
	function setP_A(){
		if ($("input[@name='pa']:checked").val() === 'p') {
			p_input = "p";
			$("#select_area").hide();
			$("#select_power").show();
			
		}
		else {
			p_input = "a";
			$("#select_power").hide();
			$("#select_area").show();
			$('#pa').html("m�");
			
		}
	};
    ////////////////// Modul ////////////////
    $("#modul").change(setModul);
    function setModul(){
 var modul="/calculation/pvonline/img/modul_"+$("#modul option:selected").val()+".jpg";
		 	$('#modul_img').attr("src",modul);
    }
    
    //////////////////lang///////////////////////
 $('#lang_div').click(setLang);
 
 function setLang(){
 	if ($("input[@name='l']:checked").val() === 'de') {
 		window.location.href = "/calculation/pvonline/pv_system/de";
                   please='Bitte Berechnung starten';
 	}
 	else 
 		if ($("input[@name='l']:checked").val() === 'en') {
 			window.location.href = "/calculation/pvonline/pv_system/en";
                        please='please start the calculation';
 		}
 }
 ///////////////////// setWeather ///////////////////////
function setWeather()
{
 var country='country='+$('#country').val();

 $.ajax(
 {
 type:"POST",
 url:"/calculation/pvonline/pv_system/getWeatherFiles",

 data:country,
  success: function(msg){
  $("#city").html(msg);
  }
 }
 
 );
}
    

   
});
