//Object which allows consumers of the library to embed active-x objects

function createObject(objectDefinition)
{
    if(document.all)
    {
         document.write(objectDefinition);
    }
}

 
function ActiveXWriter()
{
	this.accesskey="";
	this.align="";
	this.alt="";
	this.archive="";
	this.border="";
	this.classid="";
	this.styleclass="";//class is keyword in the javascript, so styleclass is used here.
	this.code="";
	this.codebase="";
	this.codetype="";
	this.data="";
	this.declare="";
	this.dir="";
	this.height="";
	this.hidefocus="";
	this.hspace="";
	this.id="";
	this.lang="";
	this.language="";
	this.name="";
	this.standby="";
	this.style="";
	this.tabindex="";
	this.title="";
	this.type="";
	this.unselectable="";
	this.usemap="";
	this.vspace="";
	this.width="";
	this.viewastext=false;//By default it is assumed that consumer is not putting VIEWASTEXT.

	this.arrparamname=new Array();
	this.arrparamvalue=new Array();
	this.intcountparam=0;

	this.addParam = func_addParam;
	this.helper = func_helper;
	this.output = func_output;
	this.insert = func_insert;
}
//Adds the parameters of the tag <PARAM name="ParamName" value="ParamValue">
function func_addParam(paramname, paramvalue)
{
	if(paramname!='') //If paramname is empty there is no meaning to add it to the object tag and it gives error.
	{
		this.arrparamname[this.intcountparam]=paramname;
		this.arrparamvalue[this.intcountparam]=paramvalue;
		this.intcountparam++;
	}
}
//Output the object tag 
function func_helper()
{
	strObject='<object';
	//All the attributes will be checked for empty, if it is not empty then only that will be added to object tag.
	if(this.accesskey!="") strObject+=' accesskey=' + '"' + this.accesskey + '"';
	if(this.align!="") strObject+=' align='+'"'+this.align+'"';
	if(this.alt!="") strObject+=' alt='+'"'+this.alt+'"';
	if(this.archive!="") strObject+=' archive='+'"'+this.archive+'"';
	if(this.border!="") strObject+=' border='+'"'+this.border+'"';
	if(this.classid!="") strObject+=' classid='+'"'+this.classid+'"';
	if(this.styleclass!="") strObject+=' class='+'"'+this.styleclass+'"';
	if(this.code!="") strObject+=' code='+'"'+this.code+'"';
	if(this.codebase!="") strObject+=' codebase='+'"'+this.codebase+'"';
	if(this.codetype!="") strObject+=' codetype='+'"'+this.codetype+'"';
	if(this.data!="") strObject+=' data='+'"'+this.data+'"';
	if(this.declare!="") strObject+=' declare='+'"'+this.declare+'"';
	if(this.dir!="") strObject+=' dir='+'"'+this.dir+'"';
	if(this.height!="") strObject+=' height='+'"'+this.height+'"';
	if(this.hidefocus!="") strObject+=' hidefocus='+'"'+this.hidefocus+'"';
	if(this.hspace!="") strObject+=' hspace='+'"'+this.hspace+'"';
	if(this.id!="") strObject+=' id='+'"'+this.id+'"';
	if(this.lang!="") strObject+=' lang='+'"'+this.lang+'"';
	if(this.language!="") strObject+=' language='+'"'+this.language+'"';
	if(this.name!="") strObject+=' name='+'"'+this.name+'"';
	if(this.standby!="") strObject+=' standby='+'"'+this.standby+'"';
	if(this.style!="") strObject+=' style='+'"'+this.style+'"';
	if(this.tabindex!="") strObject+=' tabindex='+'"'+this.tabindex+'"';
	if(this.title!="") strObject+=' title='+'"'+this.title+'"';
	if(this.type!="") strObject+=' type='+'"'+this.type+'"';
	if(this.unselectable!="") strObject+=' unselectable='+'"'+this.unselectable+'"';
	if(this.usemap!="") strObject+=' usemap='+'"'+this.usemap+'"';
	if(this.vspace!="") strObject+=' vspace='+'"'+this.vspace+'"';
	if(this.width!="") strObject+=' width='+'"'+this.width+'"';
	if(this.viewastext==true) strObject+=' VIEWASTEXT ';

	strObject+='>';
	for(i=0;i<this.intcountparam;i++)
	{
		strObject+='<param name='+'"'+this.arrparamname[i]+'"'+' value='+'"'+this.arrparamvalue[i]+'"'+'>';
	}
	strObject+='</object>';
	//alert(strObject);
	return strObject;
}
//Output the object tag 
function func_output()
{
	var strObject=this.helper();
	document.write(strObject);
}
//Output the object tag by using div ID
function func_insert(DivID)
{
	var strPlaceHolder = document.getElementById(DivID);
	strPlaceHolder.innerHTML = this.helper();
}