/**
 * Speak UP - js v 1.0 Autor: Jakub Woźniak kubix.net.pl
 */
function jumper(url) {
	window.location.href = url;
}
/* Opera */
function bookmarksite(title, url) {
	if (window.sidebar) { // firefox
		window.sidebar.addPanel(title, url, "");
	} else if (window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href', url);
		elem.setAttribute('title', title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	} else if (document.all) {// ie
		window.external.AddFavorite(url, title);
	}
}

$(document).ready(function() {

	// hide
		$('.new-window').css('display', 'none');
		$('.jobBoxContentText').css('display', 'none');
		$('.map_region').css('display', 'none');

		$('.gMapRegion').toggle(function() {
			$(this).css('font-weight', 'bold');
			var shools = $(this).parent();
			shools.children('ul').slideDown();

			return false;
		}, function() {
			$(this).css('font-weight', 'normal');
			var shools = $(this).parent();
			shools.children('ul').slideUp();
			return false;
		});

		$('.cityClick').toggle(function() {
			$(this).parent().parent().children('.sectionThreads').slideDown();
			$(this).removeClass('rozwinGreyButton');
			$(this).addClass('zwinGreyButton');
			return false;
		}, function() {
			$(this).parent().parent().children('.sectionThreads').slideUp();
			$(this).removeClass('zwinGreyButton');
			$(this).addClass('rozwinGreyButton');
			return false;
		});

		$('.rozwinGreyButton').toggle(
				function() {
					$(this).parent().parent().parent().children(
							'.jobBoxContentText').slideDown();
					$(this).parent().parent().children('.aplikuj-div')
							.children('.new-window').show();
					$(this).removeClass('rozwinGreyButton');
					$(this).addClass('zwinGreyButton');
					return false;
				},
				function() {
					$(this).parent().parent().parent().children(
							'.jobBoxContentText').slideUp();
					$(this).parent().parent().children('.aplikuj-div')
							.children('.new-window').hide();
					$(this).removeClass('zwinGreyButton');
					$(this).addClass('rozwinGreyButton');
					return false;
				});

		$('#city-select').change(
				function() {
					var current_city = $(this).val();

					$(".jobBoxContentText").each(
							function() {
								if ($(this).hasClass(current_city)) {

									$(this).slideDown();
									$(this).parent()
											.children('.greyNormalFont')
											.children('.aplikuj-div').children(
													'.new-window').show();
									var button = $(this).parent().children(
											'.greyNormalFont').children(
											'.aplikju-button')
											.children('input');
									button.removeClass('rozwinGreyButton');
									button.addClass('zwinGreyButton');
								} else {
									$(this).slideUp();
									$(this).parent()
											.children('.greyNormalFont')
											.children('.aplikuj-div').children(
													'.new-window').hide();
									var button = $(this).parent().children(
											'.greyNormalFont').children(
											'.aplikju-button')
											.children('input');
									button.removeClass('zwinGreyButton');
									button.addClass('rozwinGreyButton');
								}
							});
				});

		$('#position-select').change(
				function() {
					var current_position = $(this).val();

					$(".jobBoxContentText").each(
							function() {
								if ($(this).hasClass(current_position)) {

									$(this).slideDown();
									$(this).parent()
											.children('.greyNormalFont')
											.children('.aplikuj-div').children(
													'.new-window').show();
									var button = $(this).parent().children(
											'.greyNormalFont').children(
											'.aplikju-button')
											.children('input');
									button.removeClass('rozwinGreyButton');
									button.addClass('zwinGreyButton');
								} else {
									$(this).slideUp();
									$(this).parent()
											.children('.greyNormalFont')
											.children('.aplikuj-div').children(
													'.new-window').hide();
									var button = $(this).parent().children(
											'.greyNormalFont').children(
											'.aplikju-button')
											.children('input');
									button.removeClass('zwinGreyButton');
									button.addClass('rozwinGreyButton');
								}
							});
				});

		$(function() {
			$('a.new-window').click(function() {
				window.open(this.href);
				return false;
			});
		});

	});
