function GoPrevTag(strSelectMenuMode,oprevTagId)
{
	Request.sendPOST("/mytong/mytong.do?action=byTag", "&myTongID="+ nMyTongId+ "&tagDirection=prev&keyTagId=" + oprevTagId + "&viewMode=" +strSelectMenuMode , _IsSuccessGetTagData,strSelectMenuMode);	
}

function GoNextTag(strSelectMenuMode,onextTagId)
{
	Request.sendPOST("/mytong/mytong.do?action=byTag", "&myTongID="+ nMyTongId+ "&tagDirection=next&keyTagId=" + onextTagId + "&viewMode=" +strSelectMenuMode , _IsSuccessGetTagData,strSelectMenuMode);	
}




function _IsSuccessGetTagData(httpRequest, strSelectMenuMode)
{
	try 
	{
		eval("var oResult=" + httpRequest.responseText);
		var code = oResult.code;
		if (code == 'success') 
		{		
			// °ü½ÉÅë/Æ÷ÅäÅë/µ¿¿µ»óÅë/¸®ºäÅë ÅÂ±×¸®½ºÆ®	
			var strTagHtml = "";
			if(oResult.tagList.length < 1) strTagHtml="¾ÆÁ÷ ÅÂ±×°¡ ¾ø½À´Ï´Ù.";
			for(var i = 0; i< oResult.tagList.length ; i++)
			{
					var tagNameTemp = oResult.tagList[i].tagName;
					var tagNameDisplay = tagNameTemp.split("<").join("&lt;");
					tagNameTemp = tagNameTemp.split("\"").join("&quot;").split("\\").join("\\\\").split("\'").join("\\\'").split("&lt;").join("<").split("&#39;").join("'");
					strTagHtml = strTagHtml+ "<a href=\"javascript:GoTagView('" + strSelectMenuMode + "','" + tagNameTemp + "')\" style=\"word-break:break-all;word-wrap:break-word;\"> " + tagNameDisplay + "</a>"
					if(oResult.tagList[i].themeTongFlag == "y") strTagHtml = strTagHtml + "<span style=\"color:#A899F5;font-size:11px;\">[Å×¸¶]</span>";
					if(oResult.tagList.length != i+1)
						strTagHtml = strTagHtml+ ",";
			}
			document.getElementById('taglist_'+ strSelectMenuMode).innerHTML= strTagHtml;
			
			var nextTagId = "";
			nextTagId = oResult.nextTagId;
				
			var prevTagId = "";
			prevTagId = oResult.prevTagId;
	
			var strTagPrevNextHtml = "";
			if(prevTagId == "")
			{
				if(nextTagId != "")
					strTagPrevNextHtml = strTagPrevNextHtml+"<a href=\"javascript:GoNextTag('" + strSelectMenuMode + "','"+ nextTagId + "')\"><img src=\"/images/library/button/btn_txt_next.gif\" alt=\"´ÙÀ½\" border=\"0\"></a> ";
			}
			else
			{
				if(nextTagId == "")
				{
					strTagPrevNextHtml = strTagPrevNextHtml+"<a href=\"javascript:GoPrevTag('" + strSelectMenuMode + "','"+ prevTagId + "')\"><img src=\"/images/library/button/btn_txt_pre.gif\" alt=\"ÀÌÀü\" border=\"0\"></a> ";
				}
				else
				{
					strTagPrevNextHtml = strTagPrevNextHtml+"<a href=\"javascript:GoPrevTag('" + strSelectMenuMode + "','"+ prevTagId + "')\"><img src=\"/images/library/button/btn_txt_pre.gif\" alt=\"ÀÌÀü\" border=\"0\"></a><span class=\"btn_line\">I</span><a href=\"javascript:GoNextTag('" + strSelectMenuMode + "','"+ nextTagId + "')\"><img src=\"/images/library/button/btn_txt_next.gif\" alt=\"´ÙÀ½\" border=\"0\"></a>";
				}
			}

			document.getElementById('tagdirection_'+ strSelectMenuMode).innerHTML= strTagPrevNextHtml;

		}
		
	} 
	catch (e) {
		alert(e.message);
		
	}	
}


function OpenConfigWin(oType)
{
	if(oType)
		window.open('/library/photo.do?action=uploadConfigForm&_doType=now&_tongID=' + nMyTongId, 'configPhoto', 'status=yes,width=380,height=300,left=' + (window.screen.availWidth/2 - 380) + ',top=' + (window.screen.availHeight/2 - 300));
	else
		window.open('/library/photo.do?action=uploadConfigForm&_doType=&_tongID=' + nMyTongId, 'configPhoto', 'status=yes,width=380,height=300,left=' + (window.screen.availWidth/2 - 380) + ',top=' + (window.screen.availHeight/2 - 300));
}

function OpenAddPhoto()
{
	if( oUploadConfig == 0 )
		OpenConfigWin("now");
	else if( oUploadConfig == 1 )
		window.open('/library/photo.do?action=uploadForm&_tongID=' + nMyTongId, 'addphoto', 'status=yes,width=680,height=680,left=' + (window.screen.availWidth/2 - 340) + ',top=' + (window.screen.availHeight/2 - 385));
	else
		TongLauncher.launch();
}

function AddBookmark(targetID)
{
	if (_GetCookieValue('GUID'))
		if (_GetCookieValue('SYS_USER_ID'))
			window.open('/mytong/bookmark/add_bookmark.vm?targetID=' + targetID, '_blank', 'status=yes, width=380, height=220');
		else
			PopupJoinTong('&need_toss=false&redirect_url=/mytong/bookmark/add_bookmark.vm?targetID=' + targetID);
	else
		PopupLogin('&need_mytong=true&need_toss=false&redirect_url=/mytong/bookmark/add_bookmark.vm?targetID=' + targetID);
}

