jQuery(document).ready(

	/*
	This function gets loaded when all the HTML, not including the portlets, is
	loaded.
	*/

	function() {
        if (document.all&&document.getElementById) {
            navRoot = document.getElementById("navigation");
            for (i=0; i<navRoot.childNodes.length; i++) {
                node = navRoot.childNodes[i];
                if (node.nodeName=="LI") {
                    node.onmouseover=function() {
                        this.className+=" over";
                    }
                    node.onmouseout=function() {
                        this.className=this.className.replace(" over", "");
                    }
                }
            }
        }
        
        //jQuery("#tabs").tabs();

    }

);

var iter = 0;
var stop = false;
var t;

function finishedAnimate1(){

    

    if( stop == true )
    { 
        jQuery( "#serv li" ).eq(0).find("a").attr("style", "" );
        jQuery( "#serv li" ).eq(1).find("a").attr("style", "" );
        jQuery( "#serv li" ).eq(2).find("a").attr("style", "" );
        jQuery( "#serv li" ).eq(3).find("a").attr("style", "" );
        return;
    }
    
    var $lli = jQuery( "#serv li" ).eq(iter);
    $lli.find("a").css("color", "#02779A" );
    //jQuery( "#serv li" ).eq(iter).trigger("mouseover");
    jQuery( "div#right ul." + jQuery.trim($lli.attr("lname")) ).show();
    setTimeout("finishedAnimate2()",1500);


};

function finishedAnimate2(){

    var $lli = jQuery( "#serv li" ).eq(iter);
    $lli.find("a").css("color", "#a4c8d6" );
    //jQuery( "#serv li" ).eq(iter).trigger("mouseout");
    jQuery( "div#right ul." + jQuery.trim($lli.attr("lname")) ).hide();
    
    iter++;
    if( iter > 3 )
    {
        iter = 0;
    }
    setTimeout("finishedAnimate1()",1500);
   

};


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) {
		
        // Initialise the table
        //jQuery(".table-1").tableDnD();
        //console.log( "I'm portlet id: " + portletId );

        if( portletId == "56_INSTANCE_6M9j" ) 
        {
         
            //jQuery("#tabs").tabs();

            //jQuery("p").animate({                "opacity": "show"                }, "slow", "easein" , finishedAnimate);
            //console.log( "I'm portlet id: " + portletId );
            //setInterval( "this.finishedAnimate1()", 5000 );
            finishedAnimate1();

        }else if( portletId == "56_INSTANCE_y5Lj" || "56_INSTANCE_ukE2" )
        {
        
            jQuery('.slideshow').cycle({ 
                fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
                speed: 100,
                timeout: 3000,
                next: '.slideshow',
                pause: 1
            }); 
        } 
        

        
    }
);

jQuery(document).last(

	/*
	This function gets loaded when everything, including the portlets, is on
	the page.
	*/

	function() {

          //jQuery('.zoomoutmenu').zoomtabs(15);
	}
);

function catIn(catid) {
    //console.log( catid );

    stop = true;
    //jQuery( this ).find("a").css("color", "#02779A" );
    clearTimeout( t );
    jQuery( "div#right ul." + jQuery.trim(catid) ).show();

};

function catOut(catid) {
    //alert("catIn");
    //jQuery( this ).find("a").css("color", "#ACACAC" );
    jQuery( "div#right ul." + jQuery.trim(catid) ).hide();
    stop = false;
    t = setTimeout( "this.finishedAnimate1()", 1000 );


};

function portfcatIn(obj) {
    //alert("portfcatIn");
//    jQuery(obj).children("a").children("div.portImg").hide();
//    jQuery(obj).children("a").children("div.portImgHL").show();
    jQuery(obj).children("a").children("div.portImg").css("display","none");
    jQuery(obj).children("a").children("div.portImgHL").css("display","block");;

};

function portfcatOut(obj) {
    //alert("portfcatIn");
    jQuery(obj).children("a").children("div.portImg").show();
    jQuery(obj).children("a").children("div.portImgHL").hide();

};








