<!--

// Trim Function Implementation from JScavitto
String.prototype.LTrim = new Function("return this.replace(/^\\s+/,'')")
String.prototype.RTrim = new Function("return this.replace(/\\s+$/,'')")
String.prototype.Trim = new Function("return this.replace(/^\\s+|\\s+$/g,'')")	


var Viewer = "http://webtsf.bidbuy.co.kr/Viewer/";


function GetCookie(Name)
{
	var search = Name + "="
	if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
		offset = document.cookie.indexOf(search)
		if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
			if (end == -1)
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
}

function SetCookie (name, value)
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) + 
		((domain == null) ? "" : ("; domain=" + domain)) + 
		((secure == true) ? "; secure" : "");
}

//if (GetCookie('sys_notice1') != 'Y')
//{
//	alert('ÀÌ¿ë¿¡ ºÒÆíÀ» µå·Á ´ë´ÜÈ÷ ÁË¼ÛÇÕ´Ï´Ù.\t\n\n\nÀá½ÃÈÄ 01½Ã 15ºÐºÎÅÍ ¾à 3½Ã°£ Á¤µµ ½Ã½ºÅÛ Á¡°ËÀÌ\t\nÀÖÀ» ¿¹Á¤ÀÌ¿À´Ï ÀÌ¿ë¿¡ Âü°íÇÏ¿© ÁÖ½Ê½Ã¿ä.\t\n\n\nÁ»´õ ¿øÇÒÇÑ ¼­ºñ½º¸¦ Á¦°øÇÒ ¼ö ÀÖµµ·Ï ÃÖ¼±À» ´ÙÇÏ°Ú½À´Ï´Ù.\t\n°¨»çÇÕ´Ï´Ù.');
//	SetCookie('sys_notice1', 'Y');
//}

// ÆË¾÷À©µµ¿ì ¿­±â(ÄíÅ°È°¿ë)
function OpenEvent(p_StrPage, p_StrWinName, p_IntSrollbars, p_IntToolbar, p_IntLocation, p_IntResizable, p_IntWidth, p_IntHeight, p_IntLeft, p_IntTop)
{
	if (GetCookie(p_StrWinName) != "deny")
	{
		OpenWindow(p_StrPage, p_StrWinName, p_IntSrollbars, p_IntToolbar, p_IntLocation, p_IntResizable, p_IntWidth, p_IntHeight, p_IntLeft, p_IntTop);
	}
}


// ÆË¾÷À©µµ¿ì »ý¼º
function OpenWindow(p_StrPage, p_StrWinName, p_IntSrollbars, p_IntToolbar, p_IntLocation, p_IntResizable, p_IntWidth, p_IntHeight, p_IntLeft, p_IntTop)
{
	var OpenWin = window.open( p_StrPage, p_StrWinName, 
		"scrollbars="+ p_IntSrollbars +",toolbar="+ p_IntToolbar +",location="+ p_IntLocation +",resizable="+ p_IntResizable +",width="+ p_IntWidth +",height="+ p_IntHeight +",state=1,left="+ p_IntLeft +".top="+ p_IntTop );
	if (!OpenWin)
	{
		alert("[ È®ÀÎ ] ÆË¾÷ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù.\t\nÂ÷´ÜµÈ ÆË¾÷Ã¢À» Çã¿ëÇØ ÁÖ½Ê½Ã¿À.");
		return;
	}
	OpenWin.focus();
	return;
}


function _OnCalculator()
{
	OpenWindow( '/Etc/Calculator.asp','pop_Calculator', 1, 0, 0, 0, 500, 430, 0, 0  )
}

