var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function showdivleft(){
	var divtext = '<div id=\"divMenu\" style=\"position:absolute; left:851px; top:116px; width:120px; height:255px\">';
	divtext += '<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"120\" height=\"255\">';
	divtext += '<tr valign=\"top\">';
	divtext += '<td background=\"/images/quickmenu_bg(s).gif\" align=\"center\">';
	divtext += '<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">';
	divtext += '<tr><td height=\"37\"></td></tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/Perfsale/PerfSaleList.aspx"><img src=\"/images/quickmenu_02.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/Board/BoardPages.aspx?mid=2&pid=-1"><img src=\"/images/quickmenu_03.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/Board/BoardPages.aspx?mid=1"><img src=\"/images/quickmenu_05.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/Board/BoardPages.aspx?mid=10&pid=-1"><img src=\"/images/quickmenu_07.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/FAQ/FAQ_membership.aspx"><img src=\"/images/quickmenu_04.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"/Home/Board/AuditionList.aspx"><img src=\"/images/quickmenu_08.gif\"></a></td>';
	divtext += '</tr>';
	divtext += '</table>';
	divtext += '</td>';
	divtext += '</tr>';
	divtext += '</table>';
	divtext += '<table border=0 cellpadding=0 cellspacing=0>';
	divtext += '<tr><td height=2> </td></tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"http://blog.daum.net/seensee-play" target="_blank"><img src=\"/images/banner/bnrmother.jpg\"></a></td>';
	divtext += '</tr>';
	divtext += '<tr>';
	divtext += '<td><a href=\"http://blog.daum.net/seensee-play" target="_blank"><img src=\"/images/banner/bnr_college.jpg\"></a></td>';
	divtext += '</tr>';
	divtext += '</table>';
	divtext += '</div>';

	//divtext += '<div id=divEvent style="width:120px;height:174px;position:absolute;left:851px;top:382px;z-index:1;visibility:visible;">';
	//divtext += '<table border=0 cellpadding=0 cellspacing=0>';
	//divtext += '<tr><td height=10> </td></tr>';
	//divtext += '<tr>';
	//divtext += '<td><a href=\"http://www.namhansansung.co.kr/" target="_blank"><img src=\"/images/banner/leftbanner1.jpg\"></a></td>';
	//divtext += '</tr>';
	//divtext += '</table>';
        //divtext += '</div>';
	//divtext += '<DIV id="divPos" style="width:300px;height:100px;position:absolute;left:851px;top:106px;z-index:1;visibility:visible;"></DIV>';
	document.write(divtext);

	RefreshStaticMenu();
/*	if (isNS4) {
		var divMenu = document["divMenu"];
		divMenu.top = top.pageYOffset + 50;
		divMenu.visibility = "visible";

		var divEvent = document["divEvent"];
		divEvent.top = top.pageYOffset + 280;
		divEvent.visibility = "visible";

		moveRightEdge();
	}else if (isDOM) {
		var divMenu = getRef('divMenu');
		var divEvent = getRef('divEvent');
		
		divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 150;
		divMenu.style.visibility = "visible";

		divEvent.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 380;
		divEvent.style.visibility = "visible";

		moveRightEdge();
	}*/
}
//------------------------------------------------------------
var stmnGAP1 = 116; 
var stmnGAP2 = 116; 
var stmnActivateSpeed = 150;
var stmnScrollSpeed = 20;

var stmnTimer;

