/** Site redirect
 * if (location.href.indexOf('znanylekarz.pl') == -1) { location.href = location.href.replace(/^http:\/\/www\.znanylekarz\.[a-z]{2,3}\//, 'http://www.znanylekarz.pl/'); }
 */
function urlencode(str) {
  return encodeURIComponent(str).replace(/%20/g, "+");
}

$(document).ready(
	function ()
	{
		if ($.browser.msie && $.browser.version < 7)
		{
			$('#main-browse li').hover(
				function () { $(this).addClass('hover'); },
				function () { $(this).removeClass('hover'); }
			);
		}

/*		$('#form-search').submit(
				function ()
				{
					var foo = $('input#input-search', this).val();
					foo = ISO88592Escape(foo);
					location.href = '/ranking-lekarzy/' + foo;
					return false;
				}
		);
*/

		$('#form-search').submit(
				function ()
				{

//                        	$.get("/echo.php", { urlencode: $('input#input-search').val() },
//                        	function(data){

					var link=$('#form-search').attr('action');

/*					var w = $("#form-search select[name='w']").find(":selected").attr('title');
					if (w.length>0) {
					    link=link+"/"+w;
					}

					var s = $("#form-search select[name='s']").find(":selected").attr('title');
					if (s.length>0) {
					    link=link+"/"+s;
					}
*/
          var data=$('input#input-search').val();
					if (data.length>0) {
                                            link=link + "/" + urlencode(data);
                                        }

					location.href = link;

//				});	
			    return false;

			    }
		);





/*	
		$('#form-search').submit(
			function ()
			{
				if ($('#input-search').val().length > 0) this.submit();
				else
				{
					$('#input-search').animate(
							{ opacity: 0.3 },
							{ queue: true, duration: 100 }
						).animate(
							{ opacity: 1 },
							{ queue: true, duration: 100 }
						).animate(
							{ opacity: 0.3 },
							{ queue: true, duration: 100 }
						).animate(
							{ opacity: 1 },
							{ queue: true, duration: 100 }
						).animate(
							{ opacity: 0.3 },
							{ queue: true, duration: 100 }
						).animate(
							{ opacity: 1 },
							{ queue: true, duration: 100 }
						).focus();
					return false;
				}			
			}
		);
*/	

		$('#input-search').focus();
	
		/*$('#button-search').attr('style', 'display: inline;').click(
			function ()
			{
				$('#form-search').submit();
			}
		);*/
		
		$('#main-browse li:even').addClass('even');
		
		$('a[rel="external"]').attr('target', '_blank');

	}
);