


function menu(a){	
	$(".menu li a:eq("+a+") ").css({'color':'#e9436a'});
}
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

$(function() { 
	$("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
});

$(document).ready(function(){
						   
    $(document).bind("contextmenu",function(e){
        return false;
    });						   
						   
$.tools.tabs.addEffect("slide", function(i, done) {
 
	this.getPanes().slideUp().css({backgroundColor: "#1b1a1a"});
 	this.getPanes().eq(i).slideDown(function()  {
		$(this).css({backgroundColor: 'transparent'});
		done.call();
	});
});
						   
	$('a[rel=tooltip]').mouseover(function(e) {
		var tip = $(this).attr('title');	
		$(this).attr('title','');
		$(this).append('<div id="tooltip"><div class="tipHeader"></div><div class="tipBody">' + tip + '</div><div class="tipFooter"></div></div>');		
	
		
	}).mousemove(function(e) {
		$('#tooltip').css('top', e.pageY + -80 );
/*		$('#tooltip').css('left', e.pageX + -380 );*/
		
	}).mouseout(function() {
		$(this).attr('title',$('.tipBody').html());
		$(this).children('div#tooltip').remove();
		
	});				   
	
	$("#sliderScroll").easySlider({});

    $.preloadCssImages();
  
    $("a[rel^='prettyPopin']").prettyPopin({
			modal : false, /* true/false */
			width : false, /* false/integer */
			height: false, /* false/integer */
			opacity: 0.7, /* value from 0 to 1 */
			animationSpeed: 'fast', /* slow/medium/fast/integer */
			followScroll: true, /* true/false */
			loader_path: 'images/prettyPopin/loader.gif', /* path to your loading image */
			callback: function(){} /* callback called when closing the popin */
		});
 
// Regular Expression to test whether the value is valid
$.tools.validator.fn("[type=time]", "Please supply a valid time", function(input, value) { 
	return /^\d\d:\d\d$/.test(value);
});
 
$.tools.validator.fn("[data-equals]", "Value not equal with the $1 field", function(input) {
	var name = input.attr("data-equals"),
		 field = this.getInputs().filter("[name=" + name + "]"); 
	return input.val() == field.val() ? true : [name]; 
});
 
$.tools.validator.fn("[minlength]", function(input, value) {
	var min = input.attr("minlength");
	
	return value.length >= min ? true : {     
		en: "Please provide at least " +min+ " character" + (min > 1 ? "s" : ""),
		fi: "Kentän minimipituus on " +min+ " merkkiä" 
	};
});
 
$.tools.validator.localizeFn("[type=time]", {
	en: 'Please supply a valid time',
	fi: 'Virheellinen aika'		
});
 
 
$("#myform").validator({ 
	position: 'top left', 
	offset: [-12, 0],
	message: '<div><em/></div>' // em element is the arrow
});
	
	
	
});

function abrir(a,e,b,c,d){
	if(document.all){var ventanaW=document.body.clientWidth;}
	else{var ventanaW=window.innerWidth}
	if(document.all){var ventanaH=document.body.clientHeight+150;}
	else{var ventanaH=window.innerHeight}
	var w = ventanaW/2;
	w = w-(b/2);
	var h = ventanaH/2;
	h = h-(c/2);
	window.open(a, e, 'width='+b+', height='+c+', top='+h+',left='+w+', scrollbars='+d+', location=0');
}


		

