var firstBreak = 1;
var flood = 0;
var frmH = 0;
var pgH = 0;

var inarchives = false;

	function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
	}

	function getText(thefield){
	if (thefield.value == "")
	thefield.value = thefield.defaultValue
	}

	function clearURLText(thefield){
	if (thefield.value=="URL/Email")
	thefield.value = ""
	}

	function getURLText(thefield){
	if (thefield.value == "")
	thefield.value = "URL/Email"
	}

	function IdiotCheck()
	{
		floodprotect();
	
		if (document.rb.rb1.value=="Name") {
		alert("Please enter your name.");
		flood = 0;
		}
		
		else if (document.rb.rb3.value=="Message") {
		alert("Please enter your Message.");
		flood = 0;
		}
		
		else {
			goPostal();
		}

	}

	function rabbit(id,pg,cp) {
		refresher = window.setInterval("rabbitguts('"+id+"','"+pg+"','"+cp+"')",20000);
	}

	function rabbitguts(id,pg,cp) {
		if(!inarchives) getBoard(id,pg,'2',cp);
	}
	
	function postIt() {
		if(flood==1) alert("Please wait a 20 seconds before tagging again.");
		else IdiotCheck();
	}
	
	function floodprotect()
	{
		flood = 1;
		window.setTimeout("unProtect()",20000);
	}
	function unProtect() {flood = 0;}
	
	function NoBreak()
	{
		if(event.keyCode == 13&&firstBreak==1)
		{
			alert("Note: Linebreaks will be replaced with spaces in your message.");
			firstBreak=0;
		}
	}

	
function getPage(name,url,message,id,wh,pg,cp){

getBoard(id,'0',wh,cp);

var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'rb3_index.php?name='; //This is the path to the file we just finished making *
        var var2 = '&url=';
        var var3 = '&message=';
        var var4 = '&id=';
	var var5 = '&wh=';
	var var6 = '&pg=';
    xmlhttp.open('GET', file + name + var2 + url + var3 + message + var4 + id + var5 + wh + var6 + pg, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById('content').innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
					  pgH = frmH + document.getElementById('content').scrollHeight;
					  //top.frm.frameElement.height = pgH+30;
					  getBoard(id,'0',wh,cp);
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest

		return;
}
	
function getBoard(id,pg,wh,cp){

if(pg!="0") inarchives = true;
else inarchives = false;

var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'rb3_board.php?id='; //This is the path to the file we just finished making *
	var var1 = '&pg=';
	var var2 = '&wh=';
	var var3 = '&cp=';
    xmlhttp.open('GET', file + id + var1 + pg + var2 + wh + var3 + cp, true); //Open the file through GET, and add the page we want to retrieve as a GET variable **
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var boardy = xmlhttp.responseText; //The content data which has been retrieved ***
                if( boardy ){ //Make sure there is something in the content variable
                      document.getElementById('boardy').innerHTML = boardy; //Change the inner content of your div to the newly retrieved content ****
					  pgH = frmH + document.getElementById('boardy').scrollHeight;
					  //top.frm.frameElement.height = pgH+30;
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function clearBoard() {
document.getElementById('boardy').innerHTML = "a";
}

function upScroll(gurl,wid,hei) {

	ilef=screen.width/2;
	itop=screen.height/2;	
	ilef=ilef-(wid/2);
	itop=itop-(hei/2);
	itop=itop-25;

        unkwin2 = window.open(gurl,"subWin2","scrollbars=1,resizable=0,width="+wid+",height="+hei+",resizable=no,scrollbars=yes,directories=no,location=no,menubar=no,status=no,toolbar=no,left="+ilef+",top="+itop);

}