﻿function ReplaceTags(xStr)
    {
      var regExp = /<\/?[^>]+>/gi;
      xStr = xStr.replace(regExp,"");
      return xStr;
    }
	
	function showAll(openClose)
	{
	    var hotelRef;
	    var hotelShow;
	    var direction;
	    
	    var hotelsSpanText = document.getElementById("lblHotelsandParkingNote").innerHTML;
	    var hotelCount = ReplaceTags(hotelsSpanText);
        hotelCount = hotelCount.split(" ");
        hotelCount = hotelCount[0];
	    if (openClose == "open")
	    {	    
	        for(i=1;i<=hotelCount;i++)
	        {	   
	             if(document.getElementById("hotel" + i + "direction") != null)
	            { 
	              direction = document.getElementById("hotel" + i + "direction");
	            } 
	            direction.value ="up";
	            hotelRef = document.getElementById("hoteldiv" + i);	     
	            hotelRef.style.display = 'block';	
	            hotelShow = document.getElementById("hotel" + i + "show");	
	            hotelShow.src = "shared/Images/Hotels/drop-up.gif";	 
	        }
	    }
	    if (openClose == "close")
	    {
	        for(i=1;i<=hotelCount;i++)
	        {
	            if(document.getElementById("hotel" + i + "direction") != null)
	            { 
	              direction = document.getElementById("hotel" + i + "direction");
	            } 
	            direction.value ="down";
	            hotelRef = document.getElementById("hoteldiv" + i);	     
	            hotelRef.style.display = 'none';	
	            hotelShow = document.getElementById("hotel" + i + "show");	
	            hotelShow.src = "shared/Images/Hotels/drop-down.gif";
	        }
	    }
	}
	
    function showHideElement(hotelDiv,imageId,upDown) 
    {
        var hotelRef;
        var image;
        var direction = document.getElementById(upDown);
        image = document.getElementById(imageId);
	    hotelRef = document.getElementById(hotelDiv);
	 
	    // Check if hotel is currently hidden or not
	    
	    if (hotelRef.style.display == 'none') 
	    {	 
	        direction.value ="up";
            hotelRef.style.display = 'block';	    
	    } 
	    else
	    {
	        direction.value = "down";	    
            hotelRef.style.display = 'none';
	    }
	}
	
	// Function to change image for up down arrows	
	function show(Id, overOrOut, upDown) 
	   {
            var Out = overOrOut;
            var hotelShow;
            var direction;
           
            direction = document.getElementById(upDown);
            
	        hotelShow = document.getElementById(Id);
	        //Check if hotel is currently hidden or not
	        if (direction.value == "")
	        {
	         if (Out == "out")
	            {	            
	                hotelShow.src = "shared/Images/Hotels/drop-down.gif";
	            }
	         if (Out == "over")
	            {
	                hotelShow.src = "shared/Images/Hotels/drop-down-hover.gif";
	            }
            }
	        if (direction.value == "down")
	        {
	         if (Out == "out")
	            {	            
	                hotelShow.src = "shared/Images/Hotels/drop-down.gif";
	            }
	         if (Out == "over")
	            {
	                hotelShow.src = "shared/Images/Hotels/drop-down-hover.gif";
	            }
	        }
	        if (direction.value == "up")
	        {
	         if (Out == "out")
	            {	            
	                hotelShow.src = "shared/Images/Hotels/drop-up.gif";
	            }
	         if (Out == "over")
	            {
	                hotelShow.src = "shared/Images/Hotels/drop-up-hover.gif";
	            }
	        }           
  	              
	    }

