//========

// position of the tooltip relative to the mouse in pixel //
var offsetx = 20;
var offsety =  -60;

function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);
function getmouseposition(e)
{
    if(document.getElementById)
    {
        var iebody=(document.compatMode && 
        	document.compatMode != 'BackCompat') ? 
        		document.documentElement : document.body;
        pagex = (isapple == 1 ? 0:(ie5)?iebody.scrollLeft:window.pageXOffset);
        pagey = (isapple == 1 ? 0:(ie5)?iebody.scrollTop:window.pageYOffset);
        mousex = (ie5)?event.x:(ns6)?clientX = e.clientX:false;
        mousey = (ie5)?event.y:(ns6)?clientY = e.clientY:false;

        var lixlpixel_tooltip = document.getElementById('tooltip');
        offsetx = 20; if(mousex>500){offsetx=- 325};
        offsety = 20;if(mousey>350){offsety=-30};
        lixlpixel_tooltip.style.left = (mousex+pagex+offsetx) + 'px';
        lixlpixel_tooltip.style.top = (mousey+pagey+offsety) + 'px';
    }
}
function tooltip(tip)
{
    if(!document.getElementById('tooltip')) newelement('tooltip');
    var lixlpixel_tooltip = document.getElementById('tooltip');
    lixlpixel_tooltip.innerHTML = tip;
    lixlpixel_tooltip.style.display = 'block';
    document.onmousemove = getmouseposition;
}
function exit()
{
    document.getElementById('tooltip').style.display = 'none';
}



  function remote(mod,target) {
  new Ajax.Updater(target,'/ajax.php?'+mod+'', {asynchronous:true, evalScripts:false, onComplete:function(request){Element.hide('indicator');}, onLoading:function(request){Element.show('indicator')}});
  }





function actab(tab) {
document.getElementById("tab1").className = 'tab';
document.getElementById("tab2").className = 'tab';

tab.className='tab activeTab';
}

//map controllers
function NextLimit() {
limit = limit + nlimit;
//alert (limit);
this.coords = coords.split('|');
getMarkers(this.coords[0],this.coords[1],2,limit);
}

function retById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}


function paginate(show,hide) {
//alert ('way:'+way+',pid:'+pid+',hide:'+hide+'');

var div = retById('page'+hide);
div.style.display = 'none';

 
div = retById('page'+show);
div.style.display = 'block';

current_page = show;
}
  function GetParameters(location) {
  this.name=location.getAttribute("name");
  this.mapref=location.getAttribute("mapref");
  this.lat=location.getAttribute("lat");
  this.lng=location.getAttribute("lng");
  this.desc=location.getAttribute("desc");
  this.star=location.getAttribute("star");
  this.loc=location.getAttribute("loc");
  this.town=location.getAttribute("town");
  this.inc=location.getAttribute("inc");
  this.type=location.getAttribute("type");
return this;
}

function click(i) {
markers[i].openInfoWindowHtml(markers[i].infowindow);
}

function CreateBox(par) {
 //ajax/property_brief/        
var ret = '<div class="map_box"><table class="map_box_t" cellspacing="0" cellpadding="0" border="0"><tr><td colspan="2" height="15" valign="top"><strong>'+par.town+'</strong>&nbsp;&nbsp;<img  src="/static/ss'+par.star+'.png"/></td></tr><tr><td valign="top" class="map_box_i"><a href="property?mapref='+par.mapref+'" ><img  border="0"class="map_img" src="http://hotelsabroad.eu/thumbs/p'+par.mapref+'_0.jpg"/></a></td><td class="map_box_d" valign="top"><a href="property?mapref='+par.mapref+' ">'+par.name+'</a>: '+par.desc+'<a href="property?mapref='+par.mapref+' ">..&raquo;</a> </td></tr>';

if (eval(par.cost)>0) {
ret += '<tr><td class="map_box_p" colspan="2" valign="top" align="left">Cost for 1 x Night<br> in '+par.type+' arriving 2009-1-27 is <b>&pound;'+par.cost+'</b>.<br>';

if (par.inc != null) {
 ret += 'Price Includes '+par.inc+'.';
 } 
}



ret += '</td></tr></table></div>';


return ret;
}



/* -------------- Getting the markers ------------- */


