// Write page Header
function pageHeader(place) {
	/*if (!pagePath) {pagePath="";}*/
	var result = "";
	if (place == "foot") {
		/*Player: "+cookPlay+" / Character:*/
		result += "<div align='left' style='float: left'><select class='text' onChange='logChar2(this.value)'>";
		
		if (cookPlay!="none") {
			result += "<option value='none'>"
			result += "<option value='none'>New Character"
			for (key1 in xmlPlay['Players']['Player']) {
				if (xmlPlay['Players']['Player'][key1]['Name']!="None") {
					if (getCookie('admin')==1) {result += "<option value='none'>"+xmlPlay['Players']['Player'][key1]['Name'];}
					arrChar = xmlPlay['Players']['Player'][key1]['Character']['Name'];
					arrNick = xmlPlay['Players']['Player'][key1]['Character']['Nick'];
					for (key2 in arrChar) {
						if (arrChar[key2]!="None") {
							if (getCookie('admin')==1 || xmlPlay['Players']['Player'][key1]['Nick']==cookPlay) {
								tmpSel = ""; if(arrNick[key2]==cookChar){tmpSel = "selected";}
								result += "<option value='"+arrNick[key2]+"' "+tmpSel+">- "+arrChar[key2]
							}
						}
					}
				}
			}
		}
		
		result += "</select></div>";
		result += "<div align='right' style='float: right'>"+lastMod()+"</div>";
		result += "<div align='center' style='clear: both;'><a href='#top'>Back to Top</a></div>";
	} else {
		var selBeg = ""; var selEnd = "";
		var siteMap = new Array();
		siteName = ["Main Page", "Character", "Shop", "Documentation", "Tools", "Tables", "Informations"];
		siteMap = ["index", "character", "shop", "wiki/index", "tools", "tables", "infos"];
		
		if (window.location.pathname.match("/wiki/")) {pagePath = "../";}
		else {pagePath = "";}
		
		result += "<a name='top'></a>";
		result += "<div align='center'>";
		for (var i=0; i < siteName.length; i++) {
			if (pageName == siteName[i]) {selBeg = "<b>"; selEnd = "</b>";}	else {selBeg = ""; selEnd = "";}
			result += "<a href='"+pagePath+siteMap[i]+".html'>"+selBeg+siteName[i]+selEnd+"</a>";
			if (i+1 != siteName.length) {result += " | ";}
		}
		result += "</div>";
		result += "&nbsp;";
		result += "<div align='center' class='title'>"+pageName+"</div>";
		result += "&nbsp;";
	}
	document.write(result);
}

// Log Character #2
function logChar2(char) {
	//alert("Char: "+char);
	setCookie ("charname", char);
	location.reload();
}

// Log Character
function logChar() {
	setCookie ("username", "char_new");
	setCookie ("admin", "0");
	var user = document.getElementById("selUser").value;
	var pass = document.getElementById("selPass").value;
	
	var result = "Username / Password not found";
	tmpUser = user.toLowerCase();
	
	if (user=="Admin" && pass=="MageAdmin") {
		setCookie ("username", "char_new");
		setCookie ("admin", "1");
		result = "Admin logged";
	}
	else {
		tmpXml = xml2array(loadXMLDoc("xml/"+tmpUser+".xml"));
		tmpPass = tmpXml['Mage']['Bio']['Password'];
		if (!tmpPass) {tmpPass="";}
		
		if (tmpPass == pass) {
			result = "User '"+user+"' logged";
			setCookie ("username", user);
		}
		/*
		if (result == "Username / Password not found") {
			setCookie ("username", "None");
		}
		*/
	}
	alert(result);
	location.reload();
}

// Cookies Manipulations
function setCookie (name, value) {
    var curCookie = name + "=" + escape(value);
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}
var cookUser = getCookie ('username');
if (cookUser=="") {setCookie ("username", "char_new");}
var cookChar = getCookie ('charname');
if (cookChar=="") {setCookie ("charname", "none");}
var cookPlay = getCookie ('playname');
if (cookPlay=="") {setCookie ("playname", "none");}

