// function opens new window for ads
function NewWindow(url,windowWidth,windowHeight)
{  
	// set the window features
	var features = "width=" + windowWidth + ",height=" + windowHeight + ",scrollbars=yes";
	// open the window
	window.open(url, "popup", features);
}

// places mini-help text into help/error textbox
// strings are stored in vbcode_language.js
function htmlstat(thevalue,theform) {
	document.theform.status.value = thevalue;
}

// insert [x]yyy[/x] style markup
function mycscode(theform,vbcode,prompttext) {
	if ((normalmode(theform)) || (vbcode=="IMG")) {
		inserttext = prompt(tag_prompt+"\n["+vbcode+"]xxx[/"+vbcode+"]",prompttext);
		if ((inserttext != null) && (inserttext != ""))
			theform.message.value += "["+vbcode+"]"+inserttext+"[/"+vbcode+"] ";
		}
	else {
		donotinsert = false;
		for (i = 0; i < tags.length; i++) {
			if (tags[i] == vbcode)
				donotinsert = true;
			}
		if (donotinsert)
			stat("already_open");
		else {
			theform.message.value += "["+vbcode+"]";
			arraypush(tags,vbcode);
			}
		}
	theform.message.focus();
}

// insert two-parameter markup - [x=y]zzz[/x]
function htmlfont(theform,thevalue,thetype) {
	if (normalmode(theform)) {
		if (thevalue != 0) {
			inserttext = prompt(font_formatter_prompt+" "+thetype,"");
			if ((inserttext != null) && (inserttext != ""))
				theform.message.value += "["+thetype+"="+thevalue+"]"+inserttext+"[/"+thetype+"] ";
			}
		}
	else {
		theform.message.value += "["+thetype+"="+thevalue+"]";
		arraypush(tags,thetype);
		}
	theform.sizeselect.selectedIndex = 0;
	theform.fontselect.selectedIndex = 0;
	theform.colorselect.selectedIndex = 0;
	theform.message.focus();
}

// inserts named url or email link - [url=mylink]text[/url]
function htmllink(theform,thetype) {
	linktext = prompt(link_text_prompt,"");
		var prompttext;
		if (thetype == "URL") {
			prompt_text = link_url_prompt;
			prompt_contents = "http://";
			}
		else {
			prompt_text = link_email_prompt;
			prompt_contents = "";
			}
	linkurl = prompt(prompt_text,prompt_contents);
	if ((linkurl != null) && (linkurl != "")) {
		if ((linktext != null) && (linktext != ""))
			theform.message.value += "["+thetype+"="+linkurl+"]"+linktext+"[/"+thetype+"] ";
		else
		theform.message.value += "["+thetype+"]"+linkurl+"[/"+thetype+"] ";
		}
	theform.message.focus();
}

// inserts list with option to have numbered or alphabetical type
function htmllist(theform) {
	listtype = prompt(list_type_prompt, "");
	if ((listtype == "a") || (listtype == "1")) {
		thelist = "[list="+listtype+"]\n";
		listend = "[/list="+listtype+"] ";
		}
	else {
		thelist = "[list]\n";
		listend = "[/list] ";
		}
	listentry = "initial";
	while ((listentry != "") && (listentry != null)) {
		listentry = prompt(list_item_prompt, "");
		if ((listentry != "") && (listentry != null))
			thelist = thelist+"[*]"+listentry+"\n";
		}
	theform.message.value += thelist+listend;
	theform.message.focus();
}

// inserts smilie text
function smilie(thesmilie) {
	document.vbform.message.value += thesmilie+" ";
	document.vbform.message.focus();
}
