document.phpurl = "brokerage.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 bkdelcrv(str, msg) {
	if(msg){alert(msg)}
		document.location.href = document.location.href;

}
function retnull(str, msg){
	if(msg){alert(msg)}
return 0;
}
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")
	if(!isNaN(document.lvl) && document.lvl == 5) {
		var ky = document.getElementById("spkey");
	ky.innerHTML = '&nbsp; ~ = Log Out = ~ &nbsp;'
		document.admin = -1;
		document.clns[0].setedt(true);
		
			document.newb = document.getElementById("dvbtnconew")
			document.newb.style.display = "block"
			document.newb.onclick = function (){
				kzam("mknewco", 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) {
		document.clns[nmbr].setedt(true);
	
	}

	
	
}

function delevt(evtid) {
	if (confirm("Are you sure you want to delete the row")) {
	
		kzam("dlevt", evtid);
	}
}

function adminobjb(n){
	var ky = document.getElementById("spkey");
	if(ky.innerHTML == 'chocolate'){
		tx = prompt("Welcome, Please login below", "")
		kzam("knock", tx )
	}
	else{
		ky.innerHTML = 'chocolate'
		document.admin = 0
		writeCookie("inlvl", "", 1)
		document.location.href="gallery.htm";
		return false;
			document.newb = document.getElementById("dvbtnconew")
	document.newb.style.display = "none"
		setedt(false)
	}
}
// 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)
		for(qi=0;qi<document.clns.length;qi++){	
			document.clns[qi].setedt(true);
		}	

			document.newb = document.getElementById("dvbtnconew")
	document.newb.style.display = "block"
	document.newb.onclick = function (){
		kzam("mknewco", 0)
	}
}
function popme(ths){
	//alert(rsval(ths.dad.dad.rwdat, "gly_id"));
	writeCookie("rpdat", rsval(ths.dad.dad.rwdat, "gly_id"), 2)
	window.open("pickwick-caravans-details.html", "mypop")
} 

function popmexx(ths, fldx){
	//alert(rsval(ths.dad.dad.rwdat, "gly_id"));
	//writeCookie("rpdat", rsval(ths.dad.dad.rwdat, "gly_id"), 2)
	if (document.isbeingedt) return false;
	//alert(rsval(ths.dad.dad.rwdat, fldx));
	
	window.open("gallery-large.php?imgttl="+rsval(ths.dad.dad.rwdat, fldx), "mypop", 'width=450,height=450')
}
function more_details(mrid) {
	var mridb = mrid.split("_");
	writeCookie("mrdid", mridb[3], 2);
	top.location.href = "basca-property-detail.html";
}
function delimg() {

}
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 doupl(){

	//writeCookie("rdat", '', -24)
	//this.form.action = "kit-bkdetails.php";
	//
	document.forms['pat'].action="kit-bkdetails.php?coid=" + document.getElementById('coid').value + '&fld=' + this.fld
	document.forms['pat'].submit()
	
}
function delimgg() {
		kzam("clrimg", document.getElementById('imgfld').value+"~c~"+document.getElementById('coid').value)

}
