
/*---------------------------------------------------
	movist 2005, the 7th edition
	GENERAL JS file definition 
	
	defined by fallove, crabby, rainy
	2005/09/05
---------------------------------------------------*/
var movist = "http://www.movist.com";


// ½ÃÀÛÆäÀÌÁö ¼³Á¤
function start()
{
	startpage.style.behavior='url(#default#homepage)';
	startpage.setHomePage('http://www.movist.com/');
}


////////////////////////////////////////////////////
//Flash Object È£Ãâ ÇÔ¼ö(°æ·ÎÆ÷ÇÔÆÄÀÏ¸í, ³ÐÀÌ, ³ôÀÌ)
function getFlash(fn, w, h)
{
	var str;
	str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + w + '" height="' + h + '" id="pp_m1" align="middle" wmode="transparent" >\n';
	str += '<param name="allowScriptAccess" value="sameDomain" />\n';
	str += '<param name=movie value="' + fn + '">\n';
	str += '<PARAM NAME=wmode VALUE=transparent>\n';
	str += '<param name=quality value=best>\n';
	str += '<param name=scale value=exactfit>\n';
	str += '<param name=bgcolor value="#ffffff">\n';
	str += '<embed src="' + fn + '" quality=best scale=exactfit bgcolor="#ffffff" width=' + w + ' height=' + h + ' type="application/x-shockwave-flash" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash"></embed>\n';
	str += '</object>\n';
	document.writeln(str);
}
/////////////////////////////
//ÀÌ¹ÌÁö ÇÁ¸®·ÎµùÀ» À§ÇÑ ÇÔ¼ö
function preloadimages()
{
	var myimages=new Array();
	for (i=0;i<preloadimages.arguments.length;i++)
		{
			myimages[i]=new Image()
			myimages[i].src=preloadimages.arguments[i]
		}
}
////////////////////
//ÄíÅ° ¹Þ¾Æ¿À´Â ÇÔ¼ö
function getCookie( name )
{
	   var nameOfCookie = name + "=";
	   var x = 0;
	   while ( x <= document.cookie.length )
	   {
			   var y = (x+nameOfCookie.length);
			   if ( document.cookie.substring( x, y ) == nameOfCookie ) {
					   if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
							   endOfCookie = document.cookie.length;
					   return unescape( document.cookie.substring( y, endOfCookie ) );
			   }
			   x = document.cookie.indexOf( " ", x ) + 1;
			   if ( x == 0 )
					   break;
	   }
	   return "";
}



