var musicPlayNum = '';
var rightPlayNum = '';
var playNum = '';
/*
	Call by Click Event
	go to the Order Page
*/
function goOrder(orderUrl, contentsId, mcateCd, cpId, polyCd){
	var form = document.getElementById('frm');
	form.action = orderUrl;
	form.contentsId.value = contentsId;
	form.mcateCd.value = mcateCd;
	form.cpId.value = cpId;
	form.polyCd.value = polyCd;
	form.submit();
}
/*
	Call by Click Event
	go to the Order Page
*/
function goRightOrder(orderUrl, contentsId, mcateCd, cpId, polyCd){
	var form = document.getElementById('rightForm');
	form.action = orderUrl;
	form.contentsId.value = contentsId;
	form.mcateCd.value = mcateCd;
	form.cpId.value = cpId;
	form.polyCd.value = polyCd;
	form.submit();
}

/*
	Call by Click Event
	go to the Order Page
*/
function goOrderOfOther(formName, orderUrl, contentsId, mcateCd, cpId, polyCd){
	
	var form = eval("document.getElementById('"+formName+"')");
	
	form.action = orderUrl;
	form.contentsId.value = contentsId;
	form.mcateCd.value = mcateCd;
	form.cpId.value = cpId;
	form.polyCd.value = polyCd;
	form.submit();
}
		
function playMusic( idx ){
	document.getElementById("flashmplayer").receivedJavaScript('stop');			
			
	if(playNum != ""){
		var btnObj = eval('document.frm.btnMusic' + playNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
	}
			
	if(playNum == idx){
		var btnObj = eval('document.frm.btnMusic' + playNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
		playNum = '';
				
		return;
	}
            
	var param = new Object();
	param["filepath"]  	= eval('document.frm.filepath' + idx + '.value');
	param["filename"]  	= eval('document.frm.filename' + idx + '.value');
	param["artist"]  	= eval('document.frm.artist' + idx + '.value');
	param["title"]  	= eval('document.frm.title' + idx + '.value');
	param["order_url"]  = eval('document.frm.order_url' + idx + '.value');
	param["idx"]  		= idx;
      	 	
	MusicTonesPlayMusic.getDispFile(param, playMusicCallBack);	

}  
        
function playMusicCallBack(data){

	playNum = data['idx'];
	var btnObj = eval('document.frm.btnMusic' + playNum);
	btnObj.src = imgRoot + "/image/downloads/btn_pause_on.gif";
	document.getElementById("flashmplayer").receivedJavaScript('play', data['strDispUrl']);			
            
}
        
//-----------------------right Music-------------------------
function rightPlayMusic( idx ){
	document.getElementById("rightFlashmplayer").receivedJavaScript('stop');	
	if(rightPlayNum != ''){
		var btnObj = eval('document.rightForm.rightBtnMusic' + rightPlayNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
	}
	if(rightPlayNum == idx){
		var btnObj = eval('document.rightForm.rightBtnMusic' + rightPlayNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
		rightPlayNum = '';
				
		return;
	}
			
	var param = new Object();
	param["filepath"]  	= eval('document.rightForm.filepath' + idx + '.value');
	param["filename"]  	= eval('document.rightForm.filename' + idx + '.value');
	param["artist"]  	= eval('document.rightForm.artist' + idx + '.value');
	param["title"]  	= eval('document.rightForm.title' + idx + '.value');
	param["order_url"]  = eval('document.rightForm.order_url' + idx + '.value');
	param["idx"]  		= idx;
      	 	
	MusicTonesPlayMusic.getDispFile(param, rightPlayMusicCallBack);	

}  
        
function rightPlayMusicCallBack(data){
	
	rightPlayNum = data['idx'];
	var btnObj = eval('document.rightForm.rightBtnMusic' + rightPlayNum);
	btnObj.src = imgRoot + "/image/downloads/btn_pause_on.gif";
	document.getElementById("rightFlashmplayer").receivedJavaScript('play', data['strDispUrl']);			

}
        
//----------------other music play------------
function musicPlayMusic( idx ){
			
	document.getElementById("musicFlashmplayer").receivedJavaScript('stop');	
			
	if(musicPlayNum != ''){
		var btnObj = eval('document.musicFrm.btnMusic' + musicPlayNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
	}
	if(musicPlayNum == idx){
		var btnObj = eval('document.musicFrm.btnMusic' + musicPlayNum);
		btnObj.src = imgRoot + "/image/common/btn_sound_off.gif";
		musicPlayNum = '';
				
		return;
	}
			
	var param = new Object();
	param["filepath"]  	= eval('document.musicFrm.filepath' + idx + '.value');
	param["filename"]  	= eval('document.musicFrm.filename' + idx + '.value');
	param["artist"] 	= eval('document.musicFrm.artist' + idx + '.value');
	param["title"]  	= eval('document.musicFrm.title' + idx + '.value');
	param["order_url"]  = eval('document.musicFrm.order_url' + idx + '.value');
	param["idx"]  		= idx;
      	 	
	MusicTonesPlayMusic.getDispFile(param, musicPlayMusicCallBack);	

}  
        
function musicPlayMusicCallBack(data){
        
	musicPlayNum = data['idx'];
	var btnObj 	= eval('document.musicFrm.btnMusic' + musicPlayNum);
	btnObj.src 	= imgRoot + "/image/downloads/btn_pause_on.gif";
	document.getElementById("musicFlashmplayer").receivedJavaScript('play', data['strDispUrl']);	

}  

function goRightHowTo(part) {

	var form = document.getElementById('rightForm');
	form.action = urlRoot + "/downloads/howToUse.do?part="+part;
	form.submit();

}

function musicTonesDownFile(contentId, genreId, polyCd ){

	var form = document.getElementById('rightForm');
	form.action = urlRoot + "/downloads/downloadForPcLink.do";
	form.contentId.value = contentId;
	form.genreId.value = genreId;
	form.polyCd.value = polyCd;
	form.ctypeCd.value = "001";
	form.part.value = 'musictones';
	form.submit();		

}

function graphicsDownFile(contentId, genreId, ctypeCd ){

	var form = document.getElementById('rightForm');
	form.action = urlRoot + "/downloads/downloadForPcLink.do";
	form.contentId.value = contentId;
	form.genreId.value = genreId;
	form.ctypeCd.value = ctypeCd;
	form.part.value = 'graphics';
	form.submit();		

}	


function rightDetail(contentsId, genre, smGenre, selPhone){

	var form = document.getElementById('rightForm');
	form.action = urlRoot + "/downloads/games/mobiledetail.do";
	form.contentsId.value=contentsId;
	form.genre.value=genre;
	form.smGenre.value=smGenre;
	form.selPhone.value=selPhone;
	form.submit();

}