/* Swftype */
function doSwftype(swftypeTag, swftypeSrc, cssSrc, swftypeWidth, swftypeHeight, txtUpper, txtSelect){	
	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+'"');
				}
			}			
			pageTxt = pageTxt.replace(/"/g, "'");
			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;
		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, newHeight, newWidth, textHeight, textWidth)
{		
	document.getElementById(SwftypeId).style.width = textWidth + "px";	
	document.getElementById(SwftypeId).style.height = newHeight + "px";
}