﻿/// <reference path="jquery-1.4.1.js" />
/*
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;
}

function adBlockEnabledText() {
	$('#adScript2').html('<span style="color: #fff; padding: 2px;"><p>Ad blocking software may be preventing the display of sponsored links in this area.</p><p>The sponsored links on OregonTrails.com are very unobtrusive and fast loading. Please consider disabling ad block when viewing this site in order to support maintenance and development efforts.</p><p>Thank you!</p></span>');
}
