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 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 ="+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);
		}	       
	}
}



function list() {
if (helpstat) {
alert("List Tag\nBuilds a bulleted, numbered, or alphabetical list.\nUSE: [ul]\n[li]item1\n[li]item2\n[li]item3\n[/ul]");
} else if (basic) {
AddTxt="\r[ul]\r[li]\r[li]\r[li]\r[/ul]";
AddText(AddTxt);
} else { 
txt=prompt("Type of list\nClick 'OK' once to start the List with a blank entry.",""); 
while ((txt!="") && (txt!=null)) {
txt=prompt("ERROR!!\nYou didn't click 'OK' while the text box was blank, did you ?.",""); 
}
if (txt!=null) {
if (txt=="") {
AddTxt="\r[ul]\r\n";
} else {
AddTxt="\r[li]="+txt+"\r";
} 
txt="1";
while ((txt!="") && (txt!=null)) {
txt=prompt("List item\nClick another blank to end the list",""); 
if (txt!="") { 
AddTxt+="[li]"+txt+"\r"; 
} 
} 
AddTxt+="[/ul]\r\n";
AddText(AddTxt); 
}
}
}

function emaillink() {	if (helpstat) {		alert("Emaillink Tag\nTurns an email into a hyperlink.\nUSE: someone@url.com\nUSE: <mailto:someone@url.com>");	} else if (basic) {		AddTxt="";		AddText(AddTxt);	} else {   		txt=prompt("Your Email Address","someone@url.com");     		if (txt!=null) {           			AddTxt="mailto:";+txt+"";			AddText(AddTxt);		}	        	}}



function popit(url)
{
	newwindow=window.open(url,"name","width=404',height=374,top=100,left=360");
	if (window.focus) {newwindow.focus()}
	return false;
}