// Add commas to numbers
function commaNumb(numb) {
	var result = "";
	numb = Math.floor(parseInt(numb));
	var numbStri = ("" + numb);
	var numbLeng = numbStri.length;
	// Build Array
	var arrNumb = new Array()
	var iMax = numbLeng;
	var iLoop = 0;
	var iStart = 0;
	while (iMax>0) {
		iStart = (numbLeng-3-(3*iLoop))
		if (iStart<=0) {iStart=0;}
		arrNumb[iLoop] = numbStri.slice(iStart,(numbLeng-(3*iLoop)))
		iMax = iMax-3
		iLoop++
	}
	// Build String
	var iMax = arrNumb.length;
	var iLoop = 1;
	numbStri = arrNumb[0];
	while (iMax>iLoop) {
		numbStri = arrNumb[iLoop]+","+numbStri;
		iLoop++
	}
	result += numbStri;
	return result;
}

// List infos about a topic
function prntInfo(cat,type) {
	tmpRes = "";
	
	if (cat=="Abilities") {
	for (key in xmlAbil[cat][type]) {
		if (xmlAbil[cat][type][key]['Name'] != "None") {
		tmpRes += "<p><h3>"+xmlAbil[cat][type][key]['Name']+"</h3>";
		tmpRes += ""+xmlAbil[cat][type][key]['Desc']+"";
		}
	}
	}
	
	if (cat=="Concepts") {
	for (key in xmlConc[cat][type]) {
		if (xmlConc[cat][type][key]['Name'] != "None") {
		tmpRes += "<p><h3>"+xmlConc[cat][type][key]['Name']+"</h3>";
		tmpRes += ""+xmlConc[cat][type][key]['Desc']+"";
		}
	}
	}
	
	if (cat=="Spheres") {
	for (key in xmlSphe[cat][type]) {
		if (xmlSphe[cat][type][key]['Name'] != "None") {
		tmpRes += "<p><h3>"+xmlSphe[cat][type][key]['Name']+"</h3>";
		tmpRes += ""+xmlSphe[cat][type][key]['Desc']+"";
		}
	}
	}
	
	if (cat=="Traditions") {
	for (key in xmlTrad[cat][type]) {
		if (xmlTrad[cat][type][key]['Name'] != "None") {
		tmpRes += "<p><h3>"+xmlTrad[cat][type][key]['Name']+"</h3>";
		tmpRes += "<b class='colored'>Sphere:</b> "+xmlSphe['Spheres']['Sphere'][xmlTrad['Traditions']['Tradition'][key]['Sphere']]['Name']+"";
		tmpRes += "<br><b class='colored'>Foci:</b> "+xmlTrad['Traditions']['Tradition'][key]['Foci']+"";
		tmpRes += "<br><b class='colored'>Description:</b> "+xmlTrad['Traditions']['Tradition'][key]['Desc']+"";
		}
	}
	}
	
	if (cat=="Traits") {
	for (key in xmlTrai[cat][type]) {
		if (xmlTrai[cat][type][key]['Name'] != "None") {
		tmpRes += "<p><h3>"+xmlTrai[cat][type][key]['Name']+"</h3>";
		if (type=="Merit" || type=="Flaw") {
			tmpMax = ""; if (xmlTrai[cat][type][key]['Min']!=xmlTrai[cat][type][key]['Max']) {tmpMax = " - "+xmlTrai[cat][type][key]['Max'];}
			tmpRes += "<b>("+xmlTrai[cat][type][key]['Min']+" "+tmpMax+" pts)</b><br>";
		}
		tmpRes += ""+xmlTrai[cat][type][key]['Desc']+"";
		}
	}
	}
	return tmpRes;
}

// Print Panel Head and Foot
function prntPan(id,style) {
	var result = "";
	var tmpStyle = "visibility: visible; display: block;";
	if (style=="hide") {tmpStyle = "visibility: hidden; display: none;";}
	if (id != "foot") {
		result += "<div align='center' class='div_pan'><img src='images/div_right.gif' width='10' height='25' border='0' alt='' align='right'><img id='"+id+"_img' src='images/ico_minus.gif' width='25' height='25' border='0' alt='' align='right' onClick='toggle(\""+id+"\")'><img src='images/div_left.gif' width='10' height='25' border='0' alt='' align='left'><span style='background:#000000;'><a href='#' class='divpan' onClick='toggle(\""+id+"\")'>&nbsp;"+id+"&nbsp;</a></span></div> \n";
		result += "<div id='"+id+"_div' style='"+tmpStyle+"'> \n";
	}
	else {result += "</div> \n";}
	return result;
}

