if (window.XMLHttpRequest) {
   HttpHandler = new XMLHttpRequest();
   } else if (window.ActiveXObject) {
       HttpHandler = new ActiveXObject("Microsoft.XMLHTTP");
   }

var httpbusy = false;

function getData( RemoteSrc, DivId ) {
  if ( httpbusy ) {
        setTimeout( "getData( \""+RemoteSrc+"\", \""+DivId+"\" )", 700 );
        return;
  }
  httpbusy = true;

  if ( HttpHandler ) {
        var TargetDiv = document.getElementById( DivId );
        HttpHandler.open( "GET", RemoteSrc );

        HttpHandler.onreadystatechange = function() {
                if ( HttpHandler.readyState == 4 ) {
                        if ( TargetDiv.nodeName == "TEXTAREA" ) {
                                TargetDiv.value = HttpHandler.responseText;
                        } else {
                                TargetDiv.innerHTML = HttpHandler.responseText;
                        }

                        httpbusy = false;
                }
        } //function()

        HttpHandler.send(null);
  } //if HttpHandler
} //getData()

function txt( filename ) {
	getData( 'plain/'+filename+'.htm', 'content' );
	activeIssue( 0 );
}

function photodiv_on() {
	var HeadDiv = document.getElementById( 'anihead' );
	HeadDiv.innerHTML = '<img src="nh-head.png">';
	document.getElementById( 'maskdiv' ).style.display = "block";
	document.getElementById( 'photodiv' ).style.display = "block";
}

function photodiv_off() {
	var HeadDiv = document.getElementById( 'anihead' );
        HeadDiv.innerHTML = '<object width="530" height="140"><param name="movie" value="na_horyzoncie_01.swf"><embed src="na_horyzoncie_01.swf" width="530" height="140"></embed></object>';
	document.getElementById( 'maskdiv' ).style.display = "none";
	document.getElementById( 'photodiv' ).style.display = "none";
}

function showPhoto( imgUrl ) {
	document.getElementById( 'photodivsub' ).innerHTML = '<img src="' +imgUrl+ '" height="92%">';
}

function reloadHash() {
    if ( document.location.hash == "#foto-indx" ) {
        getData( "inc_konkursfoto.php", 'content' );
        activeIssue_nocontent( 100 );
    }
    if ( document.location.hash.substring( 1, 9 ) == 'foto-det' ) {
        getData( "inc_konkursfoto.php?id=details&phid="+document.location.hash.substring( 9 ), 'content' );
        activeIssue_nocontent( 100 );
    }
    if ( document.location.hash == "#foto-info" ) {
        getData( 'plain/nescafe.htm', 'content' );
        activeIssue_nocontent( 100 );
    }
    if ( document.location.hash.substring( 1, 9 ) == 'foto-r2d' ) {
        getData( "inc_konkursfoto.php?id=rank2daily&day="+document.location.hash.substring( 9 ), 'content' );
        activeIssue_nocontent( 100 );
    }

}

