

$(document).ready(function() {
    var whatsupNumber = Math.ceil((13 - 1 + 1) * Math.random());
    $("#whatsupRandom" + whatsupNumber).show();

    if (typeof isOzBrowser != "undefined" && isOzBrowser) {
        if (typeof rearraneSearchItemsByOzFunction == "function")
            rearraneSearchItemsByOzFunction(document.getElementById("qdomain"));

    }

    set_gcode();


	
    if (YesData.IsHttps() != "True")
        $("input[id='query']").focus();

    //ÀÚµ¿¿Ï¼ºÀ» À§ÇÑ ±â´É    
    //init_ac();

});


function set_gcode() {
/*	
 ½ºÄ«ÀÌ½ºÅ©¸®ÆÛ¿¡¼­ À£ÄÄ ¸ÞÀÎÀ» Á¦¿ÜÇÑ ÆäÀÌÁö¿¡¼­´Â Gcode¸¦ ÀüºÎ »èÁ¦ÇÔ
 2011.09.21 
 	¸ðµç ÆäÀÌÁö¿¡ Gcode°¡ ³ëÃâµÇµµ·Ï ¼öÁ¤
*/

    if (YesData.IsWelcomePage() == "False") {
        try {
    	/*  var skyscraper = $("#skyscraper a");
            for (var i = 0; i < $(skyscraper).length; i++) {
                var path = $(skyscraper)[i].href.split("?");

                if (path.length > 1) {
                    var query = path[1].split("&");

                    if (query.length > 1) {
                        var first_path = path[0];

                        for (var j = 0; j < query.length; j++) {
                            if (query[j].toLowerCase().indexOf("gcode") == -1) {
                                if (j == 0) {
                                    first_path += "?" + query[j];
                                }
                                else {
                                    first_path += "&" + query[j];
                                }
                            }
                        }
                        $(skyscraper)[i].href = first_path;
                    }
                    else {
                        $(skyscraper)[i].href = path[0];
                    }
                }
            }*/
            //whatup ¿µ¿ª
            var whatsup = $("#whatsupList a");
            for (var j = 0; j < $(whatsup).length; j++) {
                $(whatsup)[j].href = $(whatsup)[j].href.toLowerCase().replace("gcode=", "g=");
            }

            var whats = $("#whats a");
            for (var k = 0; k < $(whats).length; k++) {
                $(whats)[k].href = $(whats)[k].href.toLowerCase().replace("gcode=", "g=");
            }
            //¾î±ú¹è³Ê
            var banner = $("#banner a");
            for (var l = 0; l < $(banner).length; l++) {
                $(banner)[l].href = $(banner)[l].href.toLowerCase().replace("gcode=", "g=");
            }

            var popular = $("#popular a");
            for (var m = 0; m < $(popular).length; m++) {
                $(popular)[m].href = $(popular)[m].href.toLowerCase().replace("gcode=", "g=");
            }
            
        } catch (e) { }

    }
}

function toggle_search_submenu() {
    $("#search_submenu").toggle();
}

function close_search_submenu() {
    $("#search_submenu").hide();
}

function set_search_category(text, value) {
    $("#search_category").text(text);
    $("#qdomain").val(value);
}

