function addFav() {
if (document.all)
window.external.AddFavorite('http://www.skok24.com.pl', 'SKOK24');
else if (window.sidebar)
window.sidebar.addPanel('SKOK24', 'http://www.skok24.com.pl', "")

}

function updateCitiesList(val) {
  getCitiesList();
  getAmountInProvince();
}

function setATMCityInput (city_name) {

  var d = new Array(new Array("Brak danych", ""));

		$.ajax({
			   url: "/modules/atm-atmsList.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: {'action': 'input', id: city_name },
			   beforeSend: function() 	{	},
			   success: function(json)	{ ( document.getElementById("mapa6") ).atmList(json.value); },
			   error: function(json)	  { ( document.getElementById("mapa6") ).atmList(json.value);  }
			});

}

function setATMCity (city_id) {

  var d = new Array(new Array("Brak danych", ""));

		$.ajax({
			   url: "/modules/atm-atmsList.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: {'action': 'city', id: city_id },
			   beforeSend: function() 	{	},
			   success: function(json)	{ ( document.getElementById("mapa6") ).atmList(json.value); },
			   error: function(json)	  { ( document.getElementById("mapa6") ).atmList(json.value);  }
			});

}

function setATMProvince (province_id) {

  var d = new Array(new Array("Brak danych", ""));

		$.ajax({
			   url: "/modules/atm-atmsList.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: {'action': 'province', id: province_id },
			   beforeSend: function() 	{	},
			   success: function(json)	{	( document.getElementById("mapa6") ).atmList(json.value); },
			   error: function(json)	  { ( document.getElementById("mapa6") ).atmList(json.value);  }
			});

}

function getCitiesList () {

  var d = new Array(new Array("Brak danych", ""));

		$.ajax({
			   url: "/modules/atm-citiesList.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: { },
			   beforeSend: function() 	{	},
			   success: function(json)	{	( document.getElementById("mapa6") ).changeCitiesList(json.value); },
			   error: function(json)	  { ( document.getElementById("mapa6") ).changeCitiesList(json.value);  }
			});

}

function getAmountInProvince () {

  var d = new Array(new Array(null, 0));

		$.ajax({
			   url: "/modules/atm-ProvincesAmountList.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: { },
			   beforeSend: function() 	{	},
			   success: function(json)	{	(document.getElementById("mapa6")).changeProvincesList(json.value); },
			   error: function(json)	  { (document.getElementById("mapa6")).changeProvincesList(json.value);  }
			});

}

function gotoCity(id_value) {

  window.location = "/wyszukiwarka/" + id_value;

}

function showFaqItem(id) {

  if (faq_arr_status[id] == 1) {

    $("#item" + id).hide("slow").removeClass("faq_answerON");
    $("#linkItem" + id).removeClass("faq_linkon");
    faq_arr_status[id] = 0;

  } else {

    $("#linkItem" + id).addClass("faq_linkon");
    $("#item" + id).addClass("faq_answerON").show("slow");

    faq_arr_status[id] = 1;

  }

}

function hideAllFaqItems() {

  for(i=0;i<faq_arr_status.length;i++) {

    $("#linkItem" + i).removeClass("faq_linkon");
    $("#item" + i).hide("slow").removeClass("faq_answerON");

    faq_arr_status[i] = 0;

  }

}

function showAllFaqItems() {

  for(i=0;i<faq_arr_status.length;i++) {

    $("#item" + i).addClass("faq_answerON").show("slow");

    faq_arr_status[i] = 1;

  }

}

function getOn(obj)

	{

	var oSrc = obj.src;

	obj.src = oSrc.substring(0,oSrc.indexOf('-')) + '-o.png';

	}

function getOff(obj)

	{

	var oSrc = obj.src;

	obj.src = oSrc.substring(0,oSrc.indexOf('-')) + '-f.png';

	}

function showAllGoogleMapsPreview()

	{

	var googlePreview = window.open('/googleMapsPreview.php?action=all', 'googlePreview', 'left=200, top=100, width=550, height=550, menubar=no, statusbar=no, toolbar=no, scrollbars=no, resizable=yes'); //, menubar=no, statusbar=no, toolbar=no, scrollbars=no


	}

function showGoogleMapsPreview(geo_h, geo_w, id)

	{

	var googlePreview = window.open('/googleMapsPreview.php?geo_h=' + geo_h + '&geo_w='+geo_w+'&id=' + id, 'googlePreview', 'left=200, top=100, width=550, height=550, menubar=no, statusbar=no, resizable=yes, toolbar=no, scrollbars=no'); //, menubar=no, statusbar=no, toolbar=no, scrollbars=no


	}

function refreshpg()

  {

  history.go(0);

  }

function sendMail(name, phone, mail, content)

	{

	if ($("#frmContact").valid()) {

		var oldValue = $("#divContact").html();

		$.ajax({
			   url: "/modules/sendMail.php",
			   type: "POST",
			   timeout: 15000,
			   dataType: "json",
			   data: { name: name, phone: phone, mail: mail, content: content, oldValue: oldValue },
			   beforeSend: function() 	{	$("#divContact").html('<p class="info">Trwa wysyłanie danych z formularza ...</p>');},
			   success: function(json)	{	$("#divContact").html(json.content); back2OriginalContent('divContact', '');},
			   error: function(json)	  { $("#divContact").html(json.status); back2OriginalContent('divContact', ''); }
			});

		}

	}


function back2OriginalContent(div, content)

	{

  if (content == '') {
  
    setTimeout("refreshpg()", 3000);

  } else {

      $("#" + div)
        .animate({opacity: 1.0}, 3000)
        .fadeOut('slow', function() { $("#" + div).html(content); })
        .fadeIn('slow', function() { $("#" + div).html(content); });

  }

  }

