var as_form=eval("document.form_jbi");
var totalMonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var obj1
function JF_TellAFriend(){
	
	var wf;
	
	var pid = 4;
	//if(as_form.Hid_Est_Cd)
		//var est_cd=as_form.Hid_Est_Cd.value;
	//else
		var est_cd='';
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=609,height=541';
	var str1 = 'jbi_TellAFriend.asp?page_id=' + pid+'&est_cd='+est_cd;
	msgwin = window.open(str1,'ratewindow',wf)
    bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
          msgwin.focus();
}
function JF_Currency(){
	wf = 'toolbar=no,location=no,directories=no,top,left,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=325,height=270';
	var str1 = 'jbi_Currency.asp';
	msgwin = window.open(str1,'currencywindow',wf)
    bname = navigator.appName;
	bver = parseInt(navigator.appVersion);
	if (!(bname=="Microsoft Internet Explorer" && bver<"4"))
          msgwin.focus();
}
function JF_open_pop(url)
{
	
		wf = 'toolbar=no,location=no,directories=no,top=0,left=0,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=500,height=400';
		win = window.open(url,'winUsrUpd',wf);
	
}
function jf_change_monthyear(calid)
{
	/*if (obj1!=null)
		calClose();
	var f=document.form_jbi;
	switch (calid)
	{
		case 1:
			//f.Sel_Day_bottom.selectedIndex = f.Sel_Day.selectedIndex;
			//f.Sel_month_year_bottom.selectedIndex = f.Sel_month_year.selectedIndex;
			break;
		case 2:
			f.Sel_Right_Day_bottom.selectedIndex = f.Sel_Right_Day.selectedIndex;
			f.Sel_Right_month_year_bottom.selectedIndex = f.Sel_Right_month_year.selectedIndex;
			break;
		case 3:
			f.Sel_Day.selectedIndex = f.Sel_Day_bottom.selectedIndex;
			f.Sel_month_year.selectedIndex = f.Sel_month_year_bottom.selectedIndex;
			break;
		case 4:
			f.Sel_Right_Day.selectedIndex = f.Sel_Right_Day_bottom.selectedIndex;
			f.Sel_Right_month_year.selectedIndex = f.Sel_Right_month_year_bottom.selectedIndex;		
			break;
	}*/
	setnonights(calid);
}
function calClose () {
    obj1.hide() ;
}

function setnonights(calid, chkValid)
{
	var js_mm_cal,js_yy_cal, totalDays, td, tm
	var jl_M1='JAN',jl_M2='FEB',jl_M3='MAR',jl_M4='APR',jl_M5='MAY',jl_M6='JUN',jl_M7='JUL',jl_M8='AUG',jl_M9='SEP',jl_M10='OCT',jl_M11='NOV',jl_M12='DEC';
    totalMonthDays[1] = 28 ;
	js_dd_cal=document.form_jbi.Sel_Day.value;
	mm_yy=document.form_jbi.Sel_month_year.value;
	mm_yy_split=mm_yy.split("-");
	tm = mm_yy_split[0];
	js_mm_cal=parseFloat(tm);
	js_yy_cal=mm_yy_split[1];
	js_monthname=eval("jl_M"+js_mm_cal);
		
	if (js_yy_cal % 4 == 0 && (js_yy_cal % 100 != 0 || js_yy_cal % 400 == 0)) {
		totalMonthDays[1] = 29 ;
	}

	if(parseInt(js_dd_cal)>totalMonthDays[js_mm_cal-1])
	{
		document.form_jbi.Sel_Day.selectedIndex = totalMonthDays[parseInt(js_mm_cal-1)]-1;
		//document.form_jbi.Sel_Day_bottom.selectedIndex = totalMonthDays[parseInt(js_mm_cal-1)]-1;
		js_dd_cal = totalMonthDays[js_mm_cal-1];
	}
		
	js_from_dt=js_monthname +" " + js_dd_cal +"," + js_yy_cal;
	if (js_dd_cal.length<2) 
		js_dd_cal="0"+js_dd_cal ;
	if (tm.length<2) 
		tm="0"+tm ;
						
	document.form_jbi.dtDatefrom.value=js_dd_cal+"-"+tm+"-"+js_yy_cal;

	js_dd_cal1=document.form_jbi.Sel_Right_Day.value;
	mm_yy1=document.form_jbi.Sel_Right_month_year.value;
	mm_yy_split1=mm_yy1.split("-");
	tm=mm_yy_split1[0];
	js_mm_cal1=parseFloat(tm);
	js_yy_cal1=mm_yy_split1[1];
	js_monthname1=eval("jl_M"+js_mm_cal1);
		
	if (js_yy_cal1 % 4 == 0 && (js_yy_cal1 % 100 != 0 || js_yy_cal1 % 400 == 0)) {
		totalMonthDays[1] = 29 ;
	}
	if(parseInt(js_dd_cal1)>totalMonthDays[js_mm_cal1-1])
	{
		document.form_jbi.Sel_Right_Day.selectedIndex = totalMonthDays[parseInt(js_mm_cal1-1)]-1;
		//document.form_jbi.Sel_Right_Day_bottom.selectedIndex = totalMonthDays[parseInt(js_mm_cal1-1)]-1;
		js_dd_cal1 = totalMonthDays[js_mm_cal1-1];
	}		
		
	js_to_dt=js_monthname1 +" " + js_dd_cal1 +"," + js_yy_cal1;
	if (js_dd_cal1.length<2) 
		js_dd_cal1="0"+js_dd_cal1 ;
	if (tm.length<2) 
		tm="0"+tm ;
						
	document.form_jbi.dtDateto.value=js_dd_cal1+"-"+tm+"-"+js_yy_cal1;	
		
	js_f_dt=new Date(js_from_dt);	
	js_t_dt=new Date(js_to_dt);	
	jd_today=JF_DateDiff(js_f_dt,js_t_dt);
		
	//alert(js_f_dt);
	//alert(jd_today);
	
	if (parseInt(jd_today) <1)
	{	
		if (chkValid == 'Y')
		{
			alert('Check-out(departure) date should be greater than Check-in(arrival) date.');
			document.form_jbi.Sel_Right_Day.focus();
			return false;
		}
		
		jd_today="1";
		if (calid==1 || calid==3)
			changetodate();
	}

	HTMLstr="<b class='month'><font color='#b10004'>"+jd_today+"</font></b>";
	if (parseFloat(jd_today)>1)
		HTMLstr+="<font class='month'><font color='#000080'>&nbsp;Nights</font></font>";
	else
		HTMLstr+="<font class='month'><font color='#000080'>&nbsp;Night</font></font>";
	document.form_jbi.sle_nights.value=jd_today;
	//document.getElementById("roomtype_cnt").innerHTML=HTMLstr;
	//document.getElementById("roomtype_cnt_bottom").innerHTML=HTMLstr;
	
	return true;
}