<!-- Author Declan Kelly        -->
//

err=false;
estimate=''; //Used to show user what cost will be
quote='';    //used to build msg to send to friend
request='';  //used to itemize request.
totalcost=0;

var today     = new Date();
var thisMonth = today.getMonth();
var thisYear  = y2k(today.getYear());

function makeint(string){
var s;
s=0;
if (string.length == 0) return s;
for (var i=0;i < string.length;i++)
   if ((string.substring(i,i+1) >= '0') && (string.substring(i,i+1) <= '9'))
         s+= string.substring(i,i+1);
 return s*1;
 }
function goTo(form)
   {
   var myindex=form.dest.selectedIndex;
   location.href=form.dest.options[myindex].value+'.htm';
   return false;
   }

if (document.images){
  bim=new Image; bim.src='assets/bim.gif';
  bam=new Image; bam.src='assets/bam.gif';
  }

function swap(Target,Source){
  if(document.images){
    iTarget=eval('document.'+Target);
    iSource=eval(Source);
    iTarget.src=iSource.src;
    }
  }

var months = new MakeArray(13);
months[1]='Jan'; months[2]='Feb'; months[3]='Mar';
months[4]='Apr'; months[5]='May'; months[6]='Jun';
months[7]='Jul'; months[8]='Aug'; months[9]='Sept';
months[10]='Oct';months[11]='Nov';months[12]='Dec';

//alert(  document.cookie);
function addBookmark(name,ref)
{
  <!--
  bookmarkurl = 'http://www.hotels-in-madrid.co.uk/'+ref;
  bookmarktitle = "Bookmark: "+name;
  if (document.all) {
    window.external.AddFavorite(bookmarkurl,bookmarktitle);
    location.href=bookmarkurl;
  }
}


validChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_ ";

function strip(what){
var s;
for(var j=0,  s='';j<what.TownName.value.length;j++)
  if( validChars.indexOf(what.TownName.value.charAt(j))!=-1)
    s +=what.TownName.value.charAt(j) ;

page='/spot.php?TownName='+s;
location.href=page;
}

function isan(string)

 { //****put this FN in to save against bull prices!
if(typeof(string)=='undefined')
          return false;
if (string.length == 0)
         return false;
     for (var i=0;i < string.length;i++)
         if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
          // if (string.substring(i,i+1)!='.')
             return false;
    return true;
 }
 



function CurrencyFormatted(amount)
{
var i = parseFloat(amount);
if(isNaN(i)) { i = 0.00; }
var minus = '';
if(i < 0) { minus = '-'; }
i = Math.abs(i);
//i = parseInt((i + .005) * 100);
i = parseInt((i + .006) * 100);
i = i / 100;
s = new String(i);
if(s.indexOf('.') < 0) { s += '.00'; }
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
s = minus + s;
return s;
}

function padout(number){
return((number<10)?'0'+number:number);
}

function isHistoric (day,month,year) {
 // checks if date passed is valid
 // ie in following format: isDate(dd,mm,ccyy) 
 //    var myDate = new Date(year,month-1,day);
var myDate = new Date;
var nextyear = new Date; 
y=today.getFullYear();
nextyear.setYear(y+1);

//	alert (day+'/'+month-1+'/'+year+'='+test+' > '+today);
myDate.setDate(day);
myDate.setMonth(month); // January = 0
myDate.setFullYear(year); 
//  alert (year+'='+myDate+' > '+today);
     if (myDate < today)
		{
	//	alert (year+'A='+myDate+' > '+today);
	     alert('Booking Historic dates not possible..(yet).');
        return true;
		}
		

if (myDate >= nextyear)
		{
	  alert('For bookings more than a year in advance, please call 0845 3302500. ');
    return true;
		}		

		
		
	myDate.setDate(day-4);
    
     if (myDate <= today)
		{
	//	alert (year+'A='+myDate+' > '+today);
	     alert('For urgent bookings (within 4days), please call 0845 3302500.');
        return true;
		}		

 return false;
 }
function isnumb(string) {
     if (string.length == 0)
         return false;
     for (var i=0;i < string.length;i++)
         if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9'))
             return false;

     return true;
 }

