function validateUPC() {
	// var upcEntered = prompt("Please enter the UPC code from any Baby Bottle Pop product:", "");
	var upcEntered = removeSpaces(document.forms[0].elements[0].value);
	
	if (upcEntered == null) {
		// do nothing
	} else {
		if ((upcEntered == "4111600595") || (upcEntered == "4111600652") || (upcEntered == "4111600558") || (upcEntered == "4111600552")) {
			// unlock page contents
			showDownloads();

			var exdate = new Date();
			exdate.setDate(exdate.getDate()+7);
			document.cookie = 'wallpaperUnlocked=true; expires='+ exdate.toGMTString() +'; path=/';

			CollapsiblePanel2.close();
			alert("Wallpaper 3 unlocked!");
		} else {
			alert("Sorry, that wasn't a valid UPC code.");
		}
	}
	return false;
}

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=")
  		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)

			if (c_end==-1)
				c_end=document.cookie.length

			return unescape(document.cookie.substring(c_start,c_end))
		}
	}
	return "";
}

function checkCookie() {
	theCookie = getCookie('wallpaperUnlocked');
	if ((theCookie != null) && (theCookie != "")) {
		showDownloads();
	}
	theCookie2 = getCookie('buddyIconUnlocked');
	if ((theCookie2 != null) && (theCookie2 != "")) {
		showBuddyIcon();
	}
	theCookie3 = getCookie('wallpaper2Unlocked');
	if ((theCookie3 != null) && (theCookie3 != "")) {
		showDownloads2();
	}
}

function showDownloads() {
	document.getElementById("unlock").innerHTML = '<img src="downloads/wallpaper3_thumb.jpg" alt="wallpaper 3" width="100" height="80" /><a href="downloads/wallpaper3_800.jpg">800x600</a><a href="downloads/wallpaper3_1024.jpg">1024x768</a><a href="downloads/wallpaper3_1280.jpg">1280x1024</a>';
}
function showDownloads2() {
	document.getElementById("unlock2").innerHTML = '<img src="downloads/wallpaper2_thumb.jpg" alt="wallpaper 2" width="100" height="80" /><a href="downloads/wallpaper2_800.jpg">800x600</a><a href="downloads/wallpaper2_1024.jpg">1024x768</a><a href="downloads/wallpaper2_1280.jpg">1280x1024</a>';
}

function showBuddyIcon() {
	document.getElementById("unlock2a").innerHTML = '<a href="aim:BuddyIcon?src=downloads/buddy3.gif"><img src="downloads/buddy3.gif" alt="buddy icon 3" width="48" height="48" /></a>';
	document.getElementById("unlock2b").innerHTML = '';
}

function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}