﻿/*###################### 스킬버튼 ###########################*/					
function SkillBtn(str)
{		
	SkillHide();

	switch(str)
	{
		case "1":
			document.getElementById("skill_1").style.display = "block";
			document.getElementById("skill_btn_1").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Basicskill_on.gif";
			document.getElementById("skill_btn_2").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Learnskill_off.gif";
			document.getElementById("skill_btn_3").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Transformskill_off.gif";
		break;
		case "2":
			document.getElementById("skill_2").style.display = "block";
			document.getElementById("skill_btn_1").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Basicskill_off.gif";
			document.getElementById("skill_btn_2").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Learnskill_on.gif";
			document.getElementById("skill_btn_3").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Transformskill_off.gif";
		break;
		case "3":
			document.getElementById("skill_3").style.display = "block";
			document.getElementById("skill_btn_1").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Basicskill_off.gif";
			document.getElementById("skill_btn_2").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Learnskill_off.gif";
			document.getElementById("skill_btn_3").src = "http://image.howlingsword.co.kr/HSver0.1/img/Mn/info/brick_Transformskill_on.gif";
		break;
		default:
		alert("값이 올바르지 않습니다.");
	}
}

function SkillHide()
{
	document.getElementById("skill_1").style.display = "none";
	document.getElementById("skill_2").style.display = "none";
	document.getElementById("skill_3").style.display = "none";
}





/*###################### ie의 PNG 이미지 표현 함수 ###########################*/
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='./image/blank.gif';
    return '';
}

/*###################### rollover ###########################*/
function rollover(imgsrc){
		var imgtxt = imgsrc.src;
		imgsrc.src = imgtxt.replace("_off","_on");
	}
	
	function rollout(imgsrc){
		var imgtxt = imgsrc.src;
		imgsrc.src = imgtxt.replace("_on","_off");
	}

/*###################### flash ###########################*/
function FlashLoad(sUrl, nWidth, nHeight)
{
    document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="mFlash" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + nWidth + '" height="' + nHeight + '"> <param name="allowScriptAccess" value="always" /><param name="movie" value="' + sUrl + '"><PARAM NAME="Menu" VALUE="false"><param name="quality" value="high"><PARAM name="wmode" value="transparent"><embed src="' + sUrl + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + nWidth + '" height="' + nHeight + '" ></embed></object>');
}

function FlashLoadUniqueName(name,sUrl, nWidth, nHeight) {
    document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + name + '" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + nWidth + '" height="' + nHeight + '"> <param name="allowScriptAccess" value="always" /><param name="movie" value="' + sUrl + '"><PARAM NAME="Menu" VALUE="false"><param name="quality" value="high"><PARAM name="wmode" value="transparent"><embed src="' + sUrl + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + nWidth + '" height="' + nHeight + '" ></embed></object>');
}

function FlashTpmodeLoad(sUrl, nWidth, nHeight)
{
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="mFlash" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+nWidth+'" height="'+nHeight+'"><param name="movie" value="'+sUrl+'"><PARAM NAME="Menu" VALUE="false"><param name="quality" value="high"><PARAM name="wmode" value="transparent"><embed src="'+sUrl+'" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+nWidth+'" height="'+nHeight+'"></embed></object>');  	
}

function OpaqueFlashLoad(sUrl, nWidth, nHeight)
{
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="mFlash" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+nWidth+'" height="'+nHeight+'"><param name="movie" value="'+sUrl+'"><PARAM NAME="Menu" VALUE="false"><param name="quality" value="high"><PARAM name="wmode" value="transparent"><embed src="'+sUrl+'" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" width="'+nWidth+'" height="'+nHeight+'"></embed></object>');  	
}

function BGMLoad(sUrl, nWidth, nHeight) {
    return "";
}

function ObjectLoad(sID, sUrl)
{	
	document.writeln('<OBJECT ID="'+sID+'" width="0" height="0" codebase="'+sUrl+'" CLASSID="CLSID:FD1B28AD-5024-45E8-9013-54B8FDB9D740" VIEWASTEXT></OBJECT>');
}
function MovieLoad(sUrl, nWidth, nHeight)
{
	document.writeln('<object width="'+nWidth+'" height="'+nHeight+'" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" name="WSMediaPlayer" id="WSMediaPlayer" style="FILTER: xray()"  VIEWASTEXT> '+
	' <param name="Filename" value="'+sUrl+'"> ' +
	' <PARAM NAME="ShowControls" VALUE="true"> ' +
	' <PARAM NAME="Menu" VALUE="false"> ' +
	' <PARAM NAME="AutoRewind" VALUE="True"> ' +
	' <PARAM NAME="AutoStart" VALUE="-1"> ' +
	'<param name="allowScriptAccess" value="always" />' +
	' <embed src="'+ sUrl + '" width="'+nWidth+'" height="'+nHeight+' style="FILTER: xray()"></embed></object> ' )
}

