var allTheElements, myObject, wehelpBuild,weunderstand, sevengold, OnPM, OnEA, OnAD, OnSI, OnCC, OnMA, OnBI, OnBA;
var checkTextValue;

var i = 1;
var over = false;


$(document).ready(function () {
    allTheElements = pageText.allTheElements;
    wehelpBuild = pageText.wehelpBuild;
    weunderstand = pageText.weunderstand;
    sevengold = pageText.sevengold;

    OnPM = pageText.OnPM;
    OnEA = pageText.OnEA;
    OnAD = pageText.OnAD;
    OnSI = pageText.OnSI;
    OnCC = pageText.OnCC;
    OnMA = pageText.OnMA;
    OnBI = pageText.OnBI;
    OnBA = pageText.OnBA;
    myObject = { 1: allTheElements, 2: wehelpBuild, 3: weunderstand, 4: sevengold };
    checkTextValue = setInterval(function () {
       if (over == false) changeSpan();
   }, 5000);
});


function changeSpan() {
    $('#changeSpan').fadeOut('fast', function () { $('#changeSpan').html(myObject[i]); });
    $('#changeSpan').fadeIn('slow');
    i++;
    if (i > 4)
        i = 1;
}



//function changeImageBlack(id) {
//    over = true;
//    if (id == "BA" | id == "PM") {
//     $(".PartBAPMBA").hide();
//     $(".PartBAPM2").hide();
//        $(".PartBAPM").show();
//  }

//    else if (id == "CC" | id == "BI") {
//        $(".PartBISI2").hide();
//        $(".PartBISICC").hide();
//        $(".PartBISI").show();
//    }
//    checkTextValue = setInterval(function () {
//        changeSpan();
//    }, 5000);
//}

//function changeImageWhite(id, on) {

//    over = true;
//if (id == "BA") {
// $(".PartBAPM").hide();
// $(".PartBAPM2").hide();
//        $(".PartBAPMBA").show();
//   }
//          
// else if (id == "PM") {
//     $(".PartBAPM").hide();
//     $(".PartBAPMBA").hide();
//     $(".PartBAPM2").show();
// }
// else if (id == "CC") {
//     $(".PartBISI").hide();
//     $(".PartBISI2").hide();
//     $(".PartBISICC").show();
// }
// else if (id == "BI") {
//     $(".PartBISI").hide();
//     $(".PartBISICC").hide();
//     $(".PartBISI2").show();
// }


//   // clearInterval(checkTextValue);
//       $("#changeSpan").html(on);   
//}


function changeImage1(id, on) {
    over = true;
    if (id == 'PM') {
        $("#BADiv").hide();
        $("#EADiv").hide();
        $("#black1").hide();
        $("#PMDiv").show();

    }
    else if (id == 'BA') {
        $("#EADiv").hide();
        $("#PMDiv").hide();
        $("#black1").hide();
        $("#BADiv").show();

    }
    else if (id == 'EA') {
        $("#PMDiv").hide();
        $("#black1").hide();
        $("#BADiv").hide();
        $("#EADiv").show();
    }
    else if (id == 'AD') {
        $("#ADBlack").hide();
        $("#ADWhite").show();
    }
    //clearInterval(checkTextValue);
    $("#changeSpan").html(on);
}
function mouseOut1() {

    $("#BADiv").hide();
    $("#EADiv").hide();
    $("#PMDiv").hide();
    $("#black1").show();
//    checkTextValue = setInterval(function () {
//        changeSpan();
    //    }, 5000);
    over = false;

}

function mouseOut3(id)
{
    if (id == 'AD') {
        $("#ADWhite").hide();
        $("#ADBlack").show();
    }
    else if (id == 'SI') {
        $("#SIWhite").hide();
        $("#SIBlack").show();
    }
    over = false;
//    checkTextValue = setInterval(function () {
//        changeSpan();
//    }, 5000);
}


function changeImage2(id, on) {
    over = true;
    if (id == 'CC') {
        $("#BIDiv").hide();
        $("#MADiv").hide();
        $("#black2").hide();
        $("#CCDiv").show();

    }
    else if (id == 'BI') {
        $("#CCDiv").hide();
        $("#MADiv").hide();
        $("#black2").hide();
        $("#BIDiv").show();

    }
    else if (id == 'MA') {
        $("#CCDiv").hide();
        $("#black2").hide();
        $("#BIDiv").hide();
        $("#MADiv").show();
    }
    else if (id == 'SI') {
        $("#SIBlack").hide();
        $("#SIWhite").show();
    }
    //clearInterval(checkTextValue);
    $("#changeSpan").html(on);   
}
function mouseOut2() {
    $("#CCDiv").hide();
    $("#BIDiv").hide();
    $("#MADiv").hide();
    $("#black2").show();
    over = false;
//    checkTextValue = setInterval(function () {
//        changeSpan();
//    }, 5000);
}


    


//function changeImageBlack(id, imageURL) {
//    over = true;
//    $("#"+id).css('background-image', imageURL);
//    if (id == "BA")
//        $('.PartBAPM').css('background-image', "url(http://beta.compusight.com/images/BlackPartBAPM.png)");
//     else if (id=="PM")
//         $('.PartBAPM').css('background-image', "url(images/BlackPartBAPM.png)");
//     else if (id == "CC")
//         $('.PartBISI').css('background-image', "url(images/PartBISIBlack.png)");
//     else if (id == "BI")
//         $('.PartBISI').css('background-image', "url(images/PartBISIBlack.png)");
//     checkTextValue = setInterval(function () {
//         changeSpan();
//     }, 5000);  
//}

//function changeImageWhite(id, imageURL, on) {
//    over = true;
//    $("#"+id).css('background-image', imageURL);
////    if(id=="BA")
//        $('.PartBAPM').css('background-image', "url(http://beta.compusight.com/images/PartBAPM4.png)");
//    else if (id=="PM")
//        $('.PartBAPM').css('background-image', "url(images/PartBAPM.png)");
//    else if (id=="CC")
//        $('.PartBISI').css('background-image', "url(images/PartBISI2.png)");
//    else if (id=="BI")
//        $('.PartBISI').css('background-image', "url(images/PartBISI.png)");
//    clearInterval(checkTextValue);
//    $("#changeSpan").html(on);    
//}




