/// <reference path="vsdocs\jquery-1.3.2-vsdoc2.js"/>
function pageLoad(sender, args) {
  if (args.get_isPartialLoad()) {
    docReady();
  }
}



  var people_baloon_positions = [
    [261, 5],
    [261, 10],
    [261, 0],
    [266, 5],
    [266, 10],
    [266, 0],
    [266, 5],
    [266, 10],
    [266, 0]
]
  var agita_baloon_people_interval_1 = null;
  var agita_baloon_people_interval_2 = null;

function agita_baloon_people(velocita) {
  switch (velocita) {
    case 1:
      agita_baloon_people_interval_1 = window.setInterval("agita_baloon_people_submit()", 50);
      break;
    case 2:
      agita_baloon_people_interval_2 = window.setInterval("agita_baloon_people_submit()", 25);
      break;
  }
}

  function agita_baloon_people_submit() {
    var position = Math.floor(Math.random() * 9);

    document.getElementById('hlLogo').style.left = people_baloon_positions[position][0] + 'px';
    document.getElementById('hlLogo').style.top = people_baloon_positions[position][1] + 'px';
  }

function ferma_baloon_people() {
  window.clearInterval(agita_baloon_people_interval_2)
  document.getElementById('hlLogo').style.left = '265px';
  document.getElementById('hlLogo').style.top = '5px';
}




 function docReady() {

  $("textarea").blur(function() {
    $("textarea").each(function() {
    this.value = this.value.replace(/<\s*\/\s*\w\s*.*?>|<\s*br\s*>/g, "");
    this.value = this.value.replace(/<\s*\w.*?>/g, "");
    });
  });


  
  $('ul#faqList').simpleFAQ({
    allowSearch: true,
    searchNode: '#faqSearch',
    minSearchScore: 0.5,
    sortSearch: true
  });

    $('#simpleFAQSearch').keyup(function(jQEvent, results) {
      // If the user has no search query, show all results
      if (this.value.length < 1) {
        $('ul#faqList li').show();
      }
    });
    $('ul#faqList li').show();

    var myFile = document.location.toString();
    if (myFile.match('#')) { // the URL contains an anchor
      // click the navigation item corresponding to the anchor
      var myAnchor = '#' + myFile.split('#')[1];
      $('ul#faqList li' + myAnchor + ' div' ).show();
    }
    


   $('#slideshow').cycle({
     fx: 'shuffle',
     /*shuffle: {
       top: 30,
       left: 120
     },*/
     delay: -6000,
     prev:   '#prev', 
     next: '#slideshow',
     after: onAfter
   });

   function onAfter() {
     $('#outputName').html(this.children[1].value);
     $('#outputDescription').html(this.children[2].value);
   }

   $('#pause').click(function() {
     $('#slideshow').cycle('pause');
     return false;
   });

   $('#next').click(function() {
    $('#slideshow').cycle('next');
    return false;
  });

  $("a.group").fancybox({
    'speedIn': 600,
    'speedOut': 200,
    'overlayShow': false
  });




   



   $('#txtSearchGoogleMaps').watermark('search google maps', { className: 'InputBoxWatermark' });

   
   // hides or show the panel as soon as the DOM is ready
   // (a little sooner than page load)
   var val = $("[id$='_hfSearchPanel']").val();
   
   if (val == 'hidden') {
     $('#divSearchPanel').hide()
   }
   if (val == 'shown') {
     $('#divSearchPanel').show();
     $('#imgSearchPanel').addClass("hide");
   }

   // toggles the panel on clicking the noted link
   $('a#aSearchPanel').click(function() {
     $('#imgSearchPanel').toggleClass("hide");
     $('#divSearchPanel').slideToggle(800);

     if ($('#imgSearchPanel').hasClass("hide")) {
       $("[id$='_hfSearchPanel']").val('shown');
       OnClientShow(); // to make the slider work in Chrome
       
     }
     else {
       $("[id$='_hfSearchPanel']").val('hidden');
     }
     return false;
   });

   // hides the slickbox as soon as the DOM is ready
   // (a little sooner than page load)
   //$('#divLoginForm').hide();

   // toggles the slickbox on clicking the noted link
   $('a#divLoginButton').click(function() {
     $('#imgShow').toggleClass("hide");
     $('#divLoginForm').slideToggle(400);
     return false;
   });


   // toggles the panel on clicking the noted link
   $('a#aInvitePanel').click(function() {
     $('#imgInvitePanel').toggleClass("hide");
     $('#divInvitePanel').slideToggle(800);
     return false;
   });

   // toggles the panel on clicking the noted link
   $('a#aSendMessage').click(function() {
     $('#imgSendMessage').toggleClass("hide");
     $('#divSendMessage').slideToggle(800);
     return false;
   });

   // toggles the panel on clicking the noted link
   $('a#aShowCV').click(function() {
     $('#imgShowCV').toggleClass("hide");
     $('#divShowCV').slideToggle(800);
     return false;
   });

   // toggles the panel on clicking the noted link
   $('a#ShowFeedbackForm').click(function() {
     $(this).parent().children("div:first-child").show(800);
     return false;
   });

   // toggles the panel on clicking the noted link
   $('a#CloseFeedbackForm').click(function() {
     $(this).parent().hide(880);
     return false;
   });

  



 }




  $(document).ready(function() {

  docReady();
});


