
function handleError() {
	return true;
}

window.onerror = handleError;

/*var hasFlash = function()
{
    var a=6;
    if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1)
    {
        document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');
        if(window.hasFlash!=null)return window.hasFlash
    }
    if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
    {
        var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;
        return parseInt(b.charAt(b.indexOf(".")-1))>=a
    }
    return false
}*/

browserFlashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
needFlashVersion = 6;

htmlElements = new Array("h1","h2","h3");

function insertFlashes()
{
	if(browserFlashVersion.major >= needFlashVersion)
	{
		for(i=0;i<htmlElements.length;i++)
		{
			replaceHeading(htmlElements[i]);
		}
	}
}

function URLEncode(s) {
     if (window.encodeURIComponent) {
        return encodeURIComponent(s);
     }
     else if (window.escape) {
        return escape(s); 
     }
     return s;
}


function replaceHeading(htmltag) {
	
	for(var i = 0; i < document.getElementsByTagName(htmltag).length; i++) 	
	{
		if(document.getElementsByTagName(htmltag)[i].className == "flash")
		{
			if(htmltag == "h1")
			{
				width = "540";
				height = "24";
			}
			else if (htmltag == "h2")
			{
				width = "170";
				height = "14";
			}
			else if (htmltag == "h3")
			{
				width = "160";
				height = "14";
			}
			
			so = new SWFObject("/static/swf/" + htmltag + ".swf", "headline_" + i, width, height, "6.0.65", "#336699");
			myValue = document.getElementsByTagName(htmltag)[i].innerHTML;		
			
			if (myValue != undefined) 
			{
					
					myObj = document.getElementsByTagName(htmltag)[i];
					myParent = myObj.parentNode;
											
					myValue = URLEncode(myValue);
					
				   so.addVariable("headline", myValue);
				   so.addParam("wmode", "transparent");
				   so.addParam("scale", "noscale");
				   myFlash = so.getSWFHTML();
									
					replaceDiv = document.createElement('div');
					
					replaceDiv.className="flashheadline";
					replaceDiv.innerHTML = myFlash;
					myParent.replaceChild(replaceDiv, myObj);
					i--;
	
			}
		}
	
	}
	
}

insertFlashes();

/*if (hasFlash()) 
{
	replaceHeading("h1");
	replaceHeading("h2");
	replaceHeading("h3");
}*/