var $JQ = jQuery.noConflict();
         
function menuOver(e) 
{
   if (this.className.search(/\bopen\b/g) == -1) { this.className += ' open'; }
}

function menuOut(e) 
{
   this.className = this.className.replace(/\s*\bopen\b/g, '');
}

function menuItemOver(e) 
{
   if (this.className.search(/\bhover\b/g) == -1) { this.className += ' hover'; }
}

function menuItemOut(e) 
{
   this.className = this.className.replace(/\s*\bhover\b/g, '');
}

// Adds hover behavior to menu list elements
function enhanceMenu()
{
   if (document.all) 
   { // IE only
      var menu = document.getElementById('menu');

      if (menu) 
      {
         var ul = menu.getElementsByTagName('ul').item(0);

         if (ul) 
         {
            ul.onmouseover = menuOver;
            ul.onmouseout  = menuOut;
            ul             = null;
         }
   
         var lis = menu.getElementsByTagName('li');

         if (lis) 
         {
            for (var i = 0; i < lis.length; i++) 
            {
               var node = lis[i];

               // Add hover behavior
               node.onmouseover = menuItemOver;
               node.onmouseout  = menuItemOut;
               //
               node = null;
            }
            lis = null;
         }
         menu = null;
      }
   }
}

function initPage(e)
{
   e = e || window.event;

   enhanceMenu();
}

if (document.getElementById && document.getElementsByTagName) 
{
   window.onload = initPage;
}

/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */

this.imagePreview = function(){ 

/* CONFIG */
xOffset = 10;
yOffset = 30;

// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result

/* END CONFIG */
$JQ("a.preview").hover(function(e)
{
   this.t = this.title;
   this.title = "";     
   var c = (this.t != "") ? "<br/>" + this.t : "";
   $JQ("body").append("<p id='preview'><img src='"+ this.href +"' alt='Afbeelding wordt geladen...' />"+ c +"</p>");
   $JQ("#preview")
      .css("top",(e.pageY - xOffset) + "px")
      .css("left",(e.pageX + yOffset) + "px")
      .fadeIn("fast");
    },
      function()
      {
         this.title = this.t;
         $JQ("#preview").remove();
    });     

            $JQ("a.preview").mousemove(function(e){

                        $JQ("#preview")

                                   .css("top",(e.pageY - xOffset) + "px")

                                   .css("left",(e.pageX + yOffset) + "px");

            });                                

};

 

 

// starting the script on page load

$JQ(document).ready(function(){

            imagePreview();

});