////////////////////////////////////////////
//·Î±×ÀÎ½Ã ¾ÆÀÌµð ÆÐ½º Ã¼Å©¿ë ÇÔ¼ö
function formLogin()
{
	var fId = document.login.f_id.value;
	var fPass = document.login.f_password.value;

	if (fId == "" || fPass == "")
	{
		alert("[¹«ºñ½ºÆ®]¾ÆÀÌµð ¶Ç´Â ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		return false;
	}
}



////////////////////////////////////////////
//window open °ü·Ã
function openWindow(url, name)
{
	window.open(url, name, 'width=630,height=650,resizable=yes,scrollbars=yes');
}

function openWin(url, name, w, h)
{
	window.open(url, name, 'width='+w+',height='+h+',resizable=yes,scrollbars=yes');
}

function openIt(url, name, w, h)
{
	openWin(url, name, w, h);
}

function openWinFixed(url, name, w, h)
{
	window.open(url, name, 'width='+w+',height='+h+',resizable=no,scrollbars=no');
}

function openWinFixedScroll(url, name, w, h)
{
	window.open(url, name, 'width='+w+',height='+h+',resizable=no,scrollbars=yes');
}

function viewGallery(movie, tp, num)
{
	window.open(movist +'/movies/viewgallery.asp?mid='+movie+'&tp='+tp+'&num='+num,'vg','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=no,resizable=yes,width=830,height=900');
}

function viewMovistGallery(mst, num)
{
	window.open(movist +'/movies/viewmgallery.asp?mid='+mst+'&num='+num,'vg','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=no,resizable=yes,width=830,height=900');
}

function viewArticleGallery(aid, num)
{
	openWin(movist+'/focus/viewgallery.asp?aid='+aid+'&num='+num, 'vag', '850', '700');
}

function openVOD(movie, tp, sp, num, hid)
{
	window.open(movist+'/multi/mp.asp?movie='+movie+'&tp='+tp+'&sp='+sp+'&num='+num+'&hid='+hid, 'VOD2', 'width=780,height=485,resizable=no,scrollbars=no');
}

function openCPVOD(movie, tp, sp, num, hid)
{
	window.open(movist+'/multi/cpmp.asp?movie='+movie+'&tp='+tp+'&sp='+sp+'&num='+num+'&hid='+hid, 'VOD2', 'width=780,height=485,resizable=no,scrollbars=no');
}

function openCPVOD_nh(movie, tp, sp, num, hid)
{
	window.open(movist+'/multi/cpmp_nohd.asp?movie='+movie+'&tp='+tp+'&sp='+sp+'&num='+num+'&hid='+hid, 'VOD2', 'width=780,height=485,resizable=no,scrollbars=no');
}

function openCPVOD2_nh(article, tp, sp, num, hid)
{
	window.open(movist+'/multi/cpmp2_nohd.asp?article='+article+'&tp='+tp+'&sp='+sp+'&num='+num+'&hid='+hid, 'VODArticle', 'width=780,height=485,resizable=no,scrollbars=no');
}

function openVODH(num)
{
	window.open(movist+'/multi/view_high.asp?id='+num, 'VODH', 'width=535,height=576,resizable=no,scrollbars=no');
}

function openVODH_Movist(num)
{
	window.open(movist+'/multi/view_high_movist.asp?id='+num, 'VODH', 'width=535,height=576,resizable=no,scrollbars=no');
}

function openVOD2(article, tp, sp, num, hid)
{
	window.open(movist+'/multi/mp2.asp?article='+article+'&tp='+tp+'&sp='+sp+'&num='+num+'&hid='+hid, 'VODArticle', 'width=780,height=485,resizable=no,scrollbars=no');
}

function openVODH2(num)
{
	window.open(movist+'/multi/view_high2.asp?id='+num, 'VODHArticle', 'width=535,height=576,resizable=no,scrollbars=no');
}

function viewMedia(media, sp, hqid, tp, article)
{
	window.open(movist+'/multi/mplayer.asp?media='+media+'&sp='+sp+'&hqid='+hqid+'&tp='+tp+'&article='+article, 'viewMedia', 'width=780,height=485,resizable=no,scrollbars=no');
}

////////////////////////////////////////////
// °¢ ÆäÀÌÁö »ó´ÜÀÇ ³×ÀÌ°ÔÀÌ¼Ç ¹Ù ºÎºÐ Ãâ·Â 
function setCurPage(depth, page)
{
	if (page=="")
	{
		document.all["navCurPage"].innerHTML = depth;
	}else
	{
		document.all["navCurPage"].innerHTML = depth + "> " + page;
	}
}



//////////////////////////////////
// ÀÌ¹ÌÁö »çÀÌÁî¿¡ ¸Â°Ô ÆË¾÷ ¶ç¿ì±â 
function viewPic(img){
  foto1= new Image();
  foto1.src=(img);
  contImg(img);
}

function contImg(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewImg(img);
  }
  else{
    funzione="contImg('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewImg(img){
  var maxWidth = 1000;
  var maxHeight = 700;
  var nw = 0;
  var nh = 0;

  largh=foto1.width;
  altez=foto1.height;

  if(largh > maxWidth || altez > maxHeight){
	if(largh > altez){
		nw = maxWidth;
		nh = Math.round((altez*nw)/largh);
	}else{
		nh = maxHeight;
		nw = Math.round((nh*largh)/altez);
	}
  }else{
	nw = largh;
	nh = altez;
  }

  stringa="width="+(nw+17)+",height="+(nh+2)+", scrollbars=yes,resizable=yes";

  finestra=window.open(movist+"/inc/picview.asp?img="+img,"",stringa);
}


function movienote(mcode){
	if(mcode!=""){
		window.open(movist+'/mynote2005/default.asp?keyno='+mcode, 'myinfo'+mcode, 'width=785, height=532,resizable=no,scrollbars=no,top=50,left=265');
	}else
	{
		window.open(movist+'/mynote2005/', 'myinfo', 'width=785,height=532,resizable=no,scrollbars=no,top=50,left=265');
	}
}

function mymovienote(){
	window.open(movist+'/mynote2005/', 'myinfo', 'width=785,height=532,resizable=no,scrollbars=no,top=50,left=265');
}

function open_mynote(id,url)
{
	window.open('/mynote2005/?keyno='+id+'&url='+url, 'mynote2005', 'width=785,height=532')
}




////////////////////////////// ¾ÆÀÌµð ·Ñ¿À¹ö½Ã ¿µÈ­ ¼öÃ¸ ¸Þ´º ½ÃÀÛ  /////////////////////////////
 function showMenu(keyno){
	var mouseX, mouseY; 

	var noteicon = movist+"/images/icon/ico_movienote.gif";

	var MenuItemTitle=new Array();
		MenuItemTitle[0]="¿µÈ­ ¼öÃ¸";
		MenuItemTitle[1]="ÇÁ·ÎÇÊ";
		MenuItemTitle[2]="Áú¹® º¸±â";
		MenuItemTitle[3]="´äº¯ º¸±â";
		MenuItemTitle[4]="20ÀÚÆò º¸±â";
		MenuItemTitle[5]="¿µÈ­Æò º¸±â";
		MenuItemTitle[6]="¸Þ¸ðÀå";

	var MenuItemLink=new Array();
		MenuItemLink[0]=movist+"/mynote2005/?url=&keyno=";
		MenuItemLink[1]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=´ÚÅÍ/listMemberInfo.do?mem_code=";
		MenuItemLink[2]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=´ÚÅÍ/listMemberQuestion.do?ÆÄ¶÷";
		MenuItemLink[3]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=´ÚÅÍ/listMemberAnswer.do?ÆÄ¶÷";
		MenuItemLink[4]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=20review.asp?keyno=";
		MenuItemLink[5]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=mlist.asp?keyno=";
		MenuItemLink[6]=movist+"/mynote2005/?keyno=¸â¹öÄÚµå&url=note.asp?keyno=";


	menuContent = '<table cellpadding=1 cellspacing=0 border=0 bgcolor="#4EA7C9" style="cursor:default"><TR><TD><table cellpadding=0 cellspacing=3 border=0 bgcolor="#FFFFFF">';
	for(m=0;m<MenuItemTitle.length;m++){
		if(m==0)
			menuContent += '<tr height="17" onMouseOver="this.style.background=\'#EAFBFB\';" onMouseOut="this.style.background=\'#FFFFFF\';" onClick="parent.window.open(\'' + MenuItemLink[m].replace("¸â¹öÄÚµå",keyno) + keyno + '\', \'myinfo\', \'width=780, height=532,resizable=no,scrollbars=no,top=50,left=265\');"><td width="21" style="font-size: 9pt;" nowrap><img src="' + noteicon + '"></td><td nowrap>' + MenuItemTitle[m] + '</td></tr>';
		else
			menuContent += '<tr height="17" onMouseOver="this.style.background=\'#EAFBFB\';" onMouseOut="this.style.background=\'#FFFFFF\';" onClick="parent.window.open(\'' + MenuItemLink[m].replace("¸â¹öÄÚµå",keyno) + keyno + '\', \'myinfo\', \'width=780, height=532,resizable=no,scrollbars=no,top=50,left=265\');"><td width="21" style="font-size: 9pt;" nowrap></td><td nowrap>' + MenuItemTitle[m] + '</td></tr>';
	}
			menuContent += '<tr><td width="21" style="font-size: 9pt;" nowrap></td><td nowrap align="right" onclick="document.all[\'infopop\'].style.display = \'none\'"><img src="'+movist+'/images/icon/ico_x.gif"></td></tr>';
	menuContent += '</table></table>';


	var IE = document.all?true:false;
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
	var tempX = 0;
	var tempY = 0;

	if (IE) { 
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	}
	else {  
		tempX = e.pageX;
		tempY = e.pageY;
	}  
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}


	document.all["infopop"].innerHTML = menuContent;
	document.all["infopop"].style.left = tempX;
	document.all["infopop"].style.top = tempY;
	document.all['infopop'].style.display = ''  
}

