function changeImages() {
if (document.images) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

//make a DOM element blink (on page load, with a certain number of iteration)
$(document).ready(function(){  
	var blinkCount = 3*2;// two blinks, 4*2 for four blinks
	do {
		$('#bottomtopmenuleft.index')['fade'+(blinkCount%2==0?'Out':'In')]('slow');
	} 
	while (--blinkCount);
});

jQuery(function( $ ){	
	$.scrollTo( 0 );//reset the screen to (0,0)
	//contentp, shows how to scroll the whole window
	$('#contentp a.slow').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 800, { offset:{ top:-130 } } );
		return false;
	});
	$('#floatingmenu a.slow').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 800, { offset:{ top:-130 } } );
		return false;
	});
});

$(function () {
    $('.expandInfo a').click(function () {
        $(this.hash).slideDown(1000);
        return false;
    });
    $('.closeInfo a').click(function () {
        $(this.hash).slideUp(1000);
        return false;
    });
})
//-->

jQuery(function( $ ){	
	$.scrollTo( 0 );//reset the screen to (0,0)
	$('#contentp').scrollTo( 0 );//reset all scrollable panes to (0,0)
	//contentp, shows how to scroll the whole window
	$('#contentp a.slow').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$('#contentp').scrollTo( this.hash, 800 );
		return false;
	});
	$('#floatingmenu a.slow').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$('#contentp').scrollTo( this.hash, 800 );
		return false;
	});
});
//text resizing
$(document).ready(function(){
  // Reset Font Size
  var originalFontSize = $("#textzone").css('font-size');
    $(".resetFont").click(function(){
    $("#textzone").css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
    var currentFontSize = $("#textzone").css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.1;
	 if  (  newFontSize  <  40  )  { 
	 $("#textzone").css('font-size',newFontSize); 
	 } 
	 return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
    var currentFontSize = $("#textzone").css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.9;
	 if  (  newFontSize  >  5	 )  { 
	 $("#textzone").css('font-size',newFontSize);
	 } 
	 return  false; 
   }); 
});

//floating menu init and definition of the mouseover/out (actually mouseenter/leave...)  effect
function nextUl(node)
{
  while (node != null && (node.tagName == null || node.tagName.toUpperCase() != "UL"))
  {
    node = node.nextSibling;
  }
  return node;
}

function addEvent(obj, evType, fn)
{
  if (obj.addEventListener)
  {
    obj.addEventListener(evType, fn, false);
    return true;
  }
  else
  if (obj.attachEvent)
  {
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  }
  else
  {
    return false;
  }
}

function addLoadListener(fn)
{
  if (addEvent(window, 'load', fn) == false)
  {
    return addEvent(document, 'load', fn)
  }
  return true;
}

function setupShowFltmenu()
{
  if(!document.getElementById) return false;
  if(!document.getElementById('floatingmenu')) return false;

  var floatmenu = document.getElementById('floatingmenu');

 $('div.in').hide(); 
 $(floatmenu).bind("mouseenter",function(){
		$('div.in').fadeIn("slow");
		floatmenu.style.opacity = 1;
      }).bind("mouseleave",function(){
        $('div.in').fadeOut("fast");
		floatmenu.style.opacity = 0.3;
      });
}
//Add to window.onload
addLoadListener(setupShowFltmenu);

