function swapImg(imageName, src)
{
    if (navigator.appName == "Netscape") 
    {
		if (parseInt(navigator.appVersion) <=4 )
		{
			document.images[imageName].src = src;
		}
		else 
		{
            document[imageName].src = src;
		}
	}
	else 
	{
        document[imageName].src = src;
	}
}

function openUploader(page)
{
    window.open("/actions/uploader.php?file="+page,'SmallWindow','height=350,width=400,location=no,scrollbars=yes,resizeable=yes');
}


function whatsThis(pagenum)
{
    window.open("/whatsthis/" + pagenum + ".php","WhatsThis","height=250,width=250,location=no,scrollbars=yes,resizable=yes");
}

function openImage(imagePath,width,height)
{
    window.open(imagePath,"ImageViewer","height="+height+",width="+width+",resizable=yes,scrollbars=yes");
}

function showAll()
{
    document.getElementById("summary").style.display = "block";
    document.getElementById("bio").style.display = "block";
    document.getElementById("mission").style.display = "block";
    document.getElementById("vision").style.display = "block";
    document.getElementById("philosophy").style.display = "block";
    document.getElementById("employment").style.display = "block";
    document.getElementById("education").style.display = "block";
    document.getElementById("civic").style.display = "block";
    document.getElementById("references").style.display = "block";
    document.getElementById("skills").style.display = "block";
    document.getElementById("case").style.display = "block";
    document.getElementById("hobbies").style.display = "block";
    document.getElementById("faq").style.display = "block";
    document.getElementById("news").style.display = "block";
}

function showInfo(id)
{
    document.getElementById(id).style.display = "block";
}

function closeInfo(id)
{
    document.getElementById(id).style.display = "none";
}

function showHomePage(homepageSection)
{
    document.getElementById('discover').style.display = "none";
    document.getElementById('create').style.display = "none";
    document.getElementById('become').style.display = "none";
    document.getElementById(homepageSection).style.display = "block";
}

function validateForm(formName)
{
    if (formName == "alpharegister")
    {
        var alphaPattern = /\W+|\s+/;
        var profile_username = document.forms[formName].elements["profile_username"].value;
        var profile_password = document.forms[formName].elements["profile_password"].value;
        var profile_password_conf = document.forms[formName].elements["profile_password_conf"].value;
        var contact_email = document.forms[formName].elements["contact_email"].value;
        var alpha_pin = document.forms[formName].elements["alpha_pin"].value;
        if (profile_username == "" || profile_password == "" || profile_password_conf == "" || contact_email == "" || alpha_pin == "")
        {
            alert("ERROR: Please be sure all required fields are filled in properly");
            return false;
        }
        else
        {       
            if (profile_username.search(alphaPattern) != -1)
            {
                alert("ERROR: Username must contain only letters or numbers.");
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}
