function writeBadge()
{
var Sname = document.getElementById('surname').value;
var Fname = document.getElementById('firstname').value;
//var Tag = document.getElementById('tag').value;
var Org = document.getElementById('org').value;
var Country = document.getElementById('country').value;
var Badge = Fname+" "+Sname+" <br /> "+Org+" <br /> "+Country;
//var Badge = Tag+" "+Fname+" "+Sname+" <br /> "+Country;
document.getElementById('badge').innerHTML=Badge
}

function showReg(regcost)
{
var regcost;
var RegBox="<input type=\"hidden\" id=\"RegVal\" value=\""+regcost+"\"  /> &euro;"+regcost;
document.getElementById('RegDisp').innerHTML=RegBox;
var acccost = document.getElementById('AccVal').value;
var totcost = Number(acccost) + Number(regcost);
var AccEXBox="";
document.getElementById('AccExDisp').innerHTML=AccEXBox;
var DiscBox;
DiscBox="Package Price:  &euro;"+totcost;
document.getElementById('TotDisp').innerHTML=DiscBox;
}

function showAcc(acccost)
{
var acccost;
var AccBox="<input type=\"hidden\" id=\"AccVal\" value=\""+acccost+"\"  /> &euro;"+acccost;
document.getElementById('AccDisp').innerHTML=AccBox;
var regcost = document.getElementById('RegVal').value;
var totcost = Number(acccost) + Number(regcost);
var AccEXBox="";
document.getElementById('AccExDisp').innerHTML=AccEXBox;
var DiscBox;
DiscBox="Package Price:  &euro;"+totcost;
document.getElementById('TotDisp').innerHTML=DiscBox;
}

function showEXAcc(accexcost)
{
var exacc= Number(accexcost);
var AccEXBox="<br />Extra Night &euro;"+exacc;
document.getElementById('AccExDisp').innerHTML=AccEXBox;
var acccost = document.getElementById('AccVal').value;
var regcost = document.getElementById('RegVal').value;
var totcost = Number(acccost) + Number(regcost)+ Number(exacc);
var DiscBox;
DiscBox="Package Price:  &euro;"+totcost;
document.getElementById('TotDisp').innerHTML=DiscBox;
}

function writeChoice(inputName,inputText,inputval)
{
var inputName;
var inputText;
var ChoiceBox;
ChoiceBox="<div class=\"forminput\"><label for=\""+inputName+
"\">"+inputText+
"</label><input type=\"text\" name=\""+inputName+
"\" value=\"\" /></div>";
document.getElementById(inputName).innerHTML=ChoiceBox;
}

function hideChoice(inputName)
{ 
var inputName;
ChoiceBox="";
document.getElementById(inputName).innerHTML=ChoiceBox;
}

function writeCheck(inputName,inputval,destname)
{
var inputName;
var inputText;
var inputval;
var destname;
var ChoiceBox;
ChoiceBox="<div class=\"choiceinput\"><label for=\""+inputName+
"\">Would you like to include 28th March in your accommodation package?</label><input type=\"checkbox\" name=\""+inputName+
"\" value=\""+inputval+"\"  onclick=\"if (this.checked) {showEXAcc("+inputval+"); } \" /></div>";
document.getElementById(destname).innerHTML=ChoiceBox;
}

function hideCheck(inputName,destname)
{
var inputName;
var destname;
var ChoiceBox;
ChoiceBox=" ";
document.getElementById(destname).innerHTML=ChoiceBox;
}

function writeAuthBox(authnum)
{
var authnum;
var AuthBox;
var BoxName="authors["+authnum+"]";
var AddBoxName="addbox["+authnum+"]";
var NextBoxNum=(authnum+1);

AuthBox="<div class=\"forminput\"><label for=\"authors["
+authnum+"]\">*Name</label><input type=\"text\" size=\"25\" name=\"authors["+authnum+"]\" /></div><div class=\"choicespace\"> &nbsp; </div> <div class=\"forminput\"><label for=\"authorsaff["+authnum+"]\">*Affiliation</label><input type=\"text\" size=25 name=\"authorsaff["+authnum+"]\" ></div><div class=\"choicespace\"> &nbsp; </div> <div class=\"choiceinput\"><label for=\"presauth["+authnum+"]\">Is this author presenting? </label><input type=\"checkbox\" name=\"presauth["+authnum+"]\" value=\"Y\"  /></div><div class=\"formspace\"> &nbsp; </div>";

AddBox="<div id=\"authors["+NextBoxNum+"]\"> </div><div id=\"addbox["+NextBoxNum+"]\"> <b><a href=\"#auth\" onclick=\"writeAuthBox("+NextBoxNum+")\" >+Add Authors</a></b></div> ";
document.getElementById(BoxName).innerHTML=AuthBox;
document.getElementById(AddBoxName).innerHTML=AddBox;
}

function checkLength(length)
{
var Abs = document.getElementById('abstract').value;
//count the words
if( wordCount > length )
{
alert("This is too long");
}
}

/*	Default commands:	*/
SimpleEditor.addCommands({
	/*	bold - <b></b>	*/
	bold: {
		shortcut: 'b',
		command: function(input){
			input.insertAroundCursor({before:'<b>',after:'</b>'});
		}
	},
	/*	underline - <u></u>	*/
	underline: {
		shortcut: 'u',
		command: function(input){
			input.insertAroundCursor({before:'<u>',after:'</u>'});
		}
	}
});