jQuery.noConflict();
jQuery(function(){
	//Default Action
	//Hide all content
	jQuery(".mov_content").hide();
	
	//Activate first tab
	jQuery("ul.category li:first").addClass("active").show();
	
	//Show first tab content
	jQuery(".mov_content:first").show();
	
	//On Click Event
	jQuery("ul.category li").click(function() {
		//Remove any "active" class
		jQuery("ul.category li").removeClass("active");
		
		//Add "active" class to selected tab
		jQuery(this).addClass("active");
		
		//Hide all tab content
		jQuery(".mov_content").hide();
		
		//Find the rel attribute value to identify the active tab + content
		var activeTab = jQuery(this).find("a").attr("href");
		
		//Fade in the active content
		jQuery(activeTab).fadeIn('fast');
		
		return false;
	});
});

function loadMovie(mov_num,cm_type) {
	var mov_num;
	var cm_type;
	
	var callBack = function(val) {
		jQuery('iframe.watchmovies').attr('src',val);
		jQuery(this).blur();
		jQuery('html,body').animate({scrollTop:0},'slow');
		return false;
	}
	
	var errBack = function(e) {
		var errStr = 'ERROR: ' + e;
		var err_message = '申し訳ございません。只今調整中です。';
		jQuery('div#watchframe').text(errStr).css({
			'color':'red',
			'font-size':'14px',
			'padding-top':'100px'
		});
		alert(err_message);
		return false;
	}
	
	jQuery.ajax({
		'type': 'POST',
		'url' : 'cmgene.php',
		'data': {num:mov_num,cmtype:cm_type},
		'success': callBack,
		'error': errBack
	});
}
