$(document).ready(function() {

   //change email address
   $("#email").each(function() {
    this.href = this.href.replace("(vymente-za-zavinac)", "@");
    this.innerHTML = this.innerHTML.replace("(vymente-za-zavinac)", "@");
   });
   
   //collapse all project descriptions
   $(".open").each(function() {
      this.className = "closed";
      $(this).bind("click", function() {
        if (this.className == "closed") {
          this.className = "open";
          $(this).next(".nonvisible").show("slow");
        } else {
          this.className = "closed";
          $(this).next(".nonvisible").hide("slow");
        }
      });
   });
   
   $(".visible").each(function() {
    this.className = "nonvisible";
   });
   
   
});

function switchVisibility(event) {
	var node, subNode;
	var original, originalRoot;
	
	node = getEventSrc(event);
	subNode = node;
	
	while (subNode.tagName != "DIV" && subNode.nextSibling != null) subNode = subNode.nextSibling;
	
	originalRoot = node.className;
	original = subNode.className;
	
	if (originalRoot == 'open') node.className ='closed'
		else node.className = 'open';
	if (original == 'visible') subNode.className ='nonvisible'
		else subNode.className = 'visible';
}

function convertToPrintableVersion() {
	$("#main_css").get(0).href = "style-print.css";
}