function getRequestObj() {
  // Declare variable
  var request;

  // Using exceptions, we can handle errors a bit easier
   try {
      request = new XMLHttpRequest;
   }
   catch (e) {
      try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
         request = false;
      }
   }
   return request;
}

var http = getRequestObj();
if ( !http ) {
   alert("Houston, we have a problem.");
}

// post parameters
//    $session_values['hotelref']=$hotelref;
//    $session_values['hotelname']=$hotelname;
//    $session_values['number']=$number;
//    $session_values['room']=$roomType;
//    $session_values['date']=$booking_date;
//    $session_values['prices']=$session_price;
function bookItem(hotelref, Hotel,NumberOfRooms,roomType,ThisDate,price)
{
//alert(ThisDate);
http.open('get', 'post.php?hotelref='+hotelref+'&hotelname='+Hotel+'&number='+NumberOfRooms+'&roomType='+roomType+'&booking_date='+ThisDate+'&session_price='+price,false);
http.onreadystatechange = handleResponse;
http.send(null);
return;
}




function handleResponse() 
   {
//   return;
   if(http.readyState == 4 && http.status == 200)
        {
        // Text returned FROM the PHP script
        var response = http.responseText;
        if(response) {
          // UPDATE ajaxTest content
  //        document.getElementById("calendar").innerHTML = response;
          }
	    }
    }

//window.onload = function() {
//getObject("calendar").focus();
//}


function bookIt(hotelref, Hotel,NumberOfRooms,roomType,FromDate,pricestr,Duration,Discount){

var validRates="0123456789";
var pricestr="0.00,"+pricestr; //add a null price at [0]
var penalty=99999999; //use this as  return value, last room night cost
var price=pricestr.split(',');

price[0]=price[10]; //rewrite price at[0] wiyth the one at[10] ... so as to have 10 prices!!!

   //1.decompose FromDate (the date) into 3 numbers
    var da=FromDate.split('/');

    for(var i=0;i<3;i++)
      {
      da[i]=padout(da[i]);
      }
    FromDate=da[0]+'/'+da[1]+'/'+da[2];
    Yy=eval(FromDate.substring(6,10));
    Mm=eval(FromDate.substring(3,5));
    Dd=eval(FromDate.substring(0,2));

    //Ensure the date dividers conform
    ThisDate=Dd+'-'+months[Mm]+'-'+padout(eval(FromDate.substring(6,10)));
/*
   if (Duration<=0)
      {
      rc= alert('Your Stay should be counted in nights.');
      err=true;
      return 0;
      }

    //2.validate the date
    if (isHistoric(Dd,Mm-1,Yy))
        {
        err=true;
        return 0;
        }
	else
*/
        {
        //Valid date, look up cost in tables.
        //Initialise rates from table etc.
        Count=0;
        Count=0;
        if ((Dd>31)||(Rates[Mm].substring(Dd-1,Dd)=='X'))
			{
            alert('The property may not be available for all or some of the period you are requesting. Please call 0845 3302500 to check availability.');
            err=true;
            return;
			}
        Rate=Rates[Mm].substring(Dd-1,Dd);
        LastRate=Rate;
        Arriving='Arriving';

        Dd--;
        //check we have a price for days required
        for(var i = 0; i < Duration; i++)
          {
          Dd++;
          if ((Dd>31)||(Rates[Mm].substring(Dd-1,Dd)=='X'))
			{
				Dd=1;
				Mm++;
				if(Mm>12)
				Mm=1;
			}
          Rate=Rates[Mm].substring(Dd-1,Dd);
          //do we have a rate?
          if( validRates.indexOf(Rate)==-1)
            {
             alert('The property may not be available for all or some of the period you are requesting. Please call 0845 3302500 to check availability.');
 
            err=true;
            return 0;
            }
          //do we have a price?
          if( eval(price[Rate])<=0 || price[Rate]=="" )
            {
            alert('We have no price for '+roomType+' on ' + Dd+'-'+Mm+'-'+Yy);
            err=true;
            return 0;
            } 
          }

        //post the cost per day.
        Mm=eval(FromDate.substring(3,5));
        Dd=eval(FromDate.substring(0,2));
        //Repeatedly call bookRoom for each period
estimate+="<tr class='menu_top'><td nowrap align='right'>Number X Room Type</td><td align='right'>Date</td><td nowrap align='right'>Unit Cost</td><td align='right'>Total</td></tr>";
style='infotable1';
roompricetotal=0*1;
        for(var i = 0; i < Duration; i++)
          {
          Rate=Rates[Mm].substring(Dd-1,Dd);
          ThisDate=Dd+'-'+months[Mm]+'-'+padout(eval(FromDate.substring(6,10)));
         //Put item on booking form
        //  bookItem(hotelref, Hotel,NumberOfRooms,roomType,ThisDate,price[Rate]);
	//	$s.= "<tr class=$style><td>$hotelname</td><td>$number X $room</td><td>$datebooked</td><td>$roomprice</td><td>$roompricesubtotal</td></tr> ";
	if(penalty> NumberOfRooms * price[Rate]) //hold this value for return value
	    penalty= NumberOfRooms * price[Rate]; //hold this value for return value

	roompricesubtotal= NumberOfRooms * price[Rate];
	roompricetotal+=roompricesubtotal;

	if(style=='infotable1')
		style='infotable2';
	else 
		style='infotable1';
estimate+="<tr class='"+style+"'><td align='right' nowrap>"+ NumberOfRooms+ " x "+roomType+"</td><td align='right' nowrap>"+ThisDate+"</td><td align='right'>"+price[Rate]+"</td><td align='right'>"+CurrencyFormatted(roompricesubtotal)+"</td></tr>";

//alert(ThisDate);
          Dd++;
          if ((Dd>31)||(Rates[Mm].substring(Dd-1,Dd)=='X'))
            {
            Dd=1;
            Mm++;
            if(Mm>12)
              Mm=1;
            }
          }
totalcost+=roompricetotal;
estimate+="<tr><td colspan='3'  class='menu_top'>Cost of "+Duration+ " nights in "+ NumberOfRooms+"X"+ roomType +" arriving "+FromDate+" is</td><td align='right'> &euro;"+CurrencyFormatted(roompricetotal)+" </td></tr>  ";
quote+="\n Cost of "+Duration+ " nights in "+ NumberOfRooms+"X"+ roomType +" Room/Apartment Arriving "+FromDate+" is "+CurrencyFormatted(roompricetotal)+" Euros";

 


        }


return penalty;
}


