
////////////////////////////////////////////////////////////
// <script>
// 이 파일은 Javascript 로 인식  Content-Type: application/x-javascript
////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////
// 이동훈 폰트 추가 2010-03-18
var strMyFONTDATA = "";
var strMyFontName = "";
var strMyFontStyle = "";

if(strMyFONTDATA != ""){
	var arrFont = strMyFONTDATA.split('|');
	if( arrFont[1] == "FF001"){
		strMyFontName = "Nor" + arrFont[2] + "_10";
		strMyFontStyle = "<style type='text/css'>@font-face{font-family:"+ strMyFontName +";src:url(http://img.ufotown.com/ITEMMALL/cp/fontrix/font/"+ arrFont[0] +"/"+ arrFont[2] +"/"+ arrFont[1] +"_"+ arrFont[2] +"_10.eot);}</style>";
	}else if(arrFont[1] == "FF002"){
		strMyFontName = "Ani" + arrFont[2] + "_10";
		strMyFontStyle = "<style type='text/css'>@font-face{font-family:"+ strMyFontName +";src:url(http://img.ufotown.com/ITEMMALL/cp/fontrix/font/"+ arrFont[0] +"/"+ arrFont[2] +"/"+ arrFont[1] +"_"+ arrFont[2] +"_10.eot);}</style>";
	}
	

	//alert(strMyFontName +" | "+ strMyFontStyle);

	// 사용시 HTML BODY 내부에서 사용시
	// $("textarea#txtCONT_FONT").append(strMyFontStyle);
	// $("textarea#txtCONT_FONT").css({'font-size':'10pt' ,'line-height':'15px' ,'font-family': strMyFontName });
}


var Timer_View_font;
//var AniFontSetTags = 'SPAN,p,textarea';
var AniFontSetTag = "";

function startAniFont(){
	stopAniFont();
	var ua = navigator.userAgent;
	if(ua.indexOf("MSIE") != -1) {
		Timer_View_font = setInterval("showAnimationViewFont()" , 1100);
		//Timer_View_font = setTimeout("showAnimationViewFont()" , 1100);
	}
}

function stopAniFont(){
	try{ clearTimeout(Timer_View_font); }catch(err){}
}

function showAnimationViewFont(){
	var ua = navigator.userAgent;
	if(ua.indexOf("MSIE") == -1 ){return;}
	try{
		if( AniFontSetTag == ""){
			var aSPANTags = document.getElementsByTagName("SPAN");
			roopChangeAniFont(aSPANTags);

			aSPANTags = document.getElementsByTagName("p");
			roopChangeAniFont(aSPANTags);

			aSPANTags = document.getElementsByTagName("textarea");
			roopChangeAniFont(aSPANTags);
		}else{
			var arrAniFontSetTag = AniFontSetTag.split(',')

			for(i=0 ; i < arrAniFontSetTag.length ; i++){
				aSPANTags = document.getElementsByTagName(arrAniFontSetTag[i]);
				roopChangeAniFont(aSPANTags);
			}
		}
	}catch(err){
		alert(err.description);
		stopAniFont();
	}
}

function roopChangeAniFont(objTags){
	for (var j = 0; j < objTags.length; j++){
		var attrValue = objTags[j].style.fontFamily;
		if( attrValue.substring(0, 3).toLocaleLowerCase() == 'ani' ){
			if (attrValue.indexOf("_") > -1) {
				var spanFontCode = attrValue.substring(0, attrValue.indexOf("_"));
				var spanFontSize = attrValue.substring(attrValue.indexOf("_") + 1);

				var nowSpanFontSize = objTags[j].style.fontSize
				nowSpanFontSize = parseFloat(nowSpanFontSize)
				spanFontSize = parseFloat(spanFontSize)

				if(nowSpanFontSize == spanFontSize){
					objTags[j].style.fontSize = (spanFontSize+0.5) +"pt";
				}
				else if(nowSpanFontSize == (spanFontSize+0.5)) {
					objTags[j].style.fontSize = (spanFontSize+1) +"pt";
				}
				else if(nowSpanFontSize == (spanFontSize+1)) {
					objTags[j].style.fontSize = (spanFontSize+2) +"pt";
				}
				else if( nowSpanFontSize == (spanFontSize+2)) {
					objTags[j].style.fontSize = spanFontSize +"pt";
				}
				// ani font End
			}
		}
	}
}

// 이동훈 폰트 추가 2010-03-18
////////////////////////////////////////////////////////////
// 플라이 전용 스크립트
var Timer_View_font_fly;
//var AniFontSetTag_flys = 'SPAN,p,textarea';
var AniFontSetTag_fly = "";

function startAniFont_fly(){
	stopAniFont_fly();
	var ua = navigator.userAgent;
	if(ua.indexOf("MSIE") != -1) {
		Timer_View_font_fly = setInterval("showAnimationViewFont_fly()" , 650);
		//Timer_View_font_fly = setTimeout("showAnimationViewFont_fly()" , 1100);
	}
}

function stopAniFont_fly(){
	try{ clearTimeout(Timer_View_font_fly); }catch(err){}
}

function showAnimationViewFont_fly(){
	var ua = navigator.userAgent;
	if(ua.indexOf("MSIE") == -1 ){return;}
	try{
			/*
			aSPANTags = document.getElementsById("fa_msg");
			var attrValue =aSPANTags.style.fontFamily;
			alert(attrValue);

			if( attrValue.substring(0, 3).toLocaleLowerCase() == 'ani' ){
				if (attrValue.indexOf("_") > -1) {
					var spanFontCode = attrValue.substring(0, attrValue.indexOf("_"));
					var spanFontSize = attrValue.substring(attrValue.indexOf("_") + 1);

					spanFontSize = parseInt(spanFontSize, 10)
					var nowSpanFontSize = objTags[j].style.fontSize
					nowSpanFontSize = parseInt(nowSpanFontSize, 10)

					if(nowSpanFontSize == spanFontSize){
						objTags[j].style.fontSize = (spanFontSize+1) +"pt";
					}
					else if(nowSpanFontSize == (spanFontSize+1)) {
						objTags[j].style.fontSize = (spanFontSize+2) +"pt";
					}
					else if( nowSpanFontSize == (spanFontSize+2)) {
						objTags[j].style.fontSize = spanFontSize +"pt";
					}
				}
			}
			*/
			aSPANTags = document.getElementsByTagName("textarea");
			roopChangeAniFont(aSPANTags);
			//roopChangeAniFont_fly(aSPANTags);

	}catch(err){
		alert(err.description);
		stopAniFont_fly();
	}
}

//</script>
