﻿

function include(xUrl,xId) {

    var xmlhttp = false;

    /*@cc_on @*/

    /*@if (@_jscript_version >= 5)

    // JScript gives us Conditional compilation, we can cope with old IE versions.
    // and security blocked creation of the objects.

    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
            xmlhttp = false;
            }
        }

    /*@end @*/

    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
        xmlhttp = new XMLHttpRequest();
    }

    xmlhttp.open("GET", xUrl,true);
    xmlhttp.onreadystatechange=function() {

        if (xmlhttp.readyState==4) {
            document.getElementById(xId).innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null)

}

function cleardiv(xId) {
  document.getElementById(xId).innerHTML = '';
}


function FillDivFromDiv(xId, xId2) {
  document.getElementById(xId).innerHTML = document.getElementById(xId2).innerHTML;
}

function ClearSpansBG(xDiv){
    var spans = document.getElementById(xDiv).getElementsByTagName("span");
    for(i = 0; i < spans.length; i++){
        spans[i].style.backgroundImage = '';
        spans[i].style.color = '#FFFFFF';
        //spans[i].style.cursor = 'auto';
    }
}

function RenameSpan(xDiv){
    var spans = document.getElementById(xDiv).getElementsByTagName("span");
    for(i = 0; i < spans.length; i++){
        spans[i].id = spans[i].id + '_' + i;
    }
}

function SetBGImage(xId, imgURL) {
  if (imgURL != '') {
  document.getElementById(xId).style.backgroundImage = 'url(' + imgURL + ')';
  document.getElementById(xId).style.backgroundRepeat = 'no-repeat';
  document.getElementById(xId).style.cursor = 'pointer';
  document.getElementById(xId).style.color = '#000000';
  } else {
  document.getElementById(xId).style.backgroundImage = '';
  //document.getElementById(xId).style.cursor = 'auto';
  }
}

function SetFontOutColour1(xId) {
    if (document.getElementById(xId).style.backgroundImage != ''){
        document.getElementById(xId).style.color = '#000000';   
    } else {
        document.getElementById(xId).style.color = '#FFFFFF';   
    }
}

function SetFontOutColour(xId) {
    if (xId.style.backgroundImage != ''){
        xId.style.color = '#000000';   
    } else {
        xId.style.color = '#FFFFFF';   
    }
}