function JF_DateDiff(d1,d2)
{
	/*var jl_M1=31,jl_M3=31,jl_M4=30,jl_M5=31,jl_M6=30,jl_M7=31,jl_M8=31,jl_M9=30,jl_M10=31,jl_M11=30,jl_M12=31;
	var jl_M2=JF_LeapYearfun(d1.getFullYear());
	js_NoOfFromDays=parseInt(d1.getFullYear()-1)*365;
	for(jl_i=1;jl_i<parseInt(d1.getMonth()+1);jl_i++)
		js_NoOfFromDays=js_NoOfFromDays+parseInt(eval("jl_M"+jl_i));
	js_NoOfFromDays=js_NoOfFromDays+parseInt(d1.getDate());
	
	
	jl_M2=JF_LeapYearfun(d2.getFullYear());
	js_NoOfToDays=parseInt(d2.getFullYear()-1)*365;
	for(jl_i=1;jl_i<parseInt(d2.getMonth()+1);jl_i++)
		js_NoOfToDays=js_NoOfToDays+parseInt(eval("jl_M"+jl_i));

	js_NoOfToDays=js_NoOfToDays+parseInt(d2.getDate());
	return (parseInt(js_NoOfToDays)-parseInt(js_NoOfFromDays));

    var difference = d2.getTime() - d1.getTime();
    var daysDifference = Math.floor(difference/1000/60/60/24);
	return daysDifference;
*/	

  var s1, t1, s2, t2;
  var MinMilli = 1000 * 60;
  var HrMilli = MinMilli * 60;
  var DyMilli = HrMilli * 24;
  t1 = d1.getTime();
  s1 = Math.round(t1 / DyMilli);	//return no. of days since 1st Jan 1970
  
  t2 = d2.getTime();
  s2 = Math.round(t2 / DyMilli);	//return no. of days since 1st Jan 1970
  
  return(s2-s1);

}

function changetodate()
{
	var jl_M1='JAN',jl_M2='FEB',jl_M3='MAR',jl_M4='APR',jl_M5='MAY',jl_M6='JUN',jl_M7='JUL',jl_M8='AUG',jl_M9='SEP',jl_M10='OCT',jl_M11='NOV',jl_M12='DEC';
	
	js_dd_cal1=document.form_jbi.Sel_Day.value;
	mm_yy1=document.form_jbi.Sel_month_year.value;
	mm_yy_split1=mm_yy1.split("-");
	tm=mm_yy_split1[0];
	js_mm_cal1=parseFloat(tm);
	js_yy_cal1=mm_yy_split1[1];
	js_monthname1=eval("jl_M"+js_mm_cal1);

	js_from_dt=js_monthname1 +" " + js_dd_cal1 +"," + js_yy_cal1;

	js_from_dt=new Date(js_from_dt);
		
	js_date=JF_AddDate(js_from_dt,1);
		
	DD=js_date.getDate();
	d = new String(DD) ;
	MM=parseFloat(js_date.getMonth())+1;
	MM=""+MM;
	if(MM.length==1)
		MM="0"+MM;
	YYYY=js_date.getFullYear();
		
	if(DD=="31" && MM=="12")
		YYYY=parseFloat(YYYY)-1;
		
	document.form_jbi.Sel_Right_Day.selectedIndex = (DD-1);	
	//document.form_jbi.Sel_Right_Day_bottom.selectedIndex = (DD-1);	
			
	js_mon_year = MM+"-"+YYYY;
	for (i=0; i< document.form_jbi.Sel_Right_month_year.options.length; i++)
	{
		if (document.form_jbi.Sel_Right_month_year.options[i].value == js_mon_year)
		{
			pos = i ;
			break ;
		}
	}
	document.form_jbi.Sel_Right_month_year.selectedIndex = pos ;
	//document.form_jbi.Sel_Right_month_year_bottom.selectedIndex = pos ;
	
	if (d.length<2)
		d = "0"+d ;
	document.form_jbi.dtDateto.value = d+"-"+MM+"-"+YYYY ;
}
function JF_AddDate(d,n)
{
	var jl_M1=31,jl_M3=31,jl_M4=30,jl_M5=31,jl_M6=30,jl_M7=31,jl_M8=31,jl_M9=30,jl_M10=31,jl_M11=30,jl_M12=31;
	var js_Mon1='Jan',js_Mon2='Feb',js_Mon3='Mar',js_Mon4='Apr',js_Mon5='May',js_Mon6='Jun',js_Mon7='Jul',js_Mon8='Aug',js_Mon9='Sep',js_Mon10='Oct',js_Mon11='Nov',js_Mon12='Dec';
	var jl_M2=JF_LeapYearfun(d.getFullYear());
	if (jl_M2==29)
	{
	js_NoOfDays=parseInt(d.getFullYear())*366;
	}
	else
	js_NoOfDays=parseInt(d.getFullYear())*365;	
	for(jl_i=1;jl_i<d.getMonth()+1;jl_i++)
		js_NoOfDays=js_NoOfDays+parseInt(eval("jl_M"+jl_i));	
		
	js_NoOfDays=js_NoOfDays+parseInt(d.getDate())+parseInt(n);
	
	if (jl_M2==29)
	{
	
		js_y=parseInt(js_NoOfDays/366);		
		js_totm=parseInt(js_NoOfDays%366);
	}
	else
	{
		
		js_y=parseInt(js_NoOfDays/365);		
		js_totm=parseInt(js_NoOfDays%365);
	}
	
	for(jl_i=1;jl_i<13;jl_i++)
	{
		if (js_totm<parseInt(eval("jl_M"+jl_i)))
			break;
		js_totm=js_totm-parseInt(eval("jl_M"+jl_i));
	}
	if(js_totm==0)
		if (jl_i==1)
			var jd_date='Dec 31, '+js_y;
		else    
			var jd_date=eval("js_Mon"+parseInt(jl_i-1))+' '+parseInt(eval("jl_M"+parseInt(jl_i-1))) +', '+js_y;
	else 
		var jd_date=eval("js_Mon"+parseInt(jl_i))+' '+js_totm+', '+js_y;
	jd_ResDate=new Date(jd_date);
	return (jd_ResDate);
}
function JF_LeapYearfun(y)
{
if ((y % 4)==0 && (y % 1000)!=0 && (y % 400)!=0)
	return (29);
else
	return (28);
}