/* ¸ÞÀÎ °Ë»ö ¹öÆ° */
function check_search() {
    var Gcode = "";
    var objForm = $("form[id='HeadForm']");
    //debugger;
    
    // ÃßÃµ¾î°¡ ÀÖÀ»½Ã ÃßÃµ¾î ¸µÅ©·Î ÀÌµ¿
    if ($.trim($("#keywordAd").val()) != "") {
        if (YesData.IsWelcomePage() == "True") {
            if ($("#keywordAd").val().indexOf("?") != -1)
                window.location = $("#keywordAd").val() + "&Gcode=000_004_002"
            else
                window.location = $("#keywordAd").val() + "?Gcode=000_004_002"
        }
        else
            window.location = $("#keywordAd").val();
        return false;
    }
    // ÃßÃµ¾î ÀÌ¹ÌÁö »ç¶óÁü
    $("#query").css("background-image", "");

    // °Ë»ö¾î¸¦ ÀÔ·Â¾ÈÇÒ½Ã °æ°í ¸Þ½ÃÁö
    if ($.trim($("#query").val()) == "") {
        alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
        $("#query").focus();
        return false;
    }

    switch ($.trim($("#qdomain").val())) {
        case "ºí·Î±×":
            $("#keyword").val($("#query").val());
            $(objForm).attr("action", YesData.BLOG_URL() + "/Search/index.aspx");
            Gcode = "Gcode=000_004";
            break;
        case "Ã¤³Î¿¹½º":
            $(objForm).attr("action", YesData.HTTP_URL() + "/chyes/searchResult.aspx?Gcode=000_004");
            Gcode = "Gcode=000_004";
            break;
        default:
            $("#domain").val(fnGetDomain($("#qdomain").val()));
            Gcode = "000_004_001";
            $("#Scode").val(fnGetScode($.trim($("#qdomain").val())));
            break;
    }
    //gcode¸¦ ³Ö´Â´Ù.
    $("#Gcode").val(Gcode);
    //if (gcode != undefined)
    //$("[name='Gcode']").val(Gcode);
}
/* Scode ¹ÝÈ¯ */
function fnGetScode(domain) {
    var ret = "";
    switch (domain) {
        case "±¹³»µµ¼­":
            ret = "006_002";
            break;
        case "¿Ü±¹µµ¼­":
            ret = "006_003";
            break;
        case "e-·¯´×":
            ret = "006_004";
            break;
        case "eBook":
            ret = "006_005";
            break;
        case "UsedGoods":
            ret = "006_015";
            break;
        case "À½¹Ý":
            ret = "006_006";
            break;
        case "DVD/ºñµð¿À":
            ret = "006_007";
            break;
        case "¿µÈ­":
            ret = "006_008";
            break;
        case "°ø¿¬":
            ret = "006_009";
            break;
        case "GIFT":
            ret = "006_0010";
            break;
        case "È­ÀåÇ°":
            ret = "006_011";
            break;
        default:
            // ÀüÃ¼
            ret = "006_001";
            break;
    }
    return ret;
}
function fnGetDomain(domain) {
    var ret = "";
    switch (domain) {
        case "±¹³»µµ¼­":
            ret = "BOOK";
            break;
        case "¿Ü±¹µµ¼­":
            ret = "FOREIGN";
            break;
        case "e-·¯´×":
            ret = "E_LEARNING";
            break;
        case "eBook":
            ret = "EBOOK";
            break;
        case "UsedGoods":
            ret = "USED_GOODS";
            break;
        case "À½¹Ý":
            ret = "MUSIC";
            break;
        case "DVD/ºñµð¿À":
            ret = "DVD";
            break;
        case "¿µÈ­":
            ret = "MOVIE";
            break;
        case "°ø¿¬":
            ret = "TICKET";
            break;
        case "GIFT":
            ret = "GIFT";
            break;
        case "È­ÀåÇ°":
            ret = "BEAUTY";
            break;
        default:
            // ÀüÃ¼
            ret = "ALL";
            break;
    }
    return ret;
}

//function check_search(gcode) {
//    var objForm = $("form[id='HeadForm']");
//    var qdomain = $(objForm).find("input[id='qdomain']").val();
//    var query = $(objForm).find("input[id='query']");
//    var keywordAd = $(objForm).find("input[id='keywordAd']");
//    
//    if (qdomain == "¸®ºä") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/searchCenter/searchReview.aspx?Gcode=000_004");
//    } else if (qdomain == "ºí·Î±×") {
//        objForm.keyword.value = objForm.query.value;
//        $(objForm).attr("action",YesData.BLOG_URL() + "/Search/index.aspx?Gcode=000_004");
//    } else if (qdomain == "Æ¼ÄÏ") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/searchCenter/searchMovie.aspx?Gcode=000_004");
//    } else if (qdomain == "µµ¼­º»¹®") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/searchCenter/searchBookContent.aspx?Gcode=000_004");
//    } else if (qdomain == "¿µÈ­") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/searchCenter/searchResultMovie.aspx?Gcode=000_004");
//    } else if (qdomain == "°ø¿¬") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/searchCenter/searchResultPlay.aspx?Gcode=000_004");
//    } else if (qdomain == "Ã¤³Î¿¹½º") {
//        $(objForm).attr("action", YesData.HTTP_URL() + "/chyes/searchResult.aspx?Gcode=000_004");
//    }
//    $(query).css("background-image", "");

