// Formatter script written By Alain Lapalme
// Alsprograms.com / AtomicBoards.com

var I1=new Image;I1.src="is/bu1.png";var I2=new Image;I2.src="is/bu8.png";
var I3=new Image;I3.src="is/bu2.png";var I4=new Image;I4.src="is/bu9.png";
var I5=new Image;I5.src="is/bu3.png";var I6=new Image;I6.src="is/bu10.png";
var I7=new Image;I7.src="is/bu4.png";var I8=new Image;I8.src="is/bd1.png";
var O1=new Image;O1.src="is/bu5.png";var O2=new Image;O2.src="is/bd2.png";
var O3=new Image;O3.src="is/bu6.png";var O4=new Image;O4.src="is/bd3.png";
var O5=new Image;O5.src="is/bu7.png";var O6=new Image;O6.src="is/bd4.png";
var O7=new Image;O5.src="is/bd5.png";var O8=new Image;O6.src="is/bd6.png";
var O9=new Image;O5.src="is/bd10.png";
var BoldOn=false;var ItalOn=false;var UnderOn=false;var LeftOn=false;
var RightOn=false;var CenterOn=false;var FontOn=false;
var FontOn=false; var FontSize=3; var FontColor=0;
var isHTMLOn=true;
var str;
function SF(){document.Input.content.focus();str=document.Input.content.value;}

function Send(){if (BoldOn) SetBold();if (ItalOn) SetItal();
//if (FontOn) SetFont();
if (isHTMLOn) document.Input.content.value=document.Input.content.value+"</font>";

if (UnderOn) SetUnder();if (LeftOn) SetLeft();if (RightOn) SetRight();
if (isHTMLOn) document.Input.allow.value=""; else document.Input.allow.value="ON"; 
if (CenterOn) SetCenter();
document.Input.submit();
}

function Send2(){
if (document.Input.type.value == "POST") document.Input.type.value="PREPOST";
else document.Input.type.value="PREREPLY";
if (FontOn && isHTMLOn) SetFont(0,0);
if (isHTMLOn) document.Input.allow.value=""; else document.Input.allow.value="ON"; 
if (BoldOn) SetBold();if (ItalOn) SetItal();
if (UnderOn) SetUnder();if (LeftOn) SetLeft();if (RightOn) SetRight();
if (CenterOn) SetCenter();document.Input.submit();}

function SetFont(x,y)
{SF();
	if (FontOn) str2="</FONT>"; else str2="";
	if (x ==0 && y==0)
		{
			
			if (FontOn) FontOn=false;
			str2="</FONT>";
		}
	else if (x>0)
		{
			FontSize=x;

			if (FontColor == 0)
				str2 = str2+"<FONT SIZE="+FontSize+">";
			else
				str2 = str2+"<FONT SIZE="+FontSize+" COLOR="+FontColor+">";
			FontOn=true;
		}
	else
		{
			FontColor=y;
			str2 = str2+"<FONT SIZE="+FontSize+" COLOR="+FontColor+">";
			FontOn=true;
		}
		document.Input.content.value=str+str2;
}

function SetBold(){SF();
if (BoldOn){BoldOn=false;str2="</B>";document.OPT_BOLD.src="is/bu1.png";}
else {BoldOn=true;str2="<B>";document.OPT_BOLD.src="is/bd1.png";}
document.Input.content.value=str+str2;}

function SetItal(){SF();
if (ItalOn){ItalOn=false;str2="</I>";document.OPT_ITAL.src="is/bu2.png";}
else {ItalOn=true;str2="<I>";document.OPT_ITAL.src="is/bd2.png";}
document.Input.content.value=str+str2;}

function SetUnder(){SF();
if (UnderOn){UnderOn=false;str2="</U>";document.OPT_UNDER.src="is/bu3.png";}
else{UnderOn=true;str2="<U>";document.OPT_UNDER.src="is/bd3.png";}
document.Input.content.value=str+str2;}

function SetLeft(){SF();
if (CenterOn || RightOn){CenterOn=false;RightOn=false;document.OPT_CENTER.src="is/bu5.png";
document.OPT_RIGHT.src="is/bu6.png";str=str+"</p>";}
if (LeftOn){LeftOn=false;str2="</p>";document.OPT_LEFT.src="is/bu4.png";}
else{LeftOn=true;str2="<p align='LEFT'>";document.OPT_LEFT.src="is/bd4.png";}
document.Input.content.value=str+str2;}

function SetRight(){SF();
if (CenterOn || LeftOn){CenterOn=false;LeftOn=false;document.OPT_CENTER.src="is/bu5.png";
document.OPT_LEFT.src="is/bu4.png";str=str+"</p>";}
if (RightOn){RightOn=false;str2="</p>";document.OPT_RIGHT.src="is/bu6.png";}
else{RightOn=true;str2="<p align='RIGHT'>";document.OPT_RIGHT.src="is/bd6.png";}
document.Input.content.value=str+str2;}

function SetCenter(){SF();if (RightOn || LeftOn){RightOn=false;LeftOn=false;
document.OPT_RIGHT.src="is/bu6.png";document.OPT_LEFT.src="is/bu4.png";str=str+"</p>";}
if (CenterOn){CenterOn=false;str2="</p>";document.OPT_CENTER.src="is/bu5.png";}
else{CenterOn=true;str2="<p align='CENTER'>";document.OPT_CENTER.src="is/bd5.png";}
document.Input.content.value=str+str2;}

function InsertImage(){SF();
ims=window.prompt("Please enter the image's URL [location].\nMust start with http://:","http://");
if (ims) document.Input.content.value=document.Input.content.value+"<img src='"+ims+"'>";}

function InsertQuote(){SF();
quo=window.prompt("Please enter the text to be quoted (copy & paste)","");
aut=window.prompt("Please enter the author's name (person who said/wrote this quote)","");
if (quo) document.Input.content.value=document.Input.content.value+"<blockquote><small>_____________________________<br><small><i><b>Posted by "+aut+"</b></i></small><br>"+quo+"<br>_____________________________</blockquote></small>";}

function quotethis(aut,quo){SF();
if (quo) document.Input.content.value=document.Input.content.value+"<blockquote><small>_____________________________<br><small><i><b>Posted by "+aut+"</b></i></small><br>"+quo+"<br>_____________________________</blockquote></small>";}


function AEI(inum){SF();
document.Input.content.value=document.Input.content.value+"%icon:"+inum+"%";}

function InsertLink(){SF();
lnk=window.prompt("Please enter the URL.\nMust start with http://","http://");
if (lnk){ltt=window.prompt("Please enter link Title or Name (ex: Click Here!)","");
if (!ltt) ltt=lnk;
document.Input.content.value=document.Input.content.value+"<a href='"+lnk+"'>"+ltt+"</a>";
}
}

    IE4 = (document.all) ? 1 : 0;  
    NS4 = (document.layers) ? 1 : 0; 

 var CurX=0, CurY=0; 
function SetColor(x)
{
	SetFont(0,x);
}  
function SetSize(x)
{ 
	  SetFont(x,0);
 }


function ToggleHTML(){
if (isHTMLOn){isHTMLOn=false;document.OPT_HTML.src="is/bd10.png";}
else {isHTMLOn=true;document.OPT_HTML.src="is/bu10.png";}}