function Jf_CheckDate()
{

if (obj1!=null)
	calClose();
	ValDate=document.form_jbi.ValDate.value;
	NextYrDt=document.form_jbi.NextYrDt.value;
	DD=document.form_jbi.Sel_Right_Day.value;
	var mm_yy1=document.form_jbi.Sel_Right_month_year.value;
	mm_yy_split1=mm_yy1.split("-");
	MM=mm_yy_split1[0];
	YYYY=mm_yy_split1[1];	
	if (!setnonights(2, 'Y'))
	return;	
	js_dd_cal=document.form_jbi.Sel_Day.value;
	var mm_yy=document.form_jbi.Sel_month_year.value;
	mm_yy_split=mm_yy.split("-");
	js_mm_cal=mm_yy_split[0];
	js_yy_cal=mm_yy_split[1];
	ArrDate = parseFloat(js_yy_cal + js_mm_cal +js_dd_cal);
	ValDate = (parseFloat(ValDate) - 1);
	Jf_SetDateVal();	
	if(JF_ChkValidDate('document.form_jbi.Sel_Day1','Arrival date ','Y') != true)
	return;	
	
	if(ArrDate <= ValDate)
	{
	alert("Need to book atleast one day in advance, Please contact JustBookIt.com for today's booking.\r\rJBI Helpline Number : "+document.form_jbi.Hid_IN_Phone.value+"");
	document.form_jbi.Sel_Day.focus();return;	}
	if(ArrDate > NextYrDt)
	{
	alert("Arrival Date should not be more than a year");
	document.form_jbi.Sel_Day.focus();
	return;	
	}
	//alert(document.form_jbi.sle_nights)

	if(document.form_jbi.sle_nights.value=='')
	{
	alert('Nights should be entered');
	return;
	}
	
	if(Trim(document.form_jbi.sle_nights.value)!='')
	{
	if(parseInt(Trim(document.form_jbi.sle_nights.value)) > 15)	
	{
	alert('Please send us an email with all your requirments to book for more than 15 nights. Our Customer Service Executive will be glad to assist your enquiry. \r Email:  '+document.form_jbi.Hid_IN_eMail.value);return;}
	//alert('Please contact us by phone or email if you would like to book for more than 15 nights.\r\rJBI Helpline Number : '+document.form_jbi.Hid_IN_Phone.value+', \r Email:  '+document.form_jbi.Hid_IN_eMail.value);return;}
	}
	if(isNaN(document.form_jbi.sle_nights.value))
	{
	alert('Nights should be a numeric value');return;
	}
	else
	{
	if(parseInt(document.form_jbi.sle_nights.value) < 1)
	{
	alert('Nights should be atleast one');
	return;
	}
	if(document.form_jbi.sle_nights.value.indexOf('.') != -1)
	{
	alert('Nights should not have the decimal values');
	return;
	}

		document.form_jbi.sle_NoOfRooms_peg.value = document.form_jbi.sle_NoOfRooms_top.options[document.form_jbi.sle_NoOfRooms_top.selectedIndex].value ;
		
		document.form_jbi.sle_NoOfAdlts_peg.value = document.form_jbi.sle_NoOfAdlts_top.options[document.form_jbi.sle_NoOfAdlts_top.selectedIndex].value ;
		
	//JF_loadRates();
	document.form_jbi.action = document.form_jbi.Hid_Non_Secure.value+"jbi_hotel_book1.asp";	
	document.form_jbi.submit();
}
}
function Jf_SetDateVal()
{
	js_dd_cal=document.form_jbi.Sel_Day.value;
	var mm_yy=document.form_jbi.Sel_month_year.value;
	mm_yy_split=mm_yy.split("-");
	js_mm_cal=mm_yy_split[0];
	js_yy_cal=mm_yy_split[1];
	document.form_jbi.Sel_Day1.value = js_dd_cal + '-' + js_mm_cal + '-' + js_yy_cal;
	document.form_jbi.Sel_Day1_dd.value = js_dd_cal;
	document.form_jbi.Sel_Day1_mm_yy.value = js_mm_cal + '-' +js_yy_cal;
}
function JF_ChkValidDate(DD,MM,YYYY,flg)
{	
	
	ji_err = 0;
	
	js_val=MM;
	
	if (!(js_val == '$-$-$')) 
	{	
		if (js_val.substring(0,1) == '$') 
			{ji_err = -1;}
		if (js_val.indexOf('$') > 0) 
			{ji_err = -1;}
			
		if (ji_err == 0) 
		{
			
			js_day = DD;
			js_day=""+DD;
			
			js_mnth_year = YYYY;
			js_mnth_year=MM+"-"+YYYY;
			
			js_val=js_day;
			
			while ( js_val.substring(0,1) == '0')
			js_val = js_val.substring(1, js_val.length);
			ji_day = parseInt( js_val ) ;
			if(js_mnth_year.substring(0,1) == '0')
				js_mnth_year = js_mnth_year.substring(1, js_mnth_year.length);
			
			js_val=js_mnth_year;
			
			js_val_splt = js_val.split('-');
			ji_mnth = parseInt( js_val_splt[0]) ;
			ji_year = parseInt( js_val_splt[1] ) ;
			
		}
		var ret_val;
		if ( (ji_err == 0) && ( (ji_mnth == 4) || (ji_mnth == 6) || (ji_mnth == 9) || (ji_mnth == 11) ) && (ji_day > 30) ) 
		{
			ji_err = -1;
			ret_val="30";
		}
			if ( (ji_err == 0) && (ji_mnth == 2) ){if ( ( ( (ji_year % 4) == 0 ) && ( (ji_year % 100) != 0 ) ) || ( ji_year % 400 == 0 ) )
			{
				if (ji_day > 29) 
				{
					ji_err = -1;
					ret_val="29";
				}
			}
			else
			{
				if (ji_day > 28)
				{
					ji_err = -1;
					ret_val="28";
				}
			}
		}
	}
	
	if (ji_err == -1) 
	{
		if(flg=='Y')
		{	
			js_err = as_label + ' is not a valid date.';
			JF_ErrHandle(document.form_jbi.Sel_Day, as_label, js_err);
			return;
		}
		else
		{
			 
			return ret_val;
		}
	}
	return true;
}

function produceCalendar (bindToFld, imgid) {

	var jf_seldate, ja_dt, top;
	var jf_dt=eval("document.form_jbi."+ bindToFld);
	jf_seldate = jf_dt.value;
	ja_dt = jf_seldate.split("-");
	
	js_book_from=document.form_jbi.book_from.value;
	js_book_to=document.form_jbi.book_to.value;
	js_curyear=document.form_jbi.curyear.value;
	js_curmonth=document.form_jbi.curmonth.value;
	
    if(typeof(obj1) != 'object') obj1 = new suycCalendar() ;

    obj1.bindToElement = bindToFld ;

	obj1.goTo(parseFloat(ja_dt[1]), parseFloat(ja_dt[2])) ;
	obj1.currentDay = parseFloat(ja_dt[0]);
	obj1.currentMonth = parseFloat(ja_dt[1]);
	obj1.currentYear = parseFloat(ja_dt[2]);

	
	if (imgid=="cal_image1" || imgid=="cal_image3")
		obj1.valdate = js_book_from;
	else
		obj1.valdate = js_book_to;
		
    
    obj1.BuildCalendar() ;
   
	if(navigator.appName=="Netscape")
	{
		top = JF_DIsplay_IFrame(imgid);
		/*if (imgid=='cal_image1' || imgid=='cal_image3')
		{
			obj1.moveTo(200, top) ;
		}
		else
		{
			obj1.moveTo(400, top) ;			
		}*/
		obj1.moveTo(xMousePos, top) ;
	}
	else
	{
	
		top = JF_DIsplay_IFrame(imgid);
		obj1.moveTo(document.body.scrollLeft+event.clientX, top) ;
	}
}
function JF_DIsplay_IFrame(imgid){

	var eP=eval('document.getElementById("'+ imgid +'")');var eL=0;var eT=0;var p=eP;
	while(p&&p.tagName!="BODY")	{
		eT+=p.offsetTop;	eL+=p.offsetLeft;	p=p.offsetParent;}
	var eH=eP.offsetHeight;	var dH=200 ;//calendar height
	var W=146;//calendar width
	var sT=document.body.scrollTop;	var dW=0;var temp=parseFloat(eT)+parseFloat(eH)+parseFloat(dH) ;var temp1=parseFloat(document.body.clientHeight)+parseFloat(sT);
	
	if(temp>temp1)	{	dH=parseFloat(dH)+30;	eT-=dH;	}
	else {	
	
		if(imgid=='cal_image3' || imgid=='cal_image4')	{
		eH=parseFloat(eH)-250;		eT+=eH;
		}else	{
		eH=parseFloat(eH)+10;	eT+=eH;	}
	
		//if((temp1-temp)<100)	{
		//	dH=parseFloat(dH)+100;
	//		eT-=dH;
	//	}else{
	//		eH=parseFloat(eH)+10;
	//		eT+=eH;		}
	
	}	return eT;
}
 /****************************************************************************
        
        Constructor:
        -----------------
        var objCalendar = new suycCalendar([month(Int)], [year(Int)])
        ________________________________________________________________________
        
        Method Selectors:
        -------------------------
        BuildCalendar           - Renders a new calendar with a default of current month.
        goToCurrent             - Renders the calendar to the current month.
        toggleCalendar ( int )  - int = number of months to toggle by.
        show                     - sets the visibility of the Canvass to visible
        hide                      - sets the visibility of the Canvass to not visible
        moveTo                 - accepts x,y as pixels moves the canvass to that position
        bindToElement           - Not yet implemented.
        
        Properties Exposed:
        ---------------------------
        hasEvents   (type: Boolean) - if true then interface raises events.
        posX          allows the user to set the left location (the number of pixels from the left edge of the browser window). 
        posY          allows the user to set the top location (the number of pixels from the top edge of the browser window). 
        
        Notes:
        ---------
        If hasEvents is set to True then you need to implement the following event handlers:
            - clickhandler (d,m,y)   - receives the event thrown by the user clicking on a day/date
            - toggleCalendar (i)      - receives the event thrown by the user clicking on << or >>
            - toggleCurrent ()        - receives the event thrown by the user clicking on [ Today ]
            
        Calendar also exposes the following CSS classes:
            - clickable               : refers to the <<, [ TODAY ], and >> navigation controls at the base of the calendar
            - calendar_normal    : the normal state of a calendar date 
            - calendar_clickable  : the onMouseOver state of a calendar date
            - TR.monthsheader  : the row that contains the abbreviated Day names near the top of the calendar
            - TD.monthsheader : the individual cells contained by the aforementioned row

*****************************************************************************/



