jQuery(function () {
  	jQuery('#popup a').click(function() {
		jQuery(this).parent().parent().parent().parent().parent().hide();
	});
		
   //scroll vertical
   jQuery.localScroll.defaults.axis = 'y';
   jQuery.localScroll();

  jQuery('.tableserv tr:visible td:nth-child(2)').addClass('fristtd');
  jQuery('.tableserv tr:visible td:nth-child(4)').addClass('secondtd');
  jQuery('.tableserv tr:visible td:nth-child(6)').addClass('thirdtd');
  
  jQuery('#servtable2 tr:visible td:nth-child(1)').addClass('fristcell');
  jQuery('#servtable2 tr:visible td:nth-child(2)').addClass('secondcell');
  jQuery('#servtable2 tr:visible td:nth-child(3)').addClass('thirdcell');
  
  //
  var tabContainers3 = jQuery('div#itemglossary > div');
  jQuery('#glossaytable td a').click(function () {
  tabContainers3.hide().filter(this.rel).fadeIn(500);

  jQuery('#glossaytable td a').removeClass('selected');
  jQuery(this).addClass('selected');

  return false;
 }).filter(':first').click(); 
  jQuery('div#itemglossary div').hide();
  jQuery('div#itemglossary #a0').show();
  
  
  
  
  citem=0;
  jQuery('#menuportop ul li').each(function(index) {
   citem++;
  });
 // alert(citem);
  rowWidth2=0;
  indexli2 =0;
  jQuery("#menuportop ul li").each(function () { 
	rowWidth2 += jQuery(this).width(); 	
	indexli2++;
  });
   rowWithtotal2=rowWidth2+(indexli2*29);
  //jQuery('#menufooter ul').css({'width': rowWithtotal2+'px'});
  //jQuery('#menufooter ul li:last').css({'background' : 'none'});
  
  
/*  jQuery('#cnext').click(function() {
  jQuery('#menuportop ul').animate({
    left: '-=100'
  }, 3000, function() {
    // Animation complete.
  });
  });
  
  jQuery('#cprev').click(function() {
  jQuery('#menuportop ul').animate({
    left: '+=100'
  }, 3000, function() {
    // Animation complete.
  });
  });*/
  
  
  // carousel
  jQuery('#menuportop').jcarousel({
		wrap: null,
		scroll: 2,
		initCallback: pCarousel.init,
		easing: 'linear',
		animation: pCarousel.animationSpeed,
		buttonPrevHTML: null,
		buttonNextHTML: null
  });
  
  
  
});

// function carousel
var pCarousel = {
	animationId: null,
	animationDir: 'right',

	//time in miliseconds to wait before scrolling
	animationTimeout: 3000,

	//time in miliseconds for the scrolling transition
	animationSpeed: 550,

	init: function(carousel) {
		// Disable autoscrolling if the user clicks the prev or next button.

		jQuery('a#cnext').bind('click', function() {
		        carousel.next();
			return false;
    		});

		jQuery('a#cprev').bind('click', function() {
			carousel.prev();
			return false;
		});


	}


};


function cyclemod(idmodule) {
jQuery(function() {

    jQuery('#contentport'+idmodule).cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:   1000, 
    	timeout: 2800,
    	pause: 1,
    	//pauseOnPagerHover: 1,
    	pager:  '#navport'+idmodule,
    	pagerAnchorBuilder: function(index, slide) {
        	return '<li><a href="#">' + slide.alt + '<\/a><\/li>'; // whatever markup you want
 		}
	});
	});

}