//    //gcode¸¦ ³Ö´Â´Ù.
//    if (gcode != undefined)
//        $("[name='Gcode']").val(gcode);
//   
//    if ($(keywordAd).val() != "") {
//        if (YesData.IsWelcomePage() == "True") {
//            if ($(keywordAd).val().indexOf("?") != -1)
//                window.location = $(keywordAd).val() + "&Gcode=000_004_002"
//            else
//                window.location = $(keywordAd).val() + "?Gcode=000_004_002"
//        }
//        else
//            window.location = $(keywordAd).val();
//        return false;
//    }

//    if ($(query).val() == "") {
//        alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
//        $(objForm).focus();
//        return false;
//    }
//}
				



/*
function open_whatsup() {
    
    $("#whatsupList").show();
}

function close_whatsup() {
    $("#whatsupList").hide();
}
*/

//ÀÚµ¿¿Ï¼º ±â´É
var wi_int = 500;
var _startAcIndex = 3; // ÀÚµ¿¿Ï¼º ½ÃÀÛ´Ü¾î¼ö
var is_ac_open = false; //ÀÚµ¿¿Ï¼ºÀÌ ¿­·È´ÂÁö ¿©ºÎ
var is_ac_on = true;    //ÀÚµ¿¿Ï¼º »ç¿ë¿©ºÎ
var is_process_ac = false; //ÀÚµ¿¿Ï¼ºÀÌ ½ÇÇàµÇ´ÂÁßÀÎÁö ¿©ºÎ
var is_user_open = false; //»ç¿ëÀÚ°¡ ¼ÂÆÃÇÒ·Á°í Ã¢À» ¿¬ °æ¿ì
var old_keyword = "";
var ac_cursor_index = -1; //ÇöÀç °¡¸®Å°°í ÀÖ´Â ÀÎµ¦½º
var ac_item_count = 0;    //°Ë»ö ¾ÆÀÌÅÛ Ä«¿îÆ®
var query_init = false;   //°Ë»ö¹Ú½º¸¦ ÃÊ±âÈ­Çß´ÂÁö ¿©ºÎ
var timeout;


//ÀÚµ¿¿Ï¼º ±â´ÉÀ» ÃÊ±âÇÑ´Ù.
function init_ac() {

    timeout = setTimeout("do_ac()", wi_int);
    
    var ac_use = getCookie("AC_USE");   //ÀÚµ¿¿Ï¼º on,off
	if(!is_ac_on) ac_use = "N";			//¼³Á¤»ó Á¾·áÇßÀ¸¸é
    if (ac_use == "N") {
        is_ac_on = false;
        onoff_ac_image(); //²ô±â, ²¸±â ÀÌ¹ÌÁö º¯°æ
    }
    else
        is_ac_on = true;


    $("#query").bind(($.browser.opera ? "keypress" : "keydown"), function(e) {

        switch (e.keyCode) {
            case 40:    //DOWN
                acList_next();
                break;
            case 38:    //UP
                acList_prev();
                break;
            case 27:    //ESC
                close_ac();
                break;
            default:
                start_ac();
                break;
        }

    });

}

//
function check_ac_onoff() {
    var ac_use = getCookie("AC_USE");   //ÀÚµ¿¿Ï¼º on,off
    if (ac_use == "N") {
        is_ac_on = false;
        onoff_ac_image(); //²ô±â, ²¸±â ÀÌ¹ÌÁö º¯°æ
    }
    else
        is_ac_on = true;
}

//°Ë»ö¹Ú½º¸¦ ÃÊ±âÈ­ÇÑ´Ù.
function init_searchbox() {
    
    if (query_init)
        return;
    var obj = $("form[id='HeadForm'] input[id='query']");
    $(obj).css("background-image", "")
    $(obj).val("");
    $("form[id='HeadForm'] input[id='keywordAd']").val("");
    query_init = true;
}