function MakeArray(n)
  {
  this.length = n;
  for(var i=1;i<=n;i++)
    {
    this[i]=0
    }
  return this
  }

function Init()
  {
  Rates=new MakeArray(13);
  }


function ReadyBooking(rates,form,hotel,pricebasedon,minimumstay)

{
err=false;

if(typeof(Discount)=='undefined')Discount=0.0;
Init();
n=rates.length;
for(var i=1;i<=n;i++)
  {
  Rates[i]=rates[i]
  }
var Duration=form.nights.value;
if(form.nights.value<minimumstay)Duration=minimumstay;
var supplement=0;
var m=form.M.selectedIndex;
var y=form.Y.selectedIndex;
y= eval (thisYear+y);

//var sr=form.SR.value;



if(isan(Duration)==false)
 {
 alert('The number of nights you wish to Stay has an invalid character.');
 err=true;
 }

else
if(isan(form.D.value)==false)
 {
 alert('The Day you intend to arrive should be in the range 00-31.');
 err=true;
 }
else if (isHistoric(form.D.value,m,y)) 
    {
    err=true;
    } 
else
  {
  m++;




  FromDate=form.D.value+'/'+m+'/'+y;
/*
  if(
     isan(form.e1.value)
  && isan(form.e2.value)
  && isan(form.e3.value)
  && isan(form.e4.value)
  && isan(form.e5.value)
  && isan(form.e6.value)
  && isan(form.e7.value)
  && isan(form.e8.value)
    )
*/


totalcost=0*1;

estimate="<table width=100% border='0' cellspacing='0' cellpadding='0'  class='normalbox'><tr><th colspan='4'  class='menu_top'>Price Breakdown for a "+Duration+"night stay at "+hotel+"</th></tr>";
quote='';
request='';
if(form.nights.value<minimumstay)
  {
  estimate+="<tr><td colspan='4'  class='infowarning'> *** Please note minimum stay at this property is  "+minimumstay+" nights. ***</td></tr>";
  quote="Please note minimum stay at this property is  "+minimumstay+" nights. \n";
  }
  
  
var roomscheck=0; //total all the number of rooms requested
//currency check.. so as to calc.price only in selected currency
min=1;max=9;currency='&euro;';


for(eid=min;eid<max;eid++)
  {

  numberofrooms=document.getElementById("numberOfRooms"+eid).value;
  numberofrooms=makeint(numberofrooms);
  roomPrice=document.getElementById("roomPrice"+eid).value;
  roomType=document.getElementById("roomType"+eid).value;

  roomscheck+= numberofrooms; //total all the number of rooms requested

  if(numberofrooms>0)
    {
    supplement+=bookIt(form.mapref.value, hotel,numberofrooms, roomType, FromDate, roomPrice, Duration,Discount);
     //function bookIt(hotelref         , Hotel,NumberOfRooms, roomType,  FromDate, pricestr,  Duration,Discount){
    }
  }

  if(roomscheck<=0) //number of rooms requested is zero! (or less)
	 {
	alert('You forgot to enter which Room/Apartment Type (and how many). ');
	err=true;
	}// else alert(roomscheck);


    if(!err)
	  {
	  onDiv('ShowEstimate');offDiv('Alternatives');offDiv('BookingForm');
	  //location.href='booking.php';
//	  if(form.nights.value<pricebasedon)
	  if(Duration<pricebasedon)
		{
	    estimate+="<tr><td colspan='3'  class='boxlabel'>Short Stay' supplement is </td><td align='right'><strong> "+currency+CurrencyFormatted(supplement)+"</strong></td></tr>";
	    quote +="\n Short stay supplement charge. "+currency+supplement;
		totalcost+=supplement;
		}
	  
    if(form.deposit.value>0)
      {
  	  estimate+="<tr><th colspan='4' class='boxlabel' align='right'> Amount Payable in Advance "+CurrencyFormatted(totalcost*form.deposit.value*.01)+"</th></tr>";
  	  estimate+="<tr><th colspan='4' class='boxlabel' align='right'> Amount Payable on Arrival at Property  "+CurrencyFormatted(totalcost-totalcost*form.deposit.value*.01)+"</th></tr>";
      }
	  estimate+="<tr><th colspan='4' class='boxlabel' align='right'>* Total Amount Due for your Stay "+currency+CurrencyFormatted(totalcost)+"</th></tr>";
	  
//	  estimate+="<tr><td colspan='4' align='center'><input type='button' value='Modify Requirements' OnClick=\"changeDiv('SendEstimate','none');changeDiv('ShowEstimate','none');changeDiv('AcceptEstimate','none');changeDiv('BookingForm','block');\"></td></tr>";

	  estimate+="<tr><td colspan='4' align='right'>NOTE:* If there is any variation to the shown prices we will advise you before proceeding.</td></tr>";


    if(form.deposit.value>0)
      {
  	  quote +="\n\n Amount Payable in Advance "+CurrencyFormatted(totalcost*form.deposit.value*.01) +" Euros";
  	  quote +="\n\n Amount Payable on Arrival at Property  "+CurrencyFormatted(totalcost-totalcost*form.deposit.value*.01) +" Euros";
      }
	  
    quote +="\n\n Total cost of your stay would be "+CurrencyFormatted(totalcost) +" Euros";
	  quote +="\n\n link: http://www.hotels-in-madrid.co.uk/b"+form.mapref.value+".shtml \n"; 
	  request=quote;
	  quote+="\n Note: Price is correct at time of estimate.\n ";

		   
	  
	  
	  estimate+='</table>';
	  document.getElementById('ShowEstimate').innerHTML=estimate;

	  // Build mesage for send quote to a friend
	  	   quote="\n \n Hi \n I just found the following and thought you might be interested. \n \n Staying in "+hotel+"  \n "+quote;
           request= "Staying in "+hotel+"  \n "+request;
       // set up input for form
	   estimatemsg="<input type='hidden' name='q_quote' value='"+quote+"'><pre>"+quote+"</pre>" +
					"<input type='hidden' name='r_request' value='"+request+"'>";
       //slot onto form
	   document.getElementById('EstimateMsg').innerHTML=estimatemsg;
	   

	  
	//ask what to do next	

  	estimate="<table cellspacing='2' cellpadding='0' align='center' width='100%'>"
				 +"<tr > <th align='left' valign='top' class= 'menu_top' nowrap>"
				 +"What would you like to do next?"
				 +"</th><th align='right'>"
				 +"Proceed with Reservation &raquo;<input type='radio' name='quote' value='accept' onClick=\"changeDiv('SendEstimate','none');changeDiv('AcceptEstimate','block');\"><br>"
				 +"Send Quote to Friend &raquo;<input type='radio' name='quote' value='send' onClick=\"changeDiv('AcceptEstimate','none');changeDiv('SendEstimate','block');  \"><br>"
	 			 +"Start Again &raquo;<input type='radio' name='quote' value='accept' onClick=\"changeDiv('SendEstimate','none');changeDiv('ShowEstimate','none');changeDiv('AcceptEstimate','none');changeDiv('BookingForm','block');\"><br>"
				 +"</th></tr></table>";
 	  document.getElementById('ShowEstimate').innerHTML+=estimate;
	  changeDiv('AcceptEstimate','block');
	  }


  }

}

