﻿/// <reference path="~/scripts/jquery-1.3.2.js" />
var searchboxActive = false;
var searchBoxText = "";

if (window.location.hostname == "eng.globalconnect.dk")
    searchBoxText = "Search";
else
    searchBoxText = "Søg";

$(document).ready(function() {
	// Hover for sitesearch
	$(".siteSearch input").hover(function() { searchActive(); },
	function() {
		if (!searchboxActive) { searchInactive(); }
	});
	// On focus/blur for sitesearch input
	//var textBox = $(".siteSearch .box").get();
	//$(".siteSearch .box").each(function() { $(this).data("defValue", $(this).attr("value"); });
	$(".siteSearch .box").focus(function() {
		searchboxActive = true;
		if (this.value == searchBoxText) this.value = "";
	}).blur(function() {
		searchboxActive = false;
		if ($(this).attr("value") == "") $(this).attr("value", searchBoxText);
		searchInactive();
	});
});

function searchActive() {
	$(".siteSearch .box").addClass("active");
	$(".siteSearch .image").attr("src", "/images/topbar-search-button-active.png");
}

function searchInactive() {
	$(".siteSearch .box").removeClass("active");
	$(".siteSearch .image").attr("src", "/images/topbar-search-button.png");
}