//Àü ¾ÆÀÌÅÛÀ¸·Î ÀÌµ¿ÇÑ´Ù.
function acList_prev() {

    if (ac_cursor_index >= -1) {
        stop_ac(); //Ä¿¼­¸¦ ¿Å±â´Â µ¿¾ÈÀº °Ë»öÀ» ¸ØÃá´Ù.
        $("#ac_list_" + ac_cursor_index--).removeClass("hilight");
        var obj = $("#ac_list_" + ac_cursor_index);
        $(obj).addClass("hilight"); //Ä¿¼­ÀÌµ¿
        set_ac_image_link(obj);     //ÀÌ¹ÌÁö ¼ÂÆÃ
        $("#query").val($("#ac_query_" + ac_cursor_index).text());
    }
    
}

//´ÙÀ½ ¾ÆÀÌÅÛÀ¸·Î ÀÌµ¿ÇÑ´Ù.
function acList_next() {
    
    if (ac_cursor_index < ac_item_count - 1) {
        stop_ac(); //Ä¿¼­¸¦ ¿Å±â´Â µ¿¾ÈÀº °Ë»öÀ» ¸ØÃá´Ù.
        $("#ac_list_" + ac_cursor_index++).removeClass("hilight");
        var obj = $("#ac_list_" + ac_cursor_index);
        $(obj).addClass("hilight");
        set_ac_image_link(obj);
        $("#query").val($("#ac_query_" + ac_cursor_index).text());  //°Ë»öÃ¢¿¡ ÅØ½ºÆ® ¼ÂÆÃ
    }

}

function set_cursor(index) {
    ac_cursor_index = index;
    //¸¶¿ì½º¸¦ ¿Ã·ÈÀ»¶§ Ç¥½ÃµÇ´Â ºÎºÐÀÌ ÀÖÀ¸¸é »èÁ¦ÇÑ´Ù.
    for(k=0; k < ac_item_count; k++)
        $("#ac_list_" + k).removeClass("hilight");
}


//¹öÆ°À» Å¬¸¯ÇØ¼­ ÀÚµ¿¿Ï¼ºÀ» ¿­°í ´Ý´Â´Ù.
function toggle_ac() {
    
    if (is_ac_open) {
        is_user_open = false;
        close_ac();
        stop_ac();
    }
    else {
        is_user_open = true;
        old_keyword = "";   //old Å°¿öµå¸¦ ¸®¼ÂÇØ¼­ ´Ù½Ã °Ë»öµÇ°Ô ÇÑ´Ù.
        open_ac();
        start_ac();
    }
}

//ÀÚµ¿ ¿Ï¼º Ã¢À» ¿¬´Ù.
function open_ac() {

    //ÀÚµ¿ ¿Ï¼º ¿©ºÎ°¡ ²¨Á® ÀÖÀ¸¸é
    if (!is_ac_on) {
        $("#ac_list").html("<li>°Ë»ö¾î ÀÚµ¿¿Ï¼º ±â´ÉÀÌ ²¨Á® ÀÖ½À´Ï´Ù.</li>");
    }
    else {
        if($("#ac_list").html() == "")
            $("#ac_list").html("<li>°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.</li>");
    }
    $("#autoComplete").show();
    is_ac_open = true;
    
    
}

//ÀÚµ¿ ¿Ï¼º Ã¢À» ´Ý´Â´Ù.
function close_ac() {
    
    if (!is_user_open) {
        $("#autoComplete").hide();
        is_ac_open = false;
        $("#ac_list").html("");
        $("#ac_image_link").html("");
    }
    
}

//ÀÚµ¿ ¿Ï¼º ÀÛµ¿
function start_ac() {
    is_process_ac = true;
}

//ÀÚµ¿ ¿Ï¼º ¸ØÃã
function stop_ac() {
    is_process_ac = false;
}
//ÀÚµ¿ ¿Ï¼º ±â´É »ç¿ë
function on_ac() {
    is_ac_on = true;
    onoff_ac_image();
    setCookie("AC_USE", "Y", -1000);
    open_ac();
    start_ac();
    $("#query").focus();
    
}
//ÀÚµ¿ ¿Ï¼º ±â´É ¸ØÃã
function off_ac() {
    is_ac_on = false;
    //var query = $("input[id='query']");
    onoff_ac_image();
    //ÀÚµ¿¿Ï¼º±â´É ÇÏ·çµ¿¾È»ç¿ë¾ÈÇÔ
    setCookie("AC_USE", "N", 1000 * 60 * 60 * 24);
    close_ac();
    stop_ac();
    
}

