﻿
 function MoveImages()
    {
         document.getElementById("mainDiv").style.display = "none";
         document.getElementById("DefaultLogo").style.display = "none";
         if(document.getElementById("DefaultMenu"))
         {
            document.getElementById("DefaultMenu").style.display = "none";
         }
          
        document.getElementById("mainDiv").style.top = (document.documentElement.clientHeight - 340) + 'px';
        document.getElementById("mainDiv").style.left = ((document.documentElement.clientWidth - 1000) / 2) - 10 + 'px';
     
        if(document.documentElement.clientHeight >= 650)
        {
            document.getElementById("DefaultLogo").style.top = ((document.documentElement.clientHeight - 650) /2) + 'px';
            document.getElementById("mainDiv").style.top = ((document.documentElement.clientHeight - 650) / 2) + (650 - 340) + 'px';
            
             if(document.getElementById("pageThumbs"))
             {
                document.getElementById("pageThumbs").style.top = ((document.documentElement.clientHeight - 650) / 2) + 'px';
             }
        }
        else
        {
            document.getElementById("DefaultLogo").style.top = 0 + 'px';
            document.getElementById("mainDiv").style.top = (588 - 340) + 'px';
            
            if(document.getElementById("pageThumbs"))
            {
                document.getElementById("pageThumbs").style.top =  '0px';
                document.getElementById("pageThumbs").style.height = "588px";
            }
        }
        
        if(document.documentElement.clientWidth > 1000)
        {
             document.getElementById("DefaultLogo").style.left = (document.documentElement.clientWidth - 1000) / 2 + 'px';
             document.getElementById("mainDiv").style.left = ((document.documentElement.clientWidth - 1000) / 2) - 10 + 'px';
             
             if(document.getElementById("pageThumbs"))
             {
                document.getElementById("pageThumbs").style.left = ((document.documentElement.clientWidth - 1000) / 2) + 775 + 'px';
             }
        }
        else
        {
            document.getElementById("DefaultLogo").style.left = 0 + 'px';
            document.getElementById("mainDiv").style.left = 0 + 'px';
            
            if(document.getElementById("pageThumbs"))
            {
                document.getElementById("pageThumbs").style.left =  '775px';
            }
        }
        
                
        if(document.documentElement.clientWidth > 1000)
        {
            document.getElementById("DefaultHeading").style.left = (document.documentElement.clientWidth - 400) / 2 + 'px';
            document.getElementById("DefaultSubHeading").style.left = (document.documentElement.clientWidth - 400) / 2 + 'px';
            
            if(document.getElementById("DefaultSubSubHeading"))
            {
                document.getElementById("DefaultSubSubHeading").style.left = (document.documentElement.clientWidth - 400) / 2 + 'px';
            }
        }
        else
        {
            document.getElementById("DefaultHeading").style.left = 325 + 'px';
            document.getElementById("DefaultSubHeading").style.left = 325 + 'px';
              if(document.getElementById("DefaultSubSubHeading"))
            {
                document.getElementById("DefaultSubSubHeading").style.left = 325 + 'px';
            }
        }
        
        
        document.getElementById("mainDiv").style.display = "";
        document.getElementById("DefaultLogo").style.display = "";
        if(document.getElementById("DefaultMenu"))
        {
            document.getElementById("DefaultMenu").style.display = "";
        }
        
        return true;
    }
    
    function ChangePage(pge)
    {
        document.location.href = pge;
    }
    
    function ChangeLanguage(lang, isChecked)
    {
        if(lang == 'english' && isChecked)
        {
            document.getElementById("DivEnglish").style.display = "";
            document.getElementById("DivAfrikaans").style.display = "none";
        }
        else if(lang == 'afrikaans' && isChecked)
        {
            document.getElementById("DivEnglish").style.display = "none";
            document.getElementById("DivAfrikaans").style.display = "";
        }
    }
    
    function AddAccommodation()
    {
        window.open("dialogAccomodation.aspx", "accommWindow", "status=0, toolbar=0, location=0, menubar=0, resizeable=0, scrollbars=0, height=240, width=770");
        return false;
    }
    
    function ValidateAccommodation()
    {
        var alertString = "";
        
        if(document.getElementById("ddlAccomodationType").value == "")
        {
            alertString = "   AccommodationType\r\n";
        }
        
        if(document.getElementById("ddlUnits").value == "")
        {
            alertString += "   Unit\r\n";
        }
        
        //determine if fixed rate selected
        if(document.getElementById("chkFixed").checked)
        {
            if(document.getElementById("txtFixedRate").value == "")
            {
                alertString += "   Fixed Rate\r\n";
            }
        }
        else
        {
            if(document.getElementById("txtAdultRate").value == "")
            {
                
                alertString += "   Adult Rate\r\n";
            }
            if(document.getElementById("ddlChildren").value != "0")
            {
                if(document.getElementById("txtChildRate").value == "")
                {
                    alertString += "   Child Rate\r\n";
                }
            }
            else
            {
                document.getElementById("txtChildRate").value = 0;
            }
        }
        
        if(alertString == "")
        {
            return true;
        }
        
        alert("Please complete the following fields before you continue:\r\n\n" + alertString);
        return false;
    }
   
   function DeleteBooking(bookingID)
   {
        if(confirm("Are you sure you want to delete this booking?\r\n\nNOTE: This action cannot be reversed!"))
        {
            document.location.href="DeleteBooking.aspx?BookingID=" + bookingID;
        }
   }
   
   function DeleteAccommodation(unitBookingID)
   {
        if(confirm("Are you sure you want to delete this unit booking?\r\n\nNOTE: This action cannot be reversed!"))
        {
            document.location.href="DeleteAccommodation.aspx?UnitBookingID=" + unitBookingID;
        }
   }
   
   function EditAccommodation(unitBookingID)
   {
        window.open("dialogAccommodationEdit.aspx?UnitBookingID=" + unitBookingID, "accommEditWindow", "status=0, toolbar=0, location=0, menubar=0, resizeable=0, scrollbars=0, height=240, width=770");
   }
   
   function AddDeposit(unitBookingID)
   {
        window.open("dialogDeposit.aspx?UnitBookingID=" + unitBookingID, "accommEditWindow", "status=0, toolbar=0, location=0, menubar=0, resizeable=0, scrollbars=0, height=20, width=350");
   }
