﻿/* Any common javascript functions */

function toggleDiv(divid) {
    if(document.getElementById(divid).style.display == 'none'){
        document.getElementById(divid).style.display = 'block';
    }else{
        document.getElementById(divid).style.display = 'none';
    }
}

/* Used to clear the image hidden field and the reset the image 
   src for the upload/picker controls */
function clearImage(hiddenFieldID, imgControlID) {
    var hiddenField = document.getElementById(hiddenFieldID);
    var imgControl = document.getElementById(imgControlID);
    
    //Clear the hidden field
    hiddenField.value = "";
    //Set the image source to no image
    imgControl.src = "/Images/Icons/NoImageYetSquare.gif";
}


function changeReadButton(divid, imageID) {
    var imgControl = document.getElementById(imageID);
    //Figure out the current state
    if(document.getElementById(divid).style.display == 'none'){
        imgControl.src = '/Images/button_readfullarticle.gif';
    }else{
        imgControl.src = '/Images/button_closearticle.gif';
    }
}