function _OnPopGuide(part, page, page1, page2)
{
	if (part == 'movie')	{
		OpenWindow( '/Helpdesk/PopGuide/10.asp' , 'pop_Guide', 0, 0, 0, 1, 710, 575, 0, 0  );
	}else if (part == 'guide') {
		OpenWindow( '/Helpdesk/PopGuide/guide_main.asp' , 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else if (part == 'auction') {
		page = page	|| '01_01.asp';
		page1 = page1	||	'2';
		page2 = page2	||	'';
		OpenWindow( '/Helpdesk/PopGuide/' + page + '?page=' + page1 + '&page2=' + page2, 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else if (part == 'purchase') {
		page = page	|| '02_01.asp';
		page1 = page1	||	'3';
		page2 = page2	||	'';
		OpenWindow( '/Helpdesk/PopGuide/' + page + '?page=' + page1 + '&page2=' + page2, 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else if (part == 'delivery') {
		page = page	|| '03_01.asp';
		page1 = page1	||	'4';
		page2 = page2	||	'';
		OpenWindow( '/Helpdesk/PopGuide/' + page + '?page=' + page1 + '&page2=' + page2, 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else if (part == 'clearance') {
		page = page	|| '04_01.asp';
		page1 = page1	||	'5';
		page2 = page2	||	'';
		OpenWindow( '/Helpdesk/PopGuide/' + page + '?page=' + page1 + '&page2=' + page2, 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else if (page != ''){
		OpenWindow( '/Helpdesk/PopGuide/' + page + '?page=' + page1 + '&page'+page1+'=' + page2, 'pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}else {
		OpenWindow( '/Helpdesk/PopupGuide.asp','pop_Guide', 1, 1, 0, 1, 710, 575, 0, 0  );
	}
}

function _OnShortTranslate()
{
	OpenWindow( 'http://webtsf.bidbuy.co.kr/manual/html/bidbuy/textTrans/textTrans.php', 'Translate', 0, 0, 0, 1, 360, 390, 0, 0  )
}

function _OnCurrentFE()
{
	OpenWindow( '/Etc/Currentfe.asp','pop_Currentfe', 1, 0, 0, 0, 430, 550, 0, 0, 0 );
}

function _OnBookmark()
{
	var StrFavoriteURL="http://www.bidbuy.co.kr";
	var StrFavoriteTitle="BIDBUY - ³²´Ù¸¥ ³ª¸¦ À§ÇÑ Global Agency";

	if (document.all)
		window.external.AddFavorite(StrFavoriteURL, StrFavoriteTitle);
}

function _OnTracking(thisForm)
{
	var StrCountryCode = thisForm.CountryCode.value;
	if (StrCountryCode == "JP")
	{
		OpenWindow( 'http://cp-asw.epost.go.kr:4949/ems/ems_kor.jsp', 'Tracking', 1, 1, 0, 1, 800, 600, 0, 0  )
	}
	else if (StrCountryCode == "US")
	{
		OpenWindow( 'http://hddweb.hanjinexpress.hanjin.net:7778/ithanex/IT_MENU.openMenu?id=hddit01', 'Tracking', 1, 1, 0, 1, 800, 600, 0, 0  )
	}
	else
	{
		alert("È­¹°¹è¼ÛÁ¶È¸ ±¹°¡¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return false;
	}
	return false;
}


// ¼¿·ºÆ®¹Ú½º ¼±ÅÃÀ¸·Î ÆäÀÌÁö º¯°æ
function _OnChangeSel(sel, targetstr)
{
	var index = sel.selectedIndex;
	if (sel.options[index].value != '')
	{
		if (targetstr == 'blank')
		{
			window.open(sel.options[index].value, 'win1');
		}
		else
		{
			var frameobj;
			if ((frameobj = eval(targetstr)) != null) frameobj.location = sel.options[index].value;
		}
	}
}

//¹ø¿ªÃ¢À¸·Î ¿­±â
function _Webtrans(Opt, Url, Type)
{
	if (!(Opt == 1 || Opt == 2)) Opt = 1;
	if (Url.length == 0)
	{
		alert("µµ¸ÞÀÎ¸íÀÌ ¿Ç¹Ù¸£Áö ¾Ê½À´Ï´Ù.\t\n");
		return;
	}
	if (Type.Trim() == "") Type = "10010";

	i = Url.indexOf("http://");
	if ( i == -1 ) Url = "http://" + Url;

	OpenWindow( "/Webtrans/?Opt=" + Opt + ""+ Type +"&Url="+ Url, "", 1, 1, 1, 1, 1000, 600, 0, 0  )
//	window.open( "/Webtrans/?Opt=" + Opt + ""+ Type +"&Url="+ Url, "_blank")
//	window.open('/Webtrans/?Opt=' + Opt + ''+ Type +'&Url='+ Url,'','status=yes,toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,width=800,height=600,left=330,top=20');
}

function Category(value)
{
	this.value = value;
	this.length = 0;
}

function addCategory(ValCategory, StrValue)
{
	ValCategory[ValCategory.length] = new Category(StrValue);
	ValCategory.length++;
}

var ArrCategory = new Category();
addCategory(ArrCategory, "°æ¸Å´ëÇà");
addCategory(ArrCategory[0], "¾ßÈÄÀçÆÒ");
addCategory(ArrCategory[0][0], "°æ¸ÅÁ¦¸ñ");
addCategory(ArrCategory[0][0], "Ä«Å×°í¸®");
addCategory(ArrCategory[0][0], "°æ¸Å ID");
addCategory(ArrCategory[0][0], "ÃâÇ°ÀÚ ID");

addCategory(ArrCategory[0], "ºñ´õ½º");
addCategory(ArrCategory[0][1], "°æ¸ÅÁ¦¸ñ");
addCategory(ArrCategory[0][1], "°æ¸Å ID");
addCategory(ArrCategory[0][1], "ÃâÇ°ÀÚ ID");
addCategory(ArrCategory[0][1], "ÃâÇ°ÀÚ ´Ð³×ÀÓ");
/*
addCategory(ArrCategory[0], "¶óÄíÅÙ");
addCategory(ArrCategory[0][2], "°æ¸ÅÁ¦¸ñ");
addCategory(ArrCategory[0][2], "°æ¸Å ID");
addCategory(ArrCategory[0][2], "ÃâÇ°ÀÚ ID");
*/
addCategory(ArrCategory[0], "ÀÌº£ÀÌ");
addCategory(ArrCategory[0][2], "°æ¸ÅÁ¦¸ñ");
addCategory(ArrCategory[0][2], "°æ¸Å ID");
addCategory(ArrCategory[0][2], "ÃâÇ°ÀÚ ID");

addCategory(ArrCategory, "±¸¸Å´ëÇà");
addCategory(ArrCategory[1], "¾ßÈÄÀçÆÒ");
addCategory(ArrCategory[1][0], "»óÇ°¸í");

addCategory(ArrCategory[1], "ºñ´õ½º");
addCategory(ArrCategory[1][1], "»óÇ°¸í");

addCategory(ArrCategory[1], "¶óÄíÅÙ");
addCategory(ArrCategory[1][2], "»óÇ°¸í");

addCategory(ArrCategory[1], "ÀÌº£ÀÌ");
addCategory(ArrCategory[1][3], "»óÇ°¸í");

addCategory(ArrCategory[1], "¾Æ¸¶Á¸");
addCategory(ArrCategory[1][4], "»óÇ°¸í");

function ChangeType(thisForm)
{
	var IntIndex = thisForm.pType.selectedIndex;
	thisForm.pSite.length = ArrCategory[IntIndex].length;
	for (var i=0; i<thisForm.pSite.length; i++)	 thisForm.pSite[i].text = ArrCategory[IntIndex][i].value;
	thisForm.pSite.selectedIndex = 0;
	ChangeSite(thisForm);
}

function ChangeSite(thisForm)
{
	var IntTypeIndex = thisForm.pType.selectedIndex;
	var IntSiteIndex = thisForm.pSite.selectedIndex;
	thisForm.pOption.length = ArrCategory[IntTypeIndex][IntSiteIndex].length;
	for (var i=0; i<thisForm.pOption.length; i++) thisForm.pOption[i].text = ArrCategory[IntTypeIndex][IntSiteIndex][i].value;
	thisForm.pOption.selectedIndex = 0;
}

// ÇÑ±ÛÀÔ·Â Ã¼Å©
function IsKorean(el)
{
	var pattern = /[°¡-Èþ]/;
	return (pattern.test(el.value.Trim())) ? true : false;
}

function TopSearch(thisForm) {
     var IntTypeIndex = thisForm.pType.selectedIndex;
     var IntSiteIndex = thisForm.pSite.selectedIndex;
     var IntOptionIndex = thisForm.pOption.selectedIndex;

	if (!thisForm.pKeyword.value.Trim()) {
		alert("°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		thisForm.pKeyword.focus();
		return false;
	}

	var EOpt, JOpt;
	var VOpt, StrSite, StrSearchKey;
	var Param;

     if (IntTypeIndex == 0) {	// Auctions

		EOpt = "200010";
		JOpt = "100010";

		if (IsKorean(thisForm.pKeyword)) {
			if (IntSiteIndex == 2)
				VOpt = EOpt.substring(0,3) + '1' + EOpt.substring(4,6);
			else
				VOpt = JOpt.substring(0,3) + '1' + JOpt.substring(4,6);
		}
		else {
			if (IntSiteIndex == 2)
				VOpt = EOpt;
			else
				VOpt = JOpt;
		}

		switch (IntSiteIndex)
		{
			case 0 :
				StrSite = "YAHOO";
				switch (IntOptionIndex)
				{
					case 0 :
						StrSearchKey = "Sub";
						break;
					case 1 :
						StrSearchKey = "Cate";
						break;
					case 2 :
						StrSearchKey = "Code";
						break;
					case 3 :
						StrSearchKey = "Seller";
						break;
				}
				break;
			case 1 :
				StrSite = "BIDDERS";
				switch (IntOptionIndex)
				{
					case 0 :
						StrSearchKey = "Sub";
						break;
					case 1 :
						StrSearchKey = "Code";
						break;
					case 2 :
						StrSearchKey = "Seller";
						break;
					case 3 :
						StrSearchKey = "Nick";
						break;
				}
				break;
/*			case 2 :
				StrSite = "RAKUTEN";
				switch (IntOptionIndex)
				{
					case 0 :
						StrSearchKey = "Sub";
						break;
					case 1 :
						StrSearchKey = "Code";
						break;
					case 2 :
						StrSearchKey = "Seller";
						break;
				}
				break; */
			case 2 :
				StrSite = "EBAY";
				switch (IntOptionIndex)
				{
					case 0 :
						StrSearchKey = "Sub";
						break;
					case 1 :
						StrSearchKey = "Code";
						break;
					case 2 :
						StrSearchKey = "Seller";
						break;
				}
				break;
		}

		thisForm.Opt.value = VOpt;
		thisForm.Site.value = StrSite;
		thisForm.SearchKey.value = StrSearchKey;
		thisForm.SearchWord.value = thisForm.pKeyword.value.Trim();
		var pop = window.open('', "sFrame", "width=1000, height=700, toolbar=yes,location=no,directories=no,resizable=yes,left=10,top=10");
		thisForm.action = Viewer;
		thisForm.target = "sFrame";
		pop.focus();
		return true;
	}
	else if (IntTypeIndex==1) { // Parchase

		EOpt = "200011";
		JOpt = "100011";

		if (IsKorean(thisForm.pKeyword)) {
			if (IntSiteIndex == 3)
				VOpt = EOpt.substring(0,3) + '1' + EOpt.substring(4,6);
			else
				VOpt = JOpt.substring(0,3) + '1' + JOpt.substring(4,6);
		}
		else {
			if (IntSiteIndex == 3)
				VOpt = EOpt;
			else
				VOpt = JOpt;
		}

		switch (IntSiteIndex)
		{
			case 0 :
				StrSite = "YAHOO";
				break;
			case 1 :
				StrSite = "BIDDERS";
				break;
			case 2 :
				StrSite = "RAKUTEN";
				break;
			case 3 :
				StrSite = "EBAY";
				break;
			case 4 :
				StrSite = "AMAZON";
				break;
		}

		StrSearchKey = "Sub";

		if (IntOptionIndex != 0)
		{
			alert("±¸¸Å´ëÇàÀÇ °æ¿ì Á¦Ç°¸í¿¡ ÀÇÇÑ °Ë»ö¸¸ °¡´ÉÇÕ´Ï´Ù.");
			return false;
		}

		thisForm.Opt.value = VOpt;
		thisForm.Site.value = StrSite;
		thisForm.SearchKey.value = StrSearchKey;
		thisForm.SearchWord.value = thisForm.pKeyword.value.Trim();
		var pop = window.open('', "sFrame", "width=1000, height=700, toolbar=yes,location=no,directories=no,resizable=yes,left=10,top=10");
		thisForm.action = Viewer;
		thisForm.target = "sFrame";
		pop.focus();
		return true;

//		Param = "?Opt=" + VOpt + "&Site=" + StrSite + "&SearchKey=" + StrSearchKey + "&SearchWord="+ thisForm.pKeyword.value.Trim();
//		var pop = window.open(Viewer + Param, "sFrame", "width=1000, height=700, toolbar=yes,location=no,directories=no,resizable=yes,left=10,top=10");
//		pop.focus();
	}
}

function initTopSearch(thisForm)
{
	thisForm.pType.length = ArrCategory.length;
	for (var i=0; i < ArrCategory.length; i++) thisForm.pType[i].text = ArrCategory[i].value;
	thisForm.pType.selectedIndex = 0;
	thisForm.pSite.selectedIndex = 0;
	ChangeType(thisForm);
}

function Catalog()
{
	if (screen.availWidth == 1024) {
		window.open("/Catalog/View.htm","","fullscreen");
	}
	else {
		var left = (screen.availWidth-1024-5) / 2;
		var top = (screen.availHeight-768-10) / 2;
		window.open("/Catalog/View.htm","","toolbar=no location=no directories=no status=no menubar=no scrollbars=no resizable=no width=600 height=480 top=" + top + " left=" + left);	
	}
}

if ('undefined' == typeof(window.dialogArguments) && !navigator.cookieEnabled) {
	if (confirm("ÄíÅ° ¼³Á¤ÀÌ µÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.\t\n\nÄíÅ° ¼³Á¤ ¾øÀÌ´Â ºñµå¹ÙÀÌ »ç¿ëÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.\t\nÄíÅ° ¼³Á¤ µµ¿ò¸»À» º¸½Ã°Ú½À´Ï±î?\t\n")) {
		idx = (navigator.appVersion.indexOf("MSIE"));
        if (idx > -1) IEV = parseInt(navigator.appVersion.substr(idx+4));
        if (IEV<=4) document.location.href = '/Cookie/Cookie_ie5.asp';
        else document.location.href = '/Cookie/Cookie_ie5.asp';
     }
}

//-->
