//<script language="JavaScript">
var bError=false;
var bTrapError=true;
var ver = navigator.appVersion;
var IE = (document.all && document.getElementById) ? true : false;
var NS = (document.getElementById && !document.all) ? true : false;
var x;
//document.onmousedown = fnFlash;
function fnFlash(oTitle){
		if (NS){
		    //oTitle = oTitle.target;
	    }else{
		    oTitle = window.event.srcElement;
	    }
		oList=document.getElementById("c_"+oTitle.id);
		if (oList.length > 0){
			var par = oList[0].parentElement;
			for (i=0; i < oList.length; i++){
				if(oList[i].className=="tocItemHide"){
					oList[i].className="tocItemShow";
					par.parentElement.style.height = par.sHeight;
					pm(oTitle, oList[i]);
					showImages(oList[i]);
				}else{
					oList[i].className="tocItemHide";
					par.parentElement.style.height = 0;
					pm(oTitle, oList[i]);
				}
			}
		}else{
			if(oList.className=="tocItemHide"){
				oList.className="tocItemShow";
				pm(oTitle, oList);
				showImages(oList);
			}else{
				oList.className="tocItemHide";
				pm(oTitle, oList);
			}
		}
}
var currentMenuObject;
function displayMenu(obj){
//    if (NS){
//	    obj = obj.target;
//    }else{
//	    obj = window.event.srcElement;
//    }
//	if (event.button == 2){
//		tocMenu.style.top = event.y;
//		tocMenu.style.left = event.x;
//		tocMenu.style.display = "block";
//		currentMenuObject = obj;
//		event.cancelBubble = true;
//	}
}
function deleteToc(obj){
	obj.parentElement.style.display = "none";
	currentMenuObject.parentElement.outerHTML = "";
}
//function menuMouseUp(obj){
//	event.cancelBubble = true;
//}
function pm(t, l){
	if (t.innerHTML.substring(0, 1) == "+" || t.innerHTML.substring(0, 1) == "-"){
		if (l.className == "tocItemHide")
			t.innerHTML = "+" + t.innerHTML.substr(1);
		else
			t.innerHTML = "-" + t.innerHTML.substr(1);
	}
}
function showImages(list){
	var img = list.getElementsByTagName("IMG");
	for (var i=0; i < img.length; i++){
		if (img[i].getAttribute("src") == "" || img[i].getAttribute("src") == null){
			if (img[i].getAttribute("ssrc") != ""){
				img[i].src = img[i].getAttribute("ssrc");
			}
		}
	}
}
function naFlash(obj, ns){
    if (NS){
	    //obj = obj.target;
    }else{
	    obj = window.event.srcElement;
    }
	n = document.getElementById(ns);
	try{
	    if(n.style.display=="none"){
		    n.style.display="block";
		    obj.firstChild.src = obj.firstChild.src.replace(/show/, "hide");
		    if (typeof(document.getElementById(ns+"t")) == "object"){
			    document.getElementById(ns+"t").style.display = "block";
			    document.getElementById(ns+"b").style.display = "block";
		    }
	    }else{
		    n.style.display="none";
		    obj.firstChild.src = obj.firstChild.src.replace(/hide/, "show");
		    if (typeof(document.getElementById(ns+"t")) == "object"){
			    document.getElementById(ns+"t").style.display = "none";
			    document.getElementById(ns+"b").style.display = "none";
		    }
	    }
	 }
	 catch(e)
	 {
	    var x = e;
	    x = e;
	 }
}
var mover = null;
function mouseDown(obj){
    if (NS){
	    //obj = obj.target;
    }else{
	    obj = window.event.srcElement;
    }
	mover = obj.parentElement.getElementById("canvas");
	mover.onmousemove = mouseMove;
}
function mouseMove(obj){
    if (NS){
	    //obj = obj.target;
    }else{
	    obj = window.event.srcElement;
    }
	if (mover != null){
		if (window.event.offsetY - mover.offsetTop > 0){
			mover.style.height = (window.event.offsetY - mover.offsetTop);
		}
	}
}
document.onmousemove = mouseMove;
document.onmouseup = mouseUp;
function mouseUp(obj){
	mover = null;
}
function dragstart(which){
	event.dataTransfer.setData("text", which);
	event.dataTransfer.effectAllowed=("all");
}
function dragover(obj){
	window.event.returnValue = false;
	
}
function dragend(obj){
	var which = event.dataTransfer.getData("text");
	var wo = document.getElementById(which);
	if (wo != null){
		obj.parentElement.insertAdjacentHTML("afterEnd", wo.innerHTML);
	}
}
var saveBG;
function itemOver(obj, url){
    if (obj){
        if (NS){
	        //obj = obj.target;
        }else{
	        obj = window.event.srcElement;
        }
	    status = url;
	    saveBG = obj.style.backgroundColor;
	    obj.style.backgroundColor = "silver";
	}
}
function itemOut(obj, url){
    if (obj){
        if (NS){
	        //obj = obj.target;
        }else{
	        obj = window.event.srcElement;
        }
	    status = url;
	    obj.style.backgroundColor = saveBG;
	}
}
function savePState(){
	//debugger;
	var dt = document.getElementsByTagName("DIV");
	var cs = "";
	if (dusername == ""){
		for (i = 0; i < dt.length; i++){
			if (dt[i].className == "tocHead"){
				cs += dt[i].id + "=" + document.getElementById("c_"+dt[i].id).className + "|";
			}
		}
		document.cookie = "xml = " + escape(cs) + ";path=/";
	}else{
		try {
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp.Open("POST", "/xml/users/savexml.asp?"+dusername, false);
			xmlhttp.Send(XMLDATA.xml);
		}catch(exception){}
	}
}
var dusername = "";
function loadPState(){
	var aCookie = document.cookie.split(";");
	for (i = 0; i < aCookie.length; i++){
		var aCrumb = aCookie[i].split("=");
		if (aCrumb[0].substring(0, 1) == " ") aCrumb[0] = aCrumb[0].substr(1);
		if ("xml" == aCrumb[0]) {
			var nvp = unescape(aCrumb[1]);
			var p = nvp.split("|");
			for (j = 0; j < p.length; j++){
				var n = p[j].split("=")[0];
				if (n != ""){
					var td = document.getElementById(n);
					if (typeof(td) != "undefined"){
						var id = document.getElementById("c_" + n);
						if (id){
						    id.className = p[j].split("=")[1];
						    pm(td, id);
						    if(id.className=="tocItemShow"){
							    showImages(id);
						    }
						}
					}
				}
			}
		}
		if ("dusername" == aCrumb[0]) {
			dusername = unescape(aCrumb[1]);
		}
	}
//	if (typeof(document.XSLDocument) != "object"){
//		xsl = new ActiveXObject("Microsoft.XMLDOM");
//		xsl.async = false;
//		xsl.validateOnParse = false;
//		xsl.load("/xml/styles/toc.xsl");
//		document.XSLDocument = xsl;
//	}
//	setupScroll(document.all.tags("DIV"));
	//if (document.location.search != ""){
	//	changeContent1(document.location.search.substr(1));
	//	openToc(document.location.search.substr(1));
	//}
	if ((faqframe=document.getElementById("snifferDiv")) != null){
		document.getElementById("snifferDiv").innerText = sniffer();
		var x = 1;
	}
}
function openToc(str){
	var as = document.getElementByTagName("A");
	var f = null;
	for (i=0; i < as.length; i++){
		var oc = as[i].onclick.toString();
		if (oc.indexOf("changeContent1('"+str+"');") > 0){
			f = as[i];
			break;
		}
	}
	if (f != null){
		while(f.tagName != "BODY"){
			f = f.parentElement;
			if (f.className == "tocItemHide"){
				f.className = "tocItemShow";
				showImages(f);
			}
		}
	}
}
var windowInterval = null;
//function setupScroll(dt){
//	window.clearInterval(windowInterval);
//	var scroller = new Array();
//	var j=0;
//	for (i = 0; i < dt.length; i++){
//		if (typeof(dt[i].sHeight) != "undefined" && dt[i].sHeight != ""){
//			dt[i].parentElement.style.height = dt[i].sHeight;
//			dt[i].parentElement.style.overflow = "hidden";
//			scroller[j++] = dt[i];
//			dt[i].id = "scroller";
//			dt[i].style.xIndex = - dt[i].style.xIndex;
//			windowInterval = window.setInterval("scrollFunction()", 100);
//		}
//		if (typeof(dt[i].remote) != "undefined" && dt[i].remote != ""){
//			var xml = new ActiveXObject("Microsoft.XMLDOM");

