/*-----------------------------------------------------
* Jaleador lightweight framework by jquery
	*Version: 0.91
	*Created: 2009.02.09
	*Last Modified: 2009.02.23
	*Author: Keisuke Mori;
	*Contact Me!: forestk.peace@gmail.com;
	*Requirements:
		*jQuery.js (ver. 1.3.1);
-----------------------------------------------------*/
/*-----------------------------------------------------
* Version History
	*Version: 0.90: Created!;
	*Version: 0.91: add Flash;

* Table of Contents
	*00 Common Setting
	*01 Information Page 
		*01-1 Shadowbox
	*02 Frequently asked Questions
		*02-1 Smooth Scroll & Highlight
	*03 Contact
		*03-1 Value Convertor
		*03-2 Focus
		*03-3 Default Focus
	*04 Main Page
		*04-1 Shadowbox
		*04-2 Other Information Audition
		*04-3 Confirm Your OS
		*04-4 Chrome's Javascript is toooo fast!
	*05 Color Of Life
		*05-1 Embed Windows Media Player
		*05-2 Embed Flash
	*06 Monthly Special
		*06-1 Shadowbox
		*06-2 Add Class
-----------------------------------------------------*/

var jaleador = $;

$(function() {

/*	=00 Common Setting
-----------------------------------------------------*/
	var bodyId = $(document.body).attr('id'); // Body Id

	var contactToTop = 900; // Scroll to Top
	var contactToAns = 900; // Scroll to Answer

	var contactToTopEase = 'easeInOutQuad'; // Scroll to Top
	var contactToAnsEase = 'easeInOutQuad'; // Scroll to Answer

	var contactHighLight = '#333333'; // Highlight Color
	var contactHighLightTime = 1800; // Highlight Time


/*	=01 Information Page (/member/)-----------------------------------------------------*/
	if( bodyId == 'info') {

/* =01-1 Shadowbox --------------------------*/
// to HTML (2009.04.25)

	}


/*	=02 Frequently asked Questions (/member/faq/)-----------------------------------------------------*/
	if( bodyId == 'faq') {

/* =02-1 Smooth Scroll & Highlight --------------------------*/
// Deleted... (2009.04.25)

	}


/*	=03 Contact (/member/contact/)-----------------------------------------------------*/
	if( bodyId == 'contact') {

/* =03-1 Value Convertor --------------------------*/
		var valueconvertor = '<script type="text/javascript" language="JavaScript" src="http://www.rockamenco.com/member/wp-content/themes/Jaleador/js/valueconvertor.js"></script>';
		$('link[rel=stylesheet]').after(valueconvertor);
		$('#mail').addClass('ascii');
		$('#re-mail').addClass('ascii');

/* =03-2 Focus --------------------------*/
		$('#contact input:text, #contact input:email, #contact textarea').focus(function() {
			$(this).parents('dd').prev('dt').css({ 'font-weight': 'bold' });
		}).blur(function() {
			$(this).parents('dd').prev('dt').css({ 'font-weight': 'normal' });
		});

/* =03-3 Default Focus --------------------------*/
		$('#subject').focus();

	}



/*	=04 Main Page (/member/home/)-----------------------------------------------------*/
	if( bodyId == 'main') {

		$('#noscript').hide();

/* =04-1 Shadowbox --------------------------*/
// to HTML (2009.04.25)


/* =04-2 Other Information Audition --------------------------*/
		var play1 = '<span id="media-player1" class="media-player">Play</span>';
		var play2 = '<span id="media-player2" class="media-player">Play</span>';
		var play3 = '<span id="media-player3" class="media-player">Play</span>';

		var player1 = '<span id="media-player1-on" class="media-player-on"><object type="application/x-shockwave-flash" data="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/01_viva-amor.mp3" width="200" height="20"><param name="wmode" value="transparent" /><param name="movie" value="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/01_viva-amor.mp3" /><\/object><\/span>';
		var player2 = '<span id="media-player2-on" class="media-player-on"><object type="application/x-shockwave-flash" data="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/02_jump-up.mp3" width="200" height="20"><param name="wmode" value="transparent" /><param name="movie" value="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/02_jump-up.mp3" /><\/object><\/span>';
		var player3 = '<span id="media-player3-on" class="media-player-on"><object type="application/x-shockwave-flash" data="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/03_pasa-la-vida.mp3" width="200" height="20"><param name="wmode" value="transparent" /><param name="movie" value="http://www.rockamenco.com/member/wp-content/uploads/media/sample/dewplayer-mini.swf?autostart=1&amp;mp3=http://www.rockamenco.com/member/wp-content/uploads/media/sample/03_pasa-la-vida.mp3" /><\/object><\/span>';

		$('#other-info .nojs').hide();
		$('.audition span').show();
		$('#audition1>span:first').css({'margin-right': '100px'}).after(play1);
		$('#audition2>span:first').css({'margin-right': '100px'}).after(play2);
		$('#audition3>span:first').css({'margin-right': '100px'}).after(play3);
		$('.audition span').live('mouseover',function(){
			$(this).addClass('hover');
		}).live('mouseout',function(){
			$(this).removeClass('hover');
		});
		$('#media-player1').live('click',function(){
			$('#audition1>span:first').css({'margin-right': '210px'});
			$('#media-player2-on:visible').replaceWith(play2);
			$('#media-player3-on:visible').replaceWith(play3);
			$('#audition2>span:first').css({'margin-right': '100px'});
			$('#audition3>span:first').css({'margin-right': '100px'});
			$(this).replaceWith(player1);
		});
		$('#media-player2').live('click',function(){
			$('#audition2>span:first').css({'margin-right': '210px'});
			$('#media-player1-on:visible').replaceWith(play1);
			$('#media-player3-on:visible').replaceWith(play3);
			$('#audition1>span:first').css({'margin-right': '100px'});
			$('#audition3>span:first').css({'margin-right': '100px'});
			$(this).replaceWith(player2);
		});
		$('#media-player3').live('click',function(){
			$('#audition3>span:first').css({'margin-right': '210px'});
			$('#media-player1-on:visible').replaceWith(play1);
			$('#media-player2-on:visible').replaceWith(play2);
			$('#audition1>span:first').css({'margin-right': '100px'});
			$('#audition2>span:first').css({'margin-right': '100px'});
			$(this).replaceWith(player3);
		});

/* =04-3 Confirm Your OS --------------------------*/
		if(navigator.userAgent.indexOf('Win') != -1 ){
			$('.mac').click(function() {
				var screenSaver = $(this).attr('href');
				if(window.confirm('こちらは Mac 用のスクリーンセーバーです。\nよろしいですか？')){
					location.href = screenSaver;
				} else { return false; }
			});
		}
		if(navigator.userAgent.indexOf('Mac') != -1 ){
			$('.win').click(function() {
				var screenSaver = $(this).attr('href');
				if(window.confirm('こちらは Windows 用のスクリーンセーバーです。\nよろしいですか？')){
					location.href = screenSaver;
				} else { return false; }
			});
		
		}

/* =04-4 Chrome's Javascript is toooo fast!? --------------------------*/
		var chromecss = '<link rel="stylesheet" type="text/css" href="http://www.rockamenco.com/member/wp-content/themes/Jaleador/css/style.css" />';
		$('#jaleadorjs').after(chromecss);

	}


/*	=05 Color Of Life (/member/memberID/)-----------------------------------------------------*/
	if( bodyId == 'col') {

		switch(file){
/* =05-1 Embed Windows Media Player --------------------------*/
			case 'wmv': 
				var wmplayer = '<object type="video/x-ms-wmv" data="'+wmv+'" width="'+width+'" height="'+height+'">\n';
				wmplayer += '	<param name="src" value="'+wmv+'" />\n';
				wmplayer += '	<param name="autoplay" value="false" />\n';
				wmplayer += '	<param name="controller" value="true" />\n';				wmplayer += '	<param name="ShowControls" value="true" />\n';				wmplayer += '	<param name="ControlType" value="2" />\n';
				wmplayer += '	<param name="Volume" value="-500" />\n';				wmplayer += '	<param name="AnimationatStart" value="true" />\n';				wmplayer += '	<param name="ShowStatusBar" value="true" />\n';				wmplayer += '	<param name="loop" value="false" />\n';
				wmplayer += '<\/object>';
			
				$('#wmv').css({
					'width': width,
					'height': height
				}).html(wmplayer);
				break;

/* =05-2 Embed Flash --------------------------*/
			case 'flash':
				$.getScript('http://www.rockamenco.com/member/wp-content/themes/Jaleador/js/jquery.flash.js', function () {
					setTimeout(function () {
						$('#flash').css({
							'width': width,
							'height': height
						}).text('').flash({
							src: flash,
							width: width,
							height: height
						});
					}, 1);
				});
				break;

		}

	}


/*	=06 Monthly Special (/member/special/)-----------------------------------------------------*/
	if( bodyId == 'special') {

/* =06-1 Shadowbox --------------------------*/
// to HTML (2009.04.25)

/* =06-2 Add Class --------------------------*/
		$('.hentry:first').addClass('first-child');

	}

});