//###########
// 동영상 및 플래시
//###########
function GetMediaObject(SelectObject,Media,Width,Height)
{
	if(SelectObject == 'P')				//미디어 플레이어 일 경우
	{
		document.write("<object id='AniPlayer' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' width='" + Width + "' height='" + Height + "' style='FILTER:gray();z-index:-1;'>");
		document.write("<param name='URL' value='" + Media + "'>");
		document.write("<param name='AutoStart' value='true'>");
		document.write("<param name='Balence' value='0'>");
		document.write("<param name='Volume' VALUE='100'>");
		document.write("<param name='PlayCount' value='1'>");
		document.write("<param name='uiMode' value='full'>");
		document.write("<param name='BaseURL'>");
		document.write("<param name='EnableContextMenu' value='true'>");
		document.write("<param name='InvokeURLs' value='false'>");
		document.write("<param name='stretchToFit' value='true'>");		
		document.write("</object>");
	}
	else if(SelectObject == 'N')		//미디어 플레이어 툴바 없을 경우
	{
		document.write("<object id='AniPlayer' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' width='" + Width + "' height='" + Height + "' style='FILTER:gray();z-index:-1;'>");
		document.write("<param name='URL' value='" + Media + "'>");
		document.write("<param name='AutoStart' value='true'>");
		document.write("<param name='Balence' value='0'>");
		document.write("<param name='Volume' VALUE='100'>");
		document.write("<param name='PlayCount' value='1'>");
		document.write("<param name='uiMode' value='none'>");
		document.write("<param name='BaseURL'>");
		document.write("<param name='EnableContextMenu' value='false'>");
		document.write("<param name='InvokeURLs' value='false'>");
		document.write("<param name='stretchToFit' value='true'>");
		document.write("</object>");
	}
	else if(SelectObject == 'F')		//플래시 일 경우
	{
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' align='middle' width='" + Width + "' height='" + Height + "' >");
		document.write("<param name='movie' value='" + Media + "' />");
		document.write("<param name='quality' value='high' />");
		document.write("<param name='wmode' value='transparent' />");
		document.write("<param name='allowScriptAccess' value='always' />");
		document.write("<param name='base' />");
		document.write("<embed src='"+ Media +"' quality='high' wmode='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' allowscriptaccess='always' swliveconnect='true' align='middle' width='" + Width + "' height='" + Height + "' >");
		document.write("</object>");
	}
	else if(SelectObject == 'S')
	{
		document.write("<embed src='" + Media + "' width='" + Width + "' height='" +  Height + "'></embed>");
	}
}

function NMainTab(objidx)
{
	if (objidx == 1)
	{
		document.all.NMainImg1.src = '/Img/web_c_onair1.gif'
		document.all.NMainImg2.src = '/Img/web_c_preonair1.gif'
		document.all.now.style.display = "";
		document.all.soon.style.display = "none";
	}
	else if (objidx == 2)
	{
		document.all.NMainImg1.src = '/Img/now_off.gif'
		document.all.NMainImg2.src = '/Img/coming_on.gif'
		document.all.now.style.display = "none";
		document.all.soon.style.display = "";
	}
}

//############
//영화 정보 스틸컷 선택
//############
function MIStillCutSelect(ContentID,Num)
{
	document.ListForm.ContentID.value = ContentID;
	document.ListForm.Num.value = Num;
	document.ListForm.target = 'View';
	document.ListForm.submit();
}

function NewsSearch()
{
	var f = document.SearchForm;

	if (f.SearchText.value == '')
	{
		alert('검색 할 단어를 입력해 주세요.');
		f.SearchText.focus();
		return false;
	}

	f.submit();

}


//#################
//MNet 로그인 페이지 이동YN
function LoginYN(stat){
	if (confirm("인증이 필요한 페이지입니다.\n\n로그인 페이지로 이동 하시겠습니까?      ")!=0) {
		__CheckLogOn(stat);
	}
}
//#################

// 일반 결제
function Ready(ContentID,Quality,Code){
	var width = 352;
	var height = 310;
	var sw = screen.availWidth;
	var sh = screen.availHeight;
	var px = (sw - width) / 2;
	var py = (sh - height) / 2;

	var url = '/Pay/Ready.asp?ContentID='+ContentID+'&Quality='+Quality+'&Code='+Code;
	var wname = 'Pay_Ready';	
	var pos = 'left='+px+',top='+py+', width='+width+', height='+height+', Status=Yes';

	window.open(url,'Player_pop',pos);	
}


function ReadyTest(ContentID,Quality,Code){
	var width = 410;
	var height = 497;
	var sw = screen.availWidth;
	var sh = screen.availHeight;
	var px = (sw - width) / 2;
	var py = (sh - height) / 2;

	var url = '/Pay/ReadyTest071120.asp?ContentID='+ContentID+'&Quality='+Quality+'&Code='+Code;
	var wname = 'Pay_Ready';	
	var pos = 'left='+px+',top='+py+', width='+width+', height='+height+', Status=Yes';

	window.open(url,'Player_pop',pos);	
}

// 화보 결제
function ReadySN(ContentID,Quality,Code){
	var sw = (screen.width-352) / 2;
	var sh = (screen.height-310) / 2;
	
	var url = '/Pay/ReadySN.asp?ContentID='+ContentID+'&Quality='+Quality+'&Code='+Code;
	var wname = 'Pay_Ready';	
	var pos = 'left='+sw+',top='+sh+',Status=Yes';
	
	window.open(url,'Player_pop',pos);	
}

