
function MM_openBrWindow(theURL,winName,features) { //v2.0
	indival = true;
  window.open(theURL,winName,features);
}

var today=new Date();
var todate=today.getDate();
var tomonth=today.getMonth();
var toyear=today.getFullYear();
var checkOK = "0123456789";

function isDate1(dt)
{
	indival = true;
        var dtCh= "/";
        var daysInMonth = DaysArray(12)
  	var pos1=dt.indexOf(dtCh)
  	var pos2=dt.indexOf(dtCh,pos1+1)
  	var strMonth=dt.substring(0,pos1)
  	var strDay=dt.substring(pos1+1,pos2)
  	var strYear=dt.substring(pos2+1)
  	var strYr=strYear
  	if (strDay.charAt(0)=="0" && strDay.length>1) var strDay=strDay.substring(1)
  	if (strMonth.charAt(0)=="0" && strMonth.length>1) var strMonth=strMonth.substring(1)
  	for (var i = 1; i <= 3; i++) {
  		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
  	}
  	month=parseInt(strMonth)
  	day=parseInt(strDay)
  	year=parseInt(strYr)
  	if (strMonth.length<1 || month<1 || month>12){
  		alert("Please enter a valid month")
  		return false
  	}
  	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
  		alert("Please enter a valid day")
  		return false
  	}
  	return true    
}

function gdsMoreInfosubmit(index,gdsCount,link)
{	
	
	if(gdsCount<1)
	{
			document.GDSMoreInfoForm.link.value=link;

		document.GDSMoreInfoForm.submit();
	}
	else
	{
		document.GDSMoreInfoForm[Number(index)].link.value=link;

		document.GDSMoreInfoForm[Number(index)].submit();
	}
}

function stripCharsInBag(s, bag)
{
	indival = true;
        var i;
        var returnString = "";
        // Search through string's characters one by one.
        // If character is not in bag, append to returnString.
        for (i = 0; i < s.length; i++)
        {   
	    var c = s.charAt(i);
	    if (bag.indexOf(c) == -1) returnString += c;
        }
        return returnString;
}