// Hide / Show ID
function toggle(id){
	var divId = ""+id+"_div";
	var imgId = ""+id+"_img";
	var divStyle = document.getElementById(divId).visibility;
	if (divStyle=="visible") {
		document.getElementById(divId).visibility = 'hidden';
		document.getElementById(divId).display = 'none';
		document.getElementById(imgId).src = 'images/ico_plus.gif';
	}
	else {
		document.getElementById(divId).visibility = 'visible';
		document.getElementById(divId).display = 'block';
		document.getElementById(imgId).src = 'images/ico_minus.gif';
	}
}

// Print Dots
function prntDots(id,numb,maximum,temp,state) {
	var result = "";
	if(!temp)    {temp=0}
	if(!maximum) {maximum=5}
	if(!state)   {state=2}
	numb = parseInt(numb);
	maximum = parseInt(maximum);
	for (var i=1; i <= numb; i++) {
		result += "<img src='images/dot_on.gif' width='10' height='10' border='0' alt='' id='"+id+""+i+"' onClick='toggDots(\""+id+"\",\""+i+"\",\""+state+"\",\""+maximum+"\")'>";
	}
	for (var i=1; i <= temp; i++) {
		result += "<img src='images/dot_mid.gif' width='10' height='10' border='0' alt='' id='"+id+""+i+"' onClick='toggDots(\""+id+"\",\""+i+"\",\""+state+"\",\""+maximum+"\")'>";
	}
	for (var i=(numb+temp+1); i <= maximum; i++) {
		result += "<img src='images/dot_off.gif' width='10' height='10' border='0' alt='' id='"+id+""+i+"' onClick='toggDots(\""+id+"\",\""+i+"\",\""+state+"\",\""+maximum+"\")'>";
	}
	return result;
}

// Toggle Dots
function toggDots(id,val,state,maximum) {
	var allowUpdate = "yes";
	var tmpDot = document.getElementById(id+""+val);
	//alert(id);
	if (id.match("att") || id.match("abi") || id.match("Bac") || id.match("sph")) {
		allowUpdate = "no";
	}
	
	if (allowUpdate=="yes") {
		tmpState = "dot_mid"; if (state==2) {tmpState = "dot_on"}
		if (tmpDot.src.match("dot_off"))		{tmpDot.src = "images/"+tmpState+".gif"}
		else if (tmpDot.src.match("dot_mid"))	{tmpDot.src = "images/dot_on.gif"}
		else if (tmpDot.src.match("dot_on"))	{tmpDot.src = "images/dot_off.gif"}
	}
	
	if (id.match("advHea")) {id = "seladvHea"; maximum = 7}
	
	var tmpVal = 0;
	var tmpVal2 = 0;
	for (i=1; i<=maximum; i++) {
		if (id.match("advQui")) {
			if (document.getElementById(id+""+i).src.match("dot_mid")) {tmpVal++}
			if (document.getElementById(id+""+i).src.match("dot_on")) {tmpVal2++}
			document.getElementById("seladvPar").value = tmpVal2;
		}
		else if (id.match("advHea")) {
			if (document.getElementById(id+""+i+"1").src.match("dot_mid")) {tmpVal++}
			if (document.getElementById(id+""+i+"1").src.match("dot_on")) {tmpVal++}
			//document.getElementById("seladvPar").value = tmpVal2;
		}
		else {
			if (document.getElementById(id+""+i).src.match("dot_on")) {tmpVal++}
			if (document.getElementById(id+""+i).src.match("dot_mid")) {tmpVal++}
		}
	}
	id = id.replace("sel","");
	tmpRes = document.getElementById("sel"+id);
	tmpRes.value = tmpVal;
	prntXml();
}

