// functions.js
function scrollTo(e){
if(jQuery("#"+e))	
jQuery('html, body').animate({scrollTop: jQuery("#"+e).offset().top}, 500)
}
// mySliding.js
var item_width = 381;
var item_height = 246;
var item_count;
var obj_id = "#moveable-area";
var current_img_pos = 1;
var normal_speed = 400; // millisecondes
var wait_delay = 5500;
var interval_id;

jQuery(document).ready(function(){
	item_count = jQuery(obj_id+" a").length;
	jQuery(obj_id).css("width",item_count*item_width+"px");
	jQuery(obj_id).css("height",item_height+"px");	
	interval_id = setInterval("slide('right', 1)",normal_speed+wait_delay);
});
function slide(direction, step) {	
	if ( step >= item_count ) {
		return false;
	}
	var speed = normal_speed/step;
	if ( direction=="right" && step==1 && current_img_pos==item_count ) {
		direction = "left";
		step = item_count -1;
	}
	var current_left = getNumericValue(jQuery(obj_id).css("left"));
	var move_length = step * item_width;
	if ( direction=="right" ) {		
		jQuery(obj_id).animate({
			'marginLeft' : "-="+ move_length+"px"
		},speed);		
		current_img_pos = current_img_pos + step;
	} else {		
		jQuery(obj_id).animate({
				'marginLeft' : "+="+ move_length+"px"
		},speed);	
		current_img_pos = current_img_pos - step;
	}
	jQuery("#page-area span.page_number").removeClass("selected");
	jQuery("#page-area span#page_number_"+current_img_pos).addClass("selected");
}
function selectPage(page_number) {
	clearInterval(interval_id);
	if ( page_number == current_img_pos ) {
		return false;
	}
	if ( current_img_pos < page_number ) {
		slide("right",page_number-current_img_pos);	
	}
	if ( current_img_pos > page_number ) {
		slide("left",current_img_pos-page_number);	
	}
	interval_id = setInterval("slide('right', 1)",normal_speed+wait_delay);
}
function getNumericValue(str) {
	return parseInt(str.replace("px",""));
}
// onload.js
jQuery().ready(function() {
	// validate the comment form when it is submitted
	//jQuery("#contactform").validate();

/* Wott: topmenu changed
	jQuery("ul.main_menu").superfish({
				pathClass : 'current'
			});
*/		

	jQuery("ul.sidemenu li a.active").parents("ul").prev('a')
			.addClass("active");
	jQuery("ul.sidemenu li a.active").parent("li").parent("ul").parent("li")
			.prev("li").children("a.solidblue").addClass("active");
	jQuery("ul.sidemenu").show();

	jQuery("a.imgbutton img").fadeTo("fast", 0.7);

	jQuery("a.imgbutton img").hover(function() {
		jQuery(this).stop().fadeTo("fast", 1);
		jQuery(this).parent().parent().find('a.sp_green2')
				.addClass('sp_green2_hover');
	}, function() {
		jQuery(this).stop().fadeTo("fast", 0.7);
		jQuery(this).parent().parent().find('a.sp_green2')
				.removeClass('sp_green2_hover');
	});

	jQuery("a.sp_green2").hover(function() {
		jQuery(this).parent().parent().find('a.imgbutton img').stop().fadeTo(
				"fast", 1);
	}, function() {
		jQuery(this).parent().parent().find('a.imgbutton img').stop().fadeTo(
				"fast", 0.7);
	});

	jQuery(".sfHover .submenu").attr('style',
			'display:block; visibility: visible;');
	jQuery(".about").mouseover(function() {
				jQuery("#about_menu").attr('style', 'visibility: visible;');
			});
	jQuery("#about_menu").mouseover(function() {
				jQuery("#about_menu").attr('style', 'visibility: visible;');
			}).mouseout(function() {
				jQuery(this).attr('style', 'visibility: hidden;');
			});

});