function daysInFebruary (year)
{
	indival = true;
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) 
{
	indival = true;
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function myfunction()
{
	indival = true;
	document.searchform.submit();
}

function CityCheck(indicator)
{
	indival = true;
   var iscity=false;
   var city=document.searchform.strCity
   var cityname="";
   for(i=0;i<indicator;i++)
   {
        if(city[i].checked)
        {
        	cityname=city[i].value+":WC";
           iscity=true;
        }     
   }
   if(city[indicator].checked)
   {
         
         if(document.searchform.strOtherCity.value!="")
         {
         	cityname=document.searchform.strOtherCity.value+":WN";
            iscity=true;
         }
   }
   if(iscity==false)
   {
           alert("Please enter City Name");
           document.searchform.strOtherCity.focus();
           return false;
       }
       
   else
   {
   	document.searchform.xstartSearch.value=cityname;
            myfunction()
   } 
}


function DateCheck()
{        
	indival = true;
  	var iscity=false;
  	var Checkindate=document.searchform.CheckInDate.value;
  	var Checkinmonth=document.searchform.CheckInMonth.value;
  	Checkinmonth=Number(Checkinmonth);
  	var Checkinyear=document.searchform.CheckInYear.value;
  	var Checkoutdate=document.searchform.CheckOutDate.value;
  	var Checkoutmonth=document.searchform.CheckOutMonth.value;
  	Checkoutmonth=Number(Checkoutmonth);
    var Checkoutyear=document.searchform.CheckOutYear.value;
    var presentday=new Date(toyear,tomonth,todate);
    var enddate=new Date(Checkoutyear,Checkoutmonth-1,Checkoutdate);
    var startdate=new Date(Checkinyear,Checkinmonth-1,Checkindate);
    var city=document.searchform.hotelCity;
    var difference = Date.UTC(enddate.getYear(),enddate.getMonth(),enddate.getDate(),0,0,0)- Date.UTC(startdate.getYear(),startdate.getMonth(),startdate.getDate(),0,0,0);
    var diff=difference/1000/60/60/24;
    var dt=Checkinmonth+"/"+Checkindate+"/"+Checkinyear
    for(i=0;i<8;i++)
    {
        if(city.type!="hidden" )            //changed for travelgo sites
		{
			if(city[i].checked)
            {
                iscity=true;
            }
		}
        
    }
    if(city.type!="hidden" )            //changed for travelgo sites
	{    
	  	if(city[8].checked)
	  	{
	      		if(document.searchform.hotelCityOther.value!="")
	      		{
		 			iscity=true;
	      		}
	  	}
  	}
  	if(city.type=="hidden" && city.value!="")            //changed for travelgo sites
	{
	  	iscity=true;
  	}
	if(iscity==false)
	{
			alert("Please enter City Name");
			document.searchform.hotelCityOther.focus();
			return false;
	}
  	else if(isDate1(dt)==false)
  	{
       		return false;
  	}
  	else if(startdate<presentday)
  	{
     		alert(" CheckIn Date Should Be Higher Than Today's Date");
     		return false;
  	}
  	else if(enddate < startdate)
  	{
    		alert(" End Date Should Be Higher Than  Start Date");
    		return false;
  	}
  
  	else if(diff>30)
  	{
      		alert("Sorry You Cannot Do  Booking For More Than 30 Days");
      		return false;
  	}
   
  	else
  	{
     		return true;
  	} 
}
function DateCheck2()
{        
	indival = true;
  	var Checkindate=document.searchform.CheckInDate.value;
  	var Checkinmonth=document.searchform.CheckInMonth.value;
  	Checkinmonth=Number(Checkinmonth);
  	var Checkinyear=document.searchform.CheckInYear.value;
  	var Checkoutdate=document.searchform.CheckOutDate.value;
  	var Checkoutmonth=document.searchform.CheckOutMonth.value;
  	Checkoutmonth=Number(Checkoutmonth);
        var Checkoutyear=document.searchform.CheckOutYear.value;
        var presentday=new Date(toyear,tomonth,todate);
        var enddate=new Date(Checkoutyear,Checkoutmonth-1,Checkoutdate);
        var startdate=new Date(Checkinyear,Checkinmonth-1,Checkindate);
        var difference = Date.UTC(enddate.getYear(),enddate.getMonth(),enddate.getDate(),0,0,0)- Date.UTC(startdate.getYear(),startdate.getMonth(),startdate.getDate(),0,0,0);
        var diff=difference/1000/60/60/24;
        var dt=Checkinmonth+"/"+Checkindate+"/"+Checkinyear

  	if(isDate1(dt)==false)
  	{
       		return false;
  	}
  	else if(startdate<presentday)
  	{
     		alert(" CheckIn Date Should Be Higher Than Today's Date");
     		return false;
  	}
  	else if(enddate < startdate)
  	{
    		alert(" End Date Should Be Higher Than  Start Date");
    		return false;
  	}
  
  	else if(diff>30)
  	{
      		alert("Sorry You Cannot Do  Booking For More Than 30 Days");
      		return false;
  	}
   
  	else
  	{
     		return true;
  	} 
}

function DateCheck3()
{   
	indival = true;
	var j;
	if(document.searchform.strDestinationType[0].checked)
	{
		j=0;
	}
	
	if(document.searchform.strDestinationType[1].checked)
	{
		j=1;
				
	}
	
	if(j==0)
	{
	      
	    document.searchform.strOtherCity.value=document.searchform.strOtherCity0.value;
	    if(document.searchform.strOtherCity.value==null || document.searchform.strOtherCity.value==""){
	    	for(var i=0;i<document.searchform.strCity.length;i++){
	    		if(document.searchform.strCity[i].checked){
	    			document.searchform.hotelCity.value=document.searchform.strCity[i].value;		
	    		}
	    	}
	    	
	    }
	    else{
	    	document.searchform.hotelCity.value=document.searchform.strOtherCity.value;	
	    	
	    }
	    
	
		document.searchform.CheckInDate.value=document.searchform.strCheckindate0.value;
		document.searchform.CheckInMonth.value=document.searchform.strCheckinmonth0.value;
		document.searchform.CheckInYear.value=document.searchform.strCheckinyear0.value;
		
		document.searchform.CheckOutDate.value=document.searchform.strCheckoutdate0.value;
		document.searchform.CheckOutMonth.value=document.searchform.strCheckoutmonth0.value;
		document.searchform.CheckOutYear.value=document.searchform.strCheckoutyear0.value;
				
		
	}
	
	if(j==1)
	{
		document.searchform.strOtherCity.value=document.searchform.strOtherCity1.value;
		if(document.searchform.strOtherCity.value==null || document.searchform.strOtherCity.value==""){
	    	for(var i=0;i<document.searchform.strCity.length;i++){
	    		if(document.searchform.strCity[i].checked){
	    			document.searchform.hotelCity.value=document.searchform.strCity[i].value;		
	    		}
	    	}
	    	
	    }
	    else{
	    	document.searchform.hotelCity.value=document.searchform.strOtherCity.value;	
	    	
	    }
		
		document.searchform.CheckInDate.value=document.searchform.strCheckindate1.value;
		document.searchform.CheckInMonth.value=document.searchform.strCheckinmonth1.value;
		document.searchform.CheckInYear.value=document.searchform.strCheckinyear1.value;
	
		document.searchform.CheckOutDate.value=document.searchform.strCheckoutdate1.value;
		document.searchform.CheckOutMonth.value=document.searchform.strCheckoutmonth1.value;
		document.searchform.CheckOutYear.value=document.searchform.strCheckoutyear1.value;
	}
	var iscity=false;
  	var Checkindate=document.searchform.CheckInDate.value;
  	var Checkinmonth=document.searchform.CheckInMonth.value;
  	Checkinmonth=Number(Checkinmonth);
  	var Checkinyear=document.searchform.CheckInYear.value;
  	var Checkoutdate=document.searchform.CheckOutDate.value;
  	var Checkoutmonth=document.searchform.CheckOutMonth.value;
  	Checkoutmonth=Number(Checkoutmonth);
    var Checkoutyear=document.searchform.CheckOutYear.value;
    var presentday=new Date(toyear,tomonth,todate);
    var enddate=new Date(Checkoutyear,Checkoutmonth-1,Checkoutdate);
    var startdate=new Date(Checkinyear,Checkinmonth-1,Checkindate);
    var city=document.searchform.strCity;
    var difference = Date.UTC(enddate.getYear(),enddate.getMonth(),enddate.getDate(),0,0,0)- Date.UTC(startdate.getYear(),startdate.getMonth(),startdate.getDate(),0,0,0);
    var diff=difference/1000/60/60/24;
    var dt=Checkinmonth+"/"+Checkindate+"/"+Checkinyear
    for(i=0;i<8;i++)
    {
        if(city.type!="hidden" )            //changed for travelgo sites
		{
			if(city[i].checked)
            {
                iscity=true;
            }
		}
        
    }
    for(i=9;i<16;i++)
    {
        if(city.type!="hidden" )            //changed for travelgo sites
		{
			if(city[i].checked)
            {
                iscity=true;
            }
		}
        
    }
    if(city.type!="hidden" )            //changed for travelgo sites
	{    
	  	if(city[8].checked)
	  	{
	      		if(document.searchform.strOtherCity0.value!="")
	      		{
		 			iscity=true;
	      		}
	  	}
	  	if(city[16].checked)
	  	{
	      		if(document.searchform.strOtherCity1.value!="")
	      		{
		 			iscity=true;
	      		}
	  	}
  	}
  	if(city.type=="hidden" && city.value!="")            //changed for travelgo sites
	{
	  	iscity=true;
  	}
	if(iscity==false)
	{
			alert("Please enter City Name");
			if(j==0){
				document.searchform.strOtherCity0.focus();
			}
			if(j==1){
				document.searchform.strOtherCity1.focus();
			}
			return false;
	}
  	else if(isDate1(dt)==false)
  	{
       		return false;
  	}
  	else if(startdate<presentday)
  	{
     		alert(" CheckIn Date Should Be Higher Than Today's Date");
     		return false;
  	}
  	else if(enddate < startdate)
  	{
    		alert(" End Date Should Be Higher Than  Start Date");
    		return false;
  	}
  
  	else if(diff>30)
  	{
      		alert("Sorry You Cannot Do  Booking For More Than 30 Days");
      		return false;
  	}
   
  	else
  	{		return true;
  	} 
}





function Checkhotel(i)

{
	indival = true;
	alert("dddd");
    var Checkindate=document.forms[i].CheckInDate.value;
    var Checkinmonth=document.forms[i].CheckInMonth.value;
    Checkinmonth=Number(Checkinmonth);
    var Checkinyear=document.forms[i].CheckInYear.value;
    var Checkoutdate=document.forms[i].CheckOutDate.value;
    var Checkoutmonth=document.forms[i].CheckOutMonth.value;
    Checkoutmonth=Number(Checkoutmonth);
    var Checkoutyear=document.forms[i].CheckOutYear.value;

    var presentday=new Date(toyear,tomonth,todate);
    var enddate=new Date(Checkoutyear,Checkoutmonth-1,Checkoutdate);
    var startdate=new Date(Checkinyear,Checkinmonth-1,Checkindate);
   
   
    var difference = Date.UTC(enddate.getYear(),enddate.getMonth(),enddate.getDate(),0,0,0)- Date.UTC(startdate.getYear(),startdate.getMonth(),startdate.getDate(),0,0,0);
    var diff=difference/1000/60/60/24;
    var dt=Checkinmonth+"/"+Checkindate+"/"+Checkinyear
    if(isDate1(dt)==false)
    {
           return false;
    }
    
    else if(startdate<presentday)
    {
       alert(" Check-In-Date Should Be Higher Than Current Date");
       return false;
    }
    else if(enddate < startdate)
    {
        alert(" Check-Out-Date Should Be Higher Than  Check-In-Date");
        return false;
    }
    
        else if(diff>30)
        {
              alert("Sorry You Cannot Do  Booking For More Than 30 Days");
              return false;
    }
  
  
    else
    {
       displayPreloader();  return true;
    } 
}



function othercity()
{
	indival = true;
   document.searchform.hotelCity[8].checked=true;
}

function othercity(i)
{
	indival = true;
	if(i==0){
		document.searchform.strCity[8].checked=true;
	}
	if(i==1){
		document.searchform.strCity[17].checked=true;
	}
   
}

function text()
{
	indival = true;
   document.searchform.hotelCityOther.focus();
}

function carothercity(i)
{
	indival = true;
   document.carsearchform.strCarCity[(i*9)+8].checked=true;
}


function cartext(i)
{
	indival = true;
   document.carsearchform.strCarOtherCity[i].focus();
}

function setCheckOutDate()
{
	indival = true;
   var checkindate=document.searchform.CheckInDate.value;
   var checkinmonth=Number(document.searchform.CheckInMonth.value)-1;
   var checkinyear=document.searchform.CheckInYear.value;
   var checkout=new Date(Number(checkinyear), Number(checkinmonth), Number(checkindate)+1)
   document.searchform.CheckOutDate.value = checkout.getDate();
   document.searchform.CheckOutMonth.value = (checkout.getMonth()+1);
   document.searchform.CheckOutYear.value = checkout.getYear();
   
}


function setCheckOutDate1(i)
{
	indival = true;
   var checkindate=document.searchform[i].strCheckindate.value;
   var checkinmonth=Number(document.searchform[i].strCheckinmonth.value)-1;
   var checkinyear=document.searchform[i].strCheckinyear.value;
   var checkout=new Date(Number(checkinyear), Number(checkinmonth), Number(checkindate)+1)
   document.searchform[i].strCheckoutdate.value = checkout.getDate();
   document.searchform[i].strCheckoutmonth.value = (checkout.getMonth()+1);
   document.searchform[i].strCheckoutyear.value = checkout.getYear();
   
}

function setCheckOutDate(i)
{

	indival = true;
  var checkindate;
  var checkinmonth;
  var checkinyear;
  var checkout;
  
    if(i==0)
    {
    	
	checkindate=document.searchform.strCheckindate0.value;
	checkinmonth=Number(document.searchform.strCheckinmonth0.value)-1;
	checkinyear=document.searchform.strCheckinyear0.value;
	checkout=new Date(Number(checkinyear), Number(checkinmonth), Number(checkindate)+1)

	document.searchform.strCheckoutdate0.value = checkout.getDate();
	document.searchform.strCheckoutmonth0.value = (checkout.getMonth()+1);
	document.searchform.strCheckoutyear0.value = checkout.getYear();
    }
    
    else if(i==1)
    {
    	checkindate=document.searchform.strCheckindate1.value;
    	checkinmonth=Number(document.searchform.strCheckinmonth1.value)-1;
    	checkinyear=document.searchform.strCheckinyear1.value;
    	checkout=new Date(Number(checkinyear), Number(checkinmonth), Number(checkindate)+1)
    
    	document.searchform.strCheckoutdate1.value = checkout.getDate();
    	document.searchform.strCheckoutmonth1.value = (checkout.getMonth()+1);
    	document.searchform.strCheckoutyear1.value = checkout.getYear();
    }
    
    else 
    {
	checkindate=document.searchform.strCheckindate.value;
	checkinmonth=Number(document.searchform.strCheckinmonth.value)-1;
	checkinyear=document.searchform.strCheckinyear.value;
	checkout=new Date(Number(checkinyear), Number(checkinmonth), Number(checkindate)+1)

	document.searchform.strCheckoutdate.value = checkout.getDate();
	document.searchform.strCheckoutmonth.value = (checkout.getMonth()+1);
	document.searchform.strCheckoutyear.value = checkout.getYear();
    }
   
      
}

// Hemant - ACN Details

function graphrollover(imgPath,identifier, GraphTxt)
{
	document.getElementById(identifier).style.backgroundImage='url('+imgPath+'bar_back_hover.gif)';
	document.getElementById(identifier).style.cursor='pointer';
	document.getElementById(GraphTxt).style.color='#ff0000';
}

function graphrollout(imgPath,identifier, GraphTxt){
	document.getElementById(identifier).style.backgroundImage='url('+imgPath+'bar_back.gif)';
	document.getElementById(GraphTxt).style.color='#4E4E4E';
}

function ShowGraph(h1, h2, h3, h4, h5, h6)
{
		alert(h1);
	document.getElementById('Rooms').style.height=h1;
	document.getElementById('Restaurants').style.height=h2;
	document.getElementById('Recreation').style.height=h3;
	document.getElementById('Business').style.height=h4;
	document.getElementById('Safety').style.height=h5;
	document.getElementById('Conferences').style.height=h6;
	document.getElementById('showGraph').style.display='block';
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById("UserRatingDiv").style.top=event.clientY+document.body.scrollTop+5;
		document.getElementById("UserRatingDiv").style.left=event.clientX-500;
		window.scroll(event.clientX-500,event.clientY+document.body.scrollTop+5);
	}
	else
	{
		document.getElementById("UserRatingDiv").style.top=event.pageY+5;
		document.getElementById("UserRatingDiv").style.left=event.pageX-550;
		window.scrollTo(event.pageX,event.pageY);
	}

}
	