///////////////////////

function Calendar(rates,Month,Year) {
  var output = '';
  firstDay = new Date(Year,Month,1);
  startDay = firstDay.getDay();

  if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0))
    days[1] = 29;
  else
    days[1] = 28;

  output +=
    '<table callspacing="0" cellpadding="0" border="0" class="Cal">' +
    '<tr>' +
    '<td class="cal_month" colspan="7">' + names[Month] + ' ' + Year +
    '</td></tr>'+

    '<tr class="cal_weeks" >'+
    '<td>S</td>' +
    '<td>M</td>' +
    '<td>T</td>' +
    '<td>W</td>' +
    '<td>T</td>' +
    '<td>F</td>' +
    '<td>S</td>' +
    '</tr>'+
    '<tr CLASS="Cal" align="right">';


  var column = 0;
  for (i=0; i<startDay; i++) {
    output += '<td class="Cal">&nbsp</td>';
    column++;
  }

var offset=0;//(Year-thisYear)*12
// alert(offset+'='+thisYear+'+'+Year);
  for (i=1; i<=days[Month]; i++) {



       var col=rates[offset+Month+1].substring(i-1,i);


 switch(col)
{   
case '0':
  tdcol= 'class="cal0"';
  break;
  case '1':
  tdcol= 'class="cal1"';
  break;
  case '2':
  tdcol= 'class="cal2"';
  break;
  case '3':
  tdcol= 'class="cal3"';
  break;
  case '4':
  tdcol= 'class="cal4"';
  break;
  case '5':
  tdcol= 'class="cal5"';
  break;
  case '6':
  tdcol= 'class="cal6"';
  break;
 case '7':
  tdcol= 'class="cal7"';
  break;
case '8':
  tdcol= 'class="cal8"';
  break;
case '9':
  tdcol= 'class="cal9"';
  break;
default:
  tdcol= 'class="calx"';
}


    output += '<td ' + tdcol + '>' + i+ '</td>';

    column++;
    if (column == 7) {
      output += '</tr><tr align="right" CLASS="Cal">';
      column = 0;
    }
  }
  output += '</tr></table>';

  return output;
}

  function seeCalendar(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12 ){

  rates=new MakeArray(13);
  rates[0]='1234567890123456789012345678901X';
  rates[1]=m1;
  rates[2]=m2;
  rates[3]=m3;  
  rates[4]=m4;
  rates[5]=m5;
  rates[6]=m6;  
  rates[7]=m7;
  rates[8]=m8;
  rates[9]=m9;  
  rates[10]=m10;
  rates[11]=m11;
  rates[12]=m12;
  showCalendar(rates);
  }