/****************************************************************************
        BEGINNING OF CLASS
*****************************************************************************/
function suycCalendar(m,y)
{
    
    if (typeof(_calendar_prototype_called) == 'undefined')
    {
        _calendar_prototype_called = true ;
        
        // Object methods
        this.BuildCalendar = _create ;
        this.createCanvass = _createCanvass ;
        this.showCalendar = _showCalendar ;
        this.goToCurrent = _goToCurrent ;
        this.goTo = _goTo ;
        this.toggleCalendar = _toggleCalendar ;
        this.moveTo = _positionCanvass ;
        this.hide = _hide ;
        this.show = _show ;
        this.init = _init ;
    }
    
        // Object properties
        this.name = 'default' ;
        this.rowBGColor = 'palegoldenrod' ;
        this.currentDay = 0 ;
        this.currentMonth = 0 ;
        this.currentYear = 0 ;
        this.visible = false ;
        this.posX = 10 ;
        this.posY = 10 ;
        this.isIE4 = '';
        this.isNav4 = '' ;
        this.valdate= 0 ;
        
        // If you set hasEvents fo FALSE then the calendar face is dumbed out.
        this.hasEvents = true ;
        
        this.canvass = '' ; // The DIV || LAYER that we display the calendar on.
        this.bindToElement = '' ;  // Bind to an ELEMENT on the page.
    
    // Array of day names
    this.days = new Array("Sunday", "Monday", "Tuesday", "Wednesday","Thursday", 
                                   "Friday", "Saturday");
    // Array of month names
    this.months = new Array("January", "February", "March", "April", "May","June", "July", 
                                        "August", "September", "October", "November", "December");
    // Array of total days in each month
    this.totalDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    
    // Call the Initialize() event.
    this.init(m,y) ;
}
function _createCanvass()
{
    
    // Create canvass for NN4+
    /*if (this.isNav4) 
    { 
        this.canvass = new Layer(200) ;
        this.canvass.left = this.posX ;
        this.canvass.top = this.posY ;
    }
    
    // Create canvass for IE4+
    if (this.isIE4)
    { */
    
    
		var objDiv ;
		if (this.isNav4)
		{
			objDiv = document.createElement("div") ;
			objDiv.style.position = "absolute" ;
		}	
		else if(navigator.appName == "Opera")
		{
			objDiv = document.createElement("div") ;
			objDiv.style.position = "absolute" ;
		}
		else
			objDiv = document.createElement("<DIV STYLE='position: absolute; left: 50; top: 50;'>") ;
        document.body.appendChild (objDiv) ;
        this.canvass = objDiv ;
        this.canvass.style.left = this.posX ;
        this.canvass.style.top = this.posY ;
       
    //}
}

function _positionCanvass(x,y)
{
    // if either x || y were not supplied, default to the current settings.
    if(x==null || y==null) { x=this.posX; y=this.posY ; return ;}
    
    if( isNaN(x) || isNaN(y) )
    {
        alert('You can only enter numbers for the x/y co-ordinates') ;
        return ;
    }
    
    // apply the new settings for NN
    /*if (this.isNav4) 
    { 
        this.canvass.left = this.posX = x ;
        this.canvass.top = this.posY = y ;
    }
    
    // apply the new settings for NN
    if (this.isIE4)
    {*/ 
        this.canvass.style.left = this.posX = x ;
        this.canvass.style.top = this.posY = y ;
    //}
    
}

function _goToCurrent()
{
    
    this.year = this.currentYear ;
    this.month = this.currentMonth ;
    this.BuildCalendar() ;
}
function _goTo(mon, year)
{
    this.year = year ;
    this.month = mon ;
}
function _toggleCalendar(n)
{
    
    var currentMonth = this.month ;
    var currentYear = this.year ;
    
    if((currentMonth + n) == 0)
    { 
        this.year = currentYear-1 ; 
        this.month = 12 ; 
    }
    else if((currentMonth + n) == 13)
    { 
        this.year = currentYear+1 ; 
        this.month = 1 ; 
    }
    else
    {
        this.month = currentMonth + n ;
    }
    // Leap year correction
    if (this.year % 4 == 0 && (this.year % 100 != 0 || this.year % 400 == 0)) {
    	this.totalDays[1] = 29 ;
    }

    this.currentYear = this.year ;
    this.currentMonth = this.month ;
    
    this.BuildCalendar() ;
}
function MM_preloadImages() 
{	//v3.0
	var d=document; 
	if(d.images)
	{ 
			if(!d.MM_p) 
				d.MM_p=new Array();
    
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
			for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0)
				{ 
					d.MM_p[j]=new Image; 
					d.MM_p[j++].src=a[i];
				}
	}
}