function showTab(tab)
{
	//alert(tab);
}

function ACNDetails(index,url,event)
{
	var scrollTopValue = document.body.scrollTop;
	var xmlHttp=newXMLHttpRequest();
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById('UserRatingDiv').style.display='block';
			document.getElementById("UserRatingDiv").innerHTML=xmlHttp.responseText;
			document.getElementById('hidepage').style.display='block';
			document.getElementById('frame1').style.display='block';
			document.getElementById('hidepage').style.width=(screen.width)+"px";
			document.getElementById('hidepage').style.height =12000+"px";
			document.getElementById('frame1').style.width=(screen.width)+"px";
			document.getElementById('frame1').style.height =12000+"px";
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	xmlHttp.send(null);
	testingReview(scrollTopValue);
	
}

// Hemant - ACNeilsen Code Ends

function formsubmit(index,count,link, form, divAppender)
{  
    ClosePayByCashPopUp();
	indival = true;
	//var moreInfoDiv = (moreInfoDiv == null) ? "MoreInfoDiv" : moreInfoDiv;
	var divAppender = (divAppender == null) ? "" : divAppender;
	var isGoogleMapFormLink = 'false';
	if(divAppender == 'GoogleMap')
	{
		isGoogleMapFormLink = 'true';
	}
     if(indicator<1)
	   {
        var form = (form == null) ? document.MoreInfoForm : form;
		
	   	form.link.value = link;
        var strHotelId=form.strHotelId.value;

		var link=link;

		var hotelName=form.hotelName.value;

		var hotelClass=form.hotelClass.value;

		var address1=form.address1.value;

		var address2=form.address2.value;

		var HotelContent=form.HotelContent.value;

		var city=form.city.value;

		var state=form.state.value;

		var pinCode=form.pinCode.value;

		var country=form.country.value;

		var strAffiliateCode=form.strAffiliateCode.value;

		var searchChoice=form.searchChoice.value;

		var strByPass=form.strByPass.value;

		 if(link=='travelleropinions')
		{
			FixUpdatingResultsPosition();
		}
		else
		{
		setTimeout("showCashBackIndicator()",1500);

			 if(document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML!="")
			{
			  document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML="";
			}
			showMatrix(link,index, divAppender);
			document.getElementById(""+divAppender+"closebutton["+index+"]").style.display='block';
			document.getElementById(""+divAppender+"moreinfotable["+index+"]").style.display='block';
			document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").style.display='block';
		    document.getElementById(""+divAppender+"moreinfo_preloader["+index+"]").style.display='block';

		 

		}
			
		document.getElementById('sortBy').style.display='none';
		
		var xmlHttp=newXMLHttpRequest();
				
		xmlHttp.onreadystatechange=function()
		{
		      if(xmlHttp.readyState==4)
		        {
		         		                 
		                 if(link!='travelleropinions')
		                 {
								 
								 
								// document.getElementById(""+divAppender+"closebutton["+index+"]").style.display='block';
                                // document.getElementById("moreinfotable["+index+"]").style.display='block';
								 //document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").style.display='block';
								// document.getElementById("moreinfo_preloader["+index+"]").style.display='block';

								  //document.getElementById("moreinfo_preloader["+index+"]").style.display='none';
							     if (link == 'photo'){
									var response = xmlHttp.responseText;
									if (response.indexOf("tableHotelPhotos") > -1){
										 document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML=response;
										 handlePhotoTab(link, index);
									}
								 }else{
									 document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML=xmlHttp.responseText;
								 }
							   
							document.getElementById(""+divAppender+"moreinfo_preloader["+index+"]").style.display='none';
				         }
				 else
				 {
					  document.getElementById('UpdatingResults').style.display='none';
				      var scrollTopValue = document.body.scrollTop;
					  document.body.style.overflow="hidden";
				      var scrollLeftValue = document.body.scrollLeft;
				      document.getElementById('UserRatingDiv').style.display='block';
				      document.getElementById("UserRatingDiv").innerHTML=xmlHttp.responseText;
				      document.getElementById('hidepage').style.display='block';
					  document.getElementById('frame1').style.display='block';
				      document.getElementById('hidepage').style.left=scrollLeftValue+"px";
					  document.getElementById('frame1').style.left=scrollLeftValue+"px";
				      document.getElementById('hidepage').style.width=(screen.width)+"px";
				      document.getElementById('hidepage').style.height =12000+"px";
					  document.getElementById('frame1').style.width=(screen.width)+"px";
					  document.getElementById('frame1').style.height =12000+"px";
					  //JSFX_FloatDiv("UserRatingDiv", 20, 70).flt();
					 // JSFX_FloatDiv("hidepage", 0, 0).flt();
					 // JSFX_FloatDiv("frame1", 0, 0).flt();
					  testingReview(scrollTopValue);
					  initScrollLayer();
				 }
		        }
		}
		//xmlHttp.open("GET","moreinfo.do?strHotelId="+strHotelId+"&link="+link+"&hotelName="+hotelName+"&hotelClass="+hotelClass+"&address1="+address1+"&address2="+address2+"&HotelContent="+HotelContent+"&city="+city+"&state="+state+"&pinCode="+pinCode+"&country="+country+"&strAffiliateCode="+strAffiliateCode+"&searchChoice="+searchChoice+"&strByPass="+strByPass+"&index="+index,true);
		xmlHttp.open("GET","hoteldetail.do?strHotelId="+strHotelId+"&link="+link+"&hotelName="+hotelName+"&hotelClass="+hotelClass+"&address1="+address1+"&address2="+address2+"&HotelContent="+HotelContent+"&city="+city+"&state="+state+"&pinCode="+pinCode+"&country="+country+"&strAffiliateCode="+strAffiliateCode+"&searchChoice="+searchChoice+"&strByPass="+strByPass+"&index="+index+"&isGoogleMapFormLink="+isGoogleMapFormLink,true);
			
		xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
		
	    xmlHttp.send(null);
		
        //form.submit();
	   }
	   else
	   {
		var form;
		//check whether to use googleForm element or moreinfo form element
		if(form == null)
		 {
			//Check whether to use the node list form of the form element or the simple one
				if(document.MoreInfoForm[Number(index)]=='[object HTMLFormElement]' || document.MoreInfoForm[Number(index)].strHotelId != null)   {
					form = document.MoreInfoForm[Number(index)];
				} else {
					form = document.MoreInfoForm;
				}
		 }
		
		var strHotelId=form.strHotelId.value;

		var link=link;

		var hotelName=form.hotelName.value;

		var hotelClass=form.hotelClass.value;

		var address1=form.address1.value;

		var address2=form.address2.value;

		var HotelContent=form.HotelContent.value;

		var city=form.city.value;

		var state=form.state.value;

		var pinCode=form.pinCode.value;

		var country=form.country.value;

		var strAffiliateCode=form.strAffiliateCode.value;

		var searchChoice=form.searchChoice.value;

		var strByPass=form.strByPass.value;
		///////////////////////////////////////////////////
		 if(link=='travelleropinions')
		{
			FixUpdatingResultsPosition();
		}
		else
		{

			if(document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML!="")
			{
				
			  document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML="";
			}
			showMatrix(link,index, divAppender);
			document.getElementById(""+divAppender+"closebutton["+index+"]").style.display='block';
			document.getElementById(""+divAppender+"moreinfotable["+index+"]").style.display='block';
			document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").style.display='block';
		    document.getElementById(""+divAppender+"moreinfo_preloader["+index+"]").style.display='block';
          

		}
		document.getElementById('sortBy').style.display='none';
		
		var xmlHttp=newXMLHttpRequest();
				
		xmlHttp.onreadystatechange=function()
		{
		      if(xmlHttp.readyState==4)
		        {
		         		                 
		                 if(link!='travelleropinions')
		                 {
								
								 //showMatrix(link,index, divAppender);
							     if (link == 'photo'){
									var response = xmlHttp.responseText;
									if (response.indexOf("tableHotelPhotos") > -1){
										 document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML=response;
										 handlePhotoTab(link, index);
									}
								 }else{
									 document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").innerHTML=xmlHttp.responseText;
								 }
						   document.getElementById(""+divAppender+"moreinfo_preloader["+index+"]").style.display='none';
						   //cash back
						   showCashBackIndicator()
							//cash back
				 }
				 else
				 {	
					  document.getElementById('UpdatingResults').style.display='none';
					  var scrollTopValue = document.body.scrollTop;
				      document.body.style.overflow="hidden";
				      var scrollLeftValue = document.body.scrollLeft;
				      document.getElementById('UserRatingDiv').style.display='block';
				      document.getElementById("UserRatingDiv").innerHTML=xmlHttp.responseText;
				      /////////////////////////////////////////////////////////////////
					 
				       
				        //document.getElementById('PageDiv').style.display='block';
				        //document.getElementById("content").innerHTML=xmlHttp.responseText;
				        //scroller.init();  
						
				       
				      ///////////////////////////////////////////////////
				     
				      document.getElementById('hidepage').style.display='block';
					  document.getElementById('frame1').style.display='block';
				      document.getElementById('hidepage').style.left=scrollLeftValue+"px";
					  document.getElementById('frame1').style.left=scrollLeftValue+"px";
				      document.getElementById('hidepage').style.width=(screen.width)+"px";
				      document.getElementById('hidepage').style.height =12000+"px";
					  document.getElementById('frame1').style.width=(screen.width)+"px";
					  document.getElementById('frame1').style.height =12000+"px";
                       testingReview(scrollTopValue);
					 ///JSFX_FloatDiv("UserRatingDiv", 20, 70).flt();
					 //JSFX_FloatDiv("hidepage", 0, 0).flt();
					 //JSFX_FloatDiv("frame1", 0, 0).flt();

                      initScrollLayer()
	                  
					
				 }
		        }
		}
		
		xmlHttp.open("GET","hoteldetail.do?strHotelId="+strHotelId+"&link="+link+"&hotelName="+hotelName+"&hotelClass="+hotelClass+"&address1="+address1+"&address2="+address2+"&HotelContent="+HotelContent+"&city="+city+"&state="+state+"&pinCode="+pinCode+"&country="+country+"&strAffiliateCode="+strAffiliateCode+"&searchChoice="+searchChoice+"&strByPass="+strByPass+"&index="+index+"&isGoogleMapFormLink="+isGoogleMapFormLink,true);
		//	xmlHttp.open("GET","moreinfo.do?strHotelId="+strHotelId+"&link="+link+"&hotelName="+hotelName+"&hotelClass="+hotelClass+"&address1="+address1+"&address2="+address2+"&HotelContent="+HotelContent+"&city="+city+"&state="+state+"&pinCode="+pinCode+"&country="+country+"&strAffiliateCode="+strAffiliateCode+"&searchChoice="+searchChoice+"&strByPass="+strByPass+"&index="+index,true);
		
			
		xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
		
	    xmlHttp.send(null);
		
		
		
		/////////////////////////////////////////////////////
	        
	        
	       
	       
	       
	       //form.submit();
	   }
}