////////////////////////////// ¾ÆÀÌµð ·Ñ¿À¹ö½Ã ¿µÈ­ ¼öÃ¸ ¸Þ´º ³¡  /////////////////////////////


////////////////////////////// °Ë»ö  /////////////////////////////
var sc_img = true;
function showPanel(num)
{
	switch (num)
	{
		case "integration"	: document.f_search.title.value = "°Ë»öÇÒ Å°¿öµå"; break;
		case "title"		: document.f_search.title.value = "¿µÈ­Á¦¸ñ"; break;
		case "keyword"		: document.f_search.title.value = "DVD Å¸ÀÌÆ²"; break;
		case "name" 		: document.f_search.title.value = "¿µÈ­ÀÎ ÀÌ¸§"; break;
		case "article"		: document.f_search.title.value = "°Ë»öÇÒ Å°¿öµå"; break;
		case "drmovist"		: document.f_search.title.value = "´ÚÅÍ¹«ºñ½ºÆ® °Ë»ö"; break;
	}
}

function bestsrch(tp,kwd)
{
	document.f_search.title.style.backgroundImage='';
	sc_img=false;
	document.f_search.tp.value = tp;
	document.f_search.title.value = kwd;
	return check_msearch();
}
document.write(""); 
function check_msearch(dt, dl, il)
{
	if (document.f_search.title.value=="" && sc_img==false)
	{
		alert("[¹«ºñ½ºÆ®]\n°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
		document.f_search.title.focus();
		return false;
	}else if(document.f_search.title.value=="" && sc_img==true)
	{
		parent.location.href=il;
	}else if (document.f_search.title.value=="undefined")
	{
		return false;
	}else
	{
		if(document.f_search.title.value==dt)
		{
			parent.location.href = dl;
		}
		else
		{
			switch (document.f_search.tp.value)
			{
				case "integration" :
					document.f_search.action = movist+"/movies/search_integ.asp";
					document.f_search.method = "get";
					break;

				case "title" :
					document.f_search.action = movist+"/movies/search.asp";
					document.f_search.method = "post";
					break;

				case "keyword" :
					document.f_search.action = movist+"/shop/search.asp";
					document.f_search.method = "get";
					break;

				case "name" :
					document.f_search.action = movist+"/movies/search2.asp";
					document.f_search.method = "get";
					break;

				case "article" :
					document.f_search.action = movist+"/article/search.asp";
					document.f_search.method = "get";
					break;

				case "drmovist" :
					document.f_search.action = "http://dr.movist.com/search.do";
					document.f_search.q.value = document.f_search.title.value;
					document.f_search.method = "post";
					break;
			}

			document.f_search.submit();
		}
	}

}
	function getKeyword(str, val) 
	{
		var SpecialWord = val.split("|");

		for (i=1; i < SpecialWord.length+1; i++) 
		{
			if(SpecialWord[i]==str.replace(' ', ''))
			{
				for (k=1; k < SpecialWord.length; k++) {

					document.all['div_srch'+k].style.display = 'none';
					
				}
				document.all['div_srch'+i].style.display = '';
				
			}
		}
		
	}


////////////////////////////// °Ë»ö ³¡  /////////////////////////////



/////////////////////////////
//onload½Ã ºÒ·¯Áö´Â ÇÔ¼ö
function onloadfunc()
{
	preloadimages('/images/text/menu_nowmovie_on.gif','/images/text/menu_comingmovie_on.gif','/images/text/menu_article_on.gif', '/images/text/menu_event_on.gif','/images/text/menu_comm_on.gif','/images/text/menu_ticket_on.gif', '/images/text/menu_vod_on.gif', '/images/text/menu_dvd_on.gif');
	
}



