﻿String.prototype.trim = function()  
{  
	return this.replace(/(^\s*)|(\s*$)/g, "");  
}
function $(val)
{
    return document.getElementById(val);
}
function SetText(val,text){
    $(val).value=text;
}
function AddText(val,text){
    $(val).value+=text;
}

function getFlashObject(src,width,height,parent){
	var ie=navigator.userAgent.toLowerCase().indexOf("msie")>-1; 
	var obj=newElement("object");
	parent.appendChild(obj);
	obj.classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";	 
	obj.width=width;
	obj.height=height;	
	obj.movie=src;
	obj.menu=false;		
	if (!ie){
		obj.appendChild(newElement("param",["name","movie"],["value",src]));
		obj.appendChild(newElement("param",["name","menu"],["value",false]));
		obj.appendChild(newElement("param",["name","quality"],["value","high"])); 
		obj.appendChild(newElement("param",["name","wmode"],["value","opaque"]));	
		try{
		var emb=newElement("embed",
			["src",src],
			["width",width],
			["height",height],
			["menu",false],
			["quality","high"],
			["wmode","opaque"],
			["allowScriptAccess","sameDomain"],
			["type","application/x-shockwave-flash"],
			["pluginspage","http://www.macromedia.com/go/getflashplayer"]
		)
			obj.appendChild(emb);
		}catch(ex){}
	}
 	return(obj);		 
}

function addFlash(width,height,src){
	var ie=true; 
	var parent;
	var scs=document.getElementsByTagName("script");
	ie=String(navigator.appVersion).indexOf("MSIE")>-1;
	for (var i=0;i<scs.length;i++){
		var sc=scs[i].innerHTML;
		if (sc.indexOf("addFlash(")>-1){
			if (sc.indexOf(src)>-1){
				parent=scs[i].parentNode;
				break;	
			}
		}
	}
	if (ie){    		
 		var obj=document.createElement("object"); 
		parent.appendChild(obj);
	 	obj.classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
		obj.width=width;
		obj.height=height;	 
		obj.wmode="opaque";	 
		obj.menu=false;
	 	obj.movie=src
	}else{
		try{
		var html=('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width+ +'" height="'+ height +'">');           
		html +=('<param name="movie" value="'+src+'"><param name="quality" value="high">');           
		html +=('<param name="menu" value="false"><param name=wmode value="opaque">');          
		html +=('<embed src="'+src+'" wmode="opaque" menu="false" bgcolor="#ffffff" quality="high" width="'+ width +'" height="'+ height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');           
		html +=('</object>');
		parent.innerHTML +=html;			
		}catch(ex){}
	}
}
