function get(name) { return document.getElementById(name); }

function loadframe( name ) { return get(name).contentWindow.document.body.innerHTML; }

function loadflash(link,id,w,h)
{
	var html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+w+'" height="'+h+'" align="middle" id="'+id+'">'+
		'<param name="allowScriptAccess" value="sameDomain" />'+
		'<param name="allowFullScreen" value="false" />'+
		'<param name="movie" value="'+link+'" />'+
		'<param name="scale" value="noscale" />'+
		'<param name="wmode" value="transparent" />'+
		'<param name="quality" value="high" />'+
		'<embed src="'+link+'" scale="noscale" wmode="transparent" quality="high" name="'+id+'" swLiveConnect="true" width="'+w+'" height="'+h+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
		'</object>';
	return html;
}

function getposition(item)
{
	var data = { "x":item.offsetLeft, "y":item.offsetTop };
	if( item.offsetParent )
	{
		var temp = getposition( item.offsetParent );
		data.x += temp.x; data.y += temp.y;
	}
	return data;
}

function content(item,mode)
{
	if( item.value!="" && item.title=="" ) item.title=item.value;
	if( item.value=="" && !mode ) item.value = item.title;
	else if( item.value==item.title && mode ) item.value = "";
}

function submenu(name,item,top,left)
{
	var menu = get(name);
	var data = getposition(item);
	if( menu==undefined ) return;
	menu.style.display = "";
	menu.style.top = (data.y+top)+"px";
	menu.style.left = (data.x+left)+"px";
	menu.onmouseover = function() { menu.style.display = ""; }
	menu.onmouseout = function() { menu.style.display = "none"; }
	item.onmouseout = function() { menu.style.display = "none"; }
}

function getstyle(elem,prop)
{
	if (document.defaultView && document.defaultView.getComputedStyle) {
		if( prop.match(/[A-Z]/) ) prop=prop.replace(/([A-Z])/g, "-$1").toLowerCase();
		return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
	} else if( elem.currentStyle ) {
		return elem.currentStyle[prop];
	} else return "";
}

function flashtext(name,clas,font)
{
	var tags = document.getElementsByTagName(name);
	var styl = '';//navigator.userAgent.indexOf("Firefox")!=-1 ? 'position:relative;top:-8px' : '';
	for( var x=0; x<tags.length; x++ )
	{
		var html = tags[x].innerHTML;
		if( !clas || tags[x].className.indexOf(clas)!=-1 ) {
			tags[x].style.visibility = "visible";
			tags[x].innerHTML = loadflash(
				"/flashtext.swf?text="+(name=="a" ? "<a href='"+tags[x].href+"'>"+html+"</a>" : html)+"&font="+font+
				"&srgb="+getstyle(tags[x],"color")+
				"&size="+getstyle(tags[x],"fontSize")+
				"&bold="+getstyle(tags[x],"fontWeight")+
				"&w="+tags[x].offsetWidth+"&h="+tags[x].offsetHeight,
				"", "100%", tags[x].offsetHeight+"px");
		}
	}
}