wmtt = null;
 
document.onmousemove = updateWMTT;
 
function updateWMTT(e) {
  if (wmtt != null) {
	x = (document.all) ? window.event.x + wmtt.offsetParent.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + wmtt.offsetParent.scrollTop  : e.pageY;
	wmtt.style.left = (x + 20) + "px";
	wmtt.style.top   = (y + 20) + "px";
  }
}
 
function showWMTT(id) {
  wmtt = document.getElementById(1012);
  ajax_load_offer(wmtt,id);
  wmtt.style.display = "block";
  //document.getElementById(id).style.border = "1px solid red";
}

function ajax_load_offer(wmtt,id)
{
	var ajax = ajax_get_connection();
	
	ajax.open("GET", '/special_offers/load_offers.php?id=' + id, true);

	ajax.onreadystatechange = function(){            
		switch(ajax.readyState) {
			case 4:
				if(ajax.status!=200) {
					//alert("Fehler:"+ajax.status); 
				}else{    
					document.getElementById('1012').innerHTML = ajax.responseText;
				}
				break;
		
				default:
					return false;
				break;     
			}
		};
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send(null);
}

function ajax_get_connection()
{
try
	{
	   req = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (failed)
			{
				req = null;
			}
		}
	}
	if(req == null)
	{
		alert("Error! Konnte kein AJAX-Objekt erstellen!");
		return false;
	}
	else
		return req;
}
 
function hideWMTT(id) {
  wmtt.style.display = 'none';
  wmtt.style.innerHTML = '<img src="images/loading.gif" border="0">';
  document.getElementById(id).style.border = 'none';
}

function change_img(id) {
	document.main_img.src = '/special_offers/images/' + id;
}