function showCalendar(rates){

var output =

    '<table border="0" cellspacing="0" cellpadding="0">' +
  '<tr valign="top"><td>'+
  relCalendar(rates,thisMonth,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+1,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+2,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+3,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+4,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+5,thisYear) +
  '</td></tr><tr valign="top"> <td>' +
  relCalendar(rates,thisMonth+6,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+7,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+8,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+9,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+10,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+11,thisYear) +
  '</td></tr></table>';

document.getElementById('calendar').innerHTML=output;
//document.write(output);
return 0;
}

function array(
  m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11
) {
  this[0]  = m0;  this[1]  = m1;
  this[2]  = m2;  this[3]  = m3;
  this[4]  = m4;  this[5]  = m5;
  this[6]  = m6;  this[7]  = m7;
  this[8]  = m8;  this[9]  = m9;
  this[10] = m10; this[11] = m11;
}

var names =
  new array(
    'Jan','Feb','Mar','Apr','May','Jun',
    'Jul','Aug','Sep','Oct','Nov','Dec'
);
var days =
  new array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var thcol = 'bgcolor="#AAACBF"';
var trcol = 'bgcolor="#CCECFF"';
var tdcol = 'bgcolor="#FF8888"';
var hlcol = 'bgcolor="#d0d0d0"';



