﻿
//
//  EDC header.js
//

/* Search button filter menu functions */

var g_iSearchButtonTimer = Number(0);
function SearchButtonMouseOver() {
	document.getElementById('HAT-filter-menu').style.display = 'block';
	clearTimeout(g_iSearchButtonTimer);
}

function SearchButtonMouseOut() {
	g_iSearchButtonTimer = setTimeout("HideSearchFilterMenu()", 200 );
}

function HideSearchFilterMenu() {
	document.getElementById('HAT-filter-menu').style.display = 'none';
}

/* Search functions */

// Trap Enter events in the document so that the default aspx form is not submitted
function BodyKeyPress(e) {
	var key;      
	if(window.event)
		key = window.event.keyCode; //IE
	else
		key = e.which; //firefox      

	return (key != 13);
}

// Handle the key press in the search field
function SearchKeyPress(strKey) {
	if ( strKey == 13 ) {
		SearchEDC();
	}
}

// Send the user to the search page for the EDC
function SearchEDC() {
	// Verify that the user entered search text
	var strQuery = String(document.getElementById('SearchTextBox').value);
	if ( strQuery == "" ) {
		document.getElementById('SearchTextBox').className = 'HAT-searchbox-error';
		return;
	}
	// Redirect them to the search page
	var strSearchUrl = String(document.getElementById('SearchUrl').value);
	document.location = ( strSearchUrl + "?q=" + escape(strQuery) + "&source=top" );
}

// Send the user to the search page for the community
function SearchEmbeddedCommunity() {
	// Verify that the user entered search text
	var strQuery = String(document.getElementById('SearchTextBox').value);
	if ( strQuery == "" ) {
		document.getElementById('SearchTextBox').className = 'HAT-searchbox-error';
		return;
	}
	// Redirect them to the search page
	document.location = ( "http://community.edc.intel.com/intel/search?submitted=true&q=" + escape(strQuery) );
}

// Send the user to the Intel.com search page
function SearchIntelDotCom(strCulture) {
	// Verify that the user entered search text
	var strQuery = String(document.getElementById('SearchTextBox').value);
	if ( strQuery == "" ) {
		document.getElementById('SearchTextBox').className = 'HAT-searchbox-error';
		return;
	}
	// If we weren't passed a culture then use english
	if ( strCulture == null || strCulture == "" ) {
		strCulture = "en_US";
	}
	var strSearchUrl = String("http://mysearch.intel.com/corporate/default.aspx?culture=" + strCulture + "&category=all&adv=0&value=0&q=" + escape(strQuery));
	
	// Redirect them to the search page
	document.location = strSearchUrl;
}

function emailFriendEDC(location) {
	var width = "492";
	var heigth = "550";
	if (!location) { location = "en_US";}
	if (location == "pl_PL") {width = "562";}
	if (location == "cs_CZ"|location == "es_MX"|location == "es_LA"|location == "es_ES"|location == "nl_NL"|location == "pt_BR") {width = "542";}
	if (location == "he_IL") {width = "502";}
	if (location == "fr_FR"|location == "vi_VN") {width = "462";}
	if (location == "uk_UA") {width = "455";}
	var shareUrl = "http://www.intel.com/sites/sitewide/" + location + "/emailfriend.htm?param=" + document.location.href;
	openWin(shareUrl,width,heigth,"no","no","no","yes",60,40,"emailfriend");
}
