var dp_char=".";

function format_ncd(src,ncd) {
	var n=parseFloat(src);
	if (isNaN(n)) n=0;
	src=""+n;
	var pt=src.indexOf(dp_char);//check for decimal point
	//alert(pt+src+1);
	if (pt==-1) {//had no decimal point
		src+=dp_char;
		pt=src.indexOf(dp_char);
	}
	while((pt+ncd+1)>src.length) src+="0";//add zeroes while needed
	src=src.substr(0,pt+ncd+1);//truncate if needed
	return src;
}

function format_euros(src) {return format_ncd(src,2)+" €";}

function getPosition(o) {return getPos(o,[0,0]);}
function getPos(o,p) {
	if (o==element.capImg.offsetParent) return p;
	p[0]+=o.offsetLeft;
	p[1]+=o.offsetTop;
	if (o.offsetParent) {
		//alert((o.offsetParent)+": "+o.offsetParent.tagName);
		p=getPos(o.offsetParent,p);
	}
	return p;
}

function getScrollingPosition() 
{ 
	position = [ 
		document.body.scrollLeft, 
		document.body.scrollTop 
	]; 
	return position; 
}

/*function posItem(foto,p) {
	//alert('posItem');
	//foto.filters[0].apply();
	var s=getScrollingPosition();
	foto.style.left=window.event.x+p[0]+s[0];
	foto.style.top=window.event.y+p[1]+s[1];
	foto.style.display='block';
	foto.style.visibility='visible';
	//foto.filters[0].play();
	//window.status=window.event.y;
}*/