// Create and Display Calendar.
function _create()
{
    // Counters to count rows and days, String to store calendar output.
    var rowCount = 0 ;
    var numRows = 0 ;
    var vald, valm, valy, valtemp ;
    var sOut = new String() ;
    var tday, tmonth, tyear;
    
    // Leap year correction
    if (this.year % 4 == 0 && (this.year % 100 != 0 || this.year % 400 == 0)) {
    	this.totalDays[1] = 29 ;
    }
    
    var obj = new Date(this.year, this.month-1, 1);
    var firstDayOfMonth = obj.getDay();
    obj.setDate(31);
    var lastDayOfMonth = obj.getDay();
    var bgDay;
    obj = null ;

    if (this.currentDay > this.totalDays[this.month-1])
		bgDay = this.totalDays[this.month-1];
	else
		bgDay = this.currentDay ;
		
	//valdate format = yyyymmdd
	vald = this.valdate%100 ;
	valtemp = parseInt(this.valdate/100) ;
	valm = valtemp%100 ;
	valy = parseInt(valtemp/100) ;
	
	if(this.month==valm && this.year==valy)
	{
		if(bgDay<vald)
			bgDay = vald ;	
	}
    
    sOut = ""
    
	if(this.isNav4)
	{
		sOut += "<table border=0 cellpadding=0 cellspacing=1 bgcolor=#000000>" ;
		sOut += "<tr><td>" ;
	}    
    
    
    sOut += "<table border=0 cellpadding=0 cellspacing=0 class=calCalendar>" ;
    /*  Write the TABLE header (month/year) */
    sOut += "<tr CLASS='calTitleBar' height='27'>"
    sOut += "<td colspan=2 align=left >" ;
    sOut += "<A HREF=\"javascript:  ;\" onClick='toggleCalendar(-1) ; return false ;' CLASS='calMonth' TITLE='Previous Month' /><img src='http://www.justbookit.com/images/newcal1.gif' border='0' width='18' height='18'></A>" ;
    sOut += "</td>" ;
    sOut += "<td colspan=3 align=center CLASS='calTitleBar' bgcolor='#3dabe8'>&nbsp;<b>" + this.months[this.month-1].substring(0,3) + " " + this.year + "</b></td>" ;
    sOut += "<td colspan=2 align=right>" ;
    sOut += "<A HREF=\"javascript:  ;\" onClick='toggleCalendar(1) ; return false ;' CLASS='calMonth' TITLE='Next Month' /><img src='http://www.justbookit.com/images/newcal2.gif' border='0' width='18' height='18'></A>" ;
    sOut += "</td>" ;   
    sOut += "</tr>" ;

    /*  Write the abbreviated day names */
    sOut += "<tr class='calMonthsheader' height='20'>" ;
    for (x=0; x<7; x++) {
        sOut += "<td class='calMonthsheader' align='center'>" + this.days[x].substring(0,1) + "</td>" ;
    }
    sOut += "</tr>" ;
    
    sOut += "<tr class='calMonthsheader'>" ;
    sOut += "<td class='calMonthsheader' align='center' colspan='7'><img src='http://www.justbookit.com/images/newcal3.gif'></td>" ;
    sOut += "</tr>" ;
    
    /* Start of BODY */
    sOut += "<tr  class='bodyMain' height='20'>" ;
    numRows++ ;
    
    for (x=1; x<=firstDayOfMonth; x++) {
        /* pad the blank days at the beginning of the month. */
        rowCount++;
        sOut += "<td><span style='font-size: smaller'>&nbsp;</span></td>" ;
    }
    
    /* Increment the current date */
    this.dayCount=1;
    tyear = new String(this.year) ;
    tmonth = new String(this.month) ;
    if (tmonth.length<2) 
		tmonth = "0" + tmonth ;

    while (this.dayCount <= this.totalDays[this.month-1]){
    	/* Display new row after each 7 day block.  */
    	if (rowCount % 7 == 0)
    	{
    	    sOut += "</tr>\n<tr  class='bodyMain' height='20'>" ;
    	    numRows++ ;
    	}

        /* Insert the Date. */
        tday = new String(this.dayCount) ;
        if (tday.length<2)
			tday = "0" + tday ;
		if (parseFloat(tyear + tmonth + tday) < this.valdate) 
		{
			sOut += "<td align=center CLASS='calNonClickable'>" + this.dayCount + "</td>" ;
        }
        else
        {
			if (bgDay == this.dayCount)
				sOut += "<td align=center bgcolor = '#FFDD99' CLASS='calClickable'><A HREF=\"javascript:  ;\""
			else
				sOut += "<td align=center CLASS='calClickable'><A HREF=\"javascript:  ;\""

			if (this.hasEvents) sOut += " onClick='clickhandler(" + this.dayCount + "," + this.month + "," + this.year + ") ;'" ;
			if (bgDay == this.dayCount)
				sOut += " CLASS='calClickable'><FONT color='#000000'>" + this.dayCount + "</FONT></A>"  
			else
				sOut += " CLASS='calClickable'>" + this.dayCount + "</A>"  
			sOut += "</td>" ;        
        }
        this.dayCount++ ;
        rowCount++ ;
    }

    while (rowCount % 7 != 0) {
        /* pad the blank days at the end of the month. */
        rowCount++ ;
        sOut += "<td><span style='font-size: smaller'>&nbsp;</span></td>" ;
    }
    sOut += "</tr>" ;
    // End of BODY
    
    // Write the Calendar Navigator.
    if(this.hasEvents) {
        sOut += "<tr height='20'>" ;
        sOut += "<td colspan=7 align=center>" ;
        sOut += "<A HREF=\"javascript:  ;\" onClick='calClose() ; return false ;' TITLE='Close' CLASS='calClickable' style=color:#bb7301>Close</A>" ;
        sOut += "</td>" ;
        sOut += "</tr>" ;
    }
    
    sOut += "</table>" ;
    
    if(this.isNav4)
	{
		sOut += "</td></tr></table>" ;
	}
    
    // Render the calendar
    this.showCalendar (sOut) ;
}

function _showCalendar (s)
{
    /*if(this.isNav4)
    {
        this.canvass.document.open() ;
        this.canvass.document.writeln(s) ;
        this.canvass.document.close() ;
    } else {*/
        this.canvass.innerHTML = s ;
    //}
    this.show() ;
}
function _show()
// This function displays the objects canvass.
{
    /*if(this.isNav4)
    {
        this.canvass.visibility = 'show' ;
        this.canvass.left = this.posX ;
        this.canvass.top = this.posY ;   
    } else {*/
        this.canvass.style.visibility = 'visible' ;
        this.canvass.style.left = this.posX ;
        this.canvass.style.top = this.posY ;
    //}
    
    
    this.visible = true ; 
}
function _hide()
// This function hides the objects canvass.
{
    /*if(this.isNav4)
    {
        this.canvass.visibility = 'hide' ;   
    } else {*/
        this.canvass.style.visibility = 'hidden' ;
   // }
    this.visible = false ;
}

