$(function() {
    //find all form with class jqtransform and apply the plugin


    //diaporamas
	//$("#chained").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({interval: 3000	});
	//$("#chained-product").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({interval: 3000	});

	//
		if ($('div#chained > div.items').children().length > 0) {
			$("div#chained").scrollable({
				initialIndex: 0,
				onBeforeSeek: function() { $("#chained p").fadeOut(0);},
				onSeek: function() { $("#chained p").fadeIn('slow'); },
				circular: true,
				mousewheel: true
			}).navigator().autoscroll({interval: 5000	});
	
			$("#chained-product").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({interval: 5000	});
		}
    //tabs
	//$("ul.tabs").tabs("div.panes > div");
	//$("ul.subtabs").tabs("div.subpanes > div");
	var api = $("ul.tabs").tabs("div.panes > div");
		var api = $("ul.tabs").data("tabs");
		$("#open-tab-avis").click(function() {
			api.click(2);
		});

	$("ul.subtabs").tabs("div.subpanes > div");


	// languages navigation
	$("ul.languages-navigation-subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.languages-navigation li").click(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.languages-navigation-subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.languages-navigation-subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

	// Sub navigation
       $("ul.sf-menu").superfish();

});


function OpenNewWindow(mypage,w,h,myname){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	settings='height=' +  h +',width='+ w +',top='+ wint +',left=' +winl+ ',scrollbars=yes,toolbar=no'
	win=window.open(mypage,myname,settings)
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