// Last Modified
function lastMod() {
	var monthNames = new Array();
	monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
	var dayNames = new Array();
	dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

	update = new Date(document.lastModified);
	year = update.getYear()+1900;
	month = monthNames[update.getMonth()];
	date = update.getDate();
	day = dayNames[update.getDay()];
	time = update.getTime();
	hours = update.getHours();
	mins = update.getMinutes();
	if (mins<10) {mins = "0"+mins}
	theDate = "<i>Last update: "+day+", "+month+" "+date+" "+year+" @ "+hours+":"+mins+"h</i>";
	return theDate;
}

function prntNick(selName) {
	var tmpName = selName.split(' ').join('');
	tmpName = tmpName.split('-').join('');
	tmpName = tmpName.toLowerCase();
	tmpName = tmpName.replace("é","e");
	document.getElementById("selNick").value = tmpName;
	//setCookie ("username", tmpName.toLowerCase());
}

// Print XML Textarea
function prntXml() {
//if (!temp) {temp = "Yo"}
var xmlResult = "";
xmlResult += "<Mage>\n";
xmlResult += "	<Bio>\n";
xmlResult += "		<Name>"+document.getElementById("selbioNam").value+"</Name>\n";
xmlResult += "		<Player>"+document.getElementById("selbioPla").value+"</Player>\n";
xmlResult += "		<Password>"+document.getElementById("selbioPas").value+"</Password>\n";
xmlResult += "		<Chronicle>"+document.getElementById("selbioChr").value+"</Chronicle>\n";
xmlResult += "		<Nature>"+document.getElementById("selbioNat").value+"</Nature>\n";
xmlResult += "		<Essence>"+document.getElementById("selbioEss").value+"</Essence>\n";
xmlResult += "		<Demeanor>"+document.getElementById("selbioDem").value+"</Demeanor>\n";
xmlResult += "		<Concept>"+document.getElementById("selbioCon").value+"</Concept>\n";
xmlResult += "		<Mentor>"+document.getElementById("selbioMen").value+"</Mentor>\n";
xmlResult += "		<Cabal>"+document.getElementById("selbioCab").value+"</Cabal>\n";
xmlResult += "		<Tradition>"+document.getElementById("selbioTra").value+"</Tradition>\n";
xmlResult += "		<Experience>"+document.getElementById("selbioExp").value+"</Experience>\n";
xmlResult += "		<StudyPoint>"+document.getElementById("selbioStu").value+"</StudyPoint>\n";
xmlResult += "		<FreebiePoints>"+document.getElementById("selbioFre").value+"</FreebiePoints>\n";
xmlResult += "		<Money>"+document.getElementById("selbioMon").value+"</Money>\n";
xmlResult += "		<Armor>"+document.getElementById("selbioArm").value+"</Armor>\n";
xmlResult += "	</Bio>\n";
xmlResult += "	<Attributes>\n";
xmlResult += "		<Strength type='Physical'>"+document.getElementById("selattStr").value+"</Strength>\n";
xmlResult += "		<Dexterity type='Physical'>"+document.getElementById("selattDex").value+"</Dexterity>\n";
xmlResult += "		<Stamina type='Physical'>"+document.getElementById("selattSta").value+"</Stamina>\n";
xmlResult += "		<Charisma type='Social'>"+document.getElementById("selattCha").value+"</Charisma>\n";
xmlResult += "		<Manipulation type='Social'>"+document.getElementById("selattMan").value+"</Manipulation>\n";
xmlResult += "		<Appearance type='Social'>"+document.getElementById("selattApp").value+"</Appearance>\n";
xmlResult += "		<Perception type='Mental'>"+document.getElementById("selattPer").value+"</Perception>\n";
xmlResult += "		<Intelligence type='Mental'>"+document.getElementById("selattInt").value+"</Intelligence>\n";
xmlResult += "		<Wits type='Mental'>"+document.getElementById("selattWit").value+"</Wits>\n";
xmlResult += "	</Attributes>\n";

xmlResult += "	<Abilities>\n";
tmpMax = parseInt(document.getElementById("selabiTalNum").value);
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("selabiTalNam"+i).value!="") {
		if (document.getElementById("selabiTalSpe"+i).value!="") {tmpSpec=document.getElementById("selabiTalSpe"+i).value;} else {tmpSpec="None"}
		xmlResult += "		<Talent><Name>"+document.getElementById("selabiTalNam"+i).value+"</Name><Specialitie>"+tmpSpec+"</Specialitie><Value>"+document.getElementById("selabiTalPts"+i).value+"</Value></Talent>\n";
	}
}
for (n=i; n<=2; n++) {xmlResult += "		<Talent><Name>None</Name><Specialitie>None</Specialitie><Value>0</Value></Talent>\n";}

