﻿function imgon(input)
// this function is used with the mouseover tag.
// the id of the tag must be passed to this function.
{
	document.getElementById(input).src = "http://www.scootrnova.net/images/taskbar/" + input + "-over.jpg";
}

function imgoff(input)
// this function is used with the mouseout tag.
// the id of the tag must be passed to this function.
{
	document.getElementById(input).src = "http://www.scootrnova.net/images/taskbar/" + input + ".jpg";
}

function randombg(input)
// this function generates a random background from
// a total of 3
{
	var id = document.getElementById(input);
	id.style.backgroundImage = "url(http://www.scootrnova.net/images/desktop/background" + Math.ceil(Math.random() * 4) + ".png)";
	id.style.backgroundRepeat = "no-repeat";
	id.style.backgroundColor = "#000000";
}

function popup(page)
// opens up a popup style browser window that takes
// a webpage/file as input. ex: scootrnova.net/y.jpg
{
	window.open(page, "ScootrNova", "width=640, height=480");
}

function popupConfirm()
// pops up a confirmation dialog that asks the user
// if they would like to submit the current form
// data. user can choose yes or no. if yes, form
// is submitted. if no, form is not submitted.
{
	if (confirm("Are you sure you would like to delete this entry?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function fieldCheck(field)
// checks a submitted form for one empty field
// takes a field as input. ex: name
{
	if (field.value == null || field.value == "")
	{
		alert("There is an empty field! Please fix it to continue.");
		return false;
	}
	else
	{
		return true;
	}
}

function fieldCheck(field1, field2)
// checks a submitted form for two empty fields
// takes two fields as input. ex: name, charmander
{
	if ((field1.value == null || field1.value == "")
		|| (field2.value == null || field2.value == ""))
	{
		alert("There is an empty field! Please fix it to continue.");
		return false;
	}
	else
	{
		return true;
	}
}

function fieldCheck(field1, field2, field3)
// checks a submitted form for three empty fields
// takes three fields as input. ex: name, charmander, bulbasaur
{
	if ((field1.value == null || field1.value == "")
		|| (field2.value == null || field2.value == "")
		|| (field3.value == null || field3.value == ""))
	{
		alert("There is an empty field! Please fix it to continue.");
		return false;
	}
	else
	{
		return true;
	}
}