function y2k(number) {
  return (number < 1000) ? number + 1900 : number;
}

function relCalendar(rates,m,y){

if(m>11){m=m-12; y++;}
return Calendar(rates,m,y);
}
  function seeCalendar(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12 ){

  rates=new MakeArray(13);
  rates[0]='1234567890123456789012345678901X';
  rates[1]=m1;
  rates[2]=m2;
  rates[3]=m3;  
  rates[4]=m4;
  rates[5]=m5;
  rates[6]=m6;  
  rates[7]=m7;
  rates[8]=m8;
  rates[9]=m9;  
  rates[10]=m10;
  rates[11]=m11;
  rates[12]=m12;

  showCalendar(rates);
  }

function showCalendar(rates){

var output =

    '<table border="0" cellspacing="0" cellpadding="0">' +
  '<tr valign="top"><td>'+
  relCalendar(rates,thisMonth,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+1,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+2,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+3,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+4,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+5,thisYear) +
  '</td></tr><tr valign="top"> <td>' +
  relCalendar(rates,thisMonth+6,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+7,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+8,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+9,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+10,thisYear) +
  '</td><td>' +
  relCalendar(rates,thisMonth+11,thisYear) +
  '</td></tr></table>';
document.getElementById('calendar').innerHTML=output;
//document.write(output);
return 0;
}