function formsubmitcity(index)
{
	indival = true;
   if((document.MoreInfoForm.length)!=1)
   {
       document.MoreInfoForm[index].submit();
   }
   else
   {
       document.MoreInfoForm.submit();
   }
}




function switchImg(what,newImg)
{ 
	indival = true;
	if (document.images)
	{	
		document.images[what].src = eval(newImg + ".src");
	}
}

function checkSelectPage(indicator)
{

	indival = true;
	if(toyear<1900)
        {
      		toyear=toyear+1900;
        }
    	var reportingpoint = document.carBookingForm.arrReportingPoint
   	var date=document.carBookingForm.arrDD;
    	var month=document.carBookingForm.arrMM;
    	var year=document.carBookingForm.arrYY;
    	var presentday=new Date(toyear,tomonth,todate);
        if(indicator==1)
    	{
         	year1=year.value;
         	if(year1<1900)
      		{
      			year1=Number(year.value)+1900;
       		}
         	var startdate=new Date(year1,(month.value)-1,date.value);
         	if(startdate<presentday)
      		{ 
           		alert("Date should be greater than today's date");
           		date.focus();
           		return false;
      		}   
        	if(reportingpoint.value.length==0)
      		{
        		alert("Please enter reporting point");
        		reportingpoint.focus();
        		return false;
      		}
        }
    
    	else
    	{
         	for(i=0;i<indicator;i++)
      		{ 
     			if(reportingpoint[i].value.length==0)
      			{
        			alert("Please enter reporting point");
        			reportingpoint[i].focus();
        			return false;
      			}
     		}
     
     		if(indicator==2)
     		{
        		var firstday=new Date(year[0].value,(month[0].value)-1,date[0].value);
        		var secondday=new Date(year[1].value,(month[1].value)-1,date[1].value);
        		var finalday=new Date(year[0].value,(month[0].value)-1,Number(date[0].value)+30);
        		if(firstday<presentday)
        		{
          			alert("Date should be greater than today's date");
          			date[0].focus();
          			return false;
        		}
			if(firstday>secondday)
			{
			       alert("Date should be greater than previous date");
			    	date[1].focus();
			    	return false;
			}
			if(secondday>finalday)
			{
			    alert("Renting date should not be more than 30 days from First renting date");
			    date[1].focus();
			    return false;
			}
        
     		}
    		else if(indicator>2)
    		{
        		var firstday=new Date(year[0].value,(month[0].value)-1,date[0].value);
			var secondday=new Date(year[1].value,(month[1].value)-1,date[1].value);
			var lastdate=new Date(year[indicator-1].value,(month[indicator-1].value)-1,date[indicator-1].value);
			var secondlastdate=new Date(year[indicator-2].value,(month[indicator-2].value)-1,date[indicator-2].value);
			var finalday=new Date(year[0].value,(month[0].value)-1,Number(date[0].value)+30);

			if(firstday<presentday)
			{
			  alert("Date should be greater than today's date");
			  date[0].focus();
			  return false;
			}
			if(firstday>secondday)
			{
			    alert("Date should be less than next date");
			    date[0].focus();
			    return false;
			}
			if(lastdate<secondlastdate)
			{
			       alert("Date should be greater than previous date");
			    date[indicator-1].focus();
			    return false;
			}
			if(lastdate>finalday)
			{
			    alert("Renting date should not be more than 30 days from First Renting Date");
			    date[indicator-1].focus();
			    return false;
			}
     			for(i=1;i<indicator-1;i++)
      			{
          			var enddate=new Date(year[i+1].value,(month[i+1].value)-1,date[i+1].value);
          			var startdate=new Date(year[i].value,(month[i].value)-1,date[i].value);
          			var previousdate=new Date(year[i-1].value,(month[i-1].value)-1,date[i-1].value);
          			if(startdate>enddate)
          			{
            				alert("Date should be in-between previous date and next date");
           				 date[i+1].focus();
            				return false;
          			}
          			if(startdate<previousdate)
            			{
                			alert("Date should be in-between previous date and next date");
                			date[i].focus();
             				return false; 
         			}
         			if(startdate<presentday)
				{
				    alert("Date should be greater than today's date");
				    date[i].focus();
				    return false;
				}  
         			if(enddate>finalday)
            			{
             				alert("Renting date should not be more than 30 days from First renting date");
             				date[i+1].focus();
             				return false;
            			} 
            		}
    		}
         
   	}
   	return true;
}


