var current_loc = '';
var current_height = 0;
var flash = false;

var setHeight = function(h)
{
	flash.style.height = h > document.body.clientHeight ? h+'px' : '100%';
	current_height = h > document.body.clientHeight ? h : 0;
};

var setAnc=function(name){ document.location.hash=name; current_loc=document.location.hash; };

var checkLocation = function()
{
	var hash = document.location.hash;
    if (hash!==current_loc)
	{
		current_loc = hash;
		var obj={};
		hash.replace(/(\w+)=([\w\/.]+)/g, function(s, k, v){ obj[k]=v; });
		flash.retAnc(obj);
    }
};

var resizeHandler = function()
{
	if(document.body.clientHeight > current_height) flash.style.height = '100%';
};

var init = function()
{
	var MSIE = (navigator.userAgent.indexOf("Microsoft") != -1) && !window.opera;
	flash = MSIE ? window['flash'] : document['flash'];
	//window.onresize = resizeHandler;
	checkLocation();
	var watchAnc = setInterval(checkLocation, 500);
};

var showFrame = function(href,w,h)
{
	var nw = w || 800;
	var nh = h || 500;
	window.open(href, 'pdf', 'width='+nw+',height='+nh+',scrollbars=1,resizable=1');
	/*
	var el = document.getElementById('iframeElem');
	el.src = href;
	var el = document.getElementById('overlay');
	el.style.display = 'block';
	var el = document.getElementById('iframe');
	el.style.display = 'block';
	*/
};

var hideFrame = function()
{
	var el = document.getElementById('overlay');
	el.style.display = 'none';
	var el = document.getElementById('iframe');
	el.style.display = 'none';
};

swfobject.embedSWF('/loader.swf', 'flash', '100%', '100%', '9.0.0', '/public/flash/expressInstall.swf', false, {'allowFullScreen' : true, 'wmode' : 'opaque'});
