var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
ldem()
/////////////////////    The Main Man
function doreq (url){
	if (!xmlhttp) {
		  alert("No magic in this browser, sorry")
		  return (0);
	}
	else{
		c = 0
		resp = ""
	//alert(url)
		xmlhttp.open("GET",url ,true);
		 xmlhttp.onreadystatechange=function() {
			  if (xmlhttp.readyState==4) {
				   //alert("doreq return\n" + xmlhttp.responseText)
					   document.getElementById("dvlnm").innerHTML = xmlhttp.responseText
					   fnclf = xmlhttp.responseText.match(/^FN:([^:]+)::([^\|]+)/)
					   fncla = xmlhttp.responseText.match(/^ALT:([^#]+)/)
					   if(fnclf && fnclf[1] && fnclf[2]){
							eval(fnclf[1] + "(\"" + fnclf[2] + "\")")
							return 0
					   }
					   else if(fncla && fncla[1]){
							eval("alert(\"" + fncla[1].replace(/<br>/g,"\\n") + "\")")
							return 0
					   }
					   else{
						  eval(xmlhttp.responseText)
					}
				   //
			  }
		 }
		 t = new Date()
		 xmlhttp.send(null)
		 return(1);
	}
}
//////########  or post to change page
function pstit(url){
	var f = document.pat
	f.action = url
	//alert(f.action)
	f.submit()
}
function divtab(arystr, dvdad){
	if(!dvdad){
		dvdad = document.getElementById("dvdat")
	}
	rwary = arystr.split(":R:")
	if(!rwary){
		rwary = Array(arystr)
	}
		dvdad.style.width = "100%"
		dvdad.style.backgroundColor = "#FAFFFA"
	for(r=0;r<rwary.length;r++){
		if(rwary[r].indexOf(":F:") > 0){
			fdary = rwary[r].split(":F:")
		}
		else{
			fdary = Array(rwary[r])
		}
		var tr = document.createElement("div")
		var mytr = dvdad.appendChild(tr)
		mytr.style.clear = "both"
		mytr.style.padding = "1px 1px 1px 1px"
		mytr.id = "tr" + r
		cols = fdary.length
		wd = Math.round(96/cols) + "%"
		//alert(wd)
		for(f=0;f<cols;f++){
			var tdo = document.createElement("div")
			tdo.style.width = wd
			tdo.style.styleFloat= "left"
			tdo.style.cssFloat= "left"
			var mytdo = mytr.appendChild(tdo)
			mytdo.id = "tdo" + r + "x" + f
			var td = document.createElement("div")
			var mytd = mytdo.appendChild(td)
			mytd.id = "td" + r + "x" + f
			mytd.style.border = "1px solid #009933"
			mytd.innerHTML = fdary[f] ? fdary[f] : "Nah"
		}
	}
}
function doit(){
	var tx = document.getElementById("txtsql")
	//alert(tx.value)
	if(tx && tx.value != ""){
		doreq("playin.php?fnc=getrs&arg=" + tx.value)
	}
}
function cleardiv(div,leave){
	leave = leave ? leave : ""
	if(div.childNodes.length > 3){
		l = div.childNodes.length
		for(i=l-1;i>-1;i--){
			if(div.childNodes[i].id != leave){
				foo = div.removeChild(div.childNodes[i])
			}
		}
	}
}
function hi(){
	louis = document.cookie.match(/drmn=([^;]+)/)
	if(louis && louis[1]){
		 if(confirm("Clear cookie?")){
			doreq("oomph.php?fnc=stck&arg=nix")
		}
	}
	else{
		txt = prompt("Code & Username please")
		doreq("oomph.php?fnc=stck&arg=" + txt)
	}
}

function ldem(){
	louis = document.cookie.match(/drmn=([^;]+)/)
	if(louis && louis[1]){
		 //alert("Hi " + louis[1])
		document.getElementById("dvdb").style.display = "block"
		 doreq("oomph.php?fnc=clck&arg=%20")
	}
	else{
		 document.getElementById("dvdb").style.display = "none"
	}
}
function hesin(nm){
	alert(nm)
	window.location = "index.html"
}
actv=''
function dvtree(str){
	if(actv){
		dad = document.getElementById(actv)
	}
	else{
		dad = document.getElementById("outer")
	}
	dad.onclick = null
	ary = str.split('#~#')
	//alert(ary[0])//
	if(ary[0].indexOf(":DR:")>-1){
		dirs = ary[0].split(":DR:")
	}
	else{
		dirs = Array(ary[0])
	}
	for(i=0;i<dirs.length;i++){
		var tr = document.createElement("div")
		var mydv = dad.appendChild(tr)
		foo = dirs[i].replace(' ','_')
		mydv.id = 'odv' + foo
		mydv.innerHTML = foo
		mydv.style.clear = "both"
		mydv.style.border ="1px solid #009933"
		mydv.style.width = "300px"
		var dr = document.createElement("div")
		var mdr = mydv.appendChild(dr)
		mdr.id = actv + ">>" + foo
		mdr.innerHTML = 'Folder'
		mdr.className = "lnk"
		//mdr.style.border ="1px solid #003399"
		mdr.style.padding ="1px 1px 1px 30px"
		mdr.onclick = fldit
	}
	if(ary[1].indexOf(":FL:")>-1){
		fils = ary[1].split(":FL:")
	}
	else{
		fils = Array(ary[1])
	}
	for(i=0;i<fils.length;i++){
		var tr = document.createElement("div")
		var mydv = dad.appendChild(tr)
		foo = fils[i].replace(' ','_')
		mydv.id = actv + ">>" + foo
		mydv.innerHTML = foo
		//mydv.style.float = "right"
		mydv.style.border ="1px solid #009933"
		mydv.style.width = "200px"
		mydv.className = "lnk"
		mydv.onclick = hrf
	}
	//alert(dirs[0])
}
function fldit(evt){
	var objt = evt ? evt.target : event.srcElement ;
	//alert(objt.id)
	actv = objt.id
	doreq("oomph.php?fnc=clck&arg=" + actv)
}
function togg(dv){
	if(dv.style.display == "block"){
		dv.style.display = "none"
	}
	else{
		dv.style.display = "block"
	}
}
function hrf(evt){
	var objt = evt ? evt.target : event.srcElement ;
	url = objt.id.replace(/>>/g,'/')
	urla = url.substr(1)
	window.open(urla, "nyoob")
	
	//alert()window.location = urla
}




