// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


document.observe("dom:loaded", function() {
  // the element in which we will observe all clicks and capture
  // ones originating from pagination links
  var container = $(document.body);

  if (container) {

     container.observe('click', function(e) {
      var el = e.element();
      if (el.match('#paging a')) {
        //document.getElementById('to_render_comm').innerHTML = "<div id='loader_div' class='loader'><img src='/images/ajax_loader.gif' /><br/><br/><b>Ucitavanje</b></div>";
        new Ajax.Request(el.href, { method: 'get' });
        e.stop();
      }
	 

    })
  }
})



function ShowStreetView(lng, lat, y, p) {

	var fenwayPark = new GLatLng(lng,lat);
	
	myPOV = {yaw:y,pitch:p};
	svOpts = {latlng:fenwayPark, pov:myPOV};
	var myPano = new GStreetviewPanorama(document.getElementById("map"), svOpts);
	GEvent.addListener(myPano, "error", handleNoFlash);
}

 
function handleNoFlash(errorCode) {
  if (errorCode == 603) {
    alert("Error: Flash doesn't appear to be supported by your browser");
    return;
  }
}



var cal_to_update = 'filter_from';
var acal_to_update = 'acalfrom';


function ManipulateIndexCalFrom() {
	document.getElementById('home_page_calendar_from').style.display = 'block';
	cal_to_update = 'filter_from';
	a_cal_to_update = 'acalfrom';
}

function ManipulateIndexCalFromR() {
	document.getElementById('home_page_calendar_from').style.display = 'block';
	cal_to_update = 'request_arrival';
	a_cal_to_update = 'acalfrom';
}

function ManipulateIndexCalTo() {
	document.getElementById('home_page_calendar_to').style.display = 'block';
	cal_to_update = 'filter_to';
	a_cal_to_update = 'acalto';
}

function ManipulateIndexCalToR() {
	document.getElementById('home_page_calendar_to').style.display = 'block';
	cal_to_update = 'request_departure';
	a_cal_to_update = 'acalto';
}

function ManipulateCalImg(id,cnt,mon,year) {
	document.getElementById(a_cal_to_update).innerHTML = cnt;
	document.getElementById(a_cal_to_update).style.background = "url('/okvir/kalendar/" + mon + ".gif')";
	document.getElementById(cal_to_update).value = year;
	document.getElementById(id).style.display = 'none';
}