function _init(m,y)
{
    if (parseInt(navigator.appVersion.charAt(0)) >= 4)
    // Browser check.
    {
        this.isNav4 = (navigator.appName == "Netscape") ? true : false ;
        this.isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false ;
    }
    
    // Populate the current Day|Month|Year properties
    var obj = new Date();
    this.currentDay = obj.getDate();
    this.currentMonth = obj.getMonth() + 1;
    this.currentYear = (obj.getFullYear() < 1000) ? obj.getFullYear() + 1900 : obj.getFullYear();
    
    /* 
        The constructor optionally accepts m && y parameters
        if none are supplied, the calendar defaults to the current
        month 
    */
    this.month = m || this.currentMonth ;
    this.year = y || this.currentYear ;
    
    // Create the canvass that we will be displaying the calendar on
    this.createCanvass() ;
    obj = null ;
  
}
function toggleCalendar (i) {

    var currentMonth = obj1.month ;
    var currentYear = obj1.year ;
    var tyear, tmonth;
    var sfday, sfmonth, sfyear, sfrom;
    var stday, stmonth, styear, sto;
        
    sfyear = new String(js_curyear) ;
    sfmonth = new String(js_curmonth) ;
    if (sfmonth.length<2) 
		sfmonth = "0" + sfmonth ;
	sfrom = parseFloat(sfyear+sfmonth) ;

	if(obj1.bindToElement == "dtDateto")
		sto = parseFloat(new String(js_curyear+1)+sfmonth) ;
	else
	{
		var stemp = parseFloat(sfmonth)-1 ;
		if ( stemp == 0)
			sfmonth = "12"
		else
			sfmonth= new String(stemp) ;
		if (sfmonth.length<2) 
			sfmonth = "0" + sfmonth ;			

		sto = parseFloat(new String(js_curyear+1)+sfmonth) ; 
	}
	
	tyear = currentYear;
	tmonth = currentMonth;
			    
    if((currentMonth + i) == 0)
    { 
        tyear = currentYear-1 ; 
        tmonth = 12 ; 
    }
    else if((currentMonth + i) == 13)
    { 
        tyear = currentYear+1 ; 
        tmonth = 1 ; 
    }
    else
    {
        tmonth = currentMonth + i ;
    }

    styear = new String(tyear) ;
    stmonth = new String(tmonth) ;
    if (stmonth.length<2) 
		stmonth = "0" + stmonth ;

    if(parseFloat(styear+stmonth)>=sfrom && parseFloat(styear+stmonth)<=sto)
    {
		obj1.toggleCalendar(i) ;
		
		if (obj1.currentDay > obj1.totalDays[obj1.month-1])
			bgDay = obj1.totalDays[obj1.month-1];
		else
			bgDay = obj1.currentDay ;		

		//valdate format = yyyymmdd
		vald = obj1.valdate%100 ;
		valtemp = parseInt(obj1.valdate/100) ;
		valm = valtemp%100 ;
		valy = parseInt(valtemp/100) ;
	
		if(obj1.month==valm && obj1.year==valy)
		{
			if(bgDay<vald)
				bgDay = vald ;	
		}		
			
		updateDates(obj1, bgDay, obj1.month, obj1.year)
	}
}

function toggleCurrent () {

    obj1.goToCurrent() ;
}

function calClose () {
    obj1.hide() ;
}

function updateDates(obj, d, m, y)
{
	
	var js_mon_year, i, pos=0;
	if(obj.bindToElement=="dtDatefrom")
	{
		document.form_jbi.Sel_Day.selectedIndex = d-1;
		//document.form_jbi.Sel_Day_bottom.selectedIndex = d-1;
		js_mon_year=new String(m);
		if (js_mon_year.length<2) 
			js_mon_year = "0"+js_mon_year;
			
		js_mon_year += "-"+y;
		for (i=0; i< document.form_jbi.Sel_month_year.options.length; i++)
		{
			if (document.form_jbi.Sel_month_year.options[i].value == js_mon_year)
			{
				pos = i ;
				break ;
			}
		}
	
		document.form_jbi.Sel_month_year.selectedIndex = pos ;
		//document.form_jbi.Sel_month_year_bottom.selectedIndex = pos ;
		
		setnonights(1);
	}
	else
	{
		document.form_jbi.Sel_Right_Day.selectedIndex = d-1;
		//document.form_jbi.Sel_Right_Day_bottom.selectedIndex = d-1;
		js_mon_year=new String(m);
		if (js_mon_year.length<2) 
			js_mon_year = "0"+js_mon_year;
			
		js_mon_year += "-"+y;
		for (i=0; i< document.form_jbi.Sel_Right_month_year.options.length; i++)
		{
			if (document.form_jbi.Sel_Right_month_year.options[i].value == js_mon_year)
			{
				pos = i ;
				break ;
			}
		}
		document.form_jbi.Sel_Right_month_year.selectedIndex = pos ;
		//document.form_jbi.Sel_Right_month_year_bottom.selectedIndex = pos ;		
		setnonights(2);
	}
}
function clickhandler (d,m,y) {
	var td, tm;
	td = new String(d);
	tm = new String(obj1.month);
	if (td.length<2)
		td = "0" + td ;
	if (tm.length<2)
		tm = "0" + tm ;

    var objFld = eval("document.form_jbi." + obj1.bindToElement) ;
    
    // Update our form field.
    objFld.value = td + '-' + tm + '-' + y ;
    // hide the calendar object.
    obj1.hide() ;
    
    updateDates(obj1, d, m, y) ;
    
}

function deActivate(layerName,temp)
{
	var obj ;
	//if(browser_type=='Netscape')
	//{
	//	MM_showHideLayers_header(layerName,'','hide');
	//	if (temp)
	//	{
	//		var obj_temp;
	//		obj_temp = MM_findObj_header(temp);
	//		obj_temp.style.cursor="hand";
	//		obj_temp.style.color="brown";
	//	}			
	//}
	//else
	//{
		obj  = eval(layerName);
		obj.style.visibility = 'hidden';

		if (temp)
		{
			temp.style.cursor="hand";
			temp.style.color="brown";
		}
	//}	
	return;
}

function EnterContent(layerName, TTitle,obj, rate_obj)
{	
    var obj_tip, obj_rate, top;
        
    TContent = eval(obj).value;
	TContent=TContent.replace("*","'");
	ContentInfo = '<table border="0" cellpadding="4" bgcolor="#B10004" cellspacing="0" width="148">'+
	'<tr><td><font color=white size=-1 face="Arial">'+TContent+'</font></td></tr>'+
	'</table>';
	if(browser_type=='Netscape')
	{
		obj_tip = MM_findObj_header(layerName) ;
		if (obj_tip !=null)
		{
			obj_tip.innerHTML = ContentInfo ;
			/*top = JF_GetTop(rate_obj);
			obj_tip.style.top = top ;
			obj_tip.style.left = 250 ;*/
			obj_tip.style.top = yMousePos ;
			obj_tip.style.left = xMousePos ;			
			MM_showHideLayers_header('ToolTip','','show');
		}
	}
	else
	{
		ToolTip.innerHTML = ContentInfo;
		ToolTip.style.left = document.body.scrollLeft + eval(window.event.clientX);
		ToolTip.style.top = document.body.scrollTop + window.event.clientY
		ToolTip.style.visibility = 'visible';
	}
	return;
}
function EnterContentBook(layerName, TTitle, obj_bk,est_name)
{	
alert(obj_bk)
	var obj_tip ;	
	
    //TContent = eval(obj).value;
	//TContent=TContent.replace("*","'");
	TContent="View rate applicable for your stay at " +est_name+ " Bangalore"
	ContentInfo = '<table border="0" cellpadding="4" bgcolor="#B10004" cellspacing="0" width="148">'+
	'<tr><td><font color=white size=-1 face="Arial">'+TContent+'</font></td></tr>'+
	'</table>';
	/*if(browser_type=='Netscape')
	{
		obj_tip = MM_findObj_header(layerName) ;
		if (obj_tip !=null)
		{
			obj_tip.innerHTML = ContentInfo ;
			/*top = JF_GetTop(obj_bk);
			obj_tip.style.top = top ;
			obj_tip.style.left = 750 ;*/
			/*obj_tip.style.top = yMousePos ;
			obj_tip.style.left = xMousePos ;

			MM_showHideLayers_header('ToolTip','','show');
		}			
	}
	else
	{*/
		ToolTip.innerHTML = ContentInfo;
		//ToolTip.MoveTo= _positionCanvass
		//alert(window.event.clientY)
		ToolTip.style.left = document.body.scrollLeft + eval(window.event.clientX);
		ToolTip.style.top = document.body.scrollTop + window.event.clientY
		
		ToolTip.style.visibility = 'visible';
	//}	
	return;
		
}


