function xLoadScript(url)
{
  if (document.createElement && document.getElementsByTagName) {
    var s = document.createElement('script');
    var h = document.getElementsByTagName('head');
    if (s && h.length) {
      s.src = url;
      h[0].appendChild(s);
    }
  }
}


var imgs = document.getElementsByTagName('IMG');
for(i=0; i<imgs.length; i++) {
	var img = imgs[i];
	var VidSrc = img.src+'';
	var ext = VidSrc.substring(VidSrc.length-4, VidSrc.length).toLowerCase();
	if(ext!='.avi' && ext!='.mpg' && ext!='.mov') continue;
	img.id = 'imgvideo_'+i;
	var file = VidSrc.substring(VidSrc.indexOf(location.host)+location.host.length, VidSrc.length);
	var php = '/showvideo.php?id='+img.id+'&width='+img.offsetWidth+'&height='+img.offsetHeight+'&file='+file;
	xLoadScript(php);
}


