
function Scroll()
{
    document.getElementById('ScrollContent').style.marginTop= yPos + 'px';
    switch(yPos)
    {
        case 0:
            setTimeout("Scroll()",3000);
            break;
        case -50:
            setTimeout("Scroll()",3000);
            break;
        case -100:                                
            setTimeout("Scroll()",3000);        
            break;
        case -150:
            setTimeout("Scroll()",3000);        
            break;
        case -200:
            setTimeout("Scroll()",3000);        
            break;
        case -250:
            setTimeout("Scroll()",3000);        
            break;
        default:
            setTimeout("Scroll()",20);          
    }
    yPos-=1;
    if (yPos<-250)
    {
        yPos=50;
    }
}

function ValidateArrival(source, arguments)
{
    
    var day = document.getElementById('ArrivalDay').value;
    var month = document.getElementById('ArrivalMonth').value;
    var year = document.getElementById('ArrivalYear').value;
    var arriving = Date.parse(day + ' ' + month + ' ' + year);

    if (arriving != null)
    {
        switch (Date.today().compareTo(arriving))
        {
            case 0:
                arguments.IsValid=false;
                alert('For enquiries about accomodation tonight\n\rplease call us on +44 (0)1905 22296');
                break;
            case 1:
                arguments.IsValid=false;
                break;
            default:
                arguments.IsValid=true;
                break;
        }
    }
    else
    {
        arguments.IsValid=false;
    }  

}

function ValidateDeparture(source, arguments)
{
    
    var day = document.getElementById('ArrivalDay').value;
    var month = document.getElementById('ArrivalMonth').value;
    var year = document.getElementById('ArrivalYear').value;
    var arriving = Date.parse(day + ' ' + month + ' ' + year);
    
    var day = document.getElementById('DepartureDay').value;
    var month = document.getElementById('DepartureMonth').value;
    var year = document.getElementById('DepartureYear').value;
    var departing = Date.parse(day + ' ' + month + ' ' + year);

    if (arriving!=null && departing != null)
    {
        
        if (departing > arriving)
        {
            arguments.IsValid=true;
        }
        else
        {
            arguments.IsValid=false;    
        }
        
    }
    else
    {
        arguments.IsValid=false;
    }  
    
}

function ValidateEmail(source, arguments)
{
    arguments.IsValid=ValidateContactDetails();
}

function ValidateTel(source, arguments)
{
    arguments.IsValid=ValidateContactDetails();
}

function ValidateTel2(source, arguments)
{
    arguments.IsValid=ValidateContactDetails();
}

function ValidateContactDetails()
{
    var email = document.getElementById('txtEmail');
    var tel = document.getElementById('txtTel');
    var tel2 = document.getElementById('txtTel2');
    
    if (email.value.length==0 && tel.value.length==0 && tel2.value.length==0)
    {
        return false;
    }
    else
    {
        return true;
    }
}
