// JavaScript Document
if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else{
window.onload=resizeCaller;
autoIframe('content');}

function toonpagina2(subj){ 
/*if (_link =='contact'){
document.all.content.src=_link+'.php?Titel=contact';
} else{*/
//document.all.content.src=content.php'.php?t='+_subj;

resizeIframe()
}
function toonpagina(slink){
	document.location='pagina.php?t=' + slink
//resizeIframe()
	
}
function autoIframe(frameId){
try{
frame = document.getElementById(frameId);
innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
objToResize = (frame.style) ? frame.style : frame;
objToResize.height = innerDoc.body.scrollHeight + 10;
}
catch(err){
window.status = err.message;
}
}

function Showpopup(url,w,h){
 intWindowLeft = (screen.width - w) / 2;
 intWindowTop = (screen.height - h) / 2;		
 window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',left=' + intWindowLeft + ',top=' + intWindowTop);	
}	
function loadINpopup(url,w,h){
 intWindowLeft = (screen.width - w) / 2;
 intWindowTop = (screen.height - h) / 2;		
 window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',left=' + intWindowLeft + ',top=' + intWindowTop);	
}

function popit(url,w,h){
 intWindowLeft = (screen.width - w) / 2;
 intWindowTop = (screen.height - h) / 2;		
 window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h + ',left=' + intWindowLeft + ',top=' + intWindowTop);	
}	

function oldresizeIframe() {

	// Must launched on the body onload event handler for IE
	// Use document.documentElement if you are in Compat mode
	i = parent.document.getElementById('content')
	iHeight = document.body.scrollHeight
	i.style.height = iHeight + "px"
}

function oiFrameHeight() {
if(parent.document.getElementById && !(document.all)) {
h = parent.document.getElementById('content').contentDocument.body.scrollHeight;
parent.document.getElementById('content').style.height = h;
}
else if(document.all) {
h = parent.document.frames('content').document.body.scrollHeight;
parent.document.all.content.style.height = h;
}
//alert(document.all.content.style.height)
}
var iframeids=["content"]
var iframehide="yes"

function resizeCaller() {
	var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"

}
}
}

function resizeIframe(frameid){
		var currentfr=document.getElementById(frameid)

if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight ; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight ;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadlink(url){
if (url=='main.php'){ url='main.php?p=Home';}
if (document.getElementById)
document.getElementById("content").src=url;
resizeCaller()
}

function num2money(n_value) {
	// validate input
	if (isNaN(Number(n_value)))
		return 'ERROR';

	// save the sign
	var b_negative = Boolean(n_value < 0);
	n_value = Math.abs(n_value);

	// round to 1/100 precision, add ending zeroes if needed
	var s_result = String(Math.round(n_value * 1e2) % 1e2 + '00').substring(0, 2);
	
	// separate all orders
	var b_first = true;
	var s_subresult;
	while (n_value >= 1) {
		s_subresult = (n_value >= 1e3 ? '00' : '') + Math.floor(n_value % 1e3);
		s_result = s_subresult.slice(-3) + (b_first ? '.' : ',') +  s_result;
		b_first = false;
		n_value = n_value / 1e3;
	}
	// add at least one integer digit
	if (b_first)
		s_result = '0.' +  s_result;

	// apply formatting and return
	return b_negative
		? '(€ ' + s_result + ')'
		: '€ ' + s_result;
}
// end of function CommaFormatted()

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
// end of function CurrencyFormatted()
function FormatBedrag(region,lookupFunc){
	return"&euro; "+parseInt(lookupFunc("{Prijs}")).toFixed(2);
}
/*---------------------------------------------------*/


/*/////////////////////////////////////////////////*/
/*$(document).ready(function(){
    $(function() {			 
		$("#inwinkelwagen").dialog({
			bgiframe: true,
			modal: true,
			autoOpen:false,
			buttons: {Ok: function() {$(this).dialog('close');}}//btns
		}); //dlg 
		$("#selectmaat").dialog({
			bgiframe: true,
			modal: false,
			autoOpen:false,
			buttons: {Ok: function() {$(this).dialog('close');}}//btns
		}); //dlg 

	});//fn
	
  });
///-------------------------winkelwagen messages-----------------------------/
var del_item;
  $(document).ready(function(){
    $(function() {
				 $(".delete_icon").click(function() 
				  {
                        var thisRow = $(this).parents("tr");
                        var del_item = $(this).parent().parent().attr("id"); 						
						$(thisRow).addClass('todelete');
						jqRow = $("#" + del_item);
						jqRow.addClass("todelete");
						jqRow.fadeOut("slow");
						$.get("process.php", {del: "",pos:del_item }, function(data){gettotals();$(verwijderd_msg).dialog();})
						
						jqRow.remove();
						$("#verwijderd_msg").dialog({
							bgiframe: true,
							modal: true,
							autoOpen:true,
							buttons: {Ok: function() {$(this).dialog('close');}}//btns
						}); //dlg 
				  });
				  
	});//fn
	
  });*/
  
//------------------------------------------bcrumbs-----------------------------//
/*function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var output = "<a href=\"/\">Home</a>  >  ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  for(var i in bits){
    output += "<a href=\"";
    for(y=1;y<x-i;y++){
      output += "../";
    }
    output += bits[i] + "/\">" + bits[i] + "</a>  >  ";
  }
  document.write(output + document.title);
}
*/
//-----------------------------------------------------
function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) { // by Paul Davis - http://www.kaosweaver.com
loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
 document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
 a=(loc.indexOf(defp)==-1)?1:2;for (i=0;i<(subs.length-a);i++) { subs[i]=makeCaps(unescape(subs[i]));
 document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');}
 if (nl==1) document.write("<br>");document.write('<span class="'+tStyle+'">'+document.title+'</span>');
}
function makeCaps(a) {
  g=a.split(' ');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
  return g.join(" ");
}
function getLoc(c) {
  var d="";if (c>0) for (k=0;k<c;k++) d=d+"../"; return d;
}


