﻿if(typeof(xFunctions)=="undefined") alert("Error: xBox Requires xFunctions");
if(typeof(xBox)=="undefined") xBox={};

xBox.makeBox = function(elementid,headerHTML,footerHTML,boxTopCss,boxTopRightCss,boxMidCss,boxMidRightCss,boxBottomCss,boxBottomRightCss) 
{
	if(typeof(headerHTML)=="undefined") headerHTML="&nbsp;";
	if(typeof(footerHTML)=="undefined") footerHTML="&nbsp;";
	if(typeof(boxTopCss)=="undefined") boxTopCss="boxTop";	
	if(typeof(boxTopRightCss)=="undefined") boxTopRightCss="boxTopRt";	
	if(typeof(boxMidCss)=="undefined") boxMidCss="boxMid";		
	if(typeof(boxMidRightCss)=="undefined") boxMidRightCss="boxMidRt3";	
	if(typeof(boxBottomCss)=="undefined") boxBottomCss="boxBtm";	
	if(typeof(boxBottomRightCss)=="undefined") boxBottomRightCss="boxBtmRt";	
		
	obj=xFunctions.el(elementid);	
	if (typeof(obj)!="undefined") 
	{
		origcontent=obj.innerHTML;
		shtml="<div class=\""+boxTopCss+"\"><div class=\""+boxTopRightCss+"\">";
		shtml+=headerHTML;
		shtml+="</div><div class=\""+boxMidCss+"\"><div class=\""+boxMidRightCss+"\">";
		shtml+=origcontent;	
		shtml+="</div></div><div class=\""+boxBottomCss+"\"><div class=\""+boxBottomRightCss+"\">";
		shtml+=footerHTML;
		shtml+="</div></div></div>";
		obj.innerHTML=shtml;
	}
}

xBox.makeBoxNoHeader = function(elementid,headerHTML,footerHTML,boxTopCss,boxTopRightCss,boxMidCss,boxMidRightCss,boxBottomCss,boxBottomRightCss) 
{
	if(typeof(headerHTML)=="undefined") headerHTML="&nbsp;";
	if(typeof(footerHTML)=="undefined") footerHTML="&nbsp;";
	if(typeof(boxTopCss)=="undefined") boxTopCss="boxTop";	
	if(typeof(boxTopRightCss)=="undefined") boxTopRightCss="boxTopRt";	
	if(typeof(boxMidCss)=="undefined") boxMidCss="boxMid";		
	if(typeof(boxMidRightCss)=="undefined") boxMidRightCss="boxMidRt3";	
	if(typeof(boxBottomCss)=="undefined") boxBottomCss="boxBtm2";	
	if(typeof(boxBottomRightCss)=="undefined") boxBottomRightCss="boxBtmRt";	

	obj=xFunctions.el(elementid);	
	if (typeof(obj)!="undefined") 
	{
		origcontent=obj.innerHTML;
		shtml="<div class=\""+boxTopCss+"\"><div class=\""+boxTopRightCss+"\">";
		shtml+=origcontent;	
		shtml+="</div></div><div class=\""+boxBottomCss+"\"><div class=\""+boxBottomRightCss+"\">";		
		shtml+="</div></div></div>";
		obj.innerHTML=shtml;
	}
}

xBox.boxTop = function(headerHTML,boxTopCss,boxTopRightCss,boxMidCss,boxMidRightCss) 
{
	if(typeof(headerHTML)=="undefined") headerHTML="&nbsp;";
	if(typeof(boxTopCss)=="undefined") boxTopCss="boxTop";		
	if(typeof(boxMidCss)=="undefined") boxMidCss="boxMid";		
	if(typeof(boxMidRightCss)=="undefined") boxMidRightCss="boxMidRt3";	
	if(typeof(boxTopRightCss)=="undefined") boxTopRightCss="boxTopRt";	
	var shtml="<div class=\""+boxTopCss+"\"><div class=\""+boxTopRightCss+"\">";
	shtml+=headerHTML;
	shtml+="</div><div class=\""+boxMidCss+"\"><div class=\""+boxMidRightCss+"\">";
	return(shtml);
}

xBox.boxTopNoMiddle = function(boxTopCss,boxTopRightCss) 
{
	if(typeof(boxTopCss)=="undefined") boxTopCss="boxTop";	
	if(typeof(boxTopRightCss)=="undefined") boxTopRightCss="boxTopRt";	
	var shtml="<div class=\""+boxTopCss+"\"><div class=\""+boxTopRightCss+"\">";	
	return(shtml);
}

xBox.boxBottomNoMiddle = function(footerHTML,boxBottomCss,boxBottomRightCss) 
{
 	if(typeof(footerHTML)=="undefined") footerHTML="&nbsp;";
	if(typeof(boxBottomCss)=="undefined") boxBottomCss="boxBtm";	
	if(typeof(boxBottomRightCss)=="undefined") boxBottomRightCss="boxBtmRt";
	var shtml="</div></div><div class=\""+boxBottomCss+"\"><div class=\""+boxBottomRightCss+"\">";		
    shtml+=footerHTML;
	shtml+="</div></div>";
	return(shtml);
}	

xBox.boxBottom = function(footerHTML,boxBottomCss,boxBottomRightCss) 
{
 	if(typeof(footerHTML)=="undefined") footerHTML="&nbsp;";
	if(typeof(boxBottomCss)=="undefined") boxBottomCss="boxBtm";	
	if(typeof(boxBottomRightCss)=="undefined") boxBottomRightCss="boxBtmRt";
	var shtml="</div></div><div class=\""+boxBottomCss+"\"><div class=\""+boxBottomRightCss+"\">";		
    shtml+=footerHTML;
	shtml+="</div></div></div>";
	return(shtml);
}	
	
