
/* Find offset poistions*/
function findPos(inp){
	obj = document.getElementById(inp);
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
	} while (obj = obj.offsetParent);
	}
    return [curleft,curtop];
}

/* when Body onload event Fire.... */
$(document).ready(function()
 {
     try
     {
        var PositionLeft = Math.ceil((document.body.clientWidth - 601) / 2) + 269;
        var PositionTop = findPos('TXT_Search')[1] + $("#TXT_Search").height() + 4;
        $("div#Listitems").attr("style", "left:" + PositionLeft + "px;top:" + PositionTop + "px");
//        $('a[href*="#"]').click(function()
//        {
//        if (location.pathname == this.pathname && location.host == this.host)
//             {
//                var target = $(this.hash);
//                target = target.size() && target || $("[name=" + this.hash.slice(1) + ']');
//                if (target.size()) 
//                {
//                    target.ScrollTo(400);
//                    return false;
//                }
//            };
//        }
//        );
    }
    catch (e) {
    }
   
    
    
    $("#dropdown").click(function() {
      
        $("div.dropdown").slideToggle("slow");

    });
    $("li#DPL_Item_0").click(function() {
        $("span#lblinustry").text($("li#DPL_Item_0").text());
        document.getElementById("ctl00_HDN_Combo").value = $("li#DPL_Item_0").text();
        $("div.dropdown").slideUp("slow");
        document.getElementById("ctl00_GDHeaderControl1_ctl00_GDHeaderControl1__Search").focus();
    });
    $("li#DPL_Item_1").click(function() {
        $("span#lblinustry").text($("li#DPL_Item_1").text());
        document.getElementById("ctl00_HDN_Combo").value = $("li#DPL_Item_1").text();
        $("div.dropdown").slideUp("slow");
        document.getElementById("ctl00_GDHeaderControl1_ctl00_GDHeaderControl1__Search").focus();
    });
    $("li#DPL_Item_2").click(function() {
        $("span#lblinustry").text($("li#DPL_Item_2").text());
        document.getElementById("ctl00_HDN_Combo").value = $("li#DPL_Item_2").text();
        $("div.dropdown").slideUp("slow");
        document.getElementById("ctl00_GDHeaderControl1_ctl00_GDHeaderControl1__Search").focus();
    });
    
});
/* when Body onclick event Fire.... */
$(document.body).mousedown(function () {
    try{
        if($("div.dropdown").css("display")=="block")
        {
            $("div.dropdown").slideUp("slow");
        }
    }
    catch(e){
        //
    }
});
