window.iImagesCache=[];
function iImages() {
	var c,f,e,n,d=document.getElementsByTagName('IMG'),html='';
	for(i=0;i<d.length;i++) {
		c=d[i].className;
		if (c.substr(c.length-8)=='rollover') {
			f=d[i].src;
			e=f.substr(f.lastIndexOf('.'));
			f=f.substr(0,f.lastIndexOf('.'));
			f=f.substr(0,f.length-2);
			d[i].iImageSrc1=d[i].src;
			d[i].iImageSrc2=f+'_2'+e;
			html+='<img src="'+d[i].iImageSrc2+'">';
			html+='<img src="'+d[i].iImageSrc1+'">';
			if (d[i].addEventListener) {
				d[i].addEventListener("mouseover",iImageOver, false);
				d[i].addEventListener("mouseout",iImageOut, false);
			} else {
				d[i].onmouseover=iImageOver;
				d[i].onmouseout=iImageOut;
			}
		}
	}
	for(i=0;i<window.iImagesCache.length;i++)
	  html+='<img src="'+window.iImagesCache[i]+'">';
	if (html!='')
		document.write('<div style="position:absolute;left:0px;top:0px;visibility:hidden">'+html+'</div>');
}
function iImageOver() {
	this.src=this.iImageSrc2;
}
function iImageOut() {
	this.src=this.iImageSrc1;
}
function iImageCache(src) {
 	window.iImagesCache=window.iImagesCache.concat(src);
}
function iSelectClick(select,url) {
  url=url.replace(escape('__ID'),escape(select.value));
  window.location.href=url;
}
function iFavourites() {
	window.external.AddFavorite('http://www.medix.com.pl/','Medix sp. z o.o.');
}
window.iCalendarItems={};
function iCalendarItem(day,text) {
  h='';
  if (window.iCalendarItems[day])
  	h=window.iCalendarItems[day]+'<hr>';
  h+=text;
  window.iCalendarItems[day]=h;
}
function iCalendar(start,count) {
  weeks=Math.ceil((count+start)/7);
  html='';
  day=1-start;
  for(week=1;week<=weeks;week++) {
    html+='<tr>';
    for(wday=1;wday<=7;wday++) {
      if (window.iCalendarItems[day])
        html+='<td class=out onmouseover=iCalendarOver('+day+',this) onmouseout=iCalendarOut()>';
      else if (wday==6)
      	html+='<td class=so>';
      else if (wday==7)
      	html+='<td class=ni>';
      else
      	html+='<td>';
      if ((day>0)&&(day<=count)) {
        html+=day;
      } else html+=' ';
      html+='</td>';
      day++;
    }
    html+='</tr>';
  }
  document.write(html);
}
document.write('<div id=cal-alt class=cal-alt>Lorem ipsum</div>');
function iCalendarOver(day,cell) {
  if (!window.iCalendarDiv)
  	window.iCalendarDiv=document.getElementById('cal-alt');
  if (this===window.iCalendarDiv) {
    day=this.day;
    cell=this.cell;
  }
  if (window.iCalendarCell) {
    window.clearTimeout(window.iCalendarTimeout);
  	if (cell==window.iCalendarCell)
  	  return;
  	else
  	  iCalendarOutNow();
  }
  window.iCalendarCell=cell;
  cell.className='over';
  div=window.iCalendarDiv;
  div.style.left=(window.iMouseX+1)+'px';
  div.style.top=(window.iMouseY+1)+'px';
  div.style.visibility='visible';
  div.day=day;
  div.cell=cell;
  div.onmouseover=iCalendarOver;
  div.onmouseout=iCalendarOut;
  div.innerHTML=window.iCalendarItems[day];
}
function iCalendarOut() {
  window.iCalendarTimeout=window.setTimeout('iCalendarOutNow()',1000);
}
function iCalendarOutNow() {
  window.iCalendarCell.className='out';
  window.iCalendarDiv.style.visibility='hidden';
  window.iCalendarCell=false;
}
function iPhotoOpen(path,dx,dy) {
	dx+=18;
	dy+=20;
	window.open(path,'','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=yes,toolbar=no,width='+dx+',height='+dy+',left='+((screen.width-dx)/2)+',top='+((screen.height-dy)/2));
}
function iMouse(e) {
  if (e) {
    window.iMouseX=e.pageX;
    window.iMouseY=e.pageY;
  } else {
    window.iMouseX=event.x;
    window.iMouseY=event.y;
    if (document.body.addBehavior) {
    	window.iMouseX+=document.body.scrollLeft;
    	window.iMouseY+=document.body.scrollTop;
    }
  }
}
document.onmousedown=iMouse;
document.onmouseup=iMouse;
document.onmousemove=iMouse;