function isInteger(s){
	indival = true;
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	indival = true;
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	indival = true;
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) 
{
	indival = true;
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function desiyaIndiaDate(i)

{
	indival = true;
    var startdate=new Date(toyear,tomonth,todate+1);
    var enddate=new Date(toyear,tomonth,todate+2);
    
    for(var j=0;j<i;j++)
    {
    	document.searchform[j].strCheckindate.value = startdate.getDate();
    	document.searchform[j].strCheckinmonth.value = startdate.getMonth()+1;
    	document.searchform[j].strCheckinyear.value = startdate.getFullYear();
    
    	document.searchform[j].strCheckoutdate.value = enddate.getDate();
    	document.searchform[j].strCheckoutmonth.value = enddate.getMonth()+1;
    	document.searchform[j].strCheckoutyear.value = enddate.getFullYear();
   }
}
function leapYearCheck(y) {	
	indival = true;
	if ( ( (y%4==0)&&(y%100 != 0) ) || (y%400==0) ) { 
		return true;
	} else {
		return false;
	}
}

function addDays(datefield, num) {
	indival = true;
	var numDays=Number(monthDays[num]);
	if(leapYearCheck(toyear) && (num==1)) {		
		numDays=29;
	}
	
	datefield.options.length=0;
	for(i=1; i<=numDays; i++) {
		datefield.options[datefield.options.length]=new Option(i, i);
	}
	
	if(datefield.options[0].value=="")
		datefield.remove(0);
		
}

function addDaysAfterSearch(datefieldName, num) {
	indival = true;
	
	var datefield = document.getElementById(datefieldName);
	var numDays=Number(monthDays[num]);
	if(leapYearCheck(toyear) && (num==1)) {		
		numDays=29;
	}
	datefield.options.length=0;	

	

	for(i=1; i<=numDays; i++) {
		datefield.options[datefield.options.length]=new Option(i,i);
	}
	
	if(datefield.options[0].value=="")
		datefield.remove(0);
		
}


monthDays=new Array("31", "28", "31", "30", "31",  "30", "31", "31", "30", "31", "30", "31");

function setCheckOutDateNew()
{
	indival = true;
		var d=Number(document.searchform.strCheckindate.value);
		var m=Number(document.searchform.strCheckinmonth.value);
		var y=Number(document.searchform.strCheckinyear.value);
		var checkoutDay=d+1;
		var nextMonth=m;
		var checkoutYear=y;
		
		if(leapYearCheck(y)) {		
			monthDays[1]="29";
		} else {
			monthDays[1]="28";
		}
		
		if(leapYearCheck(y) && m==2) {
			addDays(document.searchform.strCheckindate, m-1);
			addDays(document.searchform.strCheckoutdate, m-1);
		}		
		
		
		if(document.searchform.strCheckinmonth.options.length!=monthDays[m-1]) {
			addDays(document.searchform.strCheckindate, m-1);
			addDays(document.searchform.strCheckoutdate, m-1);
		}
		
		if(checkoutDay > monthDays[m-1]) {
			nextMonth=m+1;
			if(nextMonth>12) {
				nextMonth=1;			
				checkoutYear+=1;
			}
			addDays(document.searchform.strCheckoutdate, nextMonth-1);
			checkoutDay=checkoutDay-monthDays[m-1];
		}
		
		if(d>monthDays[m-1]) {
			d=monthDays[m-1];
			checkoutDay=1;
		}
		
		
		document.searchform.strCheckinyear.value=y;
		document.searchform.strCheckinmonth.value=m;
		document.searchform.strCheckindate.value=d;
		
		document.searchform.strCheckoutyear.value=checkoutYear;
		document.searchform.strCheckoutmonth.value=nextMonth;
		document.searchform.strCheckoutdate.value=checkoutDay;
   
}

function setCheckOutDateNewAfterSearch()
{
	indival = true;
		var d=Number((document.getElementById('strCheckindate')).value);
		var m=Number((document.getElementById('strCheckinmonth')).value);
		var y=Number((document.getElementById('strCheckinyear')).value);
		var checkoutDay=d+1;
		var nextMonth=m;
		var checkoutYear=y;
		
		if(leapYearCheck(y)) {		
			monthDays[1]="29";
		} else {
			monthDays[1]="28";
		}
		
		if(leapYearCheck(y) && m==2) {
			addDaysAfterSearch('strCheckindate', m-1);
			addDaysAfterSearch('strCheckoutdate', m-1);
		}		
		
		
		if((document.getElementById('strCheckinmonth')).options.length!=monthDays[m-1]) {
			addDaysAfterSearch('strCheckindate', m-1);
			addDaysAfterSearch('strCheckoutdate', m-1);
		}
		
		if(checkoutDay > monthDays[m-1]) {
			nextMonth=m+1;
			if(nextMonth>12) {
				nextMonth=1;			
				checkoutYear+=1;
			}
			addDaysAfterSearch('strCheckoutdate', nextMonth-1);
			checkoutDay=checkoutDay-monthDays[m-1];
		}
		
		if(d>monthDays[m-1]) {
			d=monthDays[m-1];
			checkoutDay=1;
		}
		
		(document.getElementById('strCheckinyear')).value=y;
		(document.getElementById('strCheckinmonth')).value=m;
		(document.getElementById('strCheckindate')).value=d;
		
		(document.getElementById('strCheckoutyear')).value=checkoutYear;
		(document.getElementById('strCheckoutmonth')).value=nextMonth;
		(document.getElementById('strCheckoutdate')).value=checkoutDay;
}

function setDates() {
	indival = true;
	if(leapYearCheck(document.searchform.strCheckoutyear.value)) {		
		monthDays[1]="29";
	} else {
		monthDays[1]="28";
	}	
	var checkoutdate=document.searchform.strCheckoutdate.value;
	addDays(document.searchform.strCheckoutdate, document.searchform.strCheckoutmonth.selectedIndex);
	if(checkoutdate>document.searchform.strCheckoutdate.options.length) {
		document.searchform.strCheckoutdate.value=document.searchform.strCheckoutdate.options.length;
	} else {
		document.searchform.strCheckoutdate.value=checkoutdate;
	}
}

function dindate(i)
{  
	
	
	
    var Checkindate=document.forms[i].strCheckindate.value;
    var Checkinmonth=document.forms[i].strCheckinmonth.value;
    Checkinmonth=Number(Checkinmonth);
    var Checkinyear=document.forms[i].strCheckinyear.value;
    var Checkoutdate=document.forms[i].strCheckoutdate.value;
    var Checkoutmonth=document.forms[i].strCheckoutmonth.value;
    Checkoutmonth=Number(Checkoutmonth);
    var Checkoutyear=document.forms[i].strCheckoutyear.value;

    var presentday=new Date(toyear,tomonth,todate);
    var enddate=new Date(Checkoutyear,Checkoutmonth-1,Checkoutdate);
    var startdate=new Date(Checkinyear,Checkinmonth-1,Checkindate);
   
   
    var difference = Date.UTC(enddate.getYear(),enddate.getMonth(),enddate.getDate(),0,0,0)- Date.UTC(startdate.getYear(),startdate.getMonth(),startdate.getDate(),0,0,0);
    var diff=difference/1000/60/60/24;

    var dt=Checkinmonth+"/"+Checkindate+"/"+Checkinyear
    if(isDate1(dt)==false)
    {
           return false;
    }
    
    else if(startdate<presentday)
    {
       alert(" Check-In-Date Should Be Higher Than Current Date");
       return false;
    }
    else if(enddate < startdate)
    {
        alert(" Check-Out-Date Should Be Higher Than  Check-In-Date");
        return false;
    }
    
        else if(diff>30)
        {
              alert("Sorry You Cannot Do  Booking For More Than 30 Days");
              return false;
    }
  
  
    else
    {
         return true;
    } 
}

function setDatesAfterSearch() {
	indival = true;
	if(leapYearCheck((document.getElementById('strCheckoutyear')).value)) {		
		monthDays[1]="29";
	} else {
		monthDays[1]="28";
	}	
	var checkoutdate=(document.getElementById('strCheckoutdate')).value;
	addDaysAfterSearch('strCheckoutdate', (document.getElementById('strCheckoutmonth')).selectedIndex);
	if(checkoutdate>(document.getElementById('strCheckoutdate')).options.length) {
		(document.getElementById('strCheckoutdate')).value=(document.getElementById('strCheckoutdate')).options.length;
	} else {
		(document.getElementById('strCheckoutdate')).value=checkoutdate;
	}
}
/////////js for matrix starts////////////////////////
function showMatrix(link,index, divAppender)
{
	stopPageLoading(index);
	var divAppender = (divAppender == null) ? "" : divAppender;
	if(link=='RoomDesc')
	{
		 
		document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab_a";
        document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#fa4d00";
		document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#2f78dc";
        document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#2f78dc";
		//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
        //document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#2f78dc";
	}
	else if(link=='facilities')
	{
        document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab_a";
        document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#fa4d00";
        document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#2f78dc";
		//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
        //document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#2f78dc";

	}
	else if(link=='attraction')
	{
	    document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#2f78dc";
        document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab_a";
        document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#fa4d00";
		document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#2f78dc";
		//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
        //document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#2f78dc";	

	}else if(link=='photo')
	{
        document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#2f78dc";
        document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab_a";
        document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#fa4d00";
		//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
        //document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
		document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab";
        document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#2f78dc";

	}
	else if (link=='emailfriend')
	{
	document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#2f78dc";
	//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
	//document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab_a";
	document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#fa4d00";
	}
	
}
function closeDiv(index, divAppender)
{
	stopPageLoading(index);
	var divAppender = (divAppender == null) ? "" : divAppender;
	document.getElementById(""+divAppender+"moreinfotable["+index+"]").style.display='none';
	document.getElementById(""+divAppender+"MoreInfoDiv["+index+"]").style.display='none';
	document.getElementById(""+divAppender+"closebutton["+index+"]").style.display='none';
	document.getElementById(""+divAppender+"RD["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"RD_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"FC["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"FC_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"IA["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"IA_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"PH["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"PH_link["+index+"]").style.color="#2f78dc";
	//document.getElementById(""+divAppender+"AV["+index+"]").className="matrix_tab";
	//document.getElementById(""+divAppender+"AV_link["+index+"]").style.color="#2f78dc";
	document.getElementById(""+divAppender+"EF["+index+"]").className="matrix_tab";
	document.getElementById(""+divAppender+"EF_link["+index+"]").style.color="#2f78dc";
	//cash back
		showCashBackIndicator()
		//cash back
}
/////////js for matrix ends////////////////////////


/////////js for Map and Area starts////////////////////////
function closeMapArea()
{
 document.getElementById("closeAreaMap").style.display='none';
 document.getElementById("ShowArea").style.display='none';
 document.getElementById("ShowMap").style.display='none';
 document.getElementById("areatd").className="matrix_tab";
 document.getElementById("areatdfont").style.color="#2f78dc";
 document.getElementById("maptd").className="matrix_tab";
 document.getElementById("maptdfont").style.color="#2f78dc";
 //cash back
		showCashBackIndicator()
		//cash back
}

function closeMapSelectedHotelArea()
{
	document.getElementById("closeMapHotelArea").style.display='none';
	document.getElementById("closeMapHotelAreaTable").style.display='none';
	document.getElementById("ShowMap").style.bgcolor='#B2B2B2';
	if (navigator.appName == "Microsoft Internet Explorer")
	  {
		document.body.scrollTop=document.body.scrollTop-document.getElementById("map").scrollHeight;
	  }
	  else
	  {
		document.body.scrollTop=document.body.scrollTop-document.getElementById("map").scrollHeight;
	  }	
}

function displayAreaMap(indicator)
{
   if(indicator=="area")
	{ 
      document.getElementById("closeAreaMap").style.display='block';
	  document.getElementById("ShowArea").style.display='block';
      document.getElementById("ShowMap").style.display='none';

	  document.getElementById("areatd").className="matrix_tab_a";
      document.getElementById("areatdfont").style.color="#fa4d00";
	  document.getElementById("maptd").className="matrix_tab";
	  document.getElementById("maptdfont").style.color="#2f78dc";
      
	}
	else
	{
     document.getElementById("closeAreaMap").style.display='block';
	 document.getElementById("ShowMap").style.display='block';
     document.getElementById("ShowArea").style.display='none';

	  document.getElementById("maptd").className="matrix_tab_a";
      document.getElementById("maptdfont").style.color="#fa4d00";
	  document.getElementById("areatd").className="matrix_tab";
	  document.getElementById("areatdfont").style.color="#2f78dc";

	}
	//cash back
		showCashBackIndicator()
		//cash back
 
}



/////////js for Map and Area ends////////////////////////
//////////js for scrolling starts////////////
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function JSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
	el.flt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.flt()", 40);
	}
	return el;
}


/////////js for scrolling ends//////////////

////////js for travelopinions close button starts//////////
function closeUserRatingScreen()
{
  document.getElementById("UserRatingDiv").style.display='none';
  document.getElementById('hidepage').style.display='none';
  document.getElementById('frame1').style.display='none';
  document.body.style.overflow="auto";	
}

function closePromotionsScreen()
{
  document.getElementById("hotelPromotionsDiv").style.display='none';
  document.getElementById('hidepage').style.display='none';
  document.getElementById('frame1').style.display='none';
  document.body.style.overflow="auto";	
}

////////js for travelopinions close button ends//////////
 /// js for help div in left starts//////

 function amenityhelp()
 {
	closePopups();	
	
	 if (navigator.appName == "Microsoft Internet Explorer")
	{
	document.getElementById("amenityhelpdiv").style.top=407;//327;
	document.getElementById("amenityhelpdiv").style.left=192;
	 }
	 else
	{
	document.getElementById("amenityhelpdiv").style.top=405;//325;
	document.getElementById("amenityhelpdiv").style.left=192;
	}

	document.getElementById("amenityhelpdiv").style.display='block';
 }



 function hotelnamehelp()
 {
	closePopups();

	if (navigator.appName == "Microsoft Internet Explorer")
	{
	document.getElementById("hotelnamesearchhelpdiv").style.top=134;
	document.getElementById("hotelnamesearchhelpdiv").style.left=192;
	}
	else
	{
	document.getElementById("hotelnamesearchhelpdiv").style.top=133;
	document.getElementById("hotelnamesearchhelpdiv").style.left=192;
	}

	document.getElementById("hotelnamesearchhelpdiv").style.display='block';
 }



function starratinghelp()
 {
	closePopups();

	if (navigator.appName == "Microsoft Internet Explorer")
	{
	document.getElementById("starratinghelpdiv").style.top=329;//249;
	document.getElementById("starratinghelpdiv").style.left=192;
	}
	else
	{
	document.getElementById("starratinghelpdiv").style.top=324;//244;
	document.getElementById("starratinghelpdiv").style.left=192;
	}

	document.getElementById("starratinghelpdiv").style.display='block';
 }

function PriceSliderHelp()
{
	closePopups();

	if (navigator.appName == "Microsoft Internet Explorer")
	{
	document.getElementById("PriceSliderHelpDiv").style.top=228;
	document.getElementById("PriceSliderHelpDiv").style.left=192;
	}
	else
	{
	document.getElementById("PriceSliderHelpDiv").style.top=223;
	document.getElementById("PriceSliderHelpDiv").style.left=192;
	}
    
	document.getElementById("PriceSliderHelpDiv").style.display='block';
 }


 /// js for help div in left ends//////


 /////Function showing initial bookable hotels starts
 function showInitialBookableHotels()
 {
	 
    //document.getElementById('UpdatingResults').style.display='block';
	//document.getElementById("UpdatingResults").style.top=document.getElementById("UpdatingResults").clientHeight+document.body.scrollTop+20;
	FixUpdatingResultsPosition();
	document.getElementById('sortBy').style.display='none';
	var xmlHttp=newXMLHttpRequest();
     xmlHttp.onreadystatechange=function()
	  {
		if(xmlHttp.readyState==4)
        {
        document.getElementById("Resulttable").innerHTML=xmlHttp.responseText;
		document.getElementById('default').style.display='block';
		document.getElementById('SortbyLeftPanel').style.display='none';
		checkCheckBox();
		//////////////
		for (i=0;i<document.FilterResultForm.areaArr.length;i++)
			{
				if (document.FilterResultForm.areaArr[i].checked)
				{
					
					document.FilterResultForm.areaArr[i].checked=false;
				}
			}



		////////////
		document.getElementById('strHotelName').value="";
		document.Amenityform.strStarRating.value='false';
		document.Amenityform.strAmenity.value='false';
		// Resetting the price slider to initial value
		if (document.getElementById("priceSliderVal1"))
		{	
			if (document.getElementById("minHotelPrice"))
			{
				document.getElementById("priceSliderVal1").value = document.getElementById("minHotelPrice").value;
			}
		}
		if (document.getElementById("priceSliderVal2"))
		{	
			if (document.getElementById("maxHotelPrice"))
			{
				document.getElementById("priceSliderVal2").value = document.getElementById("maxHotelPrice").value;
			}
		}
		if (document.getElementById("sl0slider"))
		{	
			if (document.getElementById("n_pathLeft1"))
			{
				document.getElementById("sl0slider").style.left = document.getElementById("n_pathLeft1").value + "px";
			}
		}
		if (document.getElementById("sl11slider1"))
		{	
			if (document.getElementById("n_pathLeft2"))
			{
				document.getElementById("sl11slider1").style.left = document.getElementById("n_pathLeft2").value + "px";
			}
		}
		if (document.getElementById("img_fillSlider"))
		{	
			var n_sliderWidth = 0;
			if (document.getElementById("n_sliderWidth"))
			{
					n_sliderWidth = document.getElementById("n_sliderWidth").value * 1;
			}
			var n_pathLeft1 = 0;
			if (document.getElementById("n_pathLeft1"))
			{
					document.getElementById("img_fillSlider").style.left = document.getElementById("n_pathLeft1").value + "px";
					n_pathLeft1 = document.getElementById("n_pathLeft1").value * 1;
			}
			var n_pathLeft2 = 0;
			if (document.getElementById("n_pathLeft2"))
			{
					n_pathLeft2 = document.getElementById("n_pathLeft2").value * 1;
					document.getElementById("img_fillSlider").style.width = (n_pathLeft2-n_pathLeft1+n_sliderWidth) + "px";
			}
		}
		document.getElementById('UpdatingResults').style.display='none';
		//cash back
						showCashBackIndicator()
						//cash back
		}

	  }
	xmlHttp.open("GET","initaialbookablehotels.do",true);
	xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	xmlHttp.send(null);

 }

  /////Function showing initial bookable hotels ends

  ///js for emailfriend starts////////

function checkForm(retaction,emailindicator,divAppender)
 { 
	var divAppender = (divAppender == null) ? "" : divAppender;
	var isGoogleMapFormLink = 'false';
	if(divAppender == 'GoogleMap')
	{
		isGoogleMapFormLink = 'true';
	}
	 
	 
	if (retaction=='1')
	{
	   var strHotelId_EM = document.getElementById(""+divAppender+"strHotelId_EM["+emailindicator+"]").value;
	   var myName=Trim(document.getElementById(""+divAppender+"strMyName["+emailindicator+"]").value);
	   
		
	     
	    if(myName=='')
	    { 
	       	alert("Please specify your name");
	  		return false;
	   	}
	   	  
	    var friendsName=Trim(document.getElementById(""+divAppender+"strFriendsName["+emailindicator+"]").value);
	    if(friendsName=='')
		{ 
	     	alert("Please specify your friend's name");
	   		return false;
		}
		
		
       var mailId=Trim(document.getElementById(""+divAppender+"strMailId["+emailindicator+"]").value);
		if(mailId=='')
	    { 
	      alert("Please specify your friend(s) email id(s)");
	      return false;
	    }
	   
	     
	    else
	    {	
	      	 
		   var size = Number(mailId.length);            
	  	   var first = Number(mailId.indexOf("@"));
	   	   var second = Number(mailId.indexOf("."));
	     
		   if(!(0<first && first<(size-1)) || !(0<second && second<(size-1)))
		   {
		      alert("Please enter a valid email address");
		      return false;
		   }
		 }
         
         
          var strMessage=document.getElementById(""+divAppender+"strMessage["+emailindicator+"]").value; 
		  var strContentType=document.getElementById(""+divAppender+"strContentType["+emailindicator+"]").value; 
		  var strHotelType="DES";
		  var xmlHttp=newXMLHttpRequest();
		 
		//document.getElementById('UpdatingResults').style.display='block';	
		  if(document.getElementById(""+divAppender+"MoreInfoDiv["+emailindicator+"]").innerHTML!="")
			{
			  document.getElementById(""+divAppender+"MoreInfoDiv["+emailindicator+"]").innerHTML="";
			}
		document.getElementById(""+divAppender+"moreinfo_preloader["+emailindicator+"]").style.display='block';
		xmlHttp.onreadystatechange=function()
		{
		      if(xmlHttp.readyState==4)
		        {
                 document.getElementById(""+divAppender+"moreinfotable["+emailindicator+"]").style.display='block';
			     document.getElementById(""+divAppender+"MoreInfoDiv["+emailindicator+"]").style.display='block';
			     document.getElementById(""+divAppender+"MoreInfoDiv["+emailindicator+"]").innerHTML=xmlHttp.responseText;
				 //document.getElementById('UpdatingResults').style.display='none';
				 document.getElementById(""+divAppender+"moreinfo_preloader["+emailindicator+"]").style.display='none';

                }
          }
	   
     xmlHttp.open("GET","emailmoreinfo.do?strMyName="+myName+"&strFriendsName="+friendsName+"&strMailId="+mailId+"&strMessage="+strMessage+"&strContentType="+strContentType+"&strHotelType="+strHotelType+"&emailcloseindicator="+emailindicator+"&isGoogleMapFormLink="+isGoogleMapFormLink+"&strHotelId_EmailFriend="+strHotelId_EM,true);
	 xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
	 xmlHttp.send(null);
	 
     
	       
	  //document.EmailFriendForm.submit();
	  return true;
	}
	else
	{
	  return false;
	}
 } 
	     
 function submitaction()
	{
		document.searchform.submit();
	}

function checkHtml(elem)
{
	if(elem.checked==true)
	{
		elem.value="text/html";
	}
	else
	{
		elem.value="text/plain";
	}
}

function Trim(s) 
{
  // Remove leading spaces and carriage returns
  
  while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns

  while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}


 
 function onClick()
 {
 	document.getElementById('click').style.cursor='hand';
 	
 }
 



  ///js for emailfriend ends////////


function testingReview(scrollTopValue)
{
	var tableUserRatingWidth = parseInt(document.getElementById("tableUserRating").style.width);
	var tableUserRatingHeight = parseInt(document.getElementById("tableUserRating").style.height);

	var newUserRatingDivLeft = 0;
	var newUserRatingDivTop = 0;
	var winW = 0, winH = 0;
	if (navigator.appName == "Microsoft Internet Explorer")
	{
	  winW = document.body.offsetWidth;
	  winH = document.body.offsetHeight;
	}
	else
	{
		winW = window.innerWidth;
		winH = window.innerHeight;
	}
	if (winW && winH)
	{
		newUserRatingDivLeft = (winW-tableUserRatingWidth)/2;
		newUserRatingDivTop = (winH-tableUserRatingHeight)/2;
		if (newUserRatingDivLeft<5)
		{
			newUserRatingDivLeft = 5;
		}
		if (newUserRatingDivTop<5)
		{
			newUserRatingDivTop = 5;
		}
	}
	else
	{
		newUserRatingDivLeft = 5;
		newUserRatingDivTop = 5;
	}
	
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById("UserRatingDiv").style.top=scrollTopValue+newUserRatingDivTop;
	    document.getElementById("UserRatingDiv").style.left=document.body.scrollLeft+newUserRatingDivLeft;
	}
	else
	{
		document.body.scrollTop = scrollTopValue;
		document.getElementById("UserRatingDiv").style.top=scrollTopValue+newUserRatingDivTop;
	    document.getElementById("UserRatingDiv").style.left=document.body.scrollLeft+newUserRatingDivLeft;
	}
}

// js for Photos tab

function handlePhotoTab(link, index){
	if (link == 'photo'){
		if (window["timeout" + index]){
				clearTimeout(window["timeout" + index]);
		}
		if (window["changeOpac" + index])
		{
			clearTimeout(window["changeOpac" + index]);
		}
		window["curImg" + index] = -1;
		window["paused" + index] = false;
		prepareEnvForPhotos(index);
	}
}

function prepareEnvForPhotos(desiyaindicator){
	var speed = Math.round(5); 
	var timer = 0;
	//code for opacity
	for(i = 0; i <= 100; i++) { 
	    window["changeOpac" + desiyaindicator] = setTimeout("changeOpac("+i+","+desiyaindicator+")",(timer * speed)); 
        timer++; 
    } 
	ticker(desiyaindicator);
}

//function changeOpac(opacity, slider){ 
function changeOpac(opacity,desiyaindicator){ 
	var img_slider_id = "slider" + desiyaindicator;
	if (document.getElementById(img_slider_id))
	{
		var object = document.getElementById(img_slider_id).style; 
		object.opacity = (opacity / 100); 
		object.MozOpacity = (opacity / 100); 
		object.KhtmlOpacity = (opacity / 100); 
		object.filter = "alpha(opacity=" + opacity + ")"; 
	}
} 

function opacity(id, opacStart, opacEnd, millisec, desiyaindicator){ 
    //speed for each frame 
	var speed = Math.round(millisec / 5000); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd){ 
        for(i = opacStart; i >= opacEnd; i--){ 
			setTimeout("changeOpac("+i+","+desiyaindicator+")",(timer * speed));
            timer++;
        }
    }else if(opacStart < opacEnd){ 
        for(i = opacStart; i <= opacEnd; i++){ 
			setTimeout("changeOpac("+i+","+desiyaindicator+")",(timer * speed));
            timer++; 
        } 
    } 
} 

