/* Modified by Attila Pest, 2009-11-03 09:23:40 EST */

function miniphotos(len)
{
    var p = 1, i = 1;
    $("[id^='photo_']").each(function(){
      if ($(this).is(':visible')) p = i;
      i += 1;
    });
    if (p>=len) var n = 1;
    else var n = p+1;
    $('#photo_'+p).fadeOut("slow",function(){
      $('#photo_'+n).fadeIn("slow",function(){
        setTimeout("miniphotos(len)",5000);
      });
    });      
}

function logos(len2)
{
  random2 = Math.floor(Math.random()*len2)+1;
  current2 = 1;
  $("[id^='logo_']").each(function(){
    if ($(this).is(':visible')) {
      c2 = $(this).attr("id").split("logo_");
      current2 = c2[1];
    }
  });
  
  $("#logo_" + current2).fadeOut("slow",function(){
    $("#logo_" + random2).fadeIn("slow",function(){
        setTimeout("logos(len2)",5000);
    });
  });      
}


$(document).ready(function(){
    // FANCYBOX
  $("a.fancybox").fancybox({
    'overlayShow'     : false,
    'zoomSpeedIn'     : 600,
    'zoomSpeedOut'    : 500,
    'easingIn'        : 'easeOutBack',
    'easingOut'       : 'easeInBack'
  });
  
  len = $("[id^='photo_']").size();
  miniphotos(len);
  
  len2 = $("[id^='logo_']").size();
  logos(len2);
  
  $("#iDate").datepicker();
  
  $("#sh_1").click(function (event) {
      event.preventDefault(); 
      if ($("#senior").attr("class")=="show") $("#senior").attr("class","hide") ; 
      else $("#senior").attr("class","show") ;
  });
	$("#sh_2").click(function (event) {
      event.preventDefault(); 
      if ($("#sales").attr("class")=="show") $("#sales").attr("class","hide") ; 
      else $("#sales").attr("class","show") ;
  });
  
});