function asamaitem(itemId, imgName, w, h, t, l, track){
	/* VCO */
	$('#asama').append(
		$('<div>').attr("id", itemId).append(
			$('<img>').attr("src", "i/napit/" + imgName + ".jpg")
		).mouseover(function(){
			$(this).find('img').animate({"opacity" : "1"}, 200);
			EP_playTrack('ep_player1', track);
		}).mouseout(function(){
			$(this).find('img').animate({"opacity" : "0"}, 200);
			EP_stop('ep_player1');
		}).click(function(){
			$(this).find('img').animate({"opacity" : "1"}, 200);
			$(this).find('img').animate({"opacity" : "0"}, 200);
		}).css({
			width: w + "px",
			height: h + "px",
			top: t,
			left: l
		})
	);	
}



$(function(){
	if($('#menu_about').length > 0){
		$('#menu_about').mouseover(function(){
			$(this).css("background-image", "url('i/navi/about_on.png')");	
		}).mouseout(function(){
			$(this).css("background-image", "url('i/navi/about_off.png')");	
		});
	}
	
	if($('#menu_films').length > 0){
		$('#menu_films').mouseover(function(){
			$(this).css("background-image", "url('i/navi/films_on.png')");	
		}).mouseout(function(){
			$(this).css("background-image", "url('i/navi/films_off.png')");	
		});
	}
	
	if($('#menu_music').length > 0){
		$('#menu_music').mouseover(function(){
			$(this).css("background-image", "url('i/navi/music_on.png')");	
		}).mouseout(function(){
			$(this).css("background-image", "url('i/navi/music_off.png')");	
		});
	}
	
	if($('#menu_news').length > 0){
		$('#menu_news').mouseover(function(){
			$(this).css("background-image", "url('i/navi/news_on.png')");	
		}).mouseout(function(){
			$(this).css("background-image", "url('i/navi/news_off.png')");	
		});
	}



	/* ASAMA */
	if($('#asama').length > 0){
	
		//(itemId, imgName, w, h, t, l, track){
		asamaitem("ylapotikka_vas", "ylapotikka_vas", 88, 119, 0, 515, 0);
		asamaitem("ylaswitch_vas", "ylaswitch_vas", 59, 101, 15, 603, 1);
		asamaitem("ylaswitch_oik", "ylaswitch_oik", 49, 90, 16, 676, 2);
		asamaitem("ylapotikka_oik", "ylapotikka_oik", 91, 99, 7, 733, 3);		
		asamaitem("rate", "rate", 102, 96, 138, 501, 4);
		asamaitem("mode", "mode", 86, 86, 138, 627, 5);
		asamaitem("sweep", "sweep", 85, 85, 138, 759, 6);
		asamaitem("volume", "volume", 95, 90, 240, 445, 7);
		asamaitem("decay", "decay", 84, 79, 251, 576, 8);
		asamaitem("vco", "vco", 126, 116, 223, 675, 9);
		asamaitem("rev_volume", "rev_volume", 88, 84, 396, 452, 10);
		asamaitem("rev_decay", "rev_decay", 88, 86, 396, 567, 11);
		asamaitem("rev_vco", "rev_vco", 136, 124, 382, 668, 12);
		asamaitem("rev_rate", "rev_rate", 83, 89, 497, 514, 13);
		asamaitem("rev_mode", "rev_mode", 88, 82, 504, 627, 14);
		asamaitem("rev_sweep", "rev_sweep", 75, 75, 518, 759, 15);
		asamaitem("alapotikka_vas", "alapotikka_vas", 83, 90, 592, 527, 16);
		asamaitem("alaswitch_vas", "alaswitch_vas", 45, 60, 603, 610, 17);
		asamaitem("alaswitch_oik", "alaswitch_oik", 49, 59, 606, 680, 18);
		asamaitem("alapotikka_oik", "alapotikka_oik", 84, 85, 606, 739, 19);
		
		////////////////////////////////////////////////////////////////////////////
		var flashvars = {};
		flashvars.skin 		= 'mp3_play/skins/basic_silver/skin.xml';
		flashvars.playlist 	= 'asama_playlist.php';
		flashvars.autoplay 	= 'false';
		flashvars.volume 	= '80';
		flashvars.shuffle 	= 'false';
		flashvars.key 		= '3SJ9JJVUBYJA12J41GYJ';
		
		////////////////////////////////////////////////////////////////////////////
		var params = {};
		params.allowScriptAccess = 'always';
		
		////////////////////////////////////////////////////////////////////////////
		var attributes = {};
		attributes.id = 'ep_player1';
		
		////////////////////////////////////////////////////////////////////////////
		swfobject.embedSWF(
			'mp3_play/ep_player.swf', 			// the location of the swf file
			'player', 			// the id of the div to print the player in 
			'1', '1', 				// the width and height of the player
			'10.0.0',					// the required flash version 
			false,						// we've disabled express-install to keep it simple
			flashvars,
			params,
			attributes
		);
		
		var i = 0;
		for(i = 0; i < $('#asama div').length; i++){
			setTimeout("$('#asama div:nth-child(" + (i+1) + ")').click();", i * 200);		
			//setTimeout("$('#asama div:nth-child(" + (i+1) + ")').mouseout();", i * 100 + 90);		
			
		}

	}
	/* ASAMA */













	if($('#asama_music').length > 0){
		////////////////////////////////////////////////////////////////////////////
		var flashvars = {};
		flashvars.skin 		= 'mp3_play/skins/basic_silver/skin.xml';
		flashvars.playlist 	= '/music_playlist.php';
		flashvars.autoplay 	= 'false';
		flashvars.volume 	= '80';
		flashvars.shuffle 	= 'false';
		flashvars.wmode		= 'transparent';
		flashvars.key 		= '3SJ9JJVUBYJA12J41GYJ';
		
		////////////////////////////////////////////////////////////////////////////
		var params = {};
		params.allowScriptAccess = 'always';
		
		////////////////////////////////////////////////////////////////////////////
		var attributes = {};
		attributes.id = 'ep_player_music';
		
		////////////////////////////////////////////////////////////////////////////
		swfobject.embedSWF(
			'mp3_play/ep_player.swf', 			// the location of the swf file
			'player', 			// the id of the div to print the player in 
			'463', '420', 				// the width and height of the player
			'10.0.0',					// the required flash version 
			false,						// we've disabled express-install to keep it simple
			flashvars,
			params,
			attributes
		);	
	}
	
});



