function SimpleTabPageControl(imgOver,imgOut){
	this.tabHeader=new Array();
	this.imgMouseOver=imgOver;
	this.imgMouseOut=imgOut;
	this.currentViewHeader=null;
	this.currentDetailId=null;
	this.arrow=null;
	this.randTableId=null;
	this.bindInputById=null;
	this.eventType=0;	
}
SimpleTabPageControl.prototype.addHeader=function (arguLabel,arguDataOrHref,arguTarget,arguRelaDivId,arguDefault){ 
	if(arguDefault) this.currentDetailId=arguRelaDivId;								
	this.tabHeader.push(new Array(arguLabel,arguDataOrHref==null?'':arguDataOrHref,arguTarget,arguRelaDivId,arguDefault));							
}	
SimpleTabPageControl.prototype.setEventType=function (arguEventType){
	this.eventType=arguEventType;
}
SimpleTabPageControl.prototype.setBindInputId=function (arguInputId){
	this.bindInputById=arguInputId;
}
SimpleTabPageControl.prototype.arrowLocated=function (obj){ 								
	with(this.arrow.style){
		left=obj.offsetLeft+(obj.offsetWidth/2 - this.arrow.offsetWidth/2);
		top=obj.offsetTop+obj.offsetHeight-8;
		visibility='visible';
	}	
}
SimpleTabPageControl.prototype.createRandId=function (){
	var randId="";
	for(var i=0;i<10;i++) randId+=(Math.floor(Math.random()*9)+'');
	return randId;
}
SimpleTabPageControl.prototype.output=function (){
	this.arrow=document.createElement('DIV');
	this.arrow.style.cssText='position:absolute;top:0;left;0;visibility:hidden;z-index:+999';
	this.arrow.innerHTML="<font face='Webdings' color='#72B4EA'>6</font>";
	var randId=this.createRandId();
	this.randTableId='t'+randId;
	document.writeln("<table border=0 cellspacing=0 cellpadding=0 width='100%'  height='100%' id='"+this.randTableId+"'>");
	document.writeln("<tr></tr>");
	document.writeln("</table>");	
}
SimpleTabPageControl.prototype.apply=function (){
	document.body.appendChild(this.arrow);	
	var objTable=document.getElementById(this.randTableId);		
	var objRow=objTable.rows(0);					
	var self=this;
	objRow.align='center';
	for(var i=0;i<this.tabHeader.length;i++){
		var objCell=objRow.insertCell();
		with(objCell){ 										
			style.position='relative';
			if(i<this.tabHeader.length-1)style.borderRight='1 solid #bbbbbb';
			innerHTML="<a style='font-size:12px;color:#007BC9;text-decoration:none;' href='"+(this.eventType==1?'javascript:':(this.tabHeader[i][1]==''?'javascript:':this.tabHeader[i][2]))+"' "+(this.tabHeader[i][2]!=''?(" target='"+this.tabHeader[i][2]+"'"):"")+"><nobr>&nbsp;"+this.tabHeader[i][0]+"&nbsp;</nobr></a>";
			setAttribute("relaDivId",this.tabHeader[i][3]);
			if(this.eventType==1) setAttribute("data",this.tabHeader[i][1]);	
			if(this.eventType==1){		
				onclick=function (){
					if(self.currentViewHeader!=null) self.currentViewHeader.background=self.imgMouseOut;
					this.background=self.imgMouseOver;
					self.arrowLocated(this);
					self.currentViewHeader=this;
					if(self.currentDetailId!=null) document.getElementById(self.currentDetailId).style.display='none';												
					document.getElementById(this.getAttribute('relaDivId')).style.display='';
					self.currentDetailId=this.getAttribute('relaDivId');
					var data=this.getAttribute('data');
					if(data==null) data='';
					if(data!='') document.getElementById(self.bindInputById).value=data;
					for(var j=0;j<self.tabHeader.length;j++){
						if(self.tabHeader[j][3]!=self.currentDetailId) document.getElementById(self.tabHeader[j][3]).style.display='none';						
					}									
				}
			}
			if(this.eventType==0){		
				onmouseover=function (){
					if(self.currentViewHeader!=null) self.currentViewHeader.background=self.imgMouseOut;
					this.background=self.imgMouseOver;
					self.arrowLocated(this);
					self.currentViewHeader=this;
					if(self.currentDetailId!=null) document.getElementById(self.currentDetailId).style.display='none';				
					document.getElementById(this.getAttribute('relaDivId')).style.display='';
					self.currentDetailId=this.getAttribute('relaDivId');
					for(var j=0;j<self.tabHeader.length;j++){
						if(self.tabHeader[j][3]!=self.currentDetailId) document.getElementById(self.tabHeader[j][3]).style.display='none';						
					}				
				}
			}
			if(this.tabHeader[i][4]){
				background=this.imgMouseOver;
				this.currentViewHeader=objCell;											
			}			
		}
	}		
	this.arrowLocated(this.currentViewHeader);
	this.currentViewHeader.click();
}
