function showform(src, dst)
{
	var s = document.getElementById(dst).style
	var f = document.getElementById(src).style

	if ( s.display == 'block' )
	{
		s.display='none'
		f.display='block'
	} else {
		s.display='block'
		f.display='none'
	}
}


function hil(io, id)
{
        if (io == 1)
        {       document.getElementById(id).className = "i"
        } else {
                document.getElementById(id).className = "o"
        }
}

function toggle(id)
{
        var e = document.getElementById(id)

        if (e.className == "o" )
        {       e.className = "i"
        } else {
                e.className = "o"
        }
}

if (typeof XMLHttpRequest != "object" && typeof XMLHttpRequest != "function" ) 
{
	function XMLHttpRequest() 
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function loading_on()
{
	document.getElementById('progress').className = 'on'
}

function loading_off()
{
	document.getElementById('progress').className = ''
}

var req;
var req_busy = 0

function set_content(id, txt)
{
	document.getElementById(id).innerHTML = txt
}

function load_tag(tag)
{
	load_kontent('xml_thumb.php?tag=' + tag)
}

function load_kontent(url)
{
	req_busy++
	loading_on()

	req = new XMLHttpRequest()
        req.onreadystatechange = _show_content
        req.open("GET", url, true)
        req.send(null)
}

function load_content(photoid)
{
	req_busy++
	loading_on()

	req = new XMLHttpRequest()
        req.onreadystatechange = _show_photo
        req.open("GET", 'xml_photo.php?id=' + photoid, true)
        req.send(null)
}

function load_page(url)
{
	req_busy++
	loading_on()

	req = new XMLHttpRequest()
        req.onreadystatechange = _show_secondary
        req.open("GET", url, true)
        req.send(null)
}

function _show_secondary() 
{
	if ( req.readyState == 4 )
	{
		if ( req.status != 200 )
		{
			set_content("secondary", "<b>Error loading data..</b>")
		} else {
			set_content("secondary", req.responseText)
		}
		req_busy = 0
		loading_off()
	}
}
function _show_photo() 
{
	if ( req.readyState == 4 )
	{
		if ( req.status != 200 )
		{
			set_content("photo", "<b>Error loading data..</b>")
		} else {
			set_content("photo", req.responseText)
		}
		req_busy = 0
		loading_off()
	}
}
function _show_content() 
{
	if ( req.readyState == 4 )
	{
		if ( req.status != 200 )
		{
			set_content("content", "<b>Error loading data..</b>")
		} else {
			set_content("content", req.responseText)
		}
		req_busy = 0
		loading_off()
	}
}