function MM_findObj_header(n, d) { //v4.0
  
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length){
	d=parent.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) 
	x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) 
	x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
	x=MM_findObj_header(n,d.layers[i].document);
  if(!x && document.getElementById) 
	x=document.getElementById(n); 
  return x;
}
function EnterContentInfo(layerName, obj, bRemoveClose)
{	
	var temp ;
    TContent = obj;
	TContent=TContent.replace("*","'");
					
	var TContent_obj=TContent.split("<br>");

	ContentInfo = '<table border="0" cellpadding="0" cellspacing="0" width="350">'+
	'<tr height="25"><td valign="middle" align="left" noWrap bgcolor="#001C84"><font color=white size=-1 face="Arial"><b>&nbsp;Detail Rate Information</b></font>'+
	'</td></tr>' +
		
	'<tr><td valign="top" align="left" noWrap>'+
	'<table border="0" cellpadding="0" bgcolor="#001C84" cellspacing="1" width="350">'+
	'<tr><td valign="top" align="left" noWrap><font color=white size=-1 face="Arial">'+TContent_obj[0]+'</font></td></tr>'+
	'</table>' +
	'</td></tr>' ;

	if(!bRemoveClose)
		ContentInfo = ContentInfo +'<tr bgcolor="#001C84" height="25"><td noWrap valign="middle" align="right"><a style="cursor:pointer;cursor:hand;" onclick=javacript:deActivate("'+layerName+'"); title="Click here to close"><font color=white size=-1 face="Arial"><b>Close</b></font></a>&nbsp;</td></tr>' ;
	
	ContentInfo = ContentInfo +'</table>' ;

	if(browser_type == 'Netscape')
	{
		obj_tip = MM_findObj_header('ToolTip');
		obj_tip.innerHTML = ContentInfo;
	}
	else
	{
		if(window.event)
		{
			var xMousePos = window.event.x+document.body.scrollLeft;
			var yMousePos = window.event.y+document.body.scrollTop;
			document.all("Frame_rateinfo").style.top = yMousePos;
			document.all("Frame_rateinfo").style.left = xMousePos - 350;
        }
        
		document.all("RateInfo").value = ContentInfo
		document.all("Frame_rateinfo").src = "jbi_rate_info.asp?ToolTip=Y"
		document.all("Frame_rateinfo").style.display = "inline"
		
	}
}		
function JF_CloseRateInfo()
{
	document.all("Frame_rateinfo").style.display = "none"
}
//=================================================
//Customer review functions
//=================================================
						var totalrow
 function fill1()
 {

	var tot=document.form_jbi.hid_vs_scale.value
	var t1=tbl.insertRow();
	    
	for(i=0;i<=tot-1;i++)
	{
		var c1=t1.insertCell();
		c1.style.backgroundColor='#3dabe8'
		c1.style.border='solid'
		c1.style.borderLeftWidth='0px'
		c1.style.borderRightWidth='1px'
		c1.style.borderTopWidth='0x'
		c1.style.borderBottomWidth='0px'
		 
		c1.innerHTML="<font size=1><td valign=middle width=10% bgColor='#ffffff'>&nbsp;"
		totalrow=i+1
	}
	
	var tot1=tot.indexOf('.')    
	if((tot1)>0)
	{
		var prec=tot.substring(tot1)
		if ((prec>=parseFloat(".10"))&&(prec<=parseFloat(".35")))
		{	               
		   var tbw=parseFloat(prec) *100
		   var c1=t1.insertCell();
		   c1.style.border='solid'
		   c1.style.borderLeftWidth='0px'
		   c1.style.borderRightWidth='1px'
		   c1.style.borderTopWidth='0x'
		   c1.style.borderBottomWidth='0px'
		   
		   c1.innerHTML="<font size=1><td width=10%><table width=25% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp</font></td></tr></table></font>"  
		   totalrow=i+1
		}  
		 
		if ((prec>parseFloat(".35"))&&(prec<=parseFloat(".65")))
		{		               
		   var c1=t1.insertCell();
		   c1.style.border='solid'
		   c1.style.borderLeftWidth='0px'
		   c1.style.borderRightWidth='1px'
		   c1.style.borderTopWidth='0x'
		   c1.style.borderBottomWidth='0px'
		  
		   c1.innerHTML="<font size=1><td width=10%><font size=1><table width=50% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table></font>"  
		   totalrow=i+1
		}
		    
		 if ((prec>parseFloat(".65"))&&(prec<=parseFloat(".85")))
		 {		               
		    var c1=t1.insertCell();
		    c1.style.border='solid'
		    c1.style.borderLeftWidth='0px'
		    c1.style.borderRightWidth='1px'
		    c1.style.borderTopWidth='0x'
		    c1.style.borderBottomWidth='0px'
		    
			c1.innerHTML="<font size=1><td width=10%><table width=75% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table>"  
			totalrow=i+1
		 }
		 
		 if ((prec>parseFloat(".85"))&&(prec<=parseFloat(".95")))
		 {			                
			var c1=t1.insertCell();
			c1.style.border='solid'
		    c1.style.borderLeftWidth='0px'
		    c1.style.borderRightWidth='1px'
		    c1.style.borderTopWidth='0x'
		    c1.style.borderBottomWidth='0px'
		    
			c1.innerHTML="<font size=1><td width=10%><font size=1><table width=95% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table></font>"  
			totalrow=i+1
		 }
	}         
	        
	        
	if (totalrow!=10)
	{
	  for (i=totalrow;i<=9;i++)
	  {
	     var c1=t1.insertCell();
	     c1.style.border='solid'
		 c1.style.borderLeftWidth='0px'
		 c1.style.borderRightWidth='1px'
		 c1.style.borderTopWidth='0x'
		 c1.style.borderBottomWidth='0px'
		 
	     c1.innerHTML="<font size=1><td valign=middle width=10%>&nbsp"
	        
	  }
	        
	}
       
 } 
 function fill2()
 {
	
	var tot=document.form_jbi.hid_vs_scale.value  
	var t1=document.getElementById("tbl") 
 	var tr1=document.createElement("TR")
 for(i=0;i<=tot-1;i++)
	{
		var td1=document.createElement("TD") 
		td1.style.backgroundColor='#3dabe8'
		td1.style.border='solid'

		td1.style.borderWidth='0px'
		td1.style.borderLeftWidth='0px'
		td1.style.borderRightWidth='1px'
		td1.style.borderTopWidth='0x'
		td1.style.borderBottomWidth='0px'
		 
		td1.innerHTML="<font size=1><td valign=middle width=10% bgColor='black'>&nbsp;"
		totalrow=i+1
		tr1.appendChild(td1)
	}
	
  var tot1=tot.indexOf('.')          
	if((tot1)>0)
	{
		var prec=tot.substring(tot1)  
		if ((prec>=parseFloat(".10"))&&(prec<=parseFloat(".35")))
		{	               
		   var tbw=parseFloat(prec) *100
		   var c1=document.createElement("TD") 
		   c1.style.border='solid'
		   c1.style.borderWidth='0px'
		   c1.style.borderLeftWidth='0px'
		   c1.style.borderRightWidth='1px'
		   c1.style.borderTopWidth='0x'
		   c1.style.borderBottomWidth='0px'
		   
		   c1.innerHTML="<font size=1><td width=10%><table width=25% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp</font></td></tr></table></font>"  
		   totalrow=i+1
		   tr1.appendChild(c1)
		}  
		 
		if ((prec>parseFloat(".35"))&&(prec<=parseFloat(".65")))
		{		               
		   var c1=document.createElement("TD") 
		   c1.style.border='solid'
		   c1.style.borderWidth='0px'
		   c1.style.borderLeftWidth='0px'
		   c1.style.borderRightWidth='1px'
		   c1.style.borderTopWidth='0x'
		   c1.style.borderBottomWidth='0px'
		  
		   c1.innerHTML="<font size=1><td width=10%><font size=1><table width=50% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table></font>"  
		   totalrow=i+1
		   tr1.appendChild(c1)
		}
		    
		 if ((prec>parseFloat(".65"))&&(prec<=parseFloat(".85")))
		 {		               
		    var c1=document.createElement("TD") 
		    c1.style.border='solid'
		    c1.style.borderWidth='0px'
		    c1.style.borderLeftWidth='0px'
		    c1.style.borderRightWidth='1px'
		    c1.style.borderTopWidth='0x'
		    c1.style.borderBottomWidth='0px'
		    
			c1.innerHTML="<font size=1><td width=10%><table width=75% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table>"  
			totalrow=i+1
			tr1.appendChild(c1)
		 }
		 
		 if ((prec>parseFloat(".85"))&&(prec<=parseFloat(".95")))
		 {			                
			var c1=document.createElement("TD") 
			c1.style.border='solid'
			c1.style.borderWidth='0px'
			c1.style.borderColor='black'
		    c1.style.borderLeftWidth='0px'
		    c1.style.borderRightWidth='1px'
		    c1.style.borderTopWidth='0x'
		    c1.style.borderBottomWidth='0px'
		    
			c1.innerHTML="<font size=1><td width=10%><font size=1><table width=95% border=0 cellpadding=0 cellspacing=0><tr><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td><td bgcolor='#3dabe8'><font size=1>&nbsp;</font></td></tr></table></font>"  
			totalrow=i+1
			tr1.appendChild(c1)
		 }
	}          
	        
	if (totalrow!=10)
	{
	  for (i=totalrow;i<=9;i++)
	  {
	     var c1=document.createElement("TD") 
	     c1.style.border='solid'
	     c1.style.borderWidth='0px'
	     c1.style.borderColor='black'
	     c1.style.borderWidth='0px'
		 c1.style.borderLeftWidth='0px'
		 c1.style.borderRightWidth='1px'
		 c1.style.borderTopWidth='0x'
		 c1.style.borderBottomWidth='0px'
		 
	     c1.innerHTML="<font size=1><td valign=middle width=10%>&nbsp</td></font>" 
	     tr1.appendChild(c1)   
	  }
   }	
 t1.appendChild(tr1)

 }
 
 function JF_divshow()
{

var Obj = document.getElementById("reviewdtls");

if (Obj.style.display == "block")
	{	
		Obj.style.display = "none";
		return;
	}
else
	{		
		Obj.style.display = "block";
		js_top = document.body.scrollTop 
		temp = parseFloat(document.body.clientHeight)+parseFloat(document.body.scrollTop) ;
		    	    
		if(js_top>temp) 
		js_top = window.pageYOffset + eval(yMousePos);
		Obj.style.top = document.body.scrollTop  + 5
	    Obj.style.left = document.body.scrollLeft + 5	    
		JF_Paging();
		return;
	}		
}

