// JavaScript Document
function addStyle(box){
	var style;
	var current;
	var x = document.myform.addstyle;
	style = x.options[x.selectedIndex].text;
	//alert(style);
	current = document.getElementById(box).value;
	document.getElementById(box).value = current + "[" + style + "] [/" + style + "]";
}

function addALink(box){
	var mylink;
	var current;
	var x = document.myform.addLink;
	mylink = x.options[x.selectedIndex].value;
	//alert(style);
	current = document.getElementById(box).value;
	document.getElementById(box).value = current + " <<" + mylink + ">>";
}

function addImg(box){
	var img;
	var current;
	var x = document.myform.addimage;
	img = x.options[x.selectedIndex].value;
	//alert(img);
	current = document.getElementById(box).value;
	document.getElementById(box).value = current + "{img:" + img + "}";
}

function addFile(box){
	var file;
	var current;
	var x = document.myform.addfile;
	file = x.options[x.selectedIndex].value;
	//alert(img);
	current = document.getElementById(box).value;
	document.getElementById(box).value = current + "{file:" + file + "}";
}

function resample(box){
	var mystyle;
	var x = document.myform.style;
	mystyle = x.options[x.selectedIndex].text;
	document.getElementById(box).className = mystyle;
}

function resample2(box){
	var mystyle;
	var x = document.myform.addstyle;
	mystyle = x.options[x.selectedIndex].text;
	document.getElementById(box).className = mystyle;
}

function setColour(){
	var mycolour;
	var x = document.myform.colour;
	mycolour = x.options[x.selectedIndex].value;
	if (mycolour == "Default"){
		mycolour = "#000000";
	}
	document.getElementById("mycol").style.backgroundColor = mycolour;
}

function setFont(){
	var myfont;
	var x = document.myform.font;
	myfont = x.options[x.selectedIndex].value;
	if (myfont == "None"){
		myfont = "Arial";
	}
	document.getElementById("myfont").style.fontFamily = myfont;
}

function setSize(){
	var mysize;
	var x = document.myform.size;
	mysize = x.options[x.selectedIndex].value;
	if (mysize == "None"){
		mysize = "12";
	}
	document.getElementById("mysize").style.fontSize = mysize + "px";
}

function preview(){
	var image;
	var current;
	var x = document.myform.addimage;
	image = x.options[x.selectedIndex].value;
	window.open('../includes/preview.php?id='+image,'_blank');
}

function previewfile(){
	var file;
	var current;
	var x = document.myform.addfile;
	file = x.options[x.selectedIndex].value;
	window.open('../includes/previewfile.php?id='+file,'_blank');
}

// Created by Doive
function swap(id,img){
	document.getElementById(id).src = img;
}
