var tmpHTMLforSearch2 = "'";
var tmpHTMLforSearch = '<form id="msviLSBFormcommon" action="/library/toolbar/3.0/search.aspx" target="_top">';
tmpHTMLforSearch = tmpHTMLforSearch + '<div id="msKievcommon">';
tmpHTMLforSearch = tmpHTMLforSearch + '<input type="hidden" name="View" value="ko-kr">';
tmpHTMLforSearch = tmpHTMLforSearch + '<input type="hidden" name="charset" value="utf-8">';
tmpHTMLforSearch = tmpHTMLforSearch + '<input id="msviLSBtboxcommom" style="font-style:italic; color:#a1a1a1" onkeydown="if(event.keyCode == 13)searchBoxBlur(\'Microsoft.com 검색\')" onfocus="searchBoxFocused(\'Microsoft.com 검색\')" onblur="searchBoxBlur(\'Microsoft.com 검색\')" type="text" name="qu" value="Microsoft.com 검색" autocomplete="off">';
tmpHTMLforSearch = tmpHTMLforSearch + '<span id="msviLSBlogocommon" class="msviLSBlogocommon" title="Bing 제공"></span>';

tmpHTMLforSearch = tmpHTMLforSearch + '<input id="msviLSBssearchcommon" title="Microsoft.com 검색" type="image" name="site" src="/library/toolbar/3.0/images/LSB/Search_icon.gif" align="absmiddle">';
//tmpHTMLforSearch = tmpHTMLforSearch + '<a href="javascript:BingSearchKRMSCOMs()"><img src="/library/toolbar/3.0/images/LSB/Search_icon.gif" align="absmiddle"></a>';
tmpHTMLforSearch = tmpHTMLforSearch + '</div>';
//tmpHTMLforSearch = tmpHTMLforSearch + '<div id="msKievcommon2"><input id="msviLSBWebcommon" title="웹 검색" name="web" type="submit" value="" align="absmiddle" onclick="BingSearchKRMSCOM()"></div>';
tmpHTMLforSearch = tmpHTMLforSearch + '</form>';

document.write('<link href="/korea/css/bingSearch.css" rel="stylesheet" type="text/css">');
document.write(tmpHTMLforSearch);

var isInputqu = false;
var searchBoxWidthWithKievLogo = 0;
var searchBoxWidthWithoutKievLogo = 0;
function clearDefaultSearchLable()
{var searchBox = document.getElementById("msviLSBtboxcommom");
if(!isInputqu){searchBox.value = "";}}
var kievImageWidth = 0;

function searchBoxFocused(defaultSearchLabel)
{
    var searchBoxInput = document.getElementById("msviLSBtboxcommom");
    var kievImage = document.getElementById("msviLSBlogocommon");
    if(searchBoxInput.value == defaultSearchLabel)
    {
        searchBoxInput.value = '';
        if(kievImageWidth == 0)
        {
            kievImageWidth = kievImage.clientWidth;
        }
        searchBoxInput.style.fontStyle = '';
        searchBoxInput.style.color='#000000';
        kievImage.style.width = '1px';

        if(searchBoxWidthWithKievLogo == 0)
        {
            searchBoxWidthWithKievLogo = searchBoxInput.style.width;
            searchBoxWidthWithoutKievLogo = searchBoxInput.clientWidth + (kievImageWidth - 1);
        }
        searchBoxInput.style.width = searchBoxWidthWithoutKievLogo;
    }
}

function searchBoxBlur(defaultSearchLabel)
{
    var searchBoxInput = document.getElementById("msviLSBtboxcommom");
    var kievImage = document.getElementById("msviLSBlogocommon");
    if(searchBoxInput.value.replace(/(^\s*)|(\s*$)/g, '')=='')
    {
        searchBoxInput.value=defaultSearchLabel;
        searchBoxInput.style.fontStyle ='Italic';
        searchBoxInput.style.color = "#a1a1a1";
        kievImage.style.width = kievImageWidth;

        searchBoxInput.style.width = searchBoxWidthWithKievLogo;
        isInputqu = false;
     }
     else
     {
        isInputqu = true;
		// KRMSCOM_Search();
     }
}

function KRMSCOM_Search(){
	if(isInputqu){
		document.getElementById("msviLSBFormcommon").submit();
	}
}

function BingSearchKRMSCOM(){
    var searchBoxInput = document.getElementById("msviLSBtboxcommom");
	var tmpurls = "http://www.bing.com/search?mkt=ko-KR&q=" + searchBoxInput.value;

	document.getElementById("msviLSBFormcommon").action=tmpurls;
	document.getElementById("msviLSBFormcommon").submit();
}

 function BingSearchKRMSCOMs(){
//     var searchBoxInput = document.getElementById("msviLSBtboxcommom");
//
// 	//var tmpurls = "http://www.bing.com/search?charset=utf-8&mkt=ko-KR&q=" + searchBoxInput.value;
// 	var tmpurls = "http://search.microsoft.com/result.aspx?type=web&mkt=ko-KR&q=" + searchBoxInput.value;
// 	window.location=tmpurls;

    var searchBoxInput = document.getElementById("msviLSBtboxcommom");
	var tmpurls = "http://www.bing.com/search?mkt=ko-KR&q=" + searchBoxInput.value;

	document.getElementById("msviLSBFormcommon").action=tmpurls;
	document.getElementById("msviLSBFormcommon").submit();

 }