function hashinit()
{	hash = '', poll = true, msie = false, ieisloaded = false;
	if (navigator.userAgent.indexOf('MSIE') !=-1)
	{	msie = true;
		Event.observe(window, 'load', 
			function() 
			{	var d = document.createElement('DIV');
				d.innerHTML = '<iframe src="blank.html?" id="iehistframe" name="iehistframe" style="display:none;"></iframe>';
				document.body.appendChild(d);
			});
	}
	if(!msie)
		pollhash();
	else
		iepollhash();
}

function pollhash()
{	doPolling = setTimeout("updatehash()",500)
}

function updatehash()
{	if(poll)
	{	if(hash != document.location.hash.substr(1))
		{	hash = document.location.hash.substr(1);
			getashreload(hash.substring(0, hash.indexOf('/')), hash.substring(hash.indexOf('/') + 1));
		}
	}
	pollhash();
}

function iepollhash()
{	doPolling = setTimeout("ieupdatehash()",1000);
}

function ieupdatehash()
{	if(poll && ieisloaded)
	{	iehash = window["iehistframe"].document.body.innerHTML.substring(window["iehistframe"].document.body.innerHTML.indexOf('?') + 1).unescapeHTML();
		// alert(iehash);
		if(iehash == '')
			iehash = document.location.hash.substr(1);

		if(hash != iehash)
		{	hash = iehash;
			getashreload(hash.substring(0, hash.indexOf('/')), hash.substring(hash.indexOf('/') + 1));
		}
	}
	iepollhash();
}

function iefrisloaded()
{	ieisloaded = true;
}

function getashupdate(URL, poststr)
{	poll = false;
	if(msie)
		ieisloaded = false;
	new Ajax.Updater('ajaxcontent', URL, {evalScripts: true, parameters: poststr});
	document.location.hash = URL + '/' + poststr;
	hash = URL + '/' + poststr;
	if(msie)
		$('iehistframe').src = 'blank.html?' + hash + '&rnd=' + Math.floor(Math.random()*1000);
	poll = true;
}

function getashreload(URL, poststr)
{   poll = false;
    if(msie)
        ieisloaded = false;
    new Ajax.Updater('ajaxcontent', URL, {evalScripts: true, parameters: 'reload=true&' + poststr});
    document.location.hash = URL + '/' + poststr;
    hash = URL + '/' + poststr;
    if(msie)
        $('iehistframe').src = 'blank.html?' + hash + '&rnd=' + Math.floor(Math.random()*1000);
    poll = true;
}

function getashdivupdate(URL, poststr, div)
{   poll = false;
    if(msie)
        ieisloaded = false;
    new Ajax.Updater(div, URL, {evalScripts: true, parameters: poststr});
    document.location.hash = URL + '/' + poststr;
    hash = URL + '/' + poststr;
    if(msie)
        $('iehistframe').src = 'blank.html?' + hash + '&rnd=' + Math.floor(Math.random()*1000);
    poll = true;
}

function getashpage(URL, poststr)
{	poll = false;
	if(msie)
		ieisloaded = false;
	document.location.hash = URL + '/' + poststr;
	hash = URL + '/' + poststr;
	if(msie)
		$('iehistframe').src = 'blank.html?' + hash + '&rnd=' + Math.floor(Math.random()*1000);
	poll = true;
}

hashinit();
