function showDiv(d)
{
	var boxdiv = document.getElementById(d);
	if (boxdiv != null) {
		if (boxdiv.style.display!='block') {
			boxdiv.style.display='block';
		} else
			boxdiv.style.display='none';
			return false;
		}
}
function hideDiv(d)
{
	var boxdiv = document.getElementById(d);
	boxdiv.style.display = 'none';
	return false;
}
function showLogin(islogin, rp)
{
	var f = document.forms['loginform'];
	if (document.getElementById && f) {
		if (typeof(rp) != 'undefined') {
			f.retpath.value = rp;
		}
		if (islogin == 2) {
			var login = getCookie('author');
			islogin = (login && login.length > 1);
			if (islogin) {
				if (f.login.value != login) {
					f.login.value = login;
					f.passwd.value = '';
				}
			}
		}
		document.getElementById('login-form').style.display = 'block';
		islogin ? f.passwd.focus() : f.login.focus();
		return false;
	}
	var img = new Image();
	img.src = '';
	return true;
}
function hideLogin()
{
	document.getElementById('login-form').style.display = 'none';
	return false;
}


function settime()
{
	document.forms['loginform'].timestamp.value = new Date().getTime();
}

// ========= Add Items : see function createInput(id,value) in template ===============//
var arrInput = new Array(0);
var arrInputValue = new Array(0);
var QarrInputValue = new Array(0);
var KarrInputValue = new Array(0);
var GarrInputValue = new Array(0);
var UarrInputValue = new Array(0);
var TarrInputValue = new Array(0);
var NarrInputValue = new Array(0);
var ParrInputValue = new Array(0);
function saveValue(intId,strValue,n) {
	var reg1=/\"/g; var reg2=/'/g;
	strValue = strValue.replace(reg1,"\\");
	strValue = strValue.replace(reg2,"\\");
	if  (n==0)  { arrInputValue[intId]=strValue
	} else if (n==1) {	QarrInputValue[intId]=strValue
	} else if (n==2) {	KarrInputValue[intId]=strValue
	} else if (n==3) {	GarrInputValue[intId]=strValue
	} else if (n==4) {	UarrInputValue[intId]=strValue
	} else if (n==5) {	TarrInputValue[intId]=strValue
	} else if (n==6) {	NarrInputValue[intId]=strValue
	} else if (n==7) {	ParrInputValue[intId]=strValue	}
}

function addInput(k) {
	arrInput.push(arrInput.length);
	arrInputValue.push('');	QarrInputValue.push('');	KarrInputValue.push('');	GarrInputValue.push('');	UarrInputValue.push('');	TarrInputValue.push('');	NarrInputValue.push(''); ParrInputValue.push('');
	display(k);
}

function doneInput(k) {
	var intI=arrInput.length;
	document.getElementById('last').innerHTML+=createHidden ( arrInput[intI], arrInputValue[intI], QarrInputValue[intI], KarrInputValue[intI], GarrInputValue[intI], UarrInputValue[intI], TarrInputValue[intI], NarrInputValue[intI], ParrInputValue[intI],k );
}

function display(k) {
document.getElementById('parah').innerHTML="";
	for (intI=0;intI<arrInput.length;intI++) {
	  document.getElementById('parah').innerHTML+=createInput ( arrInput[intI], arrInputValue[intI], QarrInputValue[intI], KarrInputValue[intI], GarrInputValue[intI], UarrInputValue[intI], TarrInputValue[intI], NarrInputValue[intI], ParrInputValue[intI],k);
	}
}


function deleteInput() {
	if (arrInput.length > 0) {
		arrInput.pop();	arrInputValue.pop(); QarrInputValue.pop(); KarrInputValue.pop(); GarrInputValue.pop(); UarrInputValue.pop(); TarrInputValue.pop(); ParrInputValue.pop(); NarrInputValue.pop();
	}
display();
}
// =================================//