﻿function setAction( strActionName, strActionValue, strConfirm ) {
    var bConfirm;


    //  Request confirmation if necessary.
    if ( strConfirm != null ) {
        bConfirm = confirm( strConfirm );
    } else {
        bConfirm = true;
    }
    
    if ( bConfirm == true ) {

        //  Set the action.
        document.getElementById( "action_name" ).value = strActionName;
        document.getElementById( "action_value" ).value = strActionValue;

        //  Submit the form.
        document.getElementById( "aspnetForm" ).submit();
    }
}

function enlargeImage( strImageURL ) {

    //  Open new window.
    var objWinbdow = window.open( "/Enlarge-Image.aspx?url=" + strImageURL, "image", "status=0, toolbar=0, menubar=0, directories=0, resizable=0, scrollbars=0, height=520, width=520" );
    objWinbdow.focus();
}

function toggleDiv(id,flagit) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}







//---------------------------------------------------------------------------






var currentImage = 1;
var serviceImageTime = 5000;
//var whiteImageTime = 0;


function nextImage() {
    var objAnimationImage = document.getElementById( "imgAnimation" );
    var objAnimationLink = document.getElementById( "lnkAnimation" );

    //  Set image timings.
    if ( currentImage == 1 ) { 
        objAnimationImage.src = "/media/images/animation/neighbours-sol.jpg";
        objAnimationLink.href = "/sectors/domestic.aspx"
        setTimeout( "nextImage()", serviceImageTime ); 
    } else if ( currentImage == 2 ) {      
        objAnimationImage.src = "/media/images/animation/school-sol.jpg";
        objAnimationLink.href = "/sectors/schools.aspx"
        setTimeout( "nextImage()", serviceImageTime );
    } else if ( currentImage == 3 ) {       
        objAnimationImage.src = "/media/images/animation/housing-sol2.jpg";
        objAnimationLink.href = "/sectors/acoustic-consultants.aspx"
        setTimeout( "nextImage()", serviceImageTime );
        
        //  Reset current image.
        currentImage = 0;
    }
    
    //  Increae image counter.
    currentImage = currentImage + 1;
}