﻿<!-- begin hiding js

/* 
 *	    file: global.js
 *  purpose: this file contains generic javascript functions used throughout iSuppli.com
 */	
 
	//AC_FL_RunContent = 0;

 	function gotoSearch() {
		str = "";
		txt = document.getElementById("txtAdvancedSearchKeyword");
		document.location = "/search.aspx?k=" + txt.value;
	}
	
	function isSubmit() {
		if (event.keyCode == 13) {
		str = "";
		txt = document.getElementById("txtAdvancedSearchKeyword");
		document.location = "/search.aspx?k=" + txt.value;
		}
	}


	function ClearAdvancedSearchKeyword()
	{
		// get value of advanced search text box and blank it if it is 'search all of iSuppli'
		var txtAdvancedSearchKeyword = document.getElementById('txtAdvancedSearchKeyword');
		var sKeyword = txtAdvancedSearchKeyword.value;
		if (sKeyword == 'Search All of iSuppli')
		{
			txtAdvancedSearchKeyword.value = '';
		}
	}

	function GotoSearch( bNow, sTargetUrl )
	{
		if ( bNow == 1)
		{
			// go now

			// get value of advanced search text box
			var txtAdvancedSearchKeyword = document.getElementById('txtAdvancedSearchKeyword');
			var sKeyword = txtAdvancedSearchKeyword.value;
			
			if (sKeyword == 'Search All of iSuppli')
			{
				sKeyword = '';
			}

			// window.location.href = '/ProductSearch.aspx?KEYWORD=' + sKeyword + ''; 
			window.location.href = sTargetUrl + sKeyword + ''; 

			window.event.cancelBubble = true;

		}
		else
		{
			// if enter then go 
			var iKeyCode = window.event.keyCode;
	
			if (iKeyCode == 13)
			{
				window.event.keyCode = 0;
				GotoSearch( 1, sTargetUrl);
			}
		}
	}

// stop hiding js -->
 
 


