function ActionObject(){
	
	this.height = "";
	this.width = "";
	this.onaction = false;
	
	this.setEditorPosition = function(obj){
		myObject.setParentPosition(obj);
		cobj = document.getElementById('displaybox');
		cleft = (myObject.curleft - 5);
		ctop = (myObject.curtop - this.height);
		
		cstyle = cobj.style;
		cstyle.left = cleft+'px';
		cstyle.top = ctop+'px';
	};
	
	this.setOn = function(val){
		type = (val) ? "on" : "out";
		myTimer.queuePush('setactionstate_'+type);
	};
	
	this.setState = function(type){
		this.onaction = (type == "on");
		stoptheload();
	};
	
	this.setEditorSize = function(){
		cobj = document.getElementById('displaybox');
		cstyle = cobj.style;
		cstyle.width = this.width+'px';
		cstyle.height = this.height+'px';
	};
	
	this.setBrd = function(clr, bg, width){
		xtxt = '';
		xtxt += '<div style = "float:left; height:15px; clear:both; '+blender.initOpacity(85)+'">';
		xtxt += '<div style = "float:left; width:'+(width)+'px; height:15px; background:'+bg+';"></div>';
		xtxt += '</div>';
		return xtxt;
	};
	
	this.callCommand = function(caction, clink, csublink, ctab, cid){
		switch(caction){
			case "Delete": case "Add": 
				cmd = 'siteeditor_'+ctab+"_"+caction;
				ulink = '/p/'+clink+'/'+csublink+'/'+ctab+'/'+cid;
				params.commandlink = (ulink);
				commnd = ('callAjax_PORTAL/'+clink+'/'+cmd+'/'+cid+'/callcommandlink');
				startglazer = false;
				myTimer.queuePush(commnd);
			break;
			case "Rename":
				clist = cid.split(',_');
				cmd = 'siteeditor_'+ctab+"_"+caction;
				uobjname = document.getElementById("titlename");
				usrname = uobjname.value;
				usrname = usrname.replace(/,_/g, ', ');
				cpost = ctab+',_'+clist[0]+',_'+clist[2];
				portalUI.type = ctab;
				portalUI.tab = clist[0];
				portalUI.curid = clist[2];
				params.commandlist = ('callAjax_PORTAL/'+clink+'/'+csublink+'/'+cpost+'/setportal');
				commnd = ('callAjax_PORTAL/'+clink+'/'+cmd+'/'+cid+',_'+usrname+'/callcommandlist');
				startglazer = false;
				myTimer.queuePush(commnd);
			break;
			case "Edit":
				carray = cid.split(',_');
				carray[1] = "edit";
				cid = carray.join(',_');
				ulink = '/p/'+clink+'/'+csublink+'/'+ctab+'/'+cid;
				portalUI.newPage(ulink);
			break;
			case "Post":
				clist = cid.split(',_');
				portalUI.type = 'MessageViewer';
				portalUI.tab = 'none';
				portalUI.curid = clist[2];
				cpost = 'MessageViewer,_none,_'+clist[2];
				startglazer = false;
				params.commandlist = ('callAjax_PORTAL/'+clink+'/'+csublink+'/'+cpost+'/setportal');
				cobj = document.getElementById('siteeditform');
				cobj.action = '/postsiteinfo.php?id='+clist[2];
				cobj.submit();
			break;
		}
	};
	
	this.setActions = function(clr, actionlist, cwidth, brd, clink, csublink, ctab, cid){
		actions = actionlist.split(',_');
		alen = actions.length;
		ctxt = '';
		last=alen-1;
		for(n = 0; n <alen; n++){
			wrd = actions[n].replace(/_/g, ' ');
			carray = actions[n].split('_');
			caction = carray[0];
			ctxt += '<div style = "cursor:pointer; padding-left:5px; padding-top:2px; font-size:10px; padding-bottom:2px; width:'+(cwidth-5)+'px; ';
			if(n != last)
				ctxt += 'border-bottom:'+brd;
			ctxt += ';" class = "'+clr+'" onclick = "actionObj.callCommand(\''+caction+'\', \''+clink+'\', \''+csublink+'\', \''+ctab+'\', \''+cid+'\')">';
			ctxt += 	wrd;
			ctxt += '</div>';
		}
		return ctxt;
	};
	
	this.removeObj = function(){
		cobj = document.getElementById('displaybox');
		cobj.style.display = "none";
	};
	
	this.resize = function(){
		tobj = document.getElementById('actionobj_id');
		this.setEditorPosition(tobj);
	};
	
	this.setActionContent = function(clink, csublink, ctab, cid, actionlist, clr, bg, brd, txtclr, cobj){
		mtxt = '';
		cwidth = this.width;
		cheight = this.height;
		mheight = (cheight-45);
		objwidth = cwidth -32;
		cbg = bg/1;
		bg = "#"+bg;
		cbg = "#"+cbg;
		mtxt += this.setBrd(clr, bg, cwidth);
		mtxt += '<div style = "height:'+mheight+'px; clear:both;  width:'+cwidth+'px;  ">';
		mtxt +=		'<div style = "float:left; width:15px; background:'+bg+'; height:'+mheight+'px; '+blender.initOpacity(85)+'"></div>';
		mtxt +=		'<div style = "float:left; width:'+(objwidth)+'px; height:'+(mheight-2)+'px; color:'+txtclr+'; border:'+brd+'; background:'+cbg+';">';
		mtxt +=			this.setActions(clr, actionlist, objwidth, brd, clink, csublink, ctab, cid);
		mtxt += 	'</div>';
		mtxt +=		'<div style = "float:left; width:15px; background:'+bg+'; height:'+mheight+'px; '+blender.initOpacity(85)+'"></div>';
		mtxt += '</div>';
		mtxt += this.setBrd(clr, bg, cwidth);
		mtxt +=	'<div style = "clear:both;height:15px; width:40px; background-image:url(\'http://s3.amazonaws.com/ldimages/'+clr+'_botimg.gif\'); '+blender.initOpacity(85)+'"></div>';
		cobj.innerHTML = mtxt;
		cstyle = cobj.style;
		cstyle.display = "block";
	};
	
	
	this.init = function(obj, clink, csublink, ctab, cid, cwidth, cheight, actionlist, clr, bg, brd, txtclr){
		openaction = true;
		this.height = cheight;
		this.width = cwidth;
		this.setEditorPosition(obj);
		this.setEditorSize();
		this.setActionContent(clink, csublink, ctab, cid, actionlist, clr, bg, brd, txtclr, cobj);
	};
}

var actionObj = new ActionObject();