function JF_Paging(m,limit)
{        
		if (m=='N')
		{		  
			document.form_jbi.hid_pagecnt.value=parseInt(document.form_jbi.hid_pagecnt.value)+1;						
		}
			
		if (m=='P')
		{			
			document.form_jbi.hid_pagecnt.value=parseInt(document.form_jbi.hid_pagecnt.value)-1;			
		}		 
		
		 if (m=="L")
		{			
			document.form_jbi.hid_pagecnt.value=parseInt(limit);		   
		}
		if (m=="F")
		{	
		
			document.form_jbi.hid_pagecnt.value="1";
        }
		
		var Obj = document.getElementById("reviewdtls")	
		
		Obj.src =document.form_jbi.Hid_Non_Secure.value+'jbi_customer_reviewdtls.asp?hid_curpage='+document.form_jbi.hid_pagecnt.value+'&hid_estcode='+document.form_jbi.Hid_Est_Cd.value;		
}
var js_flag='';
function JF_closedtls1()
{
alert ("parent"+js_flag);
var DF=eval('document.all.reviewdtls');
DF.style.display="none"; 

//var Obj = document.getElementById("reviewdtls")
//Obj.style.display = "none";
}

function JF_custreview(seq_num)
{
var Obj = document.getElementById("reviewdtls")
Obj.src = 'jbi_customer_review.asp?hid_page=6&seq_num='+seq_num
Obj.style.display = "block";
}
function adjustIFrameSize (iframeWindow)
{
	if (iframeWindow.document.height) 
	{
		var iframeElement = document.getElementById(iframeWindow.name);
		iframeElement.style.height = iframeWindow.document.height + 'px';
		iframeElement.style.width = iframeWindow.document.width + 'px';
	}
	else if (document.all) 
	{
		var iframeElement = document.all[iframeWindow.name];
		if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
		{
			iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
			iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 5 + 'px';
		}
		else 
		{
			iframeElement.style.height = iframeWindow.document.body.scrollHeight + 5 + 'px';
			iframeElement.style.width = iframeWindow.document.body.scrollWidth + 5 + 'px';
		}
	}
}

function jf_closeIframe()
{
	var obj=document.getElementById("reviewdtls");
	obj.style.display='none';
}
//=========Load Rate in Hotel Page
function JF_loadRates()
{
	var url=document.form_jbi.Hid_Non_Secure.value+"JBI_est_rates_remote.asp?Hid_Est_Cd="+document.form_jbi.Hid_Est_Cd.value+"&Sel_Day="+document.form_jbi.Sel_Day.value+"&Sel_month_year="+document.form_jbi.Sel_month_year.value+"&sle_nights="+document.form_jbi.sle_nights.value+"&sle_NoOfRooms_peg="+document.form_jbi.sle_NoOfRooms_peg.value+"&sle_NoOfAdlts_peg="+document.form_jbi.sle_NoOfAdlts_peg.value;
	//alert(url);
	xmlHttp=GetXmlHttpObject(JF_RateResp);
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);	
}
function JF_RateResp() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
	//alert(xmlHttp.responseText);
	document.getElementById('td_Rate').innerHTML = xmlHttp.responseText;//document.getElementById('dv_id_1').innerHTML);//'<marquee bgcolor=\"#e5e5e5\" height=\"300\" direction=\"up\"> Text will Move </marquee>';//xmlHttp.responseText;	
	document.form_jbi.ValDate.value = document.form_jbi.hid_vlddate.value
}
}
//==============//