
/* Dosing Tools: hide / show div layers */

//initialize page
var dISI, nISI;
$(document).ready(function(){
    
    $('.content').hide();
    $('#content-dosing-heart').show();
    dISI = $('#isiVal').html();
    nISI = $('#ISIhiddenDiv').html();
});

//Switch page div layers --- only show HCT ISI on pages 2,3
function togglePage(name)
{
   refresh(); 
    
    switch(name)
    {
        case "heart":
            $('#isiVal').html(dISI);
            $('#content-dosing-heart').show();
            switchNav(1);
            break;
        case "hyper": 
            $('#isiVal').html(dISI);
            $('#content-dosing-hyper').show();
            $('#page1').show();
            switchNav(2);
            break;
        case "hyper1":
            $('#isiVal').html(dISI);
            $('#content-dosing-hyper').show();
            $('#page1').show();
            break;
        case "hyper2":
            $('#isiVal').html(nISI);
            $('#content-dosing-hyper').show();
            $('#page2').show();
            $('img.nav_headerimg').attr('src', '/images/atacand-hct.gif'); 
            $('img.nav_headerimg').attr('alt', 'ATACAND HCT (candesartan cilexetil-hydrochlorothiazide)'); 
            $('#AtaTM').hide();
            $('#AtaTMdosing').show();
            break;
        case "hyper3":
            $('#isiVal').html(nISI);
            $('#content-dosing-hyper').css('background-image', 'url(/images/dosing/bg-sel2.gif)'); 
            $('#content-dosing-hyper').show();
            $('#page3').show();
            $('img.nav_headerimg').attr('src', '/images/atacand-hct.gif'); 
            $('img.nav_headerimg').attr('alt', 'ATACAND HCT (candesartan cilexetil-hydrochlorothiazide)'); 
            $('#AtaTM').hide();
            $('#AtaTMdosing').show();
            break;
        case "pi":
            $('#isiVal').html(nISI);
            $('#content-dosing-pi').show();
            switchNav(3);
            break;
        default:
    }
            
}

//Hide all layers
function refresh()
{
    $('.content').hide();
    $('#page1').hide();
    $('#page2').hide();
    $('#page3').hide();
    $('.singlepage').hide();
    $('img.nav_headerimg').attr('src', '/images/atacand-candesartan-cilexetil.gif'); 
    $('img.nav_headerimg').attr('alt', 'ATACAND (candesartan cilexetil)'); 
    $('#content-dosing-hyper').css('background-image', 'url(/images/dosing/bg-sel1.gif)');
}

//Change navigation tab image 
function switchNav(num)
{
    $('#nav-heart').css('background-image', 'url(/images/dosing/nav-heart-off.gif)'); 
    $('#nav-pi').css('background-image', 'url(/images/dosing/nav-pi-off.gif)');
    $('#nav-hyper').css('background-image', 'url(/images/dosing/nav-hypertension-off.gif)');
    
    switch(num)
    {
        case 1:
            $('#nav-heart').css('background-image', 'url(/images/dosing/nav-heart-on.gif)'); 
            break;
        case 2:
            $('#nav-hyper').css('background-image', 'url(/images/dosing/nav-hypertension-on.gif)'); 
            break;
        case 3:
            $('#nav-pi').css('background-image', 'url(/images/dosing/nav-pi-on.gif)');
            break;
        default:
    }
}

//Change ISI 
/*function switchISI(isi)
{
    $.ajax({
    url: '/config/test.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 1000,
    error: function(){
        alert('Error loading XML document');
    },
    success: function(xml){
        alert('found!');
      //  $(xml).find('item').each(function(){
      //  var item_text = $(this).text();

      //  $('<li></li>').html(item_text).appendTo('ol');
   // });
    }
});
}*/