function pic_change(picsrc,h,b)
{
	  document.getElementById('picbig').height = document.getElementById('picbig').height
	  document.getElementById('picbig').width = document.getElementById('picbig').height*b/h
	  document.getElementById('picbig').src = picsrc
}

function slideshow (pfad,h_big,h_small) {

/* hier die den domainname eintragen */
var weburl = "http://www.fewos-henze.de/"

var req = null;
try {
  req = new XMLHttpRequest();
}
catch (e) {
  try {
    req = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e) {
    try {
      req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
      req = null;
    }
  }
}
/*----*/



function query_dir() {

	  if (req.readyState == 4 && req.status == 200) 
	  {
		  var xread = req.responseXML

		  document.getElementById('slideshow').style.textAlign = 'center'
		  document.getElementById('slideshow').style.display = 'inline'
      
		  w_big = h_big * xread.getElementsByTagName('picture')[0].firstChild.nextSibling.firstChild.nodeValue / xread.getElementsByTagName('picture')[0].firstChild.nextSibling.nextSibling.firstChild.nodeValue 

		  var content = '<table width="100%" style="table-layout: fixed;"><tr><td style="text-align: center;"><img id="picbig" height="'+h_big+'" width="'+w_big+'"'
		  content += 'src="'+weburl+'media/'+pfad+xread.getElementsByTagName("picture")[0].firstChild.firstChild.nodeValue+'" /></td></tr>'
		  content += '<tr style="height: 40px;"><td></td></tr><tr><td style="text-align: center;">'
      
      var w_all = 0
      
      var i = 0
      if (xread.getElementsByTagName("picture")[0].firstChild.firstChild.nodeValue == 'start.JPG' ||
          xread.getElementsByTagName("picture")[0].firstChild.firstChild.nodeValue == 'start.GIF' ||
          xread.getElementsByTagName("picture")[0].firstChild.firstChild.nodeValue == 'start.PNG'){
        i = 1
      }
		  for ( i; i < xread.getElementsByTagName("picture").length; i++){
			  
			  w_small = h_small * xread.getElementsByTagName('picture')[i].firstChild.nextSibling.firstChild.nodeValue / xread.getElementsByTagName('picture')[i].firstChild.nextSibling.nextSibling.firstChild.nodeValue
			  
        content += '<img onMouseOver="pic_change(this.src,this.height,this.width)" height="'+h_small+'" width="'+w_small+'" '
			  content += 'src="'+weburl+'/media/'+pfad+xread.getElementsByTagName("picture")[i].firstChild.firstChild.nodeValue+'" />&nbsp;'
        
        w_all += w_small
         
			  if (w_all >= 400){
          content += '<br />'
          w_all = 0
        }
				  
		  }
		  
		  content += '</td></tr></table>'
		  document.getElementById('slideshow').innerHTML = content

	  }
	}

  

	var url = weburl+"modules/slideshow/query_dir.php";
	var par = "dir="+pfad;
	req.open("POST", url, true);
	req.onreadystatechange = query_dir;
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.send(par);

}
