﻿/*
	This software code is made available "AS IS" without warranties of any 
	kind.  You may copy, display, modify and redistribute the software
	code either by itself or as incorporated into your code; provided that
	you do not remove any proprietary notices.  Your use of this software
	code is at your own risk and you waive any claim against Amazon
	Web Services LLC or its affiliates with respect to your use of
	this software code. (c) Amazon Web Services LLC or its
	affiliates.
*/

function search(click)
{
	if(click) // someone clicked on a button
	{
		resetActionAndSubmit(1);
	}
	else // someone hit enter while focus was in a text box
	{
		if(window.event) // IE
		{
			if(event.keyCode==13)	resetActionAndSubmit(1);
		}
		else if(event.which) // Netscape/Firefox/Opera
		{
			if(event.which==13)	resetActionAndSubmit(1);
		}
	}
	return true;
}

function resetActionAndSubmit(page)
{
	index = document.getElementById("ctl00_SearchControl_Category").selectedIndex;
	category = document.getElementById("ctl00_SearchControl_Category").options[index].value;
	keywords = escape(document.getElementById("ctl00_SearchControl_Keywords").value);
	document.forms[0].action = "Main.aspx?Category=" + category + "&Keywords=" + keywords + "&Page=" + page;
	document.forms[0].submit();
}

function loadPage(page)
{
	resetActionAndSubmit(page);
	
}

function popup(mylink, windowname, width, height)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width='+width+',height='+height+',scrollbars=no');
return false;
}
