/* Main Javascript file for InspiredMK.com */

// Delay function for jquery
$.fn.delay = function(time, callback){
    // Empty function:
    jQuery.fx.step.delay = function(){};
    // Return meaningless animation, (will be added to queue)
    return this.animate({delay:1}, time, callback);
}

// Function for switching images on mouseover event
function vdc_SimpleSwap(el,which) 
{
  el.src=el.getAttribute(which || "origsrc");
}

// Initial image swap page setup called from body.onload
function vdc_SimpleSwapSetup() 
{
  var x = document.getElementsByTagName("img");
  for (var i = 0; i < x.length; i++)
  {
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image -
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src = oversrc;

    // set event handlers
    x[i].onmouseover = new Function("vdc_SimpleSwap(this,\'oversrc\');");
    x[i].onmouseout = new Function("vdc_SimpleSwap(this);");

    // save original src
    x[i].setAttribute("origsrc", x[i].src);
  }
}
