$j(document).ready(function($){
	
	
	///////////////////////////////////////////////////////////////
	//embeds movie player.
	///////////////////////////////////////////////////////////////
	
	
	var api =  '';
	var api2 = '';
	
	(function () {
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
		var _d = '';
		for(var i = 0; i <hashes.length; i++) {
			var hash = hashes[i].split('=');
			if (hash[0] == '_d') _d = hash[1];
		}
		api =  '/api/?act=PR_FEATURE&ch_id=0&_d='+_d;
		api2 = '/api/?act=PR_FEATURE%26ch_id=0%26_d='+_d+'%26_t=';
	})();
	
	var flashvars = {
		firstPlayVideoId:"",
		confPath:(typeof(playlistXMLPath)!="undefined" && playlistXMLPath!="") ? playlistXMLPath:api //path from this html.
//		confPath:(typeof(playlistXMLPath)!="undefined" && playlistXMLPath!="") ? playlistXMLPath:"res710/images/content/player/playlist_xml_feed.xml" //path from this html.
		
	},
	params = {
		allowScriptAccess:'always',
		wmode:'transparent',
		play: "true",
		loop: "false",
		menu: "false",
		quality: "best",
		scale: "noscale",
		allowFullScreen: "true",
		salign: "lt"//,
		//base: "../res710/images/module/player-category/"
	},
	attributes = { };
	
	
	var $pTarg = $('#hero_module_category')
	,ipadInit = $.scope(this,function(d){
		
		//parseXML'n jQuery.
		$playlist = $(d);
		
		//Init Classes.
		vView = new gClasses.VideoView('hero_module_category',$playlist);
		vControl = new gClasses.VideoController($playlist,vView);
		
	})
	,pcInit = $.scope(this,function(d){
		
		//parseXML'n jQuery.
		$playlist = $(d);
		
		//$('#hero_module_category').html();
		if(chkFlaVer() == 0){
			
			$('#hero_module_category .noflash').css("display","block");
			
		}else{
			
			var fvPrefix = "#/?v="
			var fvid = window.location.href;
			if(fvid.lastIndexOf(fvPrefix)!=-1){
				fvid = fvid.substr(fvid.lastIndexOf(fvPrefix)+fvPrefix.length);
				if(fvid.lastIndexOf("&")!=-1) fvid = fvid.substr(0,fvid.lastIndexOf("&"));
				flashvars.firstPlayVideoId = fvid
			}
			flashvars.confPath = api2;
			swfobject.embedSWF("hero-module/hero-module-category-tv2.swf", "hero_module_category", "480px", "434px", "10", "../res710/images/module/common/expressInstall.swf", flashvars, params, attributes);
		}
	})
	;
	////////////////////////////// iPhone/iPad or PC //////////////////////////////
	if(spAgent.iPhone || spAgent.iPad){
		$pTarg.css({'height':'auto'});	
	}
	$.ajax({
		url: flashvars.confPath
		,dataType:'xml'
		,success: (spAgent.iPhone || spAgent.iPad) ? ipadInit : pcInit
		,error:function(request, status, eThrown){
			$pTarg.html(status);
		}
	});
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	/***************************************
	 * jQuery.blend
	 ***************************************/
	if(!$.browser.msie){
		$(".sbNavi_sub a").blend({speed:192,opacity:1});
		$("#left_column h3 a").blend({speed:192,opacity:1});
	}
	
	/***************************************
	 * side navigation set center
	 ***************************************/
	$('.sbBodyText').each(function(i,elm){
		var t = $(elm);
		t.css('margin-top',Math.max((t.parent().find('.thumb60x50').height()-t.height())/2,0))
	})
	
})