function MovieLoadToDiv(sUrl, nWidth, nHeight) {
    return ('<object width="' + nWidth + '" height="' + nHeight + '" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" name="WSMediaPlayer" id="WSMediaPlayer" style="FILTER: xray()"  VIEWASTEXT> ' +
	' <param name="Filename" value="' + sUrl + '"> ' +
	' <PARAM NAME="ShowControls" VALUE="true"> ' +
	' <PARAM NAME="Menu" VALUE="false"> ' +
	' <PARAM NAME="AutoRewind" VALUE="True"> ' +
	' <PARAM NAME="AutoStart" VALUE="-1"> ' +
	'<param name="allowScriptAccess" value="always" />' +
	' <embed src="' + sUrl + '" width="' + nWidth + '" height="' + nHeight + ' style="FILTER: xray()"></embed></object> ')
}

/*###################### flash ###########################*/
function flashWrite(url, w, h, vars, win, alt, id) {
    if (vars == null) vars = "";
    if (win == null) win = "opaque";

    var objStr = "     <object ";

    if (/MSIE/.test(navigator.userAgent)) {
        objStr += "classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'  codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'";
        objStr += "     id='" + id + "' style='width:" + w + "px; height:" + h + "px;'>";
        objStr += "    <param name='base' value='.' >";
        objStr += "    <param name='showLiveConnect' value='true' >";
        objStr += "    <param name='allowScriptAccess' value='always' >";
        objStr += "    <param name='movie' value='" + url + "' >";
        objStr += "    <param name='FlashVars' value='" + vars + "' >";
        objStr += "    <param name='wmode' value='" + win + "' >";
        objStr += "    <param name='menu' value='false' >";
        objStr += "    <param name='quality' value='high' >";
        objStr += "    <p" + ">" + alt + "</" + "p>";
        objStr += "  </" + "object>";
    }
    else {
        objStr = '<embed src="' + url + '" quality="high" wmode="' + win + '" FlashVars="' + vars + '"';
        objStr += ' width="' + w + '" height="' + h + '" name="' + id + '" id="' + id + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    }
    document.write(objStr);
}

/*###################### flash ###########################*/
function flashWriteToDiv(url, w, h, vars, win, alt, id) {

    if (vars == null) vars = "";
    if (win == null) win = "opaque";

    var objStr = "     <object ";

    if (/MSIE/.test(navigator.userAgent)) {
        objStr += "classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'  codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'";
        objStr += "     id='" + id + "' style='width:" + w + "px; height:" + h + "px;'>";
        objStr += "    <param name='base' value='.' >";
        objStr += "    <param name='showLiveConnect' value='true' >";
        objStr += "    <param name='allowScriptAccess' value='always' >";
        objStr += "    <param name='movie' value='" + url + "' >";
        objStr += "    <param name='FlashVars' value='" + vars + "' >";
        objStr += "    <param name='wmode' value='" + win + "' >";
        objStr += "    <param name='menu' value='false' >";
        objStr += "    <param name='quality' value='high' >";
        objStr += "    <p" + ">" + alt + "</" + "p>";
        objStr += "  </" + "object>";
    }
    else {
        objStr = '<embed src="' + url + '" quality="high" wmode="' + win + '" FlashVars="' + vars + '"';
        objStr += ' width="' + w + '" height="' + h + '" name="' + id + '" id="' + id + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
    }
    return objStr;
}


/*함수 몇개 추가 
수정자 : 김시원
일자 : 09/12/28
*/
var StringHandler =
{
    StrReplacer: function(target, maxLen) {
        $(target).each(function(i) {

            if ($(this).text().length > maxLen) {
                $(this).text($(this).text().substring(0, maxLen) + "...");
            }
        });
    }
}
var PanelControl =
{
    SetPanelVisible: function(masterid, id) {
        $("[id^=" + masterid + "]").each(function(i) {
            $(this).css("display", "none");
        });
        $("#" + masterid + id).css("display", "");
    }
}
$(document).ready(function() {
    var cnt = 0;
    $("img.cmdRollover").each(
        function(e) {            
            if ($(this).attr("id") === '' || $(this).attr("id") == null) {
                $(this).attr("id", "CLImageRollover" + cnt);
                cnt++;
            }
            var currentElement = $(this);
            $(this).wrap("<span id='" + $(this).attr("id") + "container'></span>")
                .after('<img src="' + $(this).attr("src").replace("off", "on") + '" id="' + $(this).attr("id") + '_on" style="display:none;" />');
            $("#" + $(this).attr("id") + "container").hover(
                function() {
                    currentElement.css("display", "none");
                    $("#" + currentElement.attr("id") + "_on").css("display", "");
                },
                function() {
                    currentElement.css("display", "");
                    $("#" + currentElement.attr("id") + "_on").css("display", "none");
                }
            );
        }
    );
    $('#btnGoTop').scrollFollow({ offset: 102, speed: 700 }).click(
        function() {
            window.scrollTo(0, 0);
        }
    );
});
