﻿﻿var xmldoc;
var xmlfile = "content.xml";
var xmlhttp = null;
	if (window.ActiveXObject){
		try{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e){
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
	}else if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}
function getxml(x){
if (xmlhttp!=null){  
  xmlhttp.open("GET",x,false);
  xmlhttp.send(null);
  }else{
  alert("Your browser does not support XMLHTTP.11");
  return false;
  }
	return(xmlhttp);
}
function loadxmldoc(x){	
	if (window.ActiveXObject){
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  	xmlDoc.async=false;
  	xmlDoc.load(x);
  	return(xmlDoc);
  }else if (window.XMLHttpRequest){
  	xmlDoc = getxml(x).responseXML;
  	return(xmlDoc);
  }else{
  alert("11Your browser does not support XMLHTTP.");
  return false;
  }
}
function styleituse(x){
	var myxml = loadxmldoc(xmlfile);
	var myxsl = loadxmldoc(x+".xsl");
	var mycss = x+".css";
	if(window.ActiveXObject){
	document.getElementById("xmldiv").innerHTML = myxml.transformNode(myxsl);
	document.getElementById("changecss").href = mycss;
}else if (document.implementation && document.implementation.createDocument){
  xsltProcessor = new XSLTProcessor();
  xsltProcessor.importStylesheet(myxsl);
  resultDocument = (new XMLSerializer()).serializeToString(xsltProcessor.transformToFragment(myxml,document));
  document.getElementById("xmldiv").innerHTML = resultDocument;
  document.getElementById("changecss").href = mycss;
}
}
function showxmlfile(){
	document.getElementById("xmldiv").innerHTML = "<textarea id='codesource'>" + getxml(xmlfile).responseText + "<\/textarea>";
}