/********************************************************************
 * Filename: site_search_branding.js                                *
 * Language: JavaScript                                             *
 *                                                                  *
 * Author: Jason Liu                                                *
 *                                                                  *
 * Copyright (c) 2008 Jason Liu. All rights reserved.               *
 * Copyright (c) 2008 The University of Minnesota Department of     *
 *                    Electrical and Computer Engineering.          *
 * Copyright (c) 2008 The University of Minnesota Institute of      *
 *                    Technology.                                   *
 * Copyright (c) 2008 The Regents of the University of Minnesota.   *
 *                                                                  *
 * Legal Disclaimer:                                                *
 *                                                                  *
 *     [Originally taken from                                       *
 *         http://www.perl.com/doc/FAQs/FAQ/oldfaq-html/Q3.5.html]  *
 *                                                                  *
 *     [In the following, "licensee" refers to the University of    *
 *      Minnesota Electrical and Computer Engineering Department,   *
 *      the University of Minnesota Institute of Technology, and    *
 *      the Regents of the University of Minnesota.]                *
 *                                                                  *
 *     This is UNPUBLISHED PROPRIETARY SOURCE CODE of Jason Liu;    *
 *     the contents of this file may not be disclosed to third      *
 *     parties, copied or duplicated in any form, in whole or in    *
 *     part, without the prior written permission of Jason Liu.     *
 *                                                                  *
 *     Permission is hereby granted solely to the licensee for use  *
 *     of this source code in its unaltered state. This source code *
 *     may not be modified by licensee except under direction of    *
 *     Jason Liu. Neither may this source code be given under any   *
 *     circumstances to non-licensees in any form, including source *
 *     or binary. Modification of this source constitutes breach of *
 *     contract, which voids any potential pending support          *
 *     responsibilities by Jason Liu. Divulging the exact or        *
 *     paraphrased contents of this source code to unlicensed       *
 *     parties either directly or indirectly constitutes violation  *
 *     of federal and international copyright and trade secret      *
 *     laws, and will be duly prosecuted to the fullest extent      *
 *     permitted under law.                                         *
 *                                                                  *
 *     This software is provided by Jason Liu "as is" and any       *
 *     express or implied warranties, including, but not limited    *
 *     to, the implied warranties of merchantability and fitness    *
 *     for a particular purpose are disclaimed. In no event shall   *
 *     the regents or contributors be liable for any direct,        *
 *     indirect, incidental, special, exemplary, or consequential   *
 *     damages (including, but not limited to, procurement of       *
 *     substitute goods or services; loss of use, data, or profits; *
 *     or business interruption) however caused and on any theory   *
 *     of liability, whether in contract, strict liability, or tort *
 *     (including negligence or otherwise) arising in any way out   *
 *     of the use of this software, even if advised of the          *
 *     possibility of such damage.                                  *
 *                                                                  *
 * Description:                                                     *
 *                                                                  *
 *     This adds the Google logo to the "Search ECE" text field.    *
 ********************************************************************/

function showLogo() {
	var form = document.getElementById("site_searchbox");
	if (form && form.q) var q = form.q;
	if (navigator.platform == "Win32") {
		q.style.border = "1px solid #7e9db9";
		q.style.padding = "2px";
	}
	if (q.value == "")
		q.style.background = "white url(" +
		                     "http://www.google.com/coop/intl/en/images/google_custom_search_watermark.gif" +
		                     ") left no-repeat";
}

function hideLogo() {
	var form = document.getElementById("site_searchbox");
	if (form && form.q) var q = form.q;
	q.style.background = "white";
}

var inputbox = document.getElementById("site_search_inputbox");
if (inputbox.addEventListener) {
	inputbox.addEventListener("blur",  showLogo, false);
	inputbox.addEventListener("focus", hideLogo, false);
} else if (inputbox.attachEvent) {
	inputbox.attachEvent("onblur",  showLogo);
	inputbox.attachEvent("onfocus", hideLogo);
}
if (!/[&?]q=[^&]/.test(location.search)) showLogo();

/********************************************************************
 ******************* End of JavaScript code file ********************
 ********************************************************************/