//			xml.async = false;
//			xml.validateOnParse = false;
//			try {
//				xml.load(dt[i].remote);
//				dt[i].outerHTML = xml.transformNode(document.XSLDocument);
//			}catch(exception){}
//		}
//	}
//	if (scroller.length > 0){ 
//		for (j=0; j < scroller.length; j++){
//			scroller[j].parentElement.insertAdjacentHTML("beforeEnd", scroller[j].innerHTML);
//		}
//	}
//}
function scrollFunction(){
	var y = document.getElementById("scroller");
	if (typeof(y) != "undefined"){
		if (typeof(y.length) == "undefined"){
			scrollit(y);
		}else{
			for (i=0; i < y.length; i++){
				scrollit(y[i]);
			}
		}
	}
}
function scrollit(x){
	var un;
	var top = x.style.marginTop;
	if (top != ""){
		un = parseInt(top.substr(0, top.indexOf("p")));
		if (typeof(un) != "NaN"){
			x.style.marginTop = un - 1;
		}else{
			x.style.marginTop = -1;
		}
	}else{
		x.style.marginTop = -1;
	}
	if (un < -(x.offsetHeight)){
		x.style.marginTop = -1;
	}
}
//var xml = new ActiveXObject("Microsoft.XMLDOM");
var mailfile = "";
//function changeContent1(file){

