function popup(src) {
	win = window.open(src,"","top=20,left=20,height=300,width=450,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes")
}




/*
Declare global variables
*/
var thisnav = '';


/*
Redirect to no cookies page
*/
function noCookies(redirect) {
	var tmpcookie = new Date();
	chkcookie = (tmpcookie.getTime() + '');
	document.cookie = "chkcookie=" + chkcookie + "; path=/";
	if (document.cookie.indexOf(chkcookie,0) < 0) {
		window.location = redirect;
	} else {
		return("true");
	}
}

/*
Clear default value of text input
*/
function clearField(thefield) {
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}


/*
General image swap function
*/
function imgSwap(id, src) {
	if (document.getElementById(id)) {
		document.getElementById(id).setAttribute('src', src);
	}
}

/*
Image swap function for Site Policies
*/
function imgSwap2(id, src) {
	if (document.getElementById(id)) {
		document.getElementById(id).setAttribute('src', src);
	}
}

/*
Swap leftnav image
*/
function navRoll(id, over) {
	if (over) {
		imgSwap('nav'+id, '/images/arr_orgbox_orgbg_roll.gif');
	} else {
		imgSwap('nav'+id, '/images/arr_orgbox_orgbg.gif');
	}
}

/*
Swap top nav image and text link underline
*/
function topRoll(id, over) {
	(over || id == thisnav) ? over = '_roll' : over = '';
	imgSwap(id, '/images/topnav_'+id+over+'.gif');
}

/*
Swap bottom nav image and text link underline
*/
function btmRoll(id, over) {
	(over || id == thisnav) ? over = '_roll' : over = '';
	imgSwap(id, '/images/btmnav_'+id+over+'.gif');
}


/*
Use a pulldown to jump to page
*/
function pagejump(to_url) {
	if (to_url != "") {
		window.location='brayden.php?type=' + to_url;
		window.location="http://search.store.yahoo.net/cgi-bin/nsearch?catalog=yhst-81046225821762&query=" + to_url + " " +  document.getElementById('type').value + " " + document.getElementById('transports').value
	}
}

function pagejump1(to_url) {
	if (to_url != "") {
		window.location=to_url
	}
}


var enableSubmitLink = false;
function enableSubmit(state) {
	enableSubmitLink = state;
}

function gotoPage(){	
	if (enableSubmitLink == true) {
		pageURL = "http://store.ecycleink.com/" + document.getElementById('categoryID').value + ".html";
		if (pageURL != "") {
			window.location.href = pageURL
		}
	} else {
		onClick="return false;";
	}	
}

function nospc(x, y)
{
	x = replc(x, ' ', ' ');
	if (0 <= x.indexOf('\t'))
	{
		x = replc(x, '\t', ' ');
	}
	y.value = x;
}
function replc(x, toreplc, wreplc)
{
	while (x.charAt(0) == ' ')
	{
		x = x.substring(1, x.length);
	}
	while (x.charAt(x.length-1) == ' ')
	{
		x = x.substring(0, x.length-1);
	}
	return x;
}

function getTrackNum_validator()
{
	nospc(document.getTrackNum.strOrigTrackNum.value, document.getTrackNum.strOrigTrackNum);
	if (document.getTrackNum.strOrigTrackNum.value.length == 0)
	{
		alert("You must enter a tracking number. Please try again.");
		document.getTrackNum.strOrigTrackNum.focus();
		return false;
	}
	if (document.getTrackNum.strOrigTrackNum.value.search("'") != -1)
	{
		alert("Invalid tracking number entered. Please try again.");
		document.getTrackNum.strOrigTrackNum.focus();
		return false;
	}
	return true;
}