function shw_l_img(thi, desiyaindicator){
	if (thi)
	{
		isrc = thi.src
		var img_slider_id = "slider" + desiyaindicator;
		if (document.getElementById(img_slider_id))
		{
			document.getElementById(img_slider_id).src = isrc
		}
		opacity('slider', 0, 100, 500, desiyaindicator);
		var div_hotel_name_id = "hotel_name" + desiyaindicator;
		if (document.getElementById(div_hotel_name_id))
		{
			document.getElementById(div_hotel_name_id).innerHTML = thi.getAttribute("title");
		}
		var tb;
		if (thi.parentNode)
		{	
			tb = thi.parentNode;
			if (tb.parentNode)
			{
				tb = tb.parentNode;
				if (tb.parentNode)
				{
					tb = tb.parentNode;
					if (tb.parentNode)
					{
						tb = tb.parentNode;
						var tb = thi.parentNode.parentNode.parentNode.parentNode
						var x = tb.getElementsByTagName("TD")

						for (var i=0;i<x.length;i++)
						{
							x[i].style.background = "white"
						}
					}
				}
			}
			thi.parentNode.style.background = "white"
		}
	}
}

function fxcurimg(desiyaindicator){
	var img_prev_id = "prev" + desiyaindicator;
	if (document.getElementsByName(img_prev_id))
	{
		var curImg = window["curImg" + desiyaindicator];
		if (curImg < 0){
			curImg = document.getElementsByName(img_prev_id).length - 1
		}else if(curImg==document.getElementsByName(img_prev_id).length){
			curImg = 0
		}
		window["curImg" + desiyaindicator] = curImg;
	}
}

