﻿function ToggleRollover(itemName, inout)
{
    var item = document.getElementById(itemName);
    
    if (item != null)
    {
        if (inout == 'in')
        {
            item.style.backgroundColor = 'rgb(233, 233, 233)';
        }
        else
        {
            item.style.backgroundColor = 'rgb(255, 255, 255)';
        }
    }
}

function DisableSearchControls()
{
    var value = 2;

    var animalLabel = document.getElementById('AnimalLabel');
    animalLabel.style.opacity = value/10;
    animalLabel.style.filter = 'alpha(opacity=' + value*10 + ')';

    var animalDropDown = document.getElementById('ctl00_AnimalDropDownList');
    animalDropDown.style.opacity = value/10;
    animalDropDown.style.filter = 'alpha(opacity=' + value*10 + ')';
    animalDropDown.disabled = true;

    var locationLabel = document.getElementById('LocationLabel');
    locationLabel.style.opacity = value/10;
    locationLabel.style.filter = 'alpha(opacity=' + value*10 + ')';

    var locationTextBox = document.getElementById('ctl00_LocationTextBox');
    locationTextBox.style.opacity = value/10;
    locationTextBox.style.filter = 'alpha(opacity=' + value*10 + ')';
    locationTextBox.disabled = true;

    var breedLabel = document.getElementById('BreedLabel');
    breedLabel.style.opacity = value/10;
    breedLabel.style.filter = 'alpha(opacity=' + value*10 + ')';

    var breedDropDown = document.getElementById('ctl00_BreedDropDownList');
    breedDropDown.style.opacity = value/10;
    breedDropDown.style.filter = 'alpha(opacity=' + value*10 + ')';
    breedDropDown.disabled = true;

    var photosLabel = document.getElementById('PhotosLabel');
    photosLabel.style.opacity = value/10;
    photosLabel.style.filter = 'alpha(opacity=' + value*10 + ')';

    var photosCheckBox = document.getElementById('ctl00_PhotosCheckBox');
    photosCheckBox.style.opacity = value/10;
    photosCheckBox.style.filter = 'alpha(opacity=' + value*10 + ')';
    photosCheckBox.disabled = true;

    var searchButton = document.getElementById('ctl00_SearchImageButton');
    searchButton.style.opacity = value/10;
    searchButton.style.filter = 'alpha(opacity=' + value*10 + ')';
    searchButton.disabled = true;
}

function DisablePhotoUploadControls()
{
    var value = 2;

    var photo1Label = document.getElementById('ctl00_MainContentPlaceHolder_Photo1Label');
    photo1Label.style.opacity = value/10;
    photo1Label.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var photo1Box = document.getElementById('ctl00_MainContentPlaceHolder_Photo1FileUpload');
    photo1Box.style.opacity = value/10;
    photo1Box.style.filter = 'alpha(opacity=' + value*10 + ')';
    photo1Box.disabled = true;
    
    var photo2Label = document.getElementById('ctl00_MainContentPlaceHolder_Photo2Label');
    photo2Label.style.opacity = value/10;
    photo2Label.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var photo2Box = document.getElementById('ctl00_MainContentPlaceHolder_Photo2FileUpload');
    photo2Box.style.opacity = value/10;
    photo2Box.style.filter = 'alpha(opacity=' + value*10 + ')';
    photo2Box.disabled = true;
    
    var photo3Label = document.getElementById('ctl00_MainContentPlaceHolder_Photo3Label');
    photo3Label.style.opacity = value/10;
    photo3Label.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var photo3Box = document.getElementById('ctl00_MainContentPlaceHolder_Photo3FileUpload');
    photo3Box.style.opacity = value/10;
    photo3Box.style.filter = 'alpha(opacity=' + value*10 + ')';
    photo3Box.disabled = true;
    
    var photo4Label = document.getElementById('ctl00_MainContentPlaceHolder_Photo4Label');
    photo4Label.style.opacity = value/10;
    photo4Label.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var photo4Box = document.getElementById('ctl00_MainContentPlaceHolder_Photo4FileUpload');
    photo4Box.style.opacity = value/10;
    photo4Box.style.filter = 'alpha(opacity=' + value*10 + ')';
    photo4Box.disabled = true;
}

function DisableLoginControls()
{
    var value = 2;

    var userNameLabel = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_UserNameLabel');
    userNameLabel.style.opacity = value/10;
    userNameLabel.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var userName = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_UserName');
    userName.style.opacity = value/10;
    userName.style.filter = 'alpha(opacity=' + value*10 + ')';
    userName.disabled = true;
    
    var passwordLabel = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_PasswordLabel');
    passwordLabel.style.opacity = value/10;
    passwordLabel.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var password = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_Password');
    password.style.opacity = value/10;
    password.style.filter = 'alpha(opacity=' + value*10 + ')';
    password.disabled = true;
    
    var rememberLabel = document.getElementById('RememberMeLabel');
    rememberLabel.style.opacity = value/10;
    rememberLabel.style.filter = 'alpha(opacity=' + value*10 + ')';
    
    var remember = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_RememberMe');
    remember.style.opacity = value/10;
    remember.style.filter = 'alpha(opacity=' + value*10 + ')';
    remember.disabled = true;
    
    var loginButton = document.getElementById('ctl00_loginControl_LoginViewControl_LoginControl_LoginButton');
    loginButton.style.opacity = value/10;
    loginButton.style.filter = 'alpha(opacity=' + value*10 + ')';
    loginButton.disabled = true;
    
    var registerButton = document.getElementById('RegisterButton');
    registerButton.style.opacity = value/10;
    registerButton.style.filter = 'alpha(opacity=' + value*10 + ')';
    registerButton.disabled = true;
    
}

function DisableAnimalDropDownControls()
{
    var typeDropDown = document.getElementById('ctl00_MainContentPlaceHolder_TypeDropDownList');
    typeDropDown.style.opacity = value/10;
    typeDropDown.style.filter = 'alpha(opacity=' + value*10 + ')';
    typeDropDown.disabled = true;
    
    var breedDropDown = document.getElementById('ctl00_MainContentPlaceHolder_BreedDropDownList');
    breedDropDown.style.opacity = value/10;
    breedDropDown.style.filter = 'alpha(opacity=' + value*10 + ')';
    breedDropDown.disabled = true;
}

function ToggleLayer(layer)
{
    var style;
    
    if (document.getElementById)
    {
        // this is the way the standards work
        style = document.getElementById(layer).style;
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        var style = document.all[layer].style;
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        var style = document.layers[layer].style;
    }
    
    if (style.display == 'block')
    {
        style.display = 'none';
    }
    else
    {
        style.display = 'block';
    }
}

function EnglargePhoto(image)
{
    var imageElement = document.getElementById(image);
    var largeImageElement = document.getElementById('ctl00_MainContentPlaceHolder_PreviewAdvert_LargeImage');
    
    largeImageElement.src = imageElement.src;
}

function ShowConfirmBox()
{
    document.getElementById('ConfirmDelete').style.display = 'block';
}