tmpMax = parseInt(document.getElementById("selabiSkiNum").value);
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("selabiSkiNam"+i).value!="") {
		if (document.getElementById("selabiSkiSpe"+i).value!="") {tmpSpec=document.getElementById("selabiSkiSpe"+i).value;} else {tmpSpec="None"}
		xmlResult += "		<Skill><Name>"+document.getElementById("selabiSkiNam"+i).value+"</Name><Specialitie>"+tmpSpec+"</Specialitie><Value>"+document.getElementById("selabiSkiPts"+i).value+"</Value></Skill>\n";
	}
}
for (n=i; n<=2; n++) {xmlResult += "		<Skill><Name>None</Name><Specialitie>None</Specialitie><Value>0</Value></Skill>\n";}

tmpMax = parseInt(document.getElementById("selabiKnoNum").value);
//xmlResult += tmpMax;
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("selabiKnoNam"+i).value!="") {
		if (document.getElementById("selabiKnoSpe"+i).value!="") {tmpSpec=document.getElementById("selabiKnoSpe"+i).value;} else {tmpSpec="None"}
		xmlResult += "		<Knowledge><Name>"+document.getElementById("selabiKnoNam"+i).value+"</Name><Specialitie>"+tmpSpec+"</Specialitie><Value>"+document.getElementById("selabiKnoPts"+i).value+"</Value></Knowledge>\n";
	}
}
for (n=i; n<=2; n++) {xmlResult += "		<Knowledge><Name>None</Name><Specialitie>None</Specialitie><Value>0</Value></Knowledge>\n";}
xmlResult += "	</Abilities>\n";

xmlResult += "	<Spheres>\n";
for (i=1; i<=9; i++) {
	var tmpSphNam = xmlSphe['Spheres']['Sphere'][i]['Name'];
	var tmpSphNic = tmpSphNam.substring(0,3);
	var tmpSphFoc = document.getElementById("selsph"+tmpSphNic+"Foc").value;
	var tmpSphVal = document.getElementById("selsph"+tmpSphNic+"").value;
	xmlResult += "		<"+tmpSphNam+"><Foci>"+tmpSphFoc+"</Foci><Value>"+tmpSphVal+"</Value></"+tmpSphNam+">\n";
}
xmlResult += "	</Spheres>\n";

xmlResult += "	<Advantages>\n";
xmlResult += "		<Arete>"+document.getElementById("seladvAre").value+"</Arete>\n";
xmlResult += "		<Health>"+document.getElementById("seladvHea").value+"</Health>\n";
xmlResult += "		<Willpower>\n";
xmlResult += "			<Max>"+document.getElementById("seladvWilMax").value+"</Max>\n";
xmlResult += "			<Current>"+document.getElementById("seladvWilCur").value+"</Current>\n";
xmlResult += "		</Willpower>\n";

xmlResult += "		<Traits>\n";
tmpMax = parseInt(document.getElementById("seladvBacNum").value);
iTmp = 0;
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("seladvBacNam"+i).value) {
		xmlResult += "			<Background><Name>"+document.getElementById("seladvBacNam"+i).value+"</Name><Value>"+document.getElementById("seladvBacPts"+i).value+"</Value></Background>\n";
		iTmp++;
	}
}
for (j=iTmp; j<=1; j++) {xmlResult += "			<Background><Name>None</Name><Value>0</Value></Background>\n";}

tmpMax = parseInt(document.getElementById("seladvMerNum").value);
iTmp = 0;
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("seladvMerNam"+i).value && document.getElementById("seladvMerNam"+i).value!="0") {
		xmlResult += "			<Merit><Name>"+document.getElementById("seladvMerNam"+i).value+"</Name><Value>"+document.getElementById("seladvMerPts"+i).value+"</Value></Merit>\n";
		iTmp++;
	}
}
for (j=iTmp; j<=1; j++) {xmlResult += "			<Merit><Name>None</Name><Value>0</Value></Merit>\n";}