function ViewListTopLayer(strSelectMenuMode,bView, sIframeSrc)
{
	if(strSelectMenuMode == 'review') 
		divLayer = document.getElementById("divReviewTopListLayer");
	else
		divLayer = document.getElementById("divTopListLayer");
		

	if(bView)
	{
		if(strSelectMenuMode == 'review') 
			iframeReviewTopListLayer.location.href = sIframeSrc;	
		else
			iframeTopListLayer.location.href = sIframeSrc;	
		divLayer.style.left = "230px";
		
		if(bUseSkin)
			divLayer.style.top = "188px";
		else
			divLayer.style.top = "143px";		
		divLayer.style.display = "" ;
	}
	else
	{	
		divLayer.style.display = "none";
	}
}




function ViewSectionLayer(strSelectMenuMode, bView, sIframeSrc, sTag)
{	
	var divLayer;
	if(strSelectMenuMode == 'review') 
		divLayer = document.getElementById("divReviewSectionLayer");
	else
		divLayer = document.getElementById("divPhotoMmediaSectionLayer");
	if(bView)
	{
		if(typeof(sTag) != "undefined")
			if(strSelectMenuMode == 'review') 
				iframeReviewSectionLayer.location.href = sIframeSrc + TongEncodeURIComponent(sTag);
			else
				iframePhotoMmediaSectionLayer.location.href = sIframeSrc + TongEncodeURIComponent(sTag);
		else
			if(strSelectMenuMode == 'review') 
				iframeReviewSectionLayer.location.href = sIframeSrc;	
			else
				iframePhotoMmediaSectionLayer.location.href = sIframeSrc;	
		divLayer.style.left = "230px";

		if(bUseSkin)
			divLayer.style.top = "188px";
		else
			divLayer.style.top = "143px";		
			
		divLayer.style.display = "" ;
	}
	else
	{	
		divLayer.style.display = "none";
	}
}




function GetTagData(strSelectMenuMode)
{
	Request.sendPOST("/mytong/mytong.do?action=byTag", "&myTongID="+ nMyTongId+ "&viewMode=" +strSelectMenuMode , _IsSuccessGetTagData,strSelectMenuMode);	
}

function GetFieldData(strSelectMenuMode)
{
	Request.sendPOST("/mytong/mytong.do?action=fieldbox", "&myTongID="+ nMyTongId+ "&viewMode=" +strSelectMenuMode , _IsSuccessGetFieldData,strSelectMenuMode);	
}



function _IsSuccessGetFieldData(httpRequest,strSelectMenuMode)
{
	var xmlDoc = httpRequest.responseXML;
	try {
		var code = xmlDoc.getElementsByTagName('code').item(0).firstChild.nodeValue;		
	} 
	catch (e) {
		alert(e);
	}	
	if (code == 'success') 
	{	

		var hasDataFlag = "";
		if( xmlDoc.getElementsByTagName('hasDataFlag').item(0).firstChild )
			hasDataFlag = xmlDoc.getElementsByTagName('hasDataFlag').item(0).firstChild.nodeValue;

		var strFieldInfoHtml = "";
		if(strSelectMenuMode != "mymaintong")
		{
			
			var fieldInfo= eval( "(" + xmlDoc.getElementsByTagName('fieldInfo').item(0).firstChild.nodeValue + ")" );
			var aryField = [fieldInfo[0].field1,fieldInfo[0].field2,fieldInfo[0].field3,fieldInfo[0].field4,fieldInfo[0].field5,fieldInfo[0].field6,fieldInfo[0].field7,fieldInfo[0].field8,fieldInfo[0].field9];

			switch(strSelectMenuMode)
			{
			case 'photo' : 
				var aryFieldName = ["ÀÎ¹°","À½½Ä","»ç¹°","µ¿/½Ä¹°","Ç³°æ","½º¼¦","ÀÚ·á","½ºÆ÷Ã÷","±âÅ¸"];
				var nFieldCnt = 9;
				break;
			case 'mmedia' :
				var aryFieldName = ["ÀÏ»ó","¿µÈ­","È­Á¦","¾Ö´Ï","°ÔÀÓ","ÇÐ½À","ÀÚ·á","±âÅ¸"]
				var nFieldCnt = 8;
				break;
			case 'review' : 
				var aryFieldName = ["¿µÈ­"]
				var nFieldCnt = 1;
				aryField = [fieldInfo[0].field1];
				break;
			}

			var nLoopCnt = 0;
			for(var i = 0; i< nFieldCnt; i++)
			{				
				if(((aryField[i] != 0) && (hasDataFlag == "true"))|| (hasDataFlag == "false"))
				{
					nLoopCnt = nLoopCnt+1;
					strFieldInfoHtml = strFieldInfoHtml+"<div class=";
					if(nLoopCnt %2 == 0) strFieldInfoHtml = strFieldInfoHtml+"\"category_right\">";
					else strFieldInfoHtml = strFieldInfoHtml+"\"category_left\">";
					var iFieldIndex = i +1;
					strFieldInfoHtml = strFieldInfoHtml+ "<a href=\"javascript:GoFieldView('" + strSelectMenuMode + "'," + iFieldIndex + ")\" >" + aryFieldName[i] +"</a>[" +aryField[i] +"]</div>";
				}
			}
			if(strSelectMenuMode == "review") strFieldInfoHtml = strFieldInfoHtml+ "<div class=\"category_right\">¹ÂÁ÷[ÁØºñÁß]</div>";
			document.getElementById('fieldlist_'+ strSelectMenuMode).innerHTML= strFieldInfoHtml;			
		}
	}

}