function ticker(desiyaindicator){
	if (!window["paused" + desiyaindicator]){
		var img_prev_id = "prev" + desiyaindicator;
		var curImg = window["curImg" + desiyaindicator];
		curImg = curImg + 1;
		window["curImg" + desiyaindicator] = curImg;
		fxcurimg(desiyaindicator);
		curImg = window["curImg" + desiyaindicator];
		if (document.getElementsByName(img_prev_id)[curImg])
		{
			shw_l_img(document.getElementsByName(img_prev_id)[curImg], desiyaindicator)
			window["timeout" + desiyaindicator] = setTimeout("ticker("+desiyaindicator+")",3000)
		}
	}
}

function ppuse(desiyaindicator){
	if (window["paused" + desiyaindicator]){
		pause(false, desiyaindicator);
	}else{
		pause(true, desiyaindicator);
	}
}

function pause(tf, desiyaindicator){
	var img_ppbut_id = "ppbut" + desiyaindicator;
	if (document.getElementById(img_ppbut_id))
	{
		if (tf){
			window["paused" + desiyaindicator] = true;
			document.getElementById(img_ppbut_id).src='/Travelguru/pages/TravelguruConsumer/images/play.gif'
			document.getElementById(img_ppbut_id).title="Play";
		}else{
			window["paused" + desiyaindicator] = false;
			document.getElementById(img_ppbut_id).src='/Travelguru/pages/TravelguruConsumer/images/pause.gif'
			document.getElementById(img_ppbut_id).title="Pause";

			if (window["timeout" + desiyaindicator])
			{
				clearTimeout(window["timeout" + desiyaindicator]);
			}
			ticker(desiyaindicator);
		}
	}
}

