extArray = new Array(".gif", ".jpg", ".png");
function LimitAttach(form, file) {
	allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1)
	file = file.slice(file.indexOf("\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = true; break; }
	}
	
	if (allowSubmit) {
		document.fileform.submit();
		HideContent('uploadphoto');
		HideContent('pagetitle');
		HideContent('topnav');
		HideContent('recads');
		ShowContent('loading');
		//changeDivImage();
		//showhide('loading');
		//showhide('browseButton');
	}else{
		alert("Please only upload files that end in types: " 
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
		return false;
	}
}

function MSubmit() {
	allowSubmit = true;
	if (allowSubmit) {
		document.fileform.submit();
		HideContent('uploadphoto');
		HideContent('pagetitle');
		HideContent('topnav');
		HideContent('recads');
		ShowContent('loading');
	}else{
		alert("Please only upload files that end in types: " 
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
		return false;
	}
}

function changeDivImage()
{
	var imgPath = new String();
	imgPath = document.getElementById("browseButton").style.backgroundImage;
        
	//if(imgPath == "url(images/blue.gif)" || imgPath == "")
    //{
		document.getElementById("browseButton").style.backgroundImage = "url(../img/browse2.jpg)";
    //}else
	//{
	//	document.getElementById("browseButton").style.backgroundImage = "url(images/blue.gif)";
	//}
}


function roll_over(img_name, img_src)
{
	document[img_name].src = img_src;
}

function roll_over_browse(downup)
{
	var imgPath = new String();
	imgPath = document.getElementById("browseButton").style.backgroundImage;
	if (downup == "up")
	{
		document.getElementById("browseButton").style.backgroundImage = "url(../img/browse.jpg)";
	}else
	{
		document.getElementById("browseButton").style.backgroundImage = "url(../img/browse3.jpg)";
	}
}

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}