/* Swftype */
function doSwftype(swftypeTag, swftypeSrc, cssSrc, swftypeWidth, swftypeHeight, txtUpper, txtSelect, resizeType, debug)
{
	if(document.getElementsByTagName(swftypeTag))
	{	
		var theSwftypeTag = document.getElementsByTagName(swftypeTag);		
		for(var i=0; i<theSwftypeTag.length; i++)
		{	
			
			var obj = theSwftypeTag[i];
			var tagName = obj.tagName;	
			var className= "";		
			if(obj.className)
			{
				className = obj.className;
			}		

			obj.setAttribute('id', 'Swftype'+swftypeTag+i);										
			if(obj.innerHTML != null)
			{			
				/* Swftype Content */
				var pageTxt = obj.innerHTML;			
				// search and add ' in classNames 
				if(pageTxt.indexOf('class=') != -1)
				{			
					var firstQuote = (pageTxt.indexOf('class=') + 6);
					var spanCloseTag = pageTxt.indexOf('>');
					var className = pageTxt.substr(firstQuote, (spanCloseTag - firstQuote));				
					if(pageTxt.charAt(firstQuote) != '"')
					{
						pageTxt = pageTxt.replace(className,'"'+className+'"');
					}
				}						
				var printAlt = document.createElement("span");				
				// printAlt.setAttribute("class", "printSwfType");   
				printAlt.className = "printSwfType";
				printAlt.innerHTML = pageTxt;   
				obj.parentNode.insertBefore(printAlt, obj);						
				pageTxt = pageTxt.replace(/"/g, "'");
				pageTxt = pageTxt.replace(/\+/g, "&#43;");
				pageTxt = pageTxt.replace(/%/g, "&#37;");	
				pageTxt = pageTxt.replace(/&/g, "{and}");
			}
			else
			{
				var pageTxt = "DEFAULT";
			}

			/* swfobject2 */
			var flashvars = {};
			flashvars.cssURL = cssSrc;
			flashvars.txtUpper = txtUpper;
			flashvars.tagName = tagName;
			flashvars.className = className;
			flashvars.txtWidth = swftypeWidth;
			flashvars.txtHeight = swftypeHeight;
			flashvars.txtSelect = txtSelect;
			flashvars.resizeType = resizeType;
			flashvars.debug = debug;
			var params = {};
			params.allowScriptAccess = "always";
			params.menu = "false";
			params.wmode = "transparent";
			var attributes = {};

			swfobject.embedSWF(swftypeSrc + "?pageTxt=" + pageTxt + "&swftypeID=Swftype"+swftypeTag+i, "Swftype" + swftypeTag + i, swftypeWidth, swftypeHeight, "8", "false", flashvars, params, attributes);			
		}
	}
}
/* Swftype Resize */
function resizeSwftype(SwftypeId, textHeight, textWidth)
{
	document.getElementById(SwftypeId).style.width = textWidth + "px";	
	document.getElementById(SwftypeId).style.height = textHeight + "px";
}