function showPrice(exists,roomDescription,eid,rates,q1,q2,q3,q4,q5,q6,q7,q8,q9,q10)
{

 var col;
 var p1="";
 var p2="";
 var p3="";
 var p4="";
 var p5="";
 var p6="";
 var p7="";
 var p8="";
 var p9="";
 var p10="";

if(exists!="yes")
  {

  output ="<INPUT id='roomType"+eid+"' TYPE=HIDDEN  VALUE='"+roomDescription+"'>"+
          "<INPUT id='numberOfRooms"+eid+"' TYPE=HIDDEN  VALUE='0''>"+
          "<INPUT id='roomPrice"+eid+"' TYPE=hidden  VALUE='0'>";
  document.write(output);
  return 0; //quick exit!
  }
//expose the prices that are applicable
var   ratestr="";
for(var i=1; i<=12; i++)
  ratestr+=rates[i];


  //if( ratestr.indexOf('1')!=-1)
  //   p1=CurrencyFormatted((q1 * 85)/100);
  //if( ratestr.indexOf('2')!=-1)
  //   p2=CurrencyFormatted((q2 * 85)/100);
  //if( ratestr.indexOf('3')!=-1)
  //   p3=CurrencyFormatted((q3 * 85)/100);
  //if( ratestr.indexOf('4')!=-1)
  //   p4=CurrencyFormatted((q4 * 85)/100);
 // if( ratestr.indexOf('5')!=-1)
 //    p5=CurrencyFormatted((q5 * 85)/100);
 // if( ratestr.indexOf('6')!=-1)
 //    p6=CurrencyFormatted((q6 * 85)/100);
 // if( ratestr.indexOf('7')!=-1)
 //    p7=CurrencyFormatted((q7 * 85)/100);
 // if( ratestr.indexOf('8')!=-1)
 //    p8=CurrencyFormatted((q8 * 85)/100);
 // if( ratestr.indexOf('9')!=-1)
 //    p9=CurrencyFormatted((q9 * 85)/100);


  if( ratestr.indexOf('1')!=-1)
     p1=CurrencyFormatted(q1);
  if( ratestr.indexOf('2')!=-1)
     p2=CurrencyFormatted(q2);
  if( ratestr.indexOf('3')!=-1)
     p3=CurrencyFormatted(q3);
  if( ratestr.indexOf('4')!=-1)
     p4=CurrencyFormatted(q4);
  if( ratestr.indexOf('5')!=-1)
     p5=CurrencyFormatted(q5);
  if( ratestr.indexOf('6')!=-1)
     p6=CurrencyFormatted(q6);
  if( ratestr.indexOf('7')!=-1)
     p7=CurrencyFormatted(q7);
  if( ratestr.indexOf('8')!=-1)
     p8=CurrencyFormatted(q8);
  if( ratestr.indexOf('9')!=-1)
     p9=CurrencyFormatted(q9);
  if( ratestr.indexOf('0')!=-1)
     p10=CurrencyFormatted(q10);






  output =
    '<tr  class="boxlabel">' +
    '<td align="right" nowrap>' + roomDescription +
    "<INPUT TYPE=HIDDEN id='roomType"+eid+"' VALUE='"+roomDescription+"'></td>"+
    "<td><INPUT  id='numberOfRooms"+eid+"' TYPE=TEXT  VALUE='0' SIZE='2'>"+
    "<INPUT TYPE=hidden  id='roomPrice"+eid+"' VALUE='"+p1+"," +p2+","+p3+"," +p4+"," +p5+"," +p6+"," +p7+"," +p8+"," +p9+"," +p10+"'></td>";

  if(p1.length>0)
    output +='<td class="cal1" align="right" width="40"> ' + p1+ '</td>';
  if(p2.length>0)
    output +='<td class="cal2" align="right" width="40"> ' + p2+ '</td>';
  if(p3.length>0)
    output +='<td class="cal3" align="right" width="40"> ' + p3+ '</td>';
  if(p4.length>0)
    output +='<td class="cal4" align="right" width="40"> ' + p4+ '</td>';
  if(p5.length>0)
    output +='<td class="cal5" align="right" width="40"> ' + p5+ '</td>';
  if(p6.length>0)
    output +='<td class="cal6" align="right" width="40"> ' + p6+ '</td>';
  if(p7.length>0)
    output +='<td class="cal7" align="right" width="40"> ' + p7+ '</td>';
  if(p8.length>0)
    output +='<td class="cal8" align="right" width="40"> ' + p8+ '</td>';
  if(p9.length>0)
    output +='<td class="cal9" align="right" width="40"> ' + p9+ '</td>';
  if(p10.length>0)
    output +='<td class="cal0" align="right" width="40"> ' + p10+ '</td>';
     
document.write(output);

}

Rxxxx=new MakeArray(13);
function init(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12 ){

  Rxxxx[0]='1234567890123456789012345678901X';
  Rxxxx[1]=m1;
  Rxxxx[2]=m2;
  Rxxxx[3]=m3;
  Rxxxx[4]=m4;
  Rxxxx[5]=m5;
  Rxxxx[6]=m6;
  Rxxxx[7]=m7;
  Rxxxx[8]=m8;
  Rxxxx[9]=m9;
  Rxxxx[10]=m10;
  Rxxxx[11]=m11;
  Rxxxx[12]=m12;
  }



var req;
var thediv;
function loadXMLDoc(url,div) {
thediv=div;

// Internet Explorer
try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e) {
try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(oc) { req = null; }
}

// Mozailla/Safari
if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }

// Call the processChange() function when the page has loaded
if (req != null) {
req.onreadystatechange = processChange;
req.open("GET", url, true);
req.send(null);
}
}



function processChange() {
// The page has loaded and the HTTP status code is 200 OK
if (req.readyState == 4 && req.status == 200) {

// Write the contents of this URL to the searchResult layer
getObject(thediv).innerHTML = req.responseText;
}
}


function getObject(name) {
var ns4 = (document.layers) ? true : false;
var w3c = (document.getElementById) ? true : false;
var ie4 = (document.all) ? true : false;

if (ns4) return eval('document.' + name);
if (w3c) return document.getElementById(name);
if (ie4) return eval('document.all.' + name);
return false;
}





//window.onload = function() {
//getObject("TownName").focus();
//}

