function jumpPage(form) {
   i = form.forum.selectedIndex;
   if (i == 0) return;
   window.location.href = url[i+1];
}

function openWindow(url) {
   opinion = window.open(url,"Handheld",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=150,height=400');
}

function makeRemote(url){
	remote = window.open(url,"remotewin","width=500,height=400,scrollbars=1");
	remote.location.href = url;
	if (remote.opener == null) remote.opener = window;
}

function afp(url){
remote = window.open(url,"remotewin","width=440,height=315,scrollbars=1");
remote.location.href = url;
if (remote.opener == null) remote.opener = window;
}


function checkit(val) {
   dlink=document.links;
   len = dlink.elements.length;
   var i=0;
   for( i=0 ; i<len ; i++) {
      if (dlink.elements[i].name=='selected') {
         dlink.elements[i].checked=val;
      }
   }
}

function check_cookie(cookie_name) {
   var cookies = document.cookie;
   var pos = cookies.indexOf(cookie_name,'=');
   if (pos != -1) {
      return true;
   }
   else {
      return false;
   }
}

function smilie_remote(emotionicon) {
   self.opener.document.post_form.body.value += emotionicon+" ";
   self.opener.document.post_form.body.focus();
}

function smilie(emotionicon) {
   document.post_form.body.value += emotionicon+" ";
   document.post_form.body.focus();
}

function choose_avatar(avatar) {
   self.opener.document.user.pc.value = avatar;
}

helpstat = false;
stprompt = true;
basic = false;
function thelp(swtch){
	if (swtch == 1){
		basic = false;
		stprompt = false;
		helpstat = true;
	} else if (swtch == 0) {
		helpstat = false;
		stprompt = false;
		basic = true;
	} else if (swtch == 2) {
		helpstat = false;
		basic = false;
		stprompt = true;
	}
}

function AddText(NewCode) {
document.post_form.body.value+=NewCode
}

function bold() {
	if (helpstat) {
		alert("Bold Tag\nMakes the enlosed text bold.\nUSE: [b]This is some bold text[/b]");
	} else if (basic) {
		AddTxt="[b][/b]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Text to be made BOLD.","Text");     
		if (txt!=null) {           
			AddTxt="[b]"+txt+"[/b]";
			AddText(AddTxt);
		}       
	}
}

function hyperlink() {
	if (helpstat) {
		alert("Hyperlink Tag\nTurns an url into a hyperlink.\nUSE: www.anywhere.com\nUSE: [link:www.anywhere.com|link text]");
	} else if (basic) {
		AddTxt="";
		AddText(AddTxt);
	} else { 
		txt2=prompt("Text to be shown for the link.",""); 
		if (txt2!=null) {
			txt=prompt("URL for the link.without http://","");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[link:URL|Text]";
					AddText(AddTxt);
				} else {
					AddTxt="[link:"+txt+"|"+txt2+"]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function italicize() {
	if (helpstat) {
		alert("Italicize Tag\nMakes the enlosed text italicized.\nUSE: [i]This is some italicized text[/i]");
	} else if (basic) {
		AddTxt="[i][/i]";
		AddText(AddTxt);
	} else {   
		txt=prompt("Text to be italicized","Text");     
		if (txt!=null) {           
			AddTxt="[i]"+txt+"[/i]";
			AddText(AddTxt);
		}	        
	}
}

function underline() {
  	if (helpstat) {
		alert("Underline Tag\nUnderlines the enclosed text.\nUSE: [u]This text is underlined[/u]");
	} else if (basic) {
		AddTxt="[u][/u]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Text to be Underlined.","Text");     
		if (txt!=null) {           
			AddTxt="[u]"+txt+"[/u]";
			AddText(AddTxt);
		}	        
	}
}

function center() {
 	if (helpstat) {
		alert("Centered tag\nCenters the enclosed text.\nUSE: [center]This text is centered[/center]");
	} else if (basic) {
		AddTxt="[center][/center]";
		AddText(AddTxt);
	} else {  
		txt=prompt("Text to be centered","Text");     
		if (txt!=null) {          
			AddTxt="\r[center]"+txt+"[/center]";
			AddText(AddTxt);
		}	       
	}
}

function showcolor(color) {
	if (helpstat) {
		alert("Color Tag\nSets the text color.  Any named color can be used.\nUSE: [color="+color+"]This is some "+color+" text[/font]");
	} else if (basic) {
		AddTxt="[font color="+color+"][/font]";
		AddText(AddTxt);
	} else {  
     	txt=prompt("Text to be "+color,"Text");
		if(txt!=null) {
			AddTxt="[font color="+color+"]"+txt+"[/font]";
			AddText(AddTxt);        
		} 
	}
}

function showsize(size) {
	if (helpstat) {
		alert("Size Tag\nSets the text size.\nPossible values are 1 to 6.\n 1 being the smallest and 6 the largest.\nUSE: [size="+size+"]This is size "+size+" text[/font]");
	} else if (basic) {
		AddTxt="[font size="+size+"][/font]";
		AddText(AddTxt);
	} else {                       
		txt=prompt("Text to be size "+size,"Text"); 
		if (txt!=null) {             
			AddTxt="[font size="+size+"]"+txt+"[/font]";
			AddText(AddTxt);
		}        
	}
}

function showfont(font) {
 	if (helpstat){
		alert("Font Tag\nSets the font face for the enclosed text.\nUSE: [font face="+font+"]The font of this text is "+font+"[/font]");
	} else if (basic) {
		AddTxt="[font face="+font+"][/font]";
		AddText(AddTxt);
	} else {                  
		txt=prompt("Text to be in "+font,"Text");
		if (txt!=null) {             
			AddTxt="[font face="+font+"]"+txt+"[/font]";
			AddText(AddTxt);
		}        
	}  
}

function showcode() {
	if (helpstat) {
		alert("Code Tag\nBlockquotes the text you reference and preserves the formatting.\nUsefull for posting code.\nUSE: [code]This is formated text[/code]");
	} else if (basic) {
		AddTxt="\r[code]\r[/code]";
		AddText(AddTxt);
	} else {   
		txt=prompt("Enter code","");     
		if (txt!=null) {          
			AddTxt="\r[code]"+txt+"[/code]";
			AddText(AddTxt);
		}	       
	}
}

cookie_name = "dataCookie";
var YouWrote;

function getName() {
    if(document.cookie)
   {
        index = document.cookie.indexOf(cookie_name);
        if (index != -1)
     {
            namestart = (document.cookie.indexOf("=", index) + 1);
            nameend = document.cookie.indexOf(";", index);
            if (nameend == -1) {nameend = document.cookie.length;}
            YouWrote = document.cookie.substring(namestart, nameend);
            return YouWrote;
           }
        }
}

function entersig() {
	if (helpstat) {
		alert("Signature\nEnters your signature.\n");
	} else if (basic) {
		AddTxt="";
		AddText(AddTxt);
	} else {  
		txt=prompt("Enter your signature","");     
		if (txt!=null) {           
			AddTxt=""+YouWrote+"";
			AddText(AddTxt);
		}       
	}
}

cookie_name = "dataCookie";
var getsig;

function getsig() {

if(document.cookie != document.cookie) 
{index = document.cookie.indexOf(cookie_name);}
else 
{ index = -1;}

if (index == -1)
{
getsig=document.cf.cfd.value;
document.cookie=cookie_name+"="+getsig+"; expires=Monday, 04-Apr-2010 05:00:00 GMT";
}

}


