/* SIDEBAR function MAKE ENCADRE for W3G -- version CLEANUP 04-12-08 -- OrigDvD w2G 25-10-04  */
function makeEncadre(FloatPosition,DivWidth,HeaderText,BodyText,codetest,BodyTextPix) 
{ 

// strip blank spaces
FloatPosition = FloatPosition.replace(/\s+/g,'');
DivWidth = DivWidth.replace(/\s+/g,'');
HeaderText = HeaderText.replace(/\s+/g,'');
BodyText = BodyText.replace(/\s+/g,'');


var HTML = "";
;
/* Test for version with DIV and errors - NOTE 04-12 08 SAVE FOR NOW FOR OLDER VERSIONS OF Encadre function  */
try
{
HeaderText= document.getElementById(HeaderText).innerHTML;
}
catch (errMsg){onerror=null;}

try
{
BodyText= document.getElementById(BodyText).innerHTML;
}
catch (errMsg){onerror=null;}

/* Test for editor errors - NOTE 04-12 08 SAVE FOR NOW - may delete later */
if (DivWidth=="" & FloatPosition != "nofloat") {
alert("No width?");
}

if (FloatPosition != "right" & FloatPosition != "left" & FloatPosition != "nofloat" ) {
   alert("POSITION = "+FloatPosition+"?");
} 


/* Test variantes */
/* If full-width sidebar use standard highlightbox */
if (FloatPosition=="nofloat")
{
	//NO photo
	if (BodyText!="none")
	{
		if (HeaderText!="" & HeaderText!="none" & HeaderText.toLowerCase()!="<b>none</b>") 
		{
		//with Header ;
		var simpSidebar = "<h2 class='highlightheader'>"+HeaderText+"</h2><div class='highlightbox'><div class='sidebarbody'>"+ BodyText+"</div></div>";
		}
		else 
		{
		//NO HEADER
		var simpSidebar = "<div class='highlightbox'><div class='sidebarbody'>"+ BodyText+"</div></div>";
		}
	}
	//With photo, then w/ or w/o header
	else 
	{
		if (HeaderText!="" & HeaderText!="none" & HeaderText.toLowerCase()!="<b>none</b>") 
		{
		var simpSidebar = "<h2 class='highlightheader'>"+HeaderText+"</h2><div class='highlightbox'><div class='sidebarbody'>"+ BodyTextPix + "</div></div>";
		}
		else 
		{
		var simpSidebar = "<div class='highlightbox'><div class='sidebarbody'>"+ BodyTextPix + "</div></div>";
		}
	}
return simpSidebar;
}
//If floating sidebar use highlightboxleft small
else
{	
	//NO photo
	if (BodyText!="none")
		{
		if (HeaderText != "")
			{
			HeaderText = "<p class='sidebarhead'><strong>"+HeaderText+"</strong></p><p>";
			}
		var floatSidebar = "<div class='highlightbox highlightboxleft small'>"+HeaderText + "<div class='sidebarbody'>"+ BodyText+"</div></div>";
		}
	//With photo
	else
		{
		if (HeaderText != "")
			{
			HeaderText = "<p class='sidebarpixhead'><strong>"+HeaderText+"</strong></p><br />";
			var floatSidebar = "<div class='highlightbox highlightboxleft small zoomadjust'><!--p class='clearing'></p-->"+ HeaderText + "<div class='sidebarbody'>"+ BodyTextPix + "</div></div>";
			}
		
		//Else NO header
		else 
			{
			var floatSidebar = "<div class='highlightbox highlightboxleft small'><!--p class='clearing'></p--><div class='sidebarbody zoomfloat'>"+ BodyTextPix + "</div></div>";

			}
		//prompt("Check code",floatSidebar);
		}
return floatSidebar;
}
/* END Test variantes */
}
/* END function MakeEncadre */

