$(document).ready(function(){ 
	$.ajax({
		type: "POST",
		url: "searchbox2.php",		//ooo - searchbox.php
		success: function(msg){
			$('#Layer2').html(msg);
			var templeft = $("#refpoint").position().left;
			var temptop = $("#refpoint").position().top - $("#Layer2").innerHeight() -3;	// +8
			$("#Layer2").css('top',temptop+'px');
			$("#Layer2").css('left',templeft+'px');
			$('#Layer2').css('visibility', 'visible');
			$("#searchBoxBtn").click(function(){
				$("#searhform").submit();
			});
			
			$("#search").focus(function() {
				if ($("#search").val() == "請輸入關鍵字") {
					$("#search").val("");
				}
			});
			
			$("#search").focusout(function() {
				if ($("#search").val() == "") {
					$("#search").val("請輸入關鍵字");
				}
			});
		}
	});
	
	/*
	var templeft = $("#refpoint").position().left;
	var temptop = $("#refpoint").position().top - $("#Layer2").innerHeight() + 8;
	$("#Layer2").css('top',temptop+'px');
	$("#Layer2").css('left',templeft+'px');
    $('#Layer2').css('visibility', 'visible');
	$("#searchBoxBtn").click(function(){
		$("#searhform").submit();
	});
	
	$("#search").focus(function() {
		if ($("#search").val() == "請輸入關鍵字") {
			$("#search").val("");
		}
	});
	
	$("#search").focusout(function() {
		if ($("#search").val() == "") {
			$("#search").val("請輸入關鍵字");
		}
	});
	*/


$(window).resize(function() {
  	var templeft = $("#refpoint").position().left;
	var temptop = $("#refpoint").position().top - $("#Layer2").innerHeight() -3;	//-3
	$("#Layer2").css('top',temptop+'px');
	$("#Layer2").css('left',templeft+'px');
});


 });