//애니 결제
function Pay_Division(Category,ContentID,SubContentID,Quality,Genre){
	var sw = (screen.width-350) / 2;
	var sh = (screen.height-320) / 2;

	var url = "/Pay/Ready.asp?Category="+Category+"&ContentID="+ContentID+"&SubContentID="+SubContentID+"&Quality="+Quality+"&Genre="+Genre;
	var wname = 'Pay_Ready';	
	var pos = 'left='+sw+',top='+sh+',Status=Yes';

	window.open(url,'Player_pop',pos);
}

//무협 결제
function Pay_Division_chi(Category,ContentID,Quality,subnum){
	var sw = (screen.width-350) / 2;
	var sh = (screen.height-320) / 2;

	var url = "/Pay/Ready.asp?Category="+Category+"&ContentID="+ContentID+"&Quality="+Quality+"&subnum="+subnum;
	var wname = 'Pay_Ready';	
	var pos = 'left='+sw+',top='+sh+',Status=Yes';

	window.open(url,'Player_pop',pos);
}

//검색 유효성 검사
//트림공백제거
String.prototype.trim = function()
{
    return this.replace(/(^[ \f\n\r\t]*)|([ \f\n\r\t]*$)/g, "");
}

function searchCheck()
{
	var f = document.searchForm;
	searchTextLength = f.searchText.value.trim()
	if (searchTextLength.length < 2)
	{
		alert('검색할 단어를 입력해 주세요.    \n☞ [검색글 수 : 2자 이상]');
		f.searchText.value = "";
		f.searchText.focus();
		return false;
	}
	f.submit();
}

//겔러리 포토보기
function GallerySelect(ContentID,Count)
{
	document.SelectForm.ContentID.value = ContentID;
	document.SelectForm.Count.value = Count;
	document.SelectForm.target = 'Photo';
	document.SelectForm.submit();
}



//#############
//팝업관련 쿠키 Setting
//#############
// 이부분부터  수정할 필요 없습니다.
function getCookie(name) { 
	var Found = false;
	var start, end;
	var i = 0;
	
	while(i <= document.cookie.length) { 
		start = i;
		end = start + name.length;
		if(document.cookie.substring(start, end) == name) {
			Found = true;
			break ;
		}
		i++ 
	} 
 
	if(Found == true) { 
		start = end + 1;
		end = document.cookie.indexOf(";", start);
		if(end < start) 
			end = document.cookie.length;
		return document.cookie.substring(start, end) 
	} 
	return "" 
} 
// 이부분 까지는 수정할 필요 없습니다. 
 
function openPopup(){ 
	var noticeCookie=getCookie("KorCJ_Pop080215");  // 쿠키네임 지정
	if (noticeCookie != "no") 
		window.open('/Movie/KorCJ_Pop080215.asp','KorCJ_Pop080215','width=400,height=300,top=150,left=150'); 
} 

function monthPay(){
	var width = 400;
	var height = 410;
	var sw = screen.availWidth;
	var sh = screen.availHeight;
	var px = (sw - width) / 2;
	var py = (sh - height) / 2;

	var url = '/Pay/OnlyMonthPay.asp';
	var wname = 'OnlyMonthPay';	
	var pos = 'left='+px+',top='+py+', width='+width+', height='+height+', Status=Yes';

	window.open(url, wname, pos);
}

//2008년 5월 이벤트::정액관 가입하고 이벤트 응모
function event200805Pay(flage){
	if (flage == "1to2")
	{
		if (confirm("스페셜 정액관 가입 후 이벤트에 응모하시겠습니까?       ")!=0)
		{
		}
		else{
			return false;
		}
	}
	var width = 400;
	var height = 500;
	var sw = screen.availWidth;
	var sh = screen.availHeight;
	var px = (sw - width) / 2;
	var py = (sh - height) / 2;

	var url = '/event/200805/eventPay.asp?flage='+flage;
	var wname = 'eventPay';	
	var pos = 'left='+px+',top='+py+', width='+width+', height='+height+', Status=Yes';

	window.open(url, wname, pos);		
}
function event200805Join(flage){
	if (flage == "inValidity")
	{
		if (confirm("이미 스페셜 정액관에 가입되어 있습니다. 이벤트에 응모하시겠습니까?       ")!=0)
		{
		}
		else{
			return false;
		}
	}
	document.event200805Form.submit();
}

//##장미인애 갤러리 결제 및 뷰어
function RoseReadySN(ContentID, subContentId){
	if (subContentId == "" || ContentID == ""){
		alert("system.msg :: galleryPayParam check!!!"+ contentId + " " + userId);
		return false;
	}
	var winWidth = 820, winHeight = 860;
	var sw = (screen.width-winWidth) / 2;
	var sh = (screen.height-winHeight) / 2;
	
	var url = '/Pay/RoseReadySN.asp?playContentId='+subContentId+'&paycontentID='+ContentID;
//	var url = "/player/galleryViewer.asp?playContentId=" + subContentId;
	var wname = 'RosegalleryPayment';	
	var pos = 'left='+sw+',top='+sh+', width='+winWidth+', height='+winHeight+', Status=Yes';
	
	window.open(url,'galleryPaymentPop',pos);	
}
 
 
 