function next_slide(desiyaindicator){
	pause(true, desiyaindicator);
	var curImg = window["curImg" + desiyaindicator];
	curImg = curImg + 1;
	window["curImg" + desiyaindicator] = curImg;
	fxcurimg(desiyaindicator);
	curImg = window["curImg" + desiyaindicator];
	var img_prev_id = "prev" + desiyaindicator;
	if (document.getElementsByName(img_prev_id)[curImg])
	{
		shw_l_img(document.getElementsByName(img_prev_id)[curImg],desiyaindicator);
	}
}

function prev_slide(desiyaindicator){
	pause(true, desiyaindicator);
	var curImg = window["curImg" + desiyaindicator];
	curImg = curImg - 1;
	window["curImg" + desiyaindicator] = curImg;
	fxcurimg(desiyaindicator);
	curImg = window["curImg" + desiyaindicator];
	var img_prev_id = "prev" + desiyaindicator;
	if (document.getElementsByName(img_prev_id)[curImg])
	{
		shw_l_img(document.getElementsByName(img_prev_id)[curImg],desiyaindicator);
	}
}

function disp_img(tt, desiyaindicator){
	pause(true, desiyaindicator);
	window["curImg" + desiyaindicator] = tt
	var curImg = window["curImg" + desiyaindicator];
	var img_prev_id = "prev" + desiyaindicator;
	if (document.getElementsByName(img_prev_id)[curImg])
	{
		shw_l_img(document.getElementsByName(img_prev_id)[curImg],desiyaindicator);
	}
}

 // cash back
function getPosition(who){

    var T= 0,L= 0;

    while(who){

        L+= who.offsetLeft;

        T+= who.offsetTop;

        who= who.offsetParent;

    }

    return [L,T];   
    
	 

}


function displayCashBack(obj,posX,posY){

	obj.style.display = 'block';
	obj.style.position = "absolute";
	//alert(posX + '  1 ' + posY);
	obj.style.top = posY-34; //76
	obj.style.left = posX+50;
}
function showCashBackIndicator()
{
	var cashBackArray = document.getElementsByName('cachback_disply');
	var datumCashBackArray = document.getElementsByName('mapCashBack');
	
	for(var i=0;i<cashBackArray.length;i++)
	{
		displayCashBack(cashBackArray[i],getPosition(datumCashBackArray[i])[0],getPosition(datumCashBackArray[i])[1] );
		//alert(datumCashBackArray.length);
	}
}

function CashBackPopUp(evt)
{
	closePopups();
	document.getElementById("know_more_CashBack").style.display='block';  
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById("know_more_CashBack").style.top=event.clientY + document.body.scrollTop;
		//document.getElementById("know_more_CashBack").style.left=event.clientX+document.body.scrollLeft;
	}
	else
	{
		document.getElementById("know_more_CashBack").style.top=evt.pageY;
		//document.getElementById("know_more_CashBack").style.left=evt.pageX;
	}
}

function CashBackPopUpClose()
{
	document.getElementById("know_more_CashBack").style.display="none";
}
  //cash back

function FixUpdatingResultsPosition()
{
	if (document.getElementById('UpdatingResults'))
	{
		var UpdatingResultsWidth = parseInt(document.getElementById("UpdatingResults").style.width);
		var UpdatingResultsHeight = parseInt(document.getElementById("UpdatingResults").style.height);

		var newUpdatingResultsLeft = 0;
		var newUpdatingResultsTop = 0;
		var winW = 0, winH = 0;
		if (navigator.appName == "Microsoft Internet Explorer")
		{
		  winW = document.body.offsetWidth;
		  winH = document.body.offsetHeight;
		}
		else
		{
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (winW && winH)
		{
			newUpdatingResultsLeft = (winW-UpdatingResultsWidth)/2;
			newUpdatingResultsTop = (winH-UpdatingResultsHeight)/2;
			if (newUpdatingResultsLeft<5)
			{
				newUpdatingResultsLeft = 5;
			}
			if (newUpdatingResultsTop<5)
			{
				newUpdatingResultsTop = 5;
			}
		}
		else
		{
			newUpdatingResultsLeft = 5;
			newUpdatingResultsTop = 5;
		}
		document.getElementById('UpdatingResults').style.display='block';
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			document.getElementById("UpdatingResults").style.top=document.body.scrollTop+newUpdatingResultsTop;
			document.getElementById("UpdatingResults").style.left=document.body.scrollLeft+newUpdatingResultsLeft;
		}
		else
		{
			document.getElementById("UpdatingResults").style.top=document.body.scrollTop+newUpdatingResultsTop;
			document.getElementById("UpdatingResults").style.left=document.body.scrollLeft+newUpdatingResultsLeft;
		}
		
	}
}

function stopPageLoading(index)
{
		if (window["timeout" + index]){
				clearTimeout(window["timeout" + index]);
		}
		if (window["changeOpac" + index])
		{
			clearTimeout(window["changeOpac" + index]);
		}
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			document.execCommand('Stop');
		}
		else
		{
			window.stop();
		}
}

function closePopups()
{
	if (document.getElementById("hotelnamesearchhelpdiv"))
	{
		document.getElementById("hotelnamesearchhelpdiv").style.display = "none";
	}
	if (document.getElementById("PriceSliderHelpDiv"))
	{
		document.getElementById("PriceSliderHelpDiv").style.display = "none";
	}
	if (document.getElementById("starratinghelpdiv"))
	{
		document.getElementById("starratinghelpdiv").style.display = "none";
	}
	if (document.getElementById("amenityhelpdiv"))
	{
		document.getElementById("amenityhelpdiv").style.display = "none";
	}
	// know more pop up for cash back option
	if (document.getElementById("know_more_CashBack"))
	{
		document.getElementById("know_more_CashBack").style.display = "none";
	}
	// know more pop up for pay by cash option
	if (document.getElementById("know_more"))
	{
		document.getElementById("know_more").style.display = "none";
	}
	// view all amenities detail pop up
	if (document.getElementById("transparency"))
	{
		document.getElementById("transparency").style.display = "none";
	}
	// Visa Discount Voucher pop up
	if (document.getElementById("Visa_Discount_Vou"))
	{
		document.getElementById("Visa_Discount_Vou").style.display = "none";
	}
}
function ClosePayByCashPopUp()
  {
  if (document.getElementById("know_more")!= null)
  {
    document.getElementById("know_more").style.display='none';
    }
  }

function showRoomTab(rPlanId, hotelId){    
    var showRoomId=rPlanId+"|"+"showRoom";
    var hideRoomId= rPlanId+"|"+"hideRoom";    
    var rpidLess=rPlanId+"|"+"lessThan";
    var rpidGreater=rPlanId+"|"+"greaterThan";    
    var v = document.getElementsByName(rpidGreater);
    if (navigator.appName.indexOf('MSIE')==-1 && navigator.appName.indexOf('Internet Explorer')==-1){	
    for (var i=0;i<v.length;i++) {		
    	    v[i].style.display='table-row';
    }
    document.getElementById(rpidLess).style.display='table-row';    
    document.getElementById(showRoomId).style.display='none';
    document.getElementById(hideRoomId).style.display='table-row';
   }else{
      for (var i=0;i<v.length;i++) {		
    	    v[i].style.display='block';
    }
    document.getElementById(rpidLess).style.display='block';     
    document.getElementById(showRoomId).style.display='none';
    document.getElementById(hideRoomId).style.display='block';
    }
    setTimeout("showCashBackIndicator()",1500);
    logSearchActivity(hotelId);
}

function hideRoomTab(rPlanId){	
 	var rpidLess=rPlanId+"|"+"lessThan";
	var rpidGreater=rPlanId+"|"+"greaterThan";	
	var showRoomId=rPlanId+"|"+"showRoom";
   	var hideRoomId= rPlanId+"|"+"hideRoom";
   	if (navigator.appName.indexOf('MSIE')==-1 && navigator.appName.indexOf('Internet Explorer')==-1){
		document.getElementById(showRoomId).style.display='table-row';
		document.getElementById(hideRoomId).style.display='none';	
		document.getElementById(rpidLess).style.display='table-row';
		var v = document.getElementsByName(rpidGreater);	   
	    for (var i=0;i<v.length;i++) {
	    	    v[i].style.display='none';
    	}
     }else{
      	document.getElementById(showRoomId).style.display='block';
	  	document.getElementById(hideRoomId).style.display='none';	
	  	document.getElementById(rpidLess).style.display='block';
	  	var v = document.getElementsByName(rpidGreater);	   
	    for (var i=0;i<v.length;i++) {
	    	    v[i].style.display='none';
    	}
     }
    setTimeout("showCashBackIndicator()",1500);     
} 