var xmlHttpG;
var sound2Embed;

function getValue(mode)
{
xmlHttpG = GetXmlHttpObjectC();
var urlG="get.php";
xmlHttpG.onreadystatechange=stateG;
xmlHttpG.open("GET", urlG + "?mode=" + mode,true);
xmlHttpG.send(null);
}



function stateG()
{
if (xmlHttpG.readyState==4 || xmlHttpG.readyState=="complete")
{
rep = xmlHttpG.responseText;

if(rep == "1"){
sound2Play('../js/files/sms1.wav');
alertTimerId = setTimeout('getValue();',60000);
}else{

}

} else {
setTimeout('getValue();',5000);
}
}


function sound2Play(file) {

        if ( !sound2Embed ) {
                sound2Embed = document.createElement("embed");
                sound2Embed.setAttribute("src", file);
                sound2Embed.setAttribute("hidden", true);
                sound2Embed.setAttribute("autostart", true);
                document.title = 'Jauna ziņa';
        } else sound2Stop();
        sound2Embed.removed = false;
        document.body.appendChild(sound2Embed);
}

function sound2Stop() {
        if ( sound2Embed && !sound2Embed.removed ) {
                document.body.removeChild(sound2Embed);
                sound2Embed.removed = true;
                
        }
}