var shorten = {
 byClass : function(t, c, l, e) {
  var o = get.tag(t);
  for(var i = 0, j = o.length; i < j; i++) {
   if(o[i].className == c) {
    var t = o[i].firstChild;
    if(t.length > l) {
     t.nodeValue = t.nodeValue.substring(0, l);
     if(t.nodeValue.substring(t.nodeValue.length - 1, t.nodeValue.length) == ' ')
      t.nodeValue = t.nodeValue.substring(0, t.nodeValue.length - 1);
     if(e)
      t.parentNode.innerHTML += e;
    };
   };
  };
 }
};
 
// Time table
var TimeTool = {
 heteren : { 
  maandag : '16:30 - 21:30',
  dinsdag : '09:00 - 12:00 16:30 - 21:30',
  woensdag : '16:30 - 21:30',
  donderdag : '09:00 - 12:00 16:30 - 21:30',
  vrijdag : 'gesloten',
  zaterdag : '09:00 - 12:00',
  zondag : 'gesloten'
 },
 renkum : {
  maandag : '08:00 - 13:00 16:30 - 22:00',
  dinsdag : '16:30 - 22:00',
  woensdag : '08:00 - 13:00 16:30 - 22:00',
  donderdag : '16:30 - 22:00',
  vrijdag : '08:00 - 13:00 16:30 - 22:00',
  zaterdag : 'gesloten',
  zondag : '09:00 - 13:00'
 },
 
 speed : 500,
 
 init : function() {
 
  /* Heteren Maandag */
  $( '.heteren_maandag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.heteren.maandag ); 
   $( '#ballon' ).css({ 'marginLeft' : '89px',
          'marginTop' : '15px',
          'display' : 'block' });
  });
   
  $( '.heteren_maandag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
  /* Heteren Dinsdag */
  $( '.heteren_dinsdag' ).mouseover( function() {
   $( '#ballon-big span' ).text( TimeTool.heteren.dinsdag ); 
   $( '#ballon-big' ).css({ 'marginLeft' : '89px',
          'marginTop' : '38px',
          'display' : 'block' });
  });
  
  $( '.heteren_dinsdag' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
   /* Heteren Woensdag */
  $( '.heteren_woensdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.heteren.woensdag ); 
   $( '#ballon ' ).css({ 'marginLeft' : '89px',
         'marginTop' : '87px',
         'display' : 'block' });
  });
   
  $( '.heteren_woensdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
    /* Heteren Donderdag */
  $( '.heteren_donderdag' ).mouseover( function() {
   $( '#ballon-big span' ).text( TimeTool.heteren.donderdag ); 
   $( '#ballon-big' ).css({ 'marginLeft' : '89px',
          'marginTop' : '97px',
          'display' : 'block' });
  });
   
  $( '.heteren_donderdag' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
    /* Heteren Vrijdag */
  $( '.heteren_vrijdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.heteren.vrijdag ); 
   $( '#ballon' ).css({ 'marginLeft' : '89px',
          'marginTop' : '125px',
          'display' : 'block' });
  });
   
  $( '.heteren_vrijdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
    /* Heteren Zaterdag */
  $( '.heteren_zaterdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.heteren.zaterdag ); 
   $( '#ballon' ).css({ 'marginLeft' : '89px',
         'marginTop' : '171px',
         'display' : 'block' });
  });
   
  $( '.heteren_zaterdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
     /* Heteren Zondag */
  $( '.heteren_zondag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.heteren.zondag ); 
   $( '#ballon' ).css({ 'marginLeft' : '89px',
         'marginTop' : '199px',
         'display' : 'block' });
  });
   
  $( '.heteren_zondag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
  
  
  /*renkum***********************************************/
  
  /* renkum Maandag */
  $( '.renkum_maandag' ).mouseover( function() {
   $( '#ballon-big span' ).text( TimeTool.renkum.maandag ); 
   $( '#ballon-big' ).css({ 'marginLeft' : '174px',
         'marginTop' : '31px',
         'display' : 'block' });
  });
   
  $( '.renkum_maandag' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
  /* renkum Dinsdag */
  $( '.renkum_dinsdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.renkum.dinsdag ); 
   $( '#ballon' ).css({ 'marginLeft' : '174px',
         'marginTop' : '58px',
         'display' : 'block' });
  });
   
  $( '.renkum_dinsdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
   /* renkum Woensdag */
  $( '.renkum_woensdag' ).mouseover( function() {
   $( '#ballon-big span' ).text( TimeTool.renkum.woensdag ); 
   $( '#ballon-big' ).css({ 'marginLeft' : '174px',
         'marginTop' : '87px',
         'display' : 'block' });
  });
   
  $( '.renkum_woensdag' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
    /* renkum Donderdag */
  $( '.renkum_donderdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.renkum.donderdag ); 
   $( '#ballon' ).css({ 'marginLeft' : '174px',
         'marginTop' : '115px',
         'display' : 'block' });
  });
   
  $( '.renkum_donderdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
    /* renkum Vrijdag */
  $( '.renkum_vrijdag' ).mouseover( function() {
   $( '#ballon-big span' ).text( TimeTool.renkum.vrijdag ); 
   $( '#ballon-big' ).css({ 'marginLeft' : '174px',
         'marginTop' : '143px',
         'display' : 'block' });
  });
   
  $( '.renkum_vrijdag' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
    /* renkum Zaterdag */
  $( '.renkum_zaterdag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.renkum.zaterdag ); 
   $( '#ballon' ).css({ 'marginLeft' : '174px',
         'marginTop' : '171px',
         'display' : 'block' });
  });
   
  $( '.renkum_zaterdag' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
     /* renkum Zondag */
  $( '.renkum_zondag' ).mouseover( function() {
   $( '#ballon span' ).text( TimeTool.renkum.zondag ); 
   $( '#ballon' ).css({ 'marginLeft' : '174px',
         'marginTop' : '199px',
         'display' : 'block' });
  });
   
  $( '.renkum_zondag' ).mouseout( function() {
   $( '#ballon' ).css({ 'marginLeft' : '174px',
         'marginTop' : '199px' });
  });
  
  
  $( '#ballon-big' ).mouseover( function() {
   $( '#ballon-big' ).css( 'display', 'block' );
  });
  
  $( '#ballon-big' ).mouseout( function() {
   $( '#ballon-big' ).css( 'display', 'none' );
  });
  
  $( '#ballon' ).mouseover( function() {
   $( '#ballon' ).css( 'display', 'block' );
  });
  
  $( '#ballon' ).mouseout( function() {
   $( '#ballon' ).css( 'display', 'none' );
  });
  
  
 } 
}
 
 
 
// When DOM is ready
$(document).ready(function () {
  TimeTool.init();
 
 $("#button").click(function () {
    $("#lightwindowOverlay ").css ({ 'display' : 'block',
          'opacity' : '0.7'  });
  
  $("#hidden-container").css({   'display' : 'block' });
    });    
 
  $("close").click(function () {
   $("#hidden").css( 'display', 'none' );
    });    
 
});
 

//-----> Preload images
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
//-----> Swap images 
 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
