a=navigator.userAgent;
if (a.indexOf("Firefox")!=-1 || a.indexOf("AppleWebKit")!=-1){
indkast_browser='FF';
} else {indkast_browser='other';}
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest) {xhttp=new XMLHttpRequest();}
else {xhttp=new ActiveXObject("Microsoft.XMLHTTP");}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}

function delayxml(div,xml,xsl){
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById(div).appendChild(resultDocument);
}

function showXML(div,xml,xsl){
 if (!window.document.getElementById(div)){document.write('<div id="'+div+'"></div>');}
  if (window.indkast_browser!='FF' || window.indkast_doFF){
  xml=loadXMLDoc(xml+'?'+ (new Date()).getTime());
  xsl=loadXMLDoc(xsl);
  // code for IE
  if (window.ActiveXObject){ex=xml.transformNode(xsl);document.getElementById(div).innerHTML=ex;}
  // code for Mozilla, Firefox, Opera, etc.
  else if (document.implementation && document.implementation.createDocument){
   xsltProcessor=new XSLTProcessor();
   xsltProcessor.importStylesheet(xsl);
   resultDocument = xsltProcessor.transformToFragment(xml,document);
   document.getElementById(div).appendChild(resultDocument);
  }
 }
}


function showXMLFF(div,xml,xsl){
 if (!window.document.getElementById(div)){document.write('<div id="'+div+'"></div>');}
// if (window.activeXML==0){
//  activeXML=1;
  xml=loadXMLDoc(xml+'?'+ (new Date()).getTime());
  xsl=loadXMLDoc(xsl);
  // code for IE
  if (window.ActiveXObject){ex=xml.transformNode(xsl);document.getElementById(div).innerHTML=ex;}
  // code for Mozilla, Firefox, Opera, etc.
  else if (document.implementation && document.implementation.createDocument){
   xsltProcessor=new XSLTProcessor();
   xsltProcessor.importStylesheet(xsl);
   resultDocument = xsltProcessor.transformToFragment(xml,document);
   document.getElementById(div).appendChild(resultDocument);
  }
//  activeXML=0;
// }
}

function queryStr(ji) {
 hu = window.location.search.substring(1);
 gy = hu.split("&");
 for (i=0;i<gy.length;i++) {
  ft = gy[i].split("=");
  if (ft[0] == ji && ft[1]!=false && ft[1]!='false') {return ft[1]}
 }
 return '';
}

function add_navigation_links(){
 var ia=0;
 while (document.getElementsByTagName("A")[ia]){
  var a=document.getElementsByTagName("A")[ia].href;

  var pos=a.indexOf('&hold='+queryStr('hold')+'&');
  if (pos>0){
   document.getElementsByTagName("A")[ia].innerHTML='<span class="ifix_team">'+document.getElementsByTagName("A")[ia].innerHTML+'</span>';
  }

  var pos=a.indexOf('&loc&');
  if (pos>0){
   var b=a;
   var inserted='';
   if (a.indexOf('&turnering=')<0 && a.indexOf('?turnering=')<0){inserted=inserted+'turnering='+queryStr('turnering')+'&';}
   if (a.indexOf('&hold=')<0 && a.indexOf('?hold=')<0){inserted=inserted+'hold='+queryStr('hold')+'&';}
   if (a.indexOf('&nation=')<0 && a.indexOf('?nation=')<0){inserted=inserted+'nation='+queryStr('nation')+'&';}
   if (a.indexOf('&emne=')<0 && a.indexOf('?emne=')<0){inserted=inserted+'emne='+queryStr('emne')+'&';}
   if (a.indexOf('&grp=')<0 && a.indexOf('?grp=')<0){inserted=inserted+'grp='+queryStr('grp')+'&';}
   a=a.substr(0,pos); if (inserted) {if (pos==0){a=a+'?';}else{a=a+'&';}a=a+inserted;}a=a+b.substr(pos+5);
   document.getElementsByTagName("A")[ia].href=a;
  }

  ia++;
 }
}

