/*
	Gemline Javascript functions
*/


// Global variables
activeColorId = 0;


function CheckRegistrationForm( )
{
	var password = document.getElementById("password");
	var password2 = document.getElementById("password2");


	// Password check
	if( password.value != password2.value )
	{
		alert( "The passwords you typed did not match. Please carefully type a password and then retype it in the field provided." );
		password.value = "";
		password2.value = "";
		return;
	}


	// Validate form
	ValidateForm("registrationValidator");
}



function PrepareForTyping( element, initialValue )
{
	var currentValue = element.value;

	if( currentValue == initialValue )
		element.value = "";
}



function SetFrame( colorId )
{
	// Hide the previous bullet
	document.getElementById("bullet_" + activeColorId).style.visibility = "hidden";

	// Show the new bullet
	document.getElementById("bullet_" + colorId).style.visibility = "";

	// Set the new active color
	activeColorId = colorId;

	// Display the new frame color
	document.getElementById("frameImage").src = eval( "color_" + colorId ).src;	
}



function SetPhoto( photoId )
{
	if( photoId != 0 )
	{
		document.getElementById("framePhoto").style.visibility = "";
		document.getElementById("framePhoto").src = eval( "photo_" + photoId ).src;
	}
	else
	{
		// No photo
		document.getElementById("framePhoto").style.visibility = "hidden";
	}
}