document.observe('dom:loaded', function() {
 
  // Ajax calendar get
 /* $('avail_open').observe('click', function(event) {
    event.stop();
	Lightview.show({
	  href: 'http://www.suffolkcottageholidays.com/availability/generateAvailability/'+propID,
	  rel: 'ajax',
	  title: aCotName,
	  options: {
	    autosize: true,
	    ajax: {
		  onComplete: function(){
		    // once the request is complete we observe the submit button
			$('avail_open_next').observe('click', nextLink);
			$('avail_open_prev').observe('click', prevLink);
			Lightview.updateViews();
			}
	    } 

	  }
	 });
  });

*/

function nextLink(event) {
	event.stop();
	var smnext = document.getElementById('smnext').firstChild.nodeValue;
	var synext = document.getElementById('synext').firstChild.nodeValue;
	Lightview.show({
		href: 'http://www.suffolkcottageholidays.com/availability/generateAvailability/'+propID+'/'+smnext+'/'+synext,
		rel: 'ajax',
		title: aCotName,
		options: {
		autosize: true,
		ajax: {
		  onComplete: function(){
		    // once the request is complete we observe the submit button
			$('avail_open_next').observe('click', nextLink);
			$('avail_open_prev').observe('click', prevLink);
			Lightview.updateViews();
			}
	    } 
		}
		});
	}
	
function prevLink(event) {
	event.stop();
	var smprev = document.getElementById('smprev').firstChild.nodeValue;
	var syprev = document.getElementById('syprev').firstChild.nodeValue;
	Lightview.show({
		href: 'http://www.suffolkcottageholidays.com/availability/generateAvailability/'+propID+'/'+smprev+'/'+syprev,
		rel: 'ajax',
		title: aCotName,
		options: {
		autosize: true,
		ajax: {
		  onComplete: function(){
		    // once the request is complete we observe the submit button
			$('avail_open_next').observe('click', nextLink);
		    $('avail_open_prev').observe('click', prevLink);
			Lightview.updateViews();
			}
	    } 
		}
		});
	}
	

	

  // Ajax prices get
  $('prices_open').observe('click', function(event) {
    event.stop();
	Lightview.show({
	  href: 'http://www.suffolkcottageholidays.com/availability/generatePrices/'+propID,
	  rel: 'ajax',
	  title: cotName,
	  options: {
	    autosize: true
	    } 

	 });
  });

// Ajax google map
$('map_open').observe('click', function(event) {
event.stop();
Lightview.show({
  href: 'http://www.suffolkcottageholidays.com/map/cotMap/'+longitude+'/'+latitude,
  rel: 'iframe',
  title: 'Location Map',
  options: {
    width:620,
    height:420
    } 

 });
});

document.observe('Lightview:opened', function() {
	Lightview.updateViews();
	});
	
});

