
/*
 iNum 070731, dcinside corp.
 Power Admin Class
*/


function HiddenPlay(cName){

	if(cName==null || cName=="") return errorStr("클래스 초기화 오류입니다.");
	this._AJC = new AjaxClass(cName+"._AJC");

	var hdDiv=null;
	var butodDiv=null;
	var hp_no=0;
	var HDIV = GEID('hiddenPlay');
	this.resetInfo = function(){
		hdDiv=null;
		butodDiv=null;
		hp_no=0;
	}

	this.resetHDIV = function(){
		HDIV.innerHTML="";
	}
	
	this.resetAll = function(){
		this.resetInfo();
		this.resetHDIV();
	}

	this.onLoad2 = function(no, butod, od, p_url){
		p_url = URLdecode(p_url, "URI");
		if(hdDiv!=null || hp_no==no) {
			try{
//				hdDiv.innerHTML="";
				HDIV.innerHTML="";
				butodDiv.className="hPlayBut_play";
				hdDiv=null;
				//butodDiv = null;
			}catch(e){
				HDIV.innerHTML="";
				hdDiv=null;
				butodDiv = null;
			}
		}
		if(hp_no==no){
			hp_no=0;
			return;
		}
		hdDiv = od;
		butodDiv = butod;
		hp_no=no;


		HDIV.innerHTML = "<iframe src='"+p_url+"' style='width:0px;height:0px;'></iframe>";
		butodDiv.className="hPlayBut_stop";


	}

	this.onLoad = function(no, butod, od){
		if(hdDiv!=null || hp_no==no) {
			try{
//				hdDiv.innerHTML="";
				HDIV.innerHTML="";
				butodDiv.className="hPlayBut_play";
				hdDiv=null;
				//butodDiv = null;
			}catch(e){
				HDIV.innerHTML="";
				hdDiv=null;
				butodDiv = null;
			}
		}
		if(hp_no==no){
			hp_no=0;
			return;
		}
		hdDiv = od;
		butodDiv = butod;
		hp_no=no;
		var query=[];
		query.push({name: "gid", value : G_ID});
		query.push({name: "mode", value:"HDP_ONLOAD"});
		query.push({name: "rno", value :no});
		this._AJC.getAHAHData("/ajdb.php", new Function(cName+".receive_onLoad();"), query);
	}

	this.receive_onLoad = function(){
		var dObj = convertFunc(this._AJC.getAHAH() );
		try{
			if(dObj.result) {
				HDIV.innerHTML = "<iframe src='"+dObj.data.hider+"' style='width:0px;height:0px;'></iframe>";
				//else hdDiv.innerHTML="<iframe src='"+dObj.data.hider+"' style='width:0px;height:0px;'></iframe>";

				/*
				if(dObj.data.hider.match(/^.+\.(wma|mp3|avi|mpeg|mp4|wmv|asf|swf)$/i)){
					hdDiv.innerHTML="'"+dObj.data.hider+"' autostart=\"true\" hidden=\"false\" loop=\"true\" width=0 height=0>";
				}else{
				*/
				
				butodDiv.className="hPlayBut_stop";
				
			}else {
				alert(URLdecode(dObj.msg, "URI"));
			}
		}catch(e){
			alert(e+"서버와의 통신이 원활치 않습니다. 잠시 후 다시 시도해 주십시오");
		}

	}

	this.mediaFileChk = function(o){
		if(o.value.match(/^.+\.(wma|mp3|avi|mpeg|mp4|wmv|asf|swf)[^.]*$/i)){
			alert("웹페이지만 등록시킬 수 있습니다.");
			o.value="";
		}else{

		}
	
	}


}