if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
// here we define global variable
var ajaxdestination="";

function getdata(what,where) { // get data from source (what)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 //document.getElementById(where).innerHTML ="<center><img  src='images/loading.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
 xmlhttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what);
 xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4) if (xmlhttp.status == 200) 
    document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}

//image viewer
function Large(obj)
{
	if (document.images) {
	newImg = new Image();
	newImg.src = obj;
	}
	var height = newImg.height, 
		width = newImg.width, 
		ratio = width/height, 
		maxheight=550, 
		imgbox=document.getElementById("imgbox"), 
		bg=document.getElementById("bg"), 
		img = document.createElement("img");
				 
	imgbox.style.visibility='visible';
    bg.style.visibility='visible';
    img.src=obj;
	img.className='img';
	img.style.width=maxheight*ratio+'px';
    img.style.height=maxheight+'px';
	//img.addEventListener('click',Out,false);
	if(img.addEventListener){
        img.addEventListener('mouseout',Out,false);
    } else {
        img.attachEvent('onmouseout',Out);
    }    
    imgbox.innerHTML='';
    imgbox.appendChild(img);
}
function Out()
{
    document.getElementById("imgbox").style.visibility='hidden';
	document.getElementById("bg").style.visibility='hidden';
}