function RefreshStaticMenu()
{
	var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

	stmnStartPoint = parseInt(divMenu.style.top, 10);
	
	if(document.body.scrollTop + stmnGAP2 > document.body.scrollHeight - 370/*ÄÜÆ®·ÑÀÇ ÃÑ³ôÀÌ*/)
		stmnEndPoint = document.body.scrollTop + 10;
	else
		stmnEndPoint = document.body.scrollTop + stmnGAP2;
		
	//divPos.innerHTML = "" + stmnStartPoint + " " + stmnEndPoint + " " + (document.body.scrollHeight - 370) + " " + document.body.scrollTop;
	
	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

	stmnRefreshTimer = stmnActivateSpeed;

	if ( stmnStartPoint != stmnEndPoint ) 
	{
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		divMenu.style.top = parseInt(divMenu.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
		//divPos.style.top = parseInt(divMenu.style.top,10) - 10;
		//divEvent.style.top = parseInt(divMenu.style.top,10) + 230;
		stmnRefreshTimer = stmnScrollSpeed;
	}

	//stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

//------------------------------------------------------------
function moveRightEdge() {
	var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;

	if (isNS4) {
		yMenuFrom   = leftdiv.top;
		yMenuTo     = windows.pageYOffset;   // À§ÂÊ À§Ä¡
	} else if (isDOM) {
		yMenuFrom   = parseInt (divMenu.style.top, 10);
		yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 116; // À§ÂÊ À§Ä¡
	}
	timeoutNextCheck = 40;

	if (yMenuFrom != yMenuTo) {
		yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
		if (yMenuTo < yMenuFrom)
			yOffset = -yOffset;
		if (isNS4)
			leftdiv.top += yOffset;
		else if (isDOM)
		{
			divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
			//divEvent.style.top = parseInt (divEvent.style.top, 10) + yOffset;
		}
		
		timeoutNextCheck = 10;
	}
	/*
	if(document.body.clientWidth <= 960){
		divMenu.style.left = "960px";
	} else {
		divMenu.style.left = 960+((document.body.clientWidth - 960)/2) + "px";
	}*/
	//setTimeout ("moveRightEdge()", timeoutNextCheck);
}

function LoginGo(){
	window.open("../Member/Login.aspx", "login", "Width=450,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
}
function FindPasswordGo(){
	window.open("../Member/FindPrivate.aspx", "login", "Width=450,Height=350,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
}

function musicGo(gbn,aid){

	if(aid != 0 && aid !='' && aid !='0'){
		if(gbn=='0'){
			window.open('/Home/Music/MusicPop.aspx?aid='+aid,'music','toolbar=no,scrollbars=0,resizable=yes,width=448,height=515,top=200,left=300');
		}else{
			window.open('/Home/Music/ShowVideo.aspx?micid='+aid,'video','toolbar=no,scrollbars=auto,resizable=yes,width=453,height=572,top=200,left=300');
		}
	}else{
		alert('¼±ÅÃÇÏ½Å ¾Ù¹üÀÌ ¾ø½À´Ï´Ù');
		return;
	}
}

function MyAlumOpen(){
	window.open('/Home/Music/MyAlbum.aspx','album','toolbar=no,scrollbars=1,resizable=yes,width=466,height=395,top=200,left=300');
}

function ShowWord(music_id){
		window.open('/Home/Music/MusicWord.aspx?mid='+music_id,'word','width=448,height=365,top=200,left=300,top=200,left=300');
}

function GoJoinMember(){
	location.href="/Home/Member/MembRuleAgree.aspx";
}

function GoFindPassword(){
	window.location="/Home/Member/FindPrivate.aspx";
}
			
// DreamWeaver Script
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


/************************************************************
* Toggle Script ½ÃÀÛ
************************************************************/

function toggle(e) {
  if (e.style.display == "none") {
     e.style.display = "";
  } else {
     e.style.display = "none";
  }
}


// Dreamweaver's Popup Script
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


// Center Open Popup(url, width, height ÀÔ·ÂÇØ¾ßÇÔ)  --  È­¸éÀÇ Áß¾Ó¿¡¼­ ÆË¾÷ÀÌ ¶ß°Ô ¸¸µå´Â ½ºÅ©¸³Æ®
function COPop(url, width, height) {
	LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	var path= url;

	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',location=no,toolbar=no,menubar=no';
	window.open(path, "", settings);
}


function COPop(url, width, height, scroll) {
	LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	var path= url;

	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',location=no,toolbar=no,menubar=no,scrollbars='+scroll;
	window.open(path, "", settings);
}



	
/********************************
*			 AUTOTAB
********************************/
function autotab(input,len, e) {
				var keycd = e.keyCode;
				var filter = [0,8,9,16,17,18,37,38,39,40,46];
				
				if(input.value.length >= len && !iscontain(filter, keycd))
				{
					input.value = input.value.slice(0, len);
					input.form[(getindex(input)+1) % input.form.length].focus();
				}
}
		
function iscontain(filter, keycd) {
			var found = false;
			var index = 0;

			while(!found && index < filter.length)
		    
				if(filter[index] == keycd) found = true;
				else index++;

			return found;
}
  		
function getindex(input) {
			var index = -1;
			var i = 0;
			var found = false;

			while (i < input.form.length && index == -1)

			if (input.form[i] == input)index = i;
			else i++;

			return index;
			return true;
}  	
		
		
function changeimg(target, imgURL){
	document.all(target).src = imgURL
}

function showpic(strpic){	
	window.open ("/recipe/viewpic.asp?src=" + strpic, "viewPic", "width=100, height=100, scrollbars=yes, status=no, resizable=no, toolbar=no, top=100, left=100");
	return;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

var MENU;
var OVER;
function Over(n)
{
	obj = eval("document.all.menu_"+n);
	if(obj !=null){
		obj.src = "/images/"+MENU+"/menu_"+n+"_on.gif";
	}
}

function PageTopimage(){
	var objse = "<img src=/images/"+MENU+"/tb_"+OVER+".gif border=0>";
	document.write(objse);
}

function Out(n)
{
	if(OVER!=n){
		obj = eval("document.all.menu_"+n);
		obj.src = "/images/"+MENU+"/menu_"+n+".gif";
	}
}

var LastNm;
function Navigation(vfirst,vLast){
	var Navitext = '<a href=\"/Home/Main/SeenSe_Main.aspx\">HOME</a>';
	Navitext += NavigationFirst(vfirst);
	Navitext += NavigationSecond(vLast);
	//if(LastNm !=""){
	//	Navitext += ' > '+LastNm;
	//}
	document.write(Navitext);
}

function NavigationFirst(vfirst){
	if(vfirst=="1"){
		return ' > <a href=\"/Home/intro/About_seensee.aspx\">½Å½Ã¼Ò°³</a>';
	}else if(vfirst=="2"){
		return ' > <a href=\"/Home/Musical/MusicalList.aspx?perf=1\">¹ÂÁöÄÃ</a>';
	}else if(vfirst=="3"){
		return ' > <a href=\"/Home/Member/MembershipGuide.aspx\">¸â¹ö½Ê</a>';
	}else if(vfirst=="4"){
		return ' > <a href=\"/Home/Perfsale/Sale_info.aspx\">Æ¼ÄÏ</a>';
	}else if(vfirst=="5"){
		return ' > <a href=\"/Home/Mobile/Usage.aspx\">¸ð¹ÙÀÏ</a>';
	}else if(vfirst=="6"){
		return ' > <a href=\"/Home/Shop/ShopUserInfo.aspx\">½Å½Ã¼¥</a>';
	}else if(vfirst=="7"){
		return ' > <a href=\"/Home/Board/BoardPages.aspx?mid=3&pid=-1\">Ä¿¹Â´ÏÆ¼</a>';
	}else if(vfirst=="8"){
		return ' > <a href=\"/Home/FAQ/FAQ_membership.aspx\">FAQ</a>';
	}else{
		return '';
	}
}

function NavigationSecond(vLast){
	return '';
}

function getSubCookie(name, subname) {
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1)
		return (null);
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length;
	var cookies = unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
	prefix = subname + "=";
	cookieStartIndex = cookies.indexOf(prefix);
	if (cookieStartIndex == -1)
		return (null);
	cookieEndIndex = cookies.indexOf("&", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length;
	return (unescape(cookies.substring(cookieStartIndex + prefix.length, cookieEndIndex)));
}

	