tmpMax = parseInt(document.getElementById("seladvFlaNum").value);
iTmp = 0;
for (i=0; i<=tmpMax; i++) {
	if (document.getElementById("seladvFlaNam"+i).value && document.getElementById("seladvFlaNam"+i).value!="0") {
		xmlResult += "			<Flaw><Name>"+document.getElementById("seladvFlaNam"+i).value+"</Name><Value>"+document.getElementById("seladvFlaPts"+i).value+"</Value></Flaw>\n";
		iTmp++;
	}
}
for (j=iTmp; j<=1; j++) {xmlResult += "			<Flaw><Name>None</Name><Value>0</Value></Flaw>\n";}
xmlResult += "		</Traits>\n";

xmlResult += "		<Quintessence>"+document.getElementById("seladvQui").value+"</Quintessence>\n";
xmlResult += "		<Paradox>"+document.getElementById("seladvPar").value+"</Paradox>\n";
xmlResult += "	</Advantages>\n";
xmlResult += "</Mage>\n";
document.getElementById("charXmlTa").value = xmlResult;
}

// Print XML Textarea
function prntPlayXml() {
var xmlResult = "";
xmlResult += "<Players>\n";

for (key in xmlPlay['Players']['Player']) {
	xmlResult += "	<Player>\n";
	xmlResult += "		<Id>"+xmlPlay['Players']['Player'][key]['Id']+"</Id>\n";
	xmlResult += "		<Name>"+xmlPlay['Players']['Player'][key]['Name']+"</Name>\n";
	xmlResult += "		<Nick>"+xmlPlay['Players']['Player'][key]['Nick']+"</Nick>\n";
	xmlResult += "		<Password>"+xmlPlay['Players']['Player'][key]['Password']+"</Password>\n";
	xmlResult += "		<Level>"+xmlPlay['Players']['Player'][key]['Level']+"</Level>\n";
	xmlResult += "		<Desc>"+xmlPlay['Players']['Player'][key]['Desc']+"</Desc>\n";
	xmlResult += "		<Character>\n";
	var tmpCharId = 0;
	var tmpCharNum = 0;
	var tmpCharNam = "none";
	for (key2 in xmlPlay['Players']['Player'][key]['Character']['Name']) {
		if (xmlPlay['Players']['Player'][key]['Character']['Name'][key2]!="None") {
		tmpId = parseInt(xmlPlay['Players']['Player'][key]['Character']['id'][key2]);
		xmlResult += "			<id>"+tmpId+"</id>";
		xmlResult += "<Name>"+xmlPlay['Players']['Player'][key]['Character']['Name'][key2]+"</Name>";
		xmlResult += "<Nick>"+xmlPlay['Players']['Player'][key]['Character']['Nick'][key2]+"</Nick>";
		xmlResult += "<Type>"+xmlPlay['Players']['Player'][key]['Character']['Type'][key2]+"</Type>\n";
		if (tmpId>tmpCharId) {tmpCharId=tmpId;}
		if (xmlPlay['Players']['Player'][key]['Character']['Name'][key2]==document.getElementById("selbioNam").value) {tmpCharNam = "selected";}
		tmpCharNum++;
		}
	}
	
	if (xmlPlay['Players']['Player'][key]['Nick']==getCookie("playname") && tmpCharNam == "none") {
		xmlResult += "			<id>"+(tmpCharId+1)+"</id>";
		xmlResult += "<Name>"+document.getElementById("selbioNam").value+"</Name>";
		xmlResult += "<Nick>"+document.getElementById("selNick").value+"</Nick>";
		xmlResult += "<Type>"+document.getElementById("selCharType").value+"</Type>\n";
		tmpCharNum++;
	}
	
	for (i=tmpCharNum; i<=1; i++) {
		xmlResult += "			<id>0</id>";
		xmlResult += "<Name>None</Name>";
		xmlResult += "<Nick>none</Nick>";
		xmlResult += "<Type>None</Type>\n";
	}
	xmlResult += "		</Character>\n";
	xmlResult += "	</Player>\n";
}

xmlResult += "</Players>\n";
document.getElementById("playXmlTa").value = xmlResult;
}