function onoff_ac_image() {
    
    $("#ac_img_off").toggle();
    $("#ac_img_on").toggle();
}

//ÀÚµ¿¿Ï¼º ¾ÆÀÌÅÛÀ» °Ë»öÇÑ´Ù.
function search_ac_item(i) {
    check_search("000_004_003");
    $("#query").val($("#ac_query_" + i).text());
    $("form[id='HeadForm']").submit();
}


//ÀÚµ¿ ¿Ï¼ºÀ» ½ÇÇà
function do_ac() {

    //ÀÚµ¿¿Ï¼º ±â´ÉÀÌ on/off ¿©ºÎ
    if (is_ac_on && is_process_ac) {
        var keyword = document.getElementById("query").value;
        var qdomain = document.getElementById('qdomain').value;
        if (keyword.length >= _startAcIndex) {  //ÃÖ¼Ò±æÀÌ ÀÌ»ó
            if (old_keyword != keyword) {
                if (qdomain != "µµ¼­º»¹®" && qdomain != "ºí·Î±×" && qdomain != "Ã¤³Î¿¹½º")
                    get_search_result(keyword, qdomain);
            }
        }
        else {
            close_ac();
        }
    }
    clearTimeout(timeout);
    timeout = setTimeout("do_ac()", wi_int);
}


function get_search_result(keyword, target) {
    old_keyword = keyword;
    //$.ajaxSetup({ contentType: "application/x-www-form-urlencoded;charset=utf-8" });
    var requestUrl = "/searchCenter/get_ac_2.aspx";
    var data = "p=1&q=" + escape(keyword) + "&t=" + escape(target);
    $.get(requestUrl, data, function(data) {
        
        eval(data);
        set_ac_list(qs_q, qs_ac_list, qs_ac_id, qs_m);
        open_ac();
        is_user_open = false; //À¯Àú°¡ Ã¢ ¿¬ ±â´ÉÀ» Á¾·á

    });
    
}

function go_to_goods(goodsNo) {
    var value = $("#qdomain").val();
    if (value == "¿µÈ­")
        location.href = "http://movie.yes24.com/Movie/Movie_View_Default.aspx?m_id=" + goodsNo;
    else if (value == "°ø¿¬")
        location.href = "http://ticket.yes24.com/Home/Perf/PerfDetailInfo.aspx?IdPerf=" + (parseInt(goodsNo, 10) + 100000);
    else
        location.href = YesData.HTTP_URL() + "/24/Goods/" + goodsNo;
}

//ÀÌ¹ÌÁö ¼ÂÆÃ
function set_ac_image_link(obj) {
    var html = "";
    var dataobj = $(obj).find("span");
    var goodsno = $(dataobj).attr("goodsno");
    var imagepath = $(dataobj).attr("imagepath");
    var agelmtyn = $(dataobj).attr("agelmtyn");
    var lmtage = $(dataobj).attr("lmtage");
    if (imagepath != "" && imagepath != undefined) {
        if (agelmtyn == 'Y' && lmtage > YesData.MEM_AGE() && lmtage >= 19) //19¼¼ Á¦ÇÑ
            imagepath = "http://image.yes24.com/sysimage/pd19.gif";
        if (YesData.IsHttps() == "True")
            imagepath = path.replace(YesData.IMG_HOST_SYS(), YesData.HTTPS_IMG_HOST_SYS());
        html = "<a href=\"javascript:go_to_goods(" + goodsno + ");\"><img src=\"" + imagepath + "\" alt=\"\"/></a>";
    }
    $("#ac_image_link").html(html);

}