//	mailfile = file;
//	document.all('content').innerHTML = "<center><b>Loading...</b></center><br /><br /><br /><br /><center><b>If you chose a Live News Feed<br />please wait before clicking!!!</b></center><br /><br /><br /><br /><br /><br />";
//	if (file.substr(file.lastIndexOf(".")+1) == 'xml'){
//		xml = new ActiveXObject("Microsoft.XMLDOM"); //;-))
//		xml.async = true;
//		xml.validateOnParse = false;
//		xml.onreadystatechange = stateChange;
//		xml.load(file);

//	}else{
//		//debugger;
//		if (file.substr(0, 4) == "/xml"){
//			document.all('content').innerHTML = "<IFRAME style='width:100%;height:100%;' src='" + file + "'></IFRAME><table width='100%'><tr><td>" + wikit() + "</td><td align='right'>" + mailToF() + "</td></tr></table>";
//											"<img src='/counter/counter.aspx?cid=0&idn=" + file + "' height='1' width='1' border='0' />";
//		}else{
//			document.all('content').innerHTML = "<IFRAME style='width:100%;height:100%;' src='" + file + "'></IFRAME>" +
//											"<img src='/counter/counter.aspx?cid=0&idn=xml_cont_other_" + file + "-1' height='0' width='0' border='0' />";
//		}		
//		if (document.all('content').all.tags("DIV").length > 0){
//			setupScroll(document.all('content').all.tags("DIV"));
//		}
//	}
//	
//}
//function stateChange(){
//	if (xml.readyState == 4){
//		if (xml.parseError.errorCode != 0){
//			document.all('content').innerHTML = "<center><h4>Unavailable</h4></center>";
//		}else{
//			document.all('content').innerHTML = xml.transformNode(document.XSLDocument) + "<table width='100%'><tr><td>" + wikit() + "</td><td align='right'>" + mailToF() + "</td></tr></table>"
//			if (document.all('content').all.tags("DIV").length > 0){
//				setupScroll(document.all.tags("DIV"));
//			}
//			if ((faqframe=document.all("randomFAQframe")) != null){
//				loadFAQ(faqframe);
//			}
//		}
//	}
//}
//function changeContent2(file, style){
//	mailfile = file;
//	var xsl = new ActiveXObject("Microsoft.XMLDOM")

