// JavaScript Document


$(function() { 
			function urlencode(str) {
				str = str.replace(/ /g, '+');
				return str;
			}


		function sportXMLURL(sport, turnir, period, tim) {
			window.location = 'http://www.sport.ba/rezultati/' + urlencode(sport) + '/' + urlencode(turnir) + '/' + period + '/' + tim;
									//		Ko%9Aarka/Kvalifikacije+Europsko+prvenstvo/1
		}
		
			$("#btn_trazi").bind('click',function() {
																					sportXMLURL($("#sport_select").val(), $("#turnir_select").val(), $("#period_select").val(), $("#txt_tim").val());
																								});
															
			$("#sport_select").bind('change',function() {
																					$("#turnir_select").val("");
																					sportXMLURL($("#sport_select").val(), $("#turnir_select").val(), $("#period_select").val(), $("#txt_tim").val());
																								});



			$("#turnir_select").bind('change',function() {
																					sportXMLURL($("#sport_select").val(), $("#turnir_select").val(), $("#period_select").val(), $("#txt_tim").val());
																								});

			

			$("#period_select").bind('change',function() {
																					sportXMLURL($("#sport_select").val(), $("#turnir_select").val(), $("#period_select").val(), $("#txt_tim").val());
																								});
			
			$("#sportxml_form").bind('submit',function() {
																					sportXMLURL($("#sport_select").val(), $("#turnir_select").val(), $("#period_select").val(), $("#txt_tim").val());
																	 return false;
																	 });
			

});


