function removeSpaces(string) 
{
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];
	return tstring;
}

function getExt(string)
{
	var ffile, fext;
	ffile = string;
	fext = ffile.split(".");
	return fext[fext.length-1];
}

function isAudio(string, msg)
{
	var tmpStr, fext;
	tmpStr = string;
	if (tmpStr != "")
	{
		fext = getExt(tmpStr).toLowerCase();
		if (!(fext.match("wav") || fext.match("mp3")))
		{
			alert("Invalid file format.\nThe " + msg + " can only be of type\n.wav, .mp3");
			return false;
		}
	}
	return true;
}

function isPic(string, msg)
{
	var tmpStr, fext;
	tmpStr = string;
	if (tmpStr!="")
	{
		fext = getExt(tmpStr).toLowerCase();
		if (!(fext.match("jpg") || fext.match("jpeg") || fext.match("bmp") || fext.match("gif") || fext.match("png")))
		{
			alert("Invalid file format.\nThe " + msg + " can only be of type\n.jpg, .gif, .png, .bmp");
			return false;
		}
	}
	return true;
}

function isDoc(string, msg)
{
	var tmpStr, fext;
	tmpStr = string;
	if (tmpStr!="")
	{
		fext = getExt(tmpStr).toLowerCase();
		if (!(fext.match("doc") || fext.match("txt") || fext.match("pdf") || fext.match("ppt") || fext.match("html") || fext.match("lp2") || fext.match("htm")))
		{
			alert("Invalid file format.\nThe " + msg + " can only be of type\n.doc, .txt, .pdf");
			return false;
		}
	}
	return true;
}

function checkIt()
{
	var ffile, fext;
	ffile = document.getElementById("im1").value;
	if (ffile!="")
	{
		fext = getExt(ffile).toLowerCase();
		if (!(fext.match("jpg") || fext.match("jpeg") || fext.match("gif") || fext.match("png")))
		{
			alert("Invalid file format.\nThe News Picture can only be of type\n.jpg, .gif, .png");
			return false;
		}
	}
	ffile = document.getElementById("im2").value;
	if (ffile!="")
	{
		fext = getExt(ffile).toLowerCase();
		if (!(fext.match("mp3") || fext.match("dat") || fext.match("wav")))
		{
			alert("Invalid file format.\nThe Audio File can only be\n.mp3, .wav, .dat");
			return false;
		}
	}
	return true;
}