﻿
var intervalId = 0;

var timeoutId = 0;



function autoSlide() {

    intervalId = setInterval("fadeToNext()", 8000);

}



function fadeToNext() {

    for (var i = 0; i < 4; i++) if (document.getElementById('slide' + i).style.display != 'none') break;

    if (i == 3) var j = 0;

    else var j = i + 1;

    $('#slide' + i).fadeOut(250, function () {

        document.getElementById('slide' + i).style.display = 'none';

        document.getElementById('slide' + j).style.display = 'block';

        $('#slide' + j).fadeOut(0);

        $('#slide' + j).fadeIn(250);

    });

    changeMenu(j);

}



function fadeToSlide(a) {

    for (var i = 0; i < 4; i++) if (document.getElementById('slide' + i).style.display != 'none') break;

    $('#slide' + i).fadeOut(250, function () {

        document.getElementById('slide0').style.display = 'none';

        document.getElementById('slide1').style.display = 'none';

        document.getElementById('slide2').style.display = 'none';

        document.getElementById('slide3').style.display = 'none';

        document.getElementById('slide' + a).style.display = 'block';

        $('#slide' + a).fadeOut(0);

        $('#slide' + a).fadeIn(250);

    });

    changeMenu(a);

}



function stopAtSlide(a) {

    clearInterval(intervalId);

    timeoutId = setTimeout("fadeToSlide(" + a + ")", 0);

}



function changeMenu(a) {

    var menus = document.getElementById('pagination').getElementsByTagName('li');

    for (var k = 0; k < menus.length; k++) {

        menus[k].className = '';

    }



    menus[a].className = 'current';

}


// all in this is executed when the DOM has loaded.
$(document).ready(function () {

    autoSlide();

    $('area').qtip({});
    $('span[title]').qtip({});

    var yourBro = []; yourBro.ualc = navigator.userAgent.toLowerCase();

    var ans;

    if ((navigator.platform == 'WinCE') || (navigator.platform == 'Windows CE') || (navigator.platform == 'Pocket PC') || (navigator.platform == 'Windows Mobile')) {

        if ((yourBro.ualc.indexOf('opera') + 1) || (yourBro.ualc.indexOf('opera mini') + 1) || (yourBro.ualc.indexOf('opera mobile') + 1)) {
        }

        else {

            ans = window.confirm('WPA recommends that you use Opera on a smartphone or PDA to view our site. Would you like to learn more?');

            if (ans == true) {

                window.location.replace("/general/mobile.html");

            }

            else {



            }

        }

    }

})  
	
	
	
