function addCarouselHovers()
{
	var carButton1 = $('carousel_previos_buy')
	carButton1.observe("mouseover", function() { carButton1.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton1.observe("mouseout", function() { carButton1.style.backgroundPosition = '0 0'; }.bind(this))
	var carButton2 = $('carousel_next_buy')
	carButton2.observe("mouseover", function() { carButton2.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton2.observe("mouseout", function() { carButton2.style.backgroundPosition = '0 0'; }.bind(this))

	var carButton3 = $('carousel_previos_rent')
	carButton3.observe("mouseover", function() { carButton3.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton3.observe("mouseout", function() { carButton3.style.backgroundPosition = '0 0'; }.bind(this))
	var carButton4 = $('carousel_next_rent')
	carButton4.observe("mouseover", function() { carButton4.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton4.observe("mouseout", function() { carButton4.style.backgroundPosition = '0 0'; }.bind(this))

	var carButton5 = $('carousel_previos_holiday')
	carButton5.observe("mouseover", function() { carButton5.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton5.observe("mouseout", function() { carButton5.style.backgroundPosition = '0 0'; }.bind(this))
	var carButton6 = $('carousel_next_holiday')
	carButton6.observe("mouseover", function() { carButton6.style.backgroundPosition = '-32px 0'; }.bind(this))
	carButton6.observe("mouseout", function() { carButton6.style.backgroundPosition = '0 0'; }.bind(this))
}


/* some Indian code START */

function triggerTabs(id,n)	{
	$('listingIframe').setStyle('display:inline');
	$('tab'+id).className='selected';
		for(var i=1;i<=n;i++)	{
			if(i!=id)	{
				$('tab'+i).className='';
			}
		}
}

function closeTabsHide(n)	{
	$('listing').setStyle('display:none');
	$('listingIframe').setStyle('display:none');
	for(var i=1;i<=n;i++)	{
		$('tab'+i).className='';
	}
}

function closeTabs(n)	{
	if(RegExp('MSIE 6', 'i').test(navigator.appVersion))
		$('listing').setStyle('display:none');
	else
		Element.slideUp('listing');
	$('listingIframe').setStyle('display:none');
	for(var i=1;i<=n;i++)	{
		$('tab'+i).className='';
	}
}
function getPageSize(){
       
        var xScroll, yScroll;
       
        if (window.innerHeight && window.scrollMaxY) {
                xScroll = document.body.scrollWidth;
                yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
        }
       
        var windowWidth, windowHeight;
        if (self.innerHeight) { // all except Explorer
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
        }
       
        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
                pageHeight = windowHeight;
        } else {
                pageHeight = yScroll;
        }

        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){
                pageWidth = windowWidth;
        } else {
                pageWidth = xScroll;
        }


        arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
        return arrayPageSize;
}

function getPageScroll(){

        var yScroll;

        if (self.pageYOffset) {
                yScroll = self.pageYOffset;
        } else if (document.documentElement && document.documentElement.scrollTop){      // Explorer 6 Strict
                yScroll = document.documentElement.scrollTop;
        } else if (document.body) {// all other Explorers
                yScroll = document.body.scrollTop;
        }

        arrayPageScroll = new Array('',yScroll)
        return arrayPageScroll;
}

function getPageSize() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}
	
function openDiv(divId)
{

	var arrayPageSize = this.getPageSize();
    $('ContactBox').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' })
	
	var arrayPageScroll = document.viewport.getScrollOffsets();
    var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
    var lightboxLeft = arrayPageScroll[0];
    $('ContactBoxFormDiv').setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' })
	
	$(divId).style.display='block';	
	$('ContactBoxFormDiv').style.display='block';
	hide_dropdowns('in');
	scrollEvent();
}
function closeDiv(divId)
{
	hide_dropdowns('out');
	$(divId).style.display='none';
	$('ContactBoxFormDiv').style.display='none';
}

document.observe('loaded', function(){document.loaded = true; window.onscroll = scrollEvent;})

function scrollEvent() {
 
   /*var arrayPageSize = getPageSize();
   var arrayPageScroll = getPageScroll();
   if($('ContactBox') != null)
		$('ContactBox').style.top=arrayPageScroll[1]+'px';
   if(Element.up($('ContactBoxFormDiv')).id == 'middle_content')
      $('ContactBoxFormDiv').style.top=arrayPageScroll[1] + (arrayPageSize[3] / 15) - 100 +'px';
   else	
      $('ContactBoxFormDiv').style.top=arrayPageScroll[1] + (arrayPageSize[3] / 15) - 250 +'px';*/
}

function hide_dropdowns(what) {
	if(what=="in"){
		if(document.getElementById('arrow_right'))
		{
			Element.hide('arrow_left'); Element.hide('arrow_right');
		}
		var anchors = document.getElementsByTagName("select");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			anchor.style.visibility='hidden';
		}
	}else{
		if(document.getElementById('arrow_right'))
		{
			Element.show('arrow_left'); Element.show('arrow_right');
		}
		var anchors = document.getElementsByTagName("select");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			anchor.style.visibility='visible';
		}
	}
}

/* some Indian code END */






var oldLink = null;
function setActiveStyleSheet(link, title) {	
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (oldLink) oldLink.style.fontWeight = 'normal';
  oldLink = link;
  link.style.fontWeight = 'bold';
  return false;
}
// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled.  In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here.  However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function showFlatCalendar(id, holder, format, selectedHandler) {
  var prnt = document.getElementById(holder);
  var element = document.getElementById(id);
  // construct a calendar giving only the "selected" handler.
  var cal = new Calendar(0, null, selectedHandler);
  // hide week numbers
  cal.setDateFormat(format);
  cal.weekNumbers = false;
  cal.create(prnt);
  cal.parseDate(element.value);
  cal.show();
}

function addRow(rtype)
	{
		var newRow = document.getElementById('editTable').insertRow(-1);
		var newCell1 = newRow.insertCell(0);
		var newCell = newRow.insertCell(0);
		//var newRow1 = document.getElementById('editTable').insertRow(-1);	

		//var val_box_width = 250;
	
		if(rtype== 'fav')
		{
			newCell.innerHTML = "<input type=text name=data[UserFavourite][name][] value=''>";
			newCell1.innerHTML = "<input type=text name=data[UserFavourite][value][] value=''>";
		} 
		else {
			newCell.innerHTML = "<input type=text name=data[UserFavourite][new_name][] value=''>";
			newCell1.innerHTML = "<input type=text name=data[UserFavourite][new_value][] value='' style=\"width:250px\">";
		}
	}

function checkFileType(ftype,fname)
{
	var imgTypes = new Array('jpeg','png','gif','jpg');
	var videoTypes = new Array('wmp','mpeg','mpg','avi','flv','wmv','WMV');
	extArray = fname.split('.');
	ext = extArray[extArray.length - 1];
	if(ftype == 'video') {
		for(i=0;i<videoTypes.length;i++) {
			if(videoTypes[i] == ext)
			  return true;
		}
		return false;
	} else if(ftype == 'image') {
		for(i=0;i<imgTypes.length;i++) {
			if(imgTypes[i] == ext)
			  return true;
		}
		return false;
	}
}

function checkCheckBox(objfrm){
	len = objfrm.elements.length;
	var i=0;
	var flag=false;
	for( i=0 ; i<len ; i++){
		if (objfrm.elements[i].type=='checkbox')
		{	
			if(objfrm.elements[i].checked==true)
			{
				flag=objfrm.elements[i].checked;
			}
		}
	}
	return flag;
}

function hideScrollBar()
{
	if(document.documentElement && document.documentElement.scrollTop)
	{
		var oTop = document.documentElement.scrollTop;
		document.documentElement.scroll = "no";
		document.documentElement.style.overflow = "hidden";
		document.documentElement.scrollTop = oTop;
	   
	} else if(document.body)
	{
		var oTop = document.body.scrollTop;
		document.body.scroll = "no";
		document.body.style.overflow = "hidden";
		document.body.scrollTop = oTop;
	}
}

function showScrollBar()
{
	if(document.documentElement && document.documentElement.scrollTop)
	{
		document.documentElement.scroll = "";
		document.documentElement.style.overflow = "visible";
	} else if(document.body)
	{
		document.body.scroll = "";
		document.body.style.overflow = "visible";
	}
}   