//	TCC Custom JavaScript

jQuery(function(){
	jQuery("ul.tabs").tabs("div.panes > div");
	
	// begin tabbox transform table to ul/div code orig. from tabbox.tpl

	var tabbox_t = new Array();
	var tabbox_c = new Array();

	jQuery(".tabs_content table:first-child tbody:first-child tr:first-child th").each(function(intIndex){
		tabbox_t[intIndex] = jQuery(this).find('p').html();
	})

	jQuery(".tabs_content table:first-child tbody:first-child tr:nth-child(2) > td").each(function(intIndex){
		tabbox_c[intIndex] = jQuery(this).html();
	})
	var out = "<ul class='tabs'>";

	for (i=0;i<tabbox_t.length;i++) {
		out+="<li><a href='#'>"+tabbox_t[i]+"</a></li>"
	}

	out+="</ul>";

	for (i=0;i<tabbox_c.length;i++) {
		out+="<div class='tc_module'>"+tabbox_c[i]+"</div>"
	}

	jQuery(".tabs_content").html(out);

	// end tabbox code
	// tabs switching
	if(jQuery('.tabs').length > 0) {
		tabMaxHeight = 0;
		jQuery('.tc_module').each(function(){
			if(tabMaxHeight < jQuery(this).height()) {
				tabMaxHeight = jQuery(this).height();
			}
				jQuery(this).css({position: 'static', display: 'none'}).filter('.on').css({display: 'block'})
		});
		tabMaxHeight += 100;
	//	jQuery('.tabs_container').css({height: tabMaxHeight+'px'})
		jQuery('.tabs a').click(function(){
			jQuery('.tabs li').removeClass();
			jQuery(this).parent().addClass('on')
			ind = jQuery('.tabs a').index(jQuery(this));
			jQuery('.tabs_content .tc_module').hide();
			jQuery('.tabs_content .tc_module:eq('+ind+')').show();
			return false;
		});
	}
	
	jQuery('.tabs li a').eq(0).click();
});

var initScrollingItems=function(objectNode, parameters){
var scrollable = jQuery(objectNode).scrollable({
	'size':parameters.size,
	'loop':parameters.loop,
	'next':'.mynext',	// Prevents an interaction from the banners
	'prev':'myprev',		// Prevents an interaction from the banners
	'clickable':false
   }).circular()
      if(parameters.autoscroll){scrollable.autoscroll();}
      if(parameters.mousewheel){scrollable.mousewheel();}
}
