document.phpurl = "eventsB.php"
//alert("boo")
init()
function init(){
	//alert("init init")//
	//self.sralt("Well buggrai")
	document.sk = Array(document.getElementById("dv-tmpl"), document.getElementById("dv-tmpl"))

	document.lnm = document.getElementById("dvdes")

	kzam("gtplst", 0)
	
	if(!document.lstgdv){
		document.lstgdv = document.getElementById("dvlst")
		document.detldv = document.getElementById("dvdet")
	}
//	document.lstgdv.style.display = "block"
//	document.detldv.style.display = "none"
	//reg()
	//alert('hit' + xmlhttp.readyState);/**/
}

function clsupl() {
	document.getElementById('edt-upl').style.display = "none";
}
function gotplst(str, msg){
	if(msg){alert(msg)}
	//alert(str);
	document.totstr = str;
	datry = str.indexOf(":R:") > -1 ? str.split(":R:") : Array(str)

	if(!document.clns){
		document.clns = Array()
	}
	for(var i=0;i<1;i++){
		if(!document.clns[i]){
			document.skin = document.sk[i%2]
			document.clns[i] = mkcln(datry[i])
			document.clns[i].dad = document.clns
			document.clns[i].rwfmt = "bluebody"
		}
		document.clns[i].setv(datry[i])
	}

	document.lvl = readCookie("inlvl")
	document.inprid = readCookie("inprid")
	if(!isNaN(document.lvl) && document.lvl == 5) {
		var ky = document.getElementById("spkey");
		ky.innerHTML = '&nbsp;[Log Out] &nbsp;'
		document.admin = -1;
		if ((document.inprid == -1) || (document.inprid == document.clns[0].rwid)) { document.clns[0].setedt(true); }

		if (document.inprid == -1) {
			document.newb = document.getElementById("dvbtnconew")
			document.newb.style.display = "block"
			document.newb.onclick = function (){
				kzam("nwnws", 0)
			 }
		}
	}
	if (datry.length != 1) {
		setTimeout("gotplstB(1);", 50);
	}

}

function gotplstB(nmbr){

	datry = document.totstr.indexOf(":R:") > -1 ? document.totstr.split(":R:") : Array(str)

	if(!document.clns[nmbr]){
		document.skin = document.sk[nmbr%2]
		document.clns[nmbr] = mkcln(datry[nmbr])
		document.clns[nmbr].dad = document.clns
		document.clns[nmbr].rwfmt = "bluebody"
	}
	document.clns[nmbr].setv(datry[nmbr])	
	if (datry.length > (nmbr+1)) {
		setTimeout("gotplstB("+(nmbr+1)+");", 50);	
	}
	if(!isNaN(document.lvl) && document.lvl == 5) {
		if ((document.inprid == -1) || (document.inprid == document.clns[nmbr].rwid)) { document.clns[nmbr].setedt(true); }
	
	}

	
	
}

function delevt(evtid) {
	if (confirm("Are you sure you want to delete the event with id "+evtid+"?")) {
	
		kzam("dlevt", evtid);
	}
}

function adminobjb(n){
	var ky = document.getElementById("spkey");
	if(ky.innerHTML == 'record'){
		tx = prompt("Welcome, Please login below", "")
		kzam("knock", tx )
	}
	else{
		ky.innerHTML = 'record'
		document.admin = 0
		writeCookie("inlvl", "", 1)
		writeCookie("inprid", "", 1)
	document.newb = document.getElementById("dvbtnconew")
	document.newb.style.display = "none"
		//setedt(false)
		reLoadPage("", "")
		
	}
}
// what you get from login
function timber(str){
	var ky = document.getElementById("spkey");
	bt = str.split(":O:")
	document.admin = bt[0]
	alert(bt[1])
    if (bt[0] == 0) { return 0; }
	ky.innerHTML = '&nbsp; ~ = Log Out = ~ &nbsp;'
	writeCookie("inlvl", 5, 2)
	writeCookie("inprid", -1, 2)

	document.newb = document.getElementById("dvbtnconew")
	document.newb.style.display = "block"
	document.newb.onclick = function (){
		kzam("nwnws", 0)
	}
	kzam("gtplst", 0)
}

function more_details(mrid) {
	var mridb = mrid.split("_");
	writeCookie("mrdid", mridb[3], 2);
	top.location.href = "basca-property-detail.html";
}
function retcmupd(msg, val){
	if(document.actv && val){
		if(document.detldv.alldat && document.detldv.style.display == "block"){
			bt=val.split(":F:")
			fv = bt[1].split(":V:")
			 reg = RegExp(fv[0] + ":V:.+?:F:")
			 document.detldv.alldat = document.detldv.alldat.replace(reg, fv[0] + ":V:" + fv[1] + ":F:")
			 gensetv( document.detldv, document.detldv.alldat)
			//alert(val + '\n' + fv[0] + '\n' + fv[1])
		}
		else{
			//alert(document.detldv.alldat.length + '\n' + document.detldv.style.display)
			document.actv.dad.htm.setv(val)
		}
	}
	if(document.actv.dad.dad.lnm){
		document.actv.dad.dad.lnm.innerHTML = "The update to your listing has been successful"
		document.actv.dad.dad.lnm.style.display = "block"
		self.setTimeout('fadit()', 5000)
	}
	else{
		alert("not able to save \n" + msg)
	}
	//+ "\n" + val
}
function fadit(dvid){
	if(dvid){
		//alert(dvid)
		var dvd =document.getElementById(dvid)
		dvd.innerHTML = "" 
		dvd.style.display = "none"
		
	}
	else{
		document.actv.dad.dad.lnm.innerHTML = "" 
		document.actv.dad.dad.lnm.style.display = "none"	
	}	

	//document.actv = 0
}
function douplr(){

	//writeCookie("rdat", '', -24)
	//this.form.action = "kitB.php";
	//?coid=" + document.getElementById('coid').value + '&fld=' + this.fld
	document.forms['pat'].action="kitB.php"
	document.forms['pat'].submit()
	
}
function reLoadPage(str, msg){
	//alert("Refreshed");
	document.location.href="vacancies.htm";

}