//	xml.async = false;
//	xsl.async = false;
//	xml.validateOnParse = false;
//	xml.load(file);
//	xsl.load(style);
//	//debugger;

//	document.all('content').innerHTML = xml.transformNode(xsl);
//}
var otherWindow;
//function outlink(obj, href){
//	var pl = new ActiveXObject("Microsoft.XMLDOM")
//	pl.async = false;
//	try {
//		pl.load("/counter/counter.aspx?cid=0&idn=xml_outlink&ref=" + escape(href));
//	}catch(exception){}
//	if (obj.target != ""){
//		otherWindow = window.open(href, obj.target);
//		try{otherWindow.focus()}catch(e){};
//	}else{
//		window.navigate(href);
//	}
//}
//function inlink(obj, href){
//	var pl = new ActiveXObject("Microsoft.XMLDOM")
//	pl.async = false;
//	try {
//		pl.load("/counter/counter.aspx?cid=0&idn=xml_inlink&ref=" + escape(href));
//	}catch(exception){}
//	if (obj.target != ""){
//		otherWindow = window.open(href, obj.target);
//		try{otherWindow.focus()}catch(e){};
//	}else{
//		window.navigate(href);
//	}
//}
//function download(obj, href){
//	var pl = new ActiveXObject("Microsoft.XMLDOM")
//	pl.async = false;
//	try {
//		pl.load("/counter/counter.aspx?cid=0&idn=xml_download " + escape(href) + "-1");
//	}catch(exception){}
//	if (obj.target != ""){
//		otherWindow = window.open("/download/download.aspx?" + href, obj.target, "height=450,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
//		try{otherWindow.focus()}catch(e){};
//	}else{
//		window.navigate(href);
//	}
//}
function mailToF(url){
	var prothost = document.location.protocol + "//" + document.location.host;
	var mlink = prothost + "/xml/index.xml%3F" + mailfile;
	var a = "<a href=\"mailto:friend&subject=Check%20this%20out&body=XML%20XSL%20Portal%20%20%20%20" + mlink + "\"><img src=\"/xml/images/outbox.gif\" height=\"20\" width=\"20\" border=\"0\"></a><font style=\"color:white;font-family:ariel;font-size:8pt\">&nbsp;Mail to a friend.</font>";
	return a;
}
function wikit(url){
	var wurl = "";
	url = mailfile.toLowerCase();
	for (var i=0; i < url.length; i++){
		if (url.substr(i, 1) == ".") break;
		if (url.substr(i, 1) == "/"){
			wurl += url.substr(i+1, 1).toUpperCase();
			i++;
		}else{
			wurl += url.substr(i, 1);
		}
	}
	var a = "<span onclick=\"win=window.open('/xmlwiki/default.asp?" + wurl + "', 'wikit', 'height=500,width=600,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no');win.focus();\"  style=\"color:white;font-family:ariel;font-size:8pt;cursor:hand;\">Wiki</span>";
	return a;
}
function _formatError(pe){
	var o = "";
	var e;
	if (typeof(pe.reason) == "string"){
		for (i=0; i < pe.linepos-1; i++){
			if (pe.srcText.substr(i,1) == "\t"){
				o += "\t";
			}else{
				o += "-";
			}
		}
		o += "^";
		e = pe.reason + ": " + pe.errorCode + "\n" + pe.srcText + "\n" + o + "\n" + pe.url + " line " + pe.line;
	}else if (typeof(pe.description) == "string"){
		e = pe.description;
	}
	return e;
}
function animateLogo(obj){
	obj.outerHTML = "<EMBED width=\"380\" height=\"48\" name=\"logotransform\" pluginspage=\"http://www.adobe.com/svg/viewer/install/\" src=\"/xml/svg/logo2.svg\" type=\"image/svg-xml\">";
}
//</script>