var min=8;
var max=18;
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}
function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}
function mainmenu(){
jQuery(" #nav li").hover(function(){
jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(300);
},function(){
jQuery(this).find('ul:first').fadeOut(300);
});
}
 
jQuery(document).ready(function(){					
mainmenu();
});
jQuery(document).ready(function() {
jQuery('.eco-dev').append('<span class="hover"></span>').each(function () {
  var $span = jQuery('> span.hover', this).css('opacity', 0);
  jQuery(this).hover(function () {
    $span.stop().fadeTo(500, 1);
  }, function () {
    $span.stop().fadeTo(500, 0);
  });
});
});
jQuery(document).ready(function() {
jQuery('.eco-data').append('<span class="hover"></span>').each(function () {
  var $span = jQuery('> span.hover', this).css('opacity', 0);
  jQuery(this).hover(function () {
    $span.stop().fadeTo(500, 1);
  }, function () {
    $span.stop().fadeTo(500, 0);
  });
});
});
jQuery(document).ready(function() {
jQuery('.eco-research').append('<span class="hover"></span>').each(function () {
  var $span = jQuery('> span.hover', this).css('opacity', 0);
  jQuery(this).hover(function () {
    $span.stop().fadeTo(500, 1);
  }, function () {
    $span.stop().fadeTo(500, 0);
  });
});
});
jQuery(document).ready(function() {
jQuery('.publications').append('<span class="hover"></span>').each(function () {
  var $span = jQuery('> span.hover', this).css('opacity', 0);
  jQuery(this).hover(function () {
    $span.stop().fadeTo(500, 1);
  }, function () {
    $span.stop().fadeTo(500, 0);
  });
});
});
/* jQuery(document).ready(function(){
jQuery(".accordion h3:first").addClass("active");
jQuery(".accordion p:not(:first)").hide();
jQuery(".accordion h3").click(function(){
jQuery(this).next("p").slideDown("slow")
.siblings("p:visible").slideUp("slow");
jQuery(this).toggleClass("active");
jQuery(this).siblings("h3").removeClass("active");
});
}); */
jQuery(document).ready(
/*
This function gets loaded when all the HTML, not including the portlets, is
loaded.
*/
function() {
}
);
Liferay.Portlet.ready(
/*
This function gets loaded after each and every portlet on the page.
portletId: the current portlet's id
jQueryObj: the jQuery wrapped object of the current portlet
*/
function(portletId, jQueryObj) {
}
);
jQuery(document).last(
/*
This function gets loaded when everything, including the portlets, is on
the page.
*/
function() {
}
);
ddaccordion.init({
headerclass: "silverheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
revealtype: "mouseover", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content
onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
animatespeed: "slow", //speed of animation: "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
function setFontPlus(id){
var size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 13;
} else {
size = size.substr(0,2);
}
if(size < 15) {
if(size == 14) {
size = eval(size) + 2;
} else {
size = eval(size) + 1;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
}
}// end setFontPlus
function setFontMinus(id){
var size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 11; 
} else {
size = size.substr(0,2);
} 
if(size > 11) {
if(size == 16) {
size = eval(size) - 2;
} else {
size = eval(size) - 1;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
}
}
function revertStyles(id){
var size = document.getElementById(id).style.fontSize;
if(size == "" || size == null) {
size = 12; 
} else {
size = size.substr(0,2);
} 
if(size > 10) {
if(size == 16) {
size = 12;
} else {
size = 12;
}
var fontSize = size + "px";
document.getElementById(id).style.fontSize=fontSize
}
changecss('body','color','black');
changecss('a','color','black');
changecss('a:hover','color','#7EACD6');
}
function changecss(theClass,element,value) {
//Last Updated on May 21, 2008
//documentation for this script at
//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
 var cssRules;
 if (document.all) {
 cssRules = 'rules';
 }
 else if (document.getElementById) {
 cssRules = 'cssRules';
 }
 var added = false;
 for (var S = 0; S < document.styleSheets.length; S++){
 for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
 if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
 if(document.styleSheets[S][cssRules][R].style[element]){
 document.styleSheets[S][cssRules][R].style[element] = value;
 added=true;
 break;
 }
 }
 }
 if(!added){
 if(document.styleSheets[S].insertRule){
 document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
 }
 else if (document.styleSheets[S].addRule) {
 document.styleSheets[S].addRule(theClass,element+': '+value+';');
 }
 }
 }
}
// end function changecss
function fontRed(){
changecss('body','color','red');
changecss('a','color','red');
changecss('a:hover','color','blue');
}
function fontBlue(){
changecss('body','color','blue');
changecss('a','color','blue');
changecss('a:hover','color','red');
}
function fontGreen(){
changecss('body','color','green');
changecss('a','color','green');
changecss('a:hover','color','blue');
}
jQuery(document).ready(function(){
jQuery(".lightbox").lightbox();
});