//ÀÚµ¿¿Ï¼º Ã¢ ¼ÂÆÃ
function set_ac_list(aq, ac_list, ai, am) {

    var keyword = jQuery.trim($("#query").val());
    if (aq && aq != "" && aq != keyword) return;

    ac_cursor_index = -1; //ÃÊ±âÈ­
    ac_item_count = 0;  //°Ë»ö ¾ÆÀÌÅÛ ¼ö ÃÊ±âÈ­
    
    var html = "";
    if (ac_list.length > 0 && ac_list != "") {
        
        for (i = 0; i < ac_list.length && i < 7; i++) {
            var data = ac_list[i].split("^");
            var goodsNm = data[0];
            var iamage_path = data[1];
			var goodsNo = data[2];
			var age_lmt_yn = data[3];
			var lmt_age = data[4];
			var name = "";
			//¹®ÀÚ¸¦ ÀÚ¸¥´Ù.
			if (goodsNm.length > 16)
			    name = goodsNm.substring(0, 16) + "...";
			else
	           name = goodsNm;
	        //°Ë»ö¾î¿Í °á°ú°¡ ¸ÅÄªµÇ´Â ºÎºÐÀ» °­Á¶           
	        var pos = goodsNm.indexOf(keyword);
			if (pos >= 0) {
			    if (pos == 0)
			        name = js_highlight(name, keyword, 0);
			    else if (pos == goodsNm.length - 1)
			        name = js_highlight(name, keyword, -1);
			    else
			        name = js_highlight(name, keyword, pos);
			}

			html += "<li id='ac_list_" + i + "' onmouseover='set_ac_image_link(this);set_cursor(" + i + ");set_useropen(true);' onmouseout='set_useropen(false)'><a href='javascript:search_ac_item(" + i + ");' style='cursor:pointer'>" + name + "</a>";
			html += "<span id='ac_query_" + i + "' style='display:none' goodsno='" + goodsNo + "' imagepath='" + iamage_path + "' agelmtyn='"+ age_lmt_yn + "' lmtage="+lmt_age +">" + goodsNm + "</span></li>";
			ac_item_count++;
        }

    }
    else {
        html = "<li>ÃßÃµ »óÇ°¸íÀÌ ¾ø½À´Ï´Ù.</li>";
    }
    $("#ac_list").html(html);
}

function set_useropen(value) {
    is_user_open = value;
}
//°Ë»ö¾î °­Á¶
function js_highlight(s, d, is_suf) {
     var ret="";
     if (is_suf == 0) {
         ret = js_makehigh_pre(s.toLowerCase(), d.toLowerCase());
     } 
     else if (is_suf == -1) {
        ret = js_makehigh_suf(s.toLowerCase(), d.toLowerCase());
     }
     else {
         ret = js_makehigh_mid(s.toLowerCase(), d.toLowerCase(), is_suf);
     }

     if (ret=="") return s;
     else return ret;
} 

function js_makehigh_pre(s, t) {
    var d = "";
    var s1 = s.replace(/ /g, "");
    var t1 = t.replace(/ /g, "");
    t1 = t1.toLowerCase();
    if (t1 == s1.substring(0, t1.length)) {
        d = "<strong>";
        for (var i = 0, j = 0; j < t1.length; i++) {
            if (s.substring(i, i + 1) != " ") j++;
            d += s.substring(i, i + 1)
        }
        d += "</strong>" + s.substring(i, s.length)
    }
    return d;
}

function js_makehigh_suf(s, t) {
    var d = "";
    var s1 = s.replace(/ /g, "");
    var t1 = t.replace(/ /g, "");
    t1 = t1.toLowerCase();
    if (t1 == s1.substring(s1.length - t1.length)) {
        for (var i = 0, j = 0; j < s1.length - t1.length; i++) {
            if (s.substring(i, i + 1) != " ") j++;
            d += s.substring(i, i + 1);
        }
        d += "<strong>";
        for (var k = i, l = 0; l < t1.length; k++) {
            if (s.substring(k, k + 1) != " ") l++;
            d += s.substring(k, k + 1);
        }
        d += "</strong>";
    }
    return d;
}

function js_makehigh_mid(s, t, pos) {
    var d = "";
    var s1 = s.replace(/ /g, "");
    var t1 = t.replace(/ /g, "");
    t1 = t1.toLowerCase();

    d = s.substring(0, pos);
    d += "<strong>";
    for (var i = pos, j = 0; j < t1.length; i++) {
        if (s.substring(i, i + 1) != " ") j++;
        d += s.substring(i, i + 1);
    }
    d += "</strong>" + s.substring(i, s.length);
    return d;
}


function open_layer(obj, topPosition) {
    obj.style.visibility = "visible";
    obj.style.top = topPosition;
}

function close_layer(obj) {
    obj.style.visibility = "hidden";
}

function openAddSearchWin() {
    centerNewWinNoScroll(YesData.HTTP_URL() + "/main/popup_AddSearchWin.aspx?Gcode=001_001_010", "searchTerm", 363, 414);
}


