
/* facebox */
jQuery(document).ready(function($) {
     $('a[rel*=facebox]').facebox()
});


/* show/hide elements by id */
function toggleBlock(id) {
	var target = $('#' + id);

	if (target.is(':hidden')) {
		target.fadeIn();
	} else {
		target.fadeOut();
	}
}

/* show elements by id */
function showBlock(id) {
	var target = $('#' + id);
     target.fadeIn();
}

/* hide elements by id */
function hideBlock(id) {
	var target = $('#' + id);
     target.fadeOut();
}

/* show only element by id and hide all other elements with class .cntWrapper (content grids) */
function showOnlyBlock (id) {
	var delay = 333;
	var undisplay = $('.cntWrapper');
	for(var i=0; i<undisplay.length; i++) hideBlock(undisplay[i].id);
	setTimeout(function(){ showBlock(id); }, delay);
}

/* show,hide elements by comma-separated id list */
function displayUndisplay (undisp,disp) {
	var delay = 333;
	var display   = disp.split(',');
	var undisplay = undisp.split(',');
	for(var i=0; i<undisplay.length; i++) hideBlock(undisplay[i]);
	setTimeout(function(){ for(var i=0; i<display.length; i++) showBlock(display[i]); }, delay);
}

/* expandable box */
$(document).ready(function(){
    
     var slidespeed = 800;
     //hook the mouseup events to each header
     $(".toggle").mouseup(function(){
     
          //find the body whose header was clicked
          var head = $(this).parent().children(".toggle:first");
          var body = $(this).parent().children(".toggleof:first");
          var insideLists = $(this).parent().find("ul");
          
          //slide the panel
          if(body.is(":hidden")) {
               body.slideDown(slidespeed, function(){
                    insideLists.css("visibility","visible");
                    head.removeClass("toggledwn");
               });
          }
          else {
               insideLists.css("visibility","hidden");
               body.slideUp(slidespeed);
               head.addClass("toggledwn");
          }
     });
    
});

/* Text selection for embedded video code */
$(document).ready(function() {
  $(".focus").focus(function(){
    this.select();
	});
});

/* not used */
/*
$(document).ready(function() {
	$('div.block').hide();
});
*/



