// JavaScript Document

var troy_ounce=31.1034768; 

var http_request = false;

var bid = 0;

var ask =0;

var time = 0;

var change=0;

var error="";

  

function makeRequest(url, parameters) {

	http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...

    	http_request = new XMLHttpRequest();

        if (http_request.overrideMimeType) {

        	http_request.overrideMimeType('text/xml');

        	}

      } else if (window.ActiveXObject) { // IE

      		try {

            	http_request = new ActiveXObject("Msxml2.XMLHTTP");

         	} catch (e) {

            try {

               http_request = new ActiveXObject("Microsoft.XMLHTTP");

            } catch (e) {}

		}

      }

      if (!http_request) {

         alert('Cannot create XMLHTTP instance');

         return false;

      }

      http_request.onreadystatechange = alertContents;

      http_request.open('GET', url , false);

	  http_request.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");

	  http_request.setRequestHeader( "Pragma", "no-cache" );

   	  http_request.setRequestHeader( "Cache-Control", "no-cache" );

      http_request.setRequestHeader( "Expires", 0 );

      http_request.send(null);

   }

   function alertContents() {

      if (http_request.readyState == 4) {

         if (http_request.status == 200) {

            var xmldoc = http_request.responseXML;

			if(xmldoc.hasChildNodes()){

			var xauEur = xmldoc.selectSingleNode("//FEED/SPOT/XAUEUR").attributes

            bid = xauEur.getNamedItem("bid").value;

			ask = xauEur.getNamedItem("ask").value;

			time= xauEur.getNamedItem("timestamp").value;

			change=xauEur.getNamedItem("change").value;

			errorStr=xmldoc.parseError.srcText;

			}

		}

	  }

   }

function geld(bedrag){

var nr = bedrag;

var a=[];

nr +=""

a=nr.split(".");

n=a[0];

var b = [ ];

while(n.length > 3)

	{

		var nn = n.substr(n.length-3);

		b.unshift(nn);

		n = n.substr(0,n.length-3);

	}

	if(n.length > 0) { b.unshift(n); }

	n = b.join(".") + "," + a[1];

	return n;

}

function init(){

	setInterval( 'update()', 5000);

	checkIn();

}

function mouseX(evt) {

	if (!evt) evt = window.event;

	if (evt.pageX) return evt.pageX;

	else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft);

	else return 0;

}

	

function mouseY(evt) {

	if (!evt) evt = window.event;

	if (evt.pageY) return evt.pageY;

	else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);

	else return 0;

}

function dynDiv(path,foto1,foto2,foto3,e){

	calloutHTML="<div class='lijn'><div class='toe' onclick='hideDiv()'></div></div>"

	calloutHTML+="<div  class='left-foto' ><img src='" + path + "groot/" + foto1 + ".jpg' name='groteFoto' width='250'> </div>";

	calloutHTML+="	<div class='right-foto'>";

	calloutHTML+="  		<div class='topfoto' ><img src='" + path + "small/" + foto1 + ".jpg' onMouseOver=\"swap('" + path + "groot/" + foto1 + ".jpg')\"></div>" ;

	calloutHTML+="     		<div class='topfoto' ><img src='" + path + "small/" + foto2 + ".jpg' onMouseOver=\"swap('" + path + "groot/" + foto2 + ".jpg')\"/></div>";

	calloutHTML+="     		<div class='topfoto' ><img src='" + path + "small/" + foto3 + ".jpg' onmouseOver=\"swap('" + path + "groot/" + foto3 + ".jpg')\"/></div>";

	calloutHTML+="	</div>";

	if (!document.getElementById("foto")){

		var IE=document.all;

		xx=mouseX(e)

		yy=mouseY(e)

		var newdiv = document.createElement('div');

		newdiv.setAttribute('id', 'foto');

		newdiv.className='fotoCallout';

		newdiv.style.left = xx+10;

		newdiv.style.top = yy+40;

		newdiv.innerHTML = calloutHTML;

		document.body.appendChild(newdiv);

	}

}

function hideDiv(){

	if(document.getElementById('foto')){

		oldDiv=document.getElementById('foto')

		document.body.removeChild(oldDiv);

	}

}

function showpop(id,x,y) {

/* var obj1 = document.getElementById("proc-"+id); */

var obj1 = document.getElementById("content-frame");

var pos_left = obj1.offsetLeft + x ;

var pos_top = obj1.offsetTop + y;

document.getElementById("myToolTip-"+id).style.display = "inline";

document.getElementById("myToolTip-"+id).style.left =  pos_left + "px";

document.getElementById("myToolTip-"+id).style.top =  pos_top + "px";

document.getElementById("myToolTip-"+id).style.visibility = "visible";

}

function hidepop(id) {

document.getElementById("myToolTip-"+id).style.display = "none";

document.getElementById("myToolTip-"+id).style.visibility = "visible";

}