﻿// JScript 파일
	function LoginWinOpen() {
	    window.location.href = "/include/LoginForm.aspx";
	}

	function LoginOpen() {
	   NewWindow("/include/Login.aspx","Login", 707, 375);
	}
	
	function loginClose() {
		document.all.bgLayer.style.display = "none";
	}
	
	function LoginOut() {
		if(confirm('접속을 종료 하시겠습니까?')) {
			window.location.href = '/include/LogOut.aspx';
		}
	}

	function boardWrite(strNum) {
		window.location.href = "?num=" + strNum + "&mode=write";
		return false;
	}
	
	function boardList(strNum) {
		window.location.href = "?num=" + strNum + "&m=l";
		return false;
	}
	
	function boardPreNext(strNum, strBnum) {
		window.location.href = "?num=" + strNum + "&bnum=" +strBnum+ "&mode=view";
		return false;
	}

	function reviewPreNext(strNum, strBnum, strPage) {
	    window.location.href = "?num=" + strNum + "&bnum=" + strBnum + "&page=" + strPage + "&mode=rView";
	    return false;
	}

	function reviewList(strNum, strPage) {
	    window.location.href = "?num=" + strNum + "&mode=rList&page=" + strPage;
	    return false;
	}
	
	function boardNonDate(str) {
		var msg;
		if (str == 'next') {
			msg = '다음글이 없습니다.';
		} else {
			msg = '이전글이 없습니다.';
		}
		alert(msg);
		return false;
	}

	function boardModify(strNum, strBnum) {
		window.location.href = "?num=" + strNum + "&bnum=" +strBnum+ "&mode=modify";
		return false;
	}

	function reviewModify(strNum, strBnum, strPage) {
	    window.location.href = "./PostModify.aspx?num=" + strNum + "&bnum=" + strBnum + "&page=" + strPage;
	    return false;
	}

	// 이메일 체크
	function isEmail(str) {
	  var supported = 0;
	  if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	  }
	  if (!supported) 
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	  return (!r1.test(str) && r2.test(str));
	}

	// 주민등록번호 체크
	function Jumin_chk(it)
	{
		IDtot = 0;
		IDAdd = "234567892345";
		for(i=0; i<12; i++) IDtot = IDtot + parseInt
		(it.substring(i, i+1)) * parseInt(IDAdd.substring(i, i+1));
		IDtot = 11 - (IDtot%11);
		if (IDtot == 10) IDtot = 0;
		else if (IDtot == 11) IDtot = 1;
		if(parseInt(it.substring(12, 13)) != IDtot)
			return true;
	}

	// 모니터 중앙에 새창 띄우기
	var win= null;

	function NewWindow(mypage,myname,w,h,scroll){
	 var winl = (screen.width-w)/2;
	 var wint = (screen.height-h)/2;
	 var settings  ='height='+h+',';
	     settings +='width='+w+',';
	     settings +='top='+wint+',';
	     settings +='left='+winl+',';
	     settings +='scrollbars='+scroll+',';
	     settings +='resizable=no';
	 win=window.open(mypage,myname,settings);
	 if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
	}

	// 아이디 체크
	function IdCheck(strID) {

		if(strID.length <4 || strID.length >12) {
			alert("아이디는 4자 이상, 12자 이하여야 합니다.");
			return false;
		}

		if (strID != '')
		{
			var valid = "abcdefghijklmnopqrstuvwxyz0123456789_";
			var startChar = "abcdefghijklmnopqrstuvwxyz";
			var temp;

			var chkid = strID.toLowerCase();

			if (startChar.indexOf(chkid.substring(0, 1)) == "-1") {
				alert("아이디의 시작은 영문으로만 가능합니다.");
				return false;
			}

			for (var i=0; i<chkid.length; i++) {
			temp = "" + chkid.substring(i, i+1);

			if (valid.indexOf(temp) == "-1") {
				alert("아이디는 영문과 숫자, _ 로만 이루어질수 있습니다.");
				return false;
				}
			}
		}
	}

	// 로그아웃
	function LogOut() {
		if(!(confirm('접속을 종료하시겠습니까?'))) {
			return false;
		}
	}

	function ecatalog(docu, kd, dir) {
		if(screen.width < 800){
			alert('The screen resolution should be over 800*600');
			return;
		}

		if(kd == 'fixed'){ x = 1024; y = 768; wname = 'fixed_ecatalog'; }
		else if(screen.width > 1600 || screen.height > 1200){ x = 1600; y = 1200; wname = 'ecatalog'; }
		else{ x = screen.width; y = screen.height; wname = 'ecatalog'; }

		x = x - 10;
		y = y - 58;

		property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,copyhistory=no,";
		property += "width=" + x + ",height=" + y + ",left=" + 0 + ",top=" + 0;
		docu = 'http://www.solco.co.kr' + docu + '/ecatalog.asp?Dir=' + dir;

		ecawin = window.open(docu, wname, property);
	}

	function swf_viewer(FlashFileName, FlashWidth, FlashHeight) {
		document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" ');
		document.write(' ID="Solco" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '">');
		document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
		document.write('<PARAM NAME="quality" VALUE="high">');
		document.write('<PARAM NAME="bgcolor" VALUE="#ffffff">');
		document.write('<PARAM NAME="wmode" VALUE="transparent">');
		document.write('<PARAM NAME="allowScriptAccess" VALUE="always">');
		document.write('<EMBED SRC="'+ FlashFileName + '"  NAME="Solco"');
		document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="high" BGCOLOR="#ffffff"');
		document.write(' ALLOWSCRIPTACCESS="always" WMODE="transparent" TYPE="application/x-shockwave-flash" ');
		document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
		document.write('</EMBED>');
		document.write('</OBJECT>');
	}

	function Media(url,vol,wth, hht) {
	//    document.write("<OBJECT id='myMedia' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' width='" + wth + "' height='" + hht + "'>"+
	//		"<PARAM NAME='FileName' VALUE='" +url+ "'>" +
	//		"<PARAM NAME='AudioStream' value='-1'>" +
	//		"<PARAM NAME='AutoSize' value='false'>" +
	//		"<PARAM NAME='displaysize' value='false'>" +
	//		"<PARAM NAME='ShowControls' VALUE='0'>" +
	//		"<PARAM NAME='ShowStatusBar' VALUE='0'>" +
	//		"<PARAM NAME='AutoRewind' VALUE='0'>" +
	//		"<PARAM NAME='ShowDisplay' VALUE='0'>" +
	//		"<PARAM NAME='DefaultFrame' VALUE='Slide'>" +
	//		"<PARAM NAME='Autostart' VALUE='1'>" +
	//		"<PARAM NAME='SendMouseClickEvents' VALUE='1'>" +
	//		"<PARAM NAME='EnableContextMenu' value='false'>" +
	//		"<PARAM NAME='TransparentAtStart' value='-1'>" +
	//		"<PARAM NAME='AnimationAtStart' value='0'>" +
	//		"<Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/download/default.asp' src='" +url+ "' Name=MMPlayer1 Autostart='1' ShowControls='0' ShowDisplay='0' ShowStatusBar='0' DefaultFrame='Slide' width='" + wth + "' height='" + hht + "' AutoRewind='0' SendMouseClickEvents='1' EnableContextMenu='false' TransparentAtStart='-1' AnimationAtStart='0' loop='-1'>" + 
	//	"</object>");
		document.write("<Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/download/default.asp' src='" +url+ "' Name=myMedia Autostart='1'showtracker='1' ShowControls='0' ShowDisplay='0' ShowStatusBar='0' DefaultFrame='Slide' width='" +wth+ "' height='" +hht+ "' AutoRewind='0' SendMouseClickEvents='1' EnableContextMenu='false' TransparentAtStart='-1' AnimationAtStart='0' loop='-1'>");
	}

    function objfunc()
    {
        var str = eval("document.all.pp.src");
        var intStr = str.indexOf("_pause.gif");

       if ( intStr >= 0) {
            document.myMedia.pause(); 
            document.all.pp.src = "../image/common/cfbtn_play.gif";
       } else {
            document.myMedia.play(); 
            document.all.pp.src = "../image/common/cfbtn_pause.gif";
       }
    }

    function mainObjfunc()
    {
        var str = eval("document.all.pp.src");
        var intStr = str.indexOf("_pause.gif");

       if ( intStr >= 0) {
            document.myMedia.pause(); 
            document.all.pp.src = "image/main/btn_play.gif";
       } else {
            document.myMedia.play(); 
            document.all.pp.src = "image/main/btn_pause.gif";
       }
    }

    function stopfnc()
    {
        document.myMedia.stop();
        document.all.pp.src = "../image/common/cfbtn_play.gif";
    }

    function PhotoView(strFolder, strFile)
    {
        var strUrl = "/include/PhotoView.aspx";
		var file = "/Upload/" + strFolder + "/" + strFile;
		
		window.open(strUrl + "?pName=" + file, 'photo', 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,copyhistory=no');
    }

    function PhotoViewer(strFolder, strFile)
    {
        var strUrl = "/include/PhotoViewer.aspx?fld=/upload/" + strFolder + "/&fnm=";
		
		window.open(strUrl + strFile, 'photo', 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,copyhistory=no');
    }

	function WonAmount(NumV) {
		Num = NumV.toString();

		var count     = 0;
		var temp      = "";
		var resultWon = "";
		var oneChar   = "";

		for (var ch = Num.length-1; ch >= 0; ch--)
		{ 
			oneChar = Num.charAt(ch);

			if (count == 3) 
			{
				temp += ",";
				temp +=
				oneChar;
				count = 1;
				continue;
			} 
			else 
			{
				temp +=
				oneChar;
				count ++;
			}
		}
		
		for (var ch = temp.length-1; ch >= 0; ch--)
		{ 
			oneChar =temp.charAt(ch);
			resultWon += oneChar;
		}
		return resultWon;
	}

	function getCookie(strName) {
		var strArg = new String(strName + "=");	
		var nArgLen, nCookieLen, nEnd;
		var i = 0, j;
		
		nArgLen    = strArg.length;
		nCookieLen = document.cookie.length;
		
		if(nCookieLen > 0) {
		
			while(i < nCookieLen) {
			
				j = i + nArgLen;
				
				if(document.cookie.substring(i, j) == strArg) {
				
					nEnd = document.cookie.indexOf (";", j);
					
					if(nEnd == -1) nEnd = document.cookie.length;
					
					return unescape(document.cookie.substring(j, nEnd));
				 
				}
				
				i = document.cookie.indexOf(" ", i) + 1;
				if (i == 0) break;
			}
		}
		
		return("");
	}

    function expandFaq(intNum) {
       var f = document.all;

       if(f.faqContent[intNum].style.display == "none")
       {
           for(i=0;i<f.faqContent.length;i++)
           {
               if (i == intNum) {
                   f.faqContent[i].style.display = '';
                   f.faqTitle[i].className = 'mediumgreenb';
               }
               else {
                   f.faqContent[i].style.display = "none";
                   f.faqTitle[i].className = '';
               }
          }
        } else { f.faqContent[intNum].style.display ="none"; } 
    }

    function expandTop(intNum) {
       var f = document.all;

       if(f.topList[intNum].style.display == "none") {
           for(i=0;i<f.topList.length;i++)
           {
                if(i == intNum) {
                    f.topList[i].style.display = '';
                    f.topTitle[i].className = 'mediumgreenb'; 
                } else {
                    f.topList[i].style.display = "none";
                   f.topTitle[i].className = ''; 
                } 
          }
        } else { f.topList[intNum].style.display ="none"; } 
    }

    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_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_findObj(n, d) { //v4.01
        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 && d.getElementById) x = d.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 postCopy(url) {
        window.clipboardData.setData("Text", url);
        alert("포스트 주소가 복사되었습니다.");
    }

    function goNewUrl(url) {
        window.open(url, "SolcoMall");
    }

    function sr3dView() {
        if (document.getElementById("sr3d_ly").style.display == "none") {
            document.getElementById("sr3d_ly").style.display = "block";
            var strHtml = '<iframe src="./Sr3D.htm" width="707" onload="this.style.height=this.Document.body.scrollHeight;" frameborder="0" scrolling="no"></iframe>'
            document.getElementById("sr3d_ly").innerHTML = strHtml;
        } else {
            document.getElementById("sr3d_ly").style.display = "none";
            var strHtml = ''
            document.getElementById("sr3d_ly").innerHTML = strHtml;
        }
        //alert(document.getElementById("sr3d_ly").style.display);
    }
