temp_image_0 = new Image() ; temp_image_0.src = "/FLM/Images/Home_on.jpg" ;
temp_image_1 = new Image() ; temp_image_1.src = "/FLM/Images/About_on.jpg" ;
temp_image_2 = new Image() ; temp_image_2.src = "/FLM/Images/Movies_on.jpg" ;
temp_image_3 = new Image() ; temp_image_3.src = "/FLM/Images/Forums_on.jpg" ;
temp_image_4 = new Image() ; temp_image_4.src = "/FLM/Images/Downloads_on.jpg" ;
temp_image_5 = new Image() ; temp_image_5.src = "/FLM/Images/Contact_on.jpg" ;
temp_image_6 = new Image() ; temp_image_6.src = "/FLM/Images/SubmitMovie_on.jpg" ;
temp_image_7 = new Image() ; temp_image_7.src = "/FLM/Images/Links_on.jpg" ;
temp_image_8 = new Image() ; temp_image_8.src = "/FLM/Images/Profile_on.jpg" ;

temp_image_10 = new Image() ; temp_image_10.src = "/FLM/Images/TopLeft_Home.jpg" ;
temp_image_11 = new Image() ; temp_image_11.src = "/FLM/Images/TopLeft_About.jpg" ;
temp_image_12 = new Image() ; temp_image_12.src = "/FLM/Images/TopLeft_Movies.jpg" ;
temp_image_13 = new Image() ; temp_image_13.src = "/FLM/Images/TopLeft_Forums.jpg" ;
temp_image_14 = new Image() ; temp_image_14.src = "/FLM/Images/TopLeft_Downloads.jpg" ;
temp_image_15 = new Image() ; temp_image_15.src = "/FLM/Images/TopLeft_Contact.jpg" ;
temp_image_16 = new Image() ; temp_image_16.src = "/FLM/Images/TopLeft_SubmitMovie.jpg" ;
temp_image_17 = new Image() ; temp_image_17.src = "/FLM/Images/TopLeft_Links.jpg" ;
temp_image_18 = new Image() ; temp_image_18.src = "/FLM/Images/TopLeft_Profile.jpg" ;

var RequiredFieldMarker = "*";

function swapImage(theImage, newSrc){
	document.getElementById(theImage).src=newSrc;
}

function addHiddenField(parent, name, value)
{
	e = document.createElement("input");
	e.setAttribute("name", name);
	e.setAttribute("type", "Hidden");
	e.setAttribute("value", value);
	
	parent.appendChild(e);
}
function addCheckboxField(parent, name, value)
{
	e = document.createElement("input");
	e.setAttribute("name", name);
	e.setAttribute("type", "Checkbox");
	e.setAttribute("value", value);
	
	parent.appendChild(e);
}
function addTextField(parent, name, value, size, maxlength)
{
	e = document.createElement("input");
	e.setAttribute("name", name);
	e.setAttribute("type", "text");
	e.setAttribute("value", value);
	e.setAttribute("size", size);
	e.setAttribute("maxLength", maxlength);
	
	parent.appendChild(e);
}
function addTextareaField(parent, name, value, rows, cols)
{
	e = document.createElement("textarea");
	e.setAttribute("name", name);
	e.setAttribute("value", value);
	e.setAttribute("rows", rows);
	e.setAttribute("cols", cols);
	
	parent.appendChild(e);
}
function addSelectFieldWithCopy(parent, name, selectToCopy)
{
	e = document.createElement("select");
	e.setAttribute("name", name);
	for (x=0; x<selectToCopy.length; x++)
	{
		e.options[e.length] = new Option(selectToCopy[x].text, selectToCopy[x].value);
	}
	
	parent.appendChild(e);
}
function addButton(parent, name, value, onclick)
{
	e = document.createElement("button");
	e.setAttribute("name", name);
	e.setAttribute("value", value);
	e.setAttribute("onclick", onclick);
	
	parent.appendChild(e);
}

function addDirector(theForm)
{
	numDirs = theForm.NumDirectors.value;
	numDirs++;
	theForm.NumDirectors.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveDirector", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "Director_" + numDirs, "", "25", "30");
	addHiddenField(col, "DirectorCrewID_" + numDirs, "");
	addHiddenField(col, "DirectorPersonID_" + numDirs, "");
	addHiddenField(col, "DirectorProfileLink_" + numDirs, "");
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('DirectorList');
	d.appendChild(row);
}

function addWriter(theForm)
{
	numDirs = theForm.NumWriters.value;
	numDirs++;
	theForm.NumWriters.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveWriter", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "Writer_" + numDirs, "", "25", "30");
	addHiddenField(col, "WriterCrewID_" + numDirs, "");
	addHiddenField(col, "WriterPersonID_" + numDirs, "");
	addHiddenField(col, "WriterProfileLink_" + numDirs, "");
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('WriterList');
	d.appendChild(row);
}

function addProducer(theForm)
{
	numDirs = theForm.NumProducers.value;
	numDirs++;
	theForm.NumProducers.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveProducer", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "Producer_" + numDirs, "", "25", "30");
	addHiddenField(col, "ProducerCrewID_" + numDirs, "");
	addHiddenField(col, "ProducerPersonID_" + numDirs, "");
	addHiddenField(col, "ProducerProfileLink_" + numDirs, "");
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('ProducerList');
	d.appendChild(row);
}

function addCrew(theForm)
{
	for (i=1; i<=3; i++)
	{
		numCrew = theForm.NumCrewMembers.value;
		numCrew++;
		theForm.NumCrewMembers.value=numCrew;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveCrew", numCrew);
		row.appendChild(col);
		
		col = document.createElement("td");
		addSelectFieldWithCopy(col, "CrewType_" + numCrew, e_CrewTypes);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "OtherCrewType_" + numCrew, "", "20", "30");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "CrewMember_" + numCrew, "", "25", "30");
		addHiddenField(col, "MovieCrewID_" + numCrew, "");
		addHiddenField(col, "CrewPersonID_" + numCrew, "");
		addHiddenField(col, "CrewProfileLink_" + numCrew, "");
		row.appendChild(col);

		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('CrewList');
		d.appendChild(row);
	}
}

function addCharacters(theForm)
{
	for (i=1; i<=3; i++)
	{
		numCast = theForm.NumCastMembers.value;
		numCast++;
		theForm.NumCastMembers.value=numCast;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveCast", numCast);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "Character_" + numCast, "", "25", "30");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "CastMember_" + numCast, "", "25", "30");
		addHiddenField(col, "MovieCastID_" + numCast, "");
		addHiddenField(col, "CastPersonID_" + numCast, "");
		addHiddenField(col, "CastProfileLink_" + numCast, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('CastList');
		d.appendChild(row);
	}
}

function addAwards(theForm)
{
	for (i=1; i<=2; i++)
	{
		numAwards = theForm.NumAwards.value;
		numAwards++;
		theForm.NumAwards.value=numAwards;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveAward", numAwards);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "AwardOrganization_" + numAwards, "", "25", "30");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "AwardTitle_" + numAwards, "", "25", "30");
		addHiddenField(col, "MovieAwardID_" + numAwards, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('AwardsList');
		d.appendChild(row);
	}
}

function addReviews(theForm)
{
	maxReviews = 6;
	numReviews = theForm.NumReviews.value;
	if (numReviews < maxReviews)
	{
		numReviews++;
		theForm.NumReviews.value=numReviews;
		
		d = document.getElementById('ReviewList');
		
		//line
		row = document.createElement("tr");
		row.appendChild(document.createElement("td"));
		col = document.createElement("td");
		col.setAttribute("colSpan", "3");
		col.appendChild(document.createElement("hr"));
		row.appendChild(col);
		d.appendChild(row);
		
		//row 1
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveReview", numReviews);
		row.appendChild(col);
		
		col = document.createElement("td");
		col.className = "FormLabel";
		col.innerHTML = "Reviewer Name:&nbsp;";
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "ReviewerName_" + numReviews, "", "25", "30");
		addHiddenField(col, "MovieReviewID_" + numReviews, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d.appendChild(row);
		
		//row 2
		row = document.createElement("tr");
		
		row.appendChild(document.createElement("td"));
		
		col = document.createElement("td");
		col.className = "FormLabel";
		col.innerHTML = "Association:&nbsp;";
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "Association_" + numReviews, "", "25", "30");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d.appendChild(row);
		
		//row 3
		row = document.createElement("tr");
		
		row.appendChild(document.createElement("td"));
		
		col = document.createElement("td");
		col.className = "FormLabel";
		col.innerHTML = "Review:&nbsp;";
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextareaField(col, "Review_" + numReviews, "", "5", "40");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d.appendChild(row);
	} else {
		alert("You can only have " + maxReviews + " reviews.");
	}
}

function addTalentWorkedWith(theForm)
{
	for (i=1; i<=2; i++)
	{
		numTalent = theForm.NumTalentWorkedWith.value;
		numTalent++;
		theForm.NumTalentWorkedWith.value=numTalent;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveTalent", numTalent);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "TalentName_" + numTalent, "", 25, 60);
		addHiddenField(col, "TalentWorkedWithID_" + numTalent, "");
		addHiddenField(col, "TalentPersonID_" + numTalent, "");
		row.appendChild(col);
		
		col = document.createElement("td");
		addSelectFieldWithCopy(col, "TalentTitle_" + numTalent, e_TalentTitles);
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('TalentList');
		d.appendChild(row);
	}
}

function addCrewWorkedWith(theForm)
{
	for (i=1; i<=2; i++)
	{
		numCrew = theForm.NumCrewWorkedWith.value;
		numCrew++;
		theForm.NumCrewWorkedWith.value=numCrew;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveCrew", numCrew);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "CrewName_" + numCrew, "", 25, 60);
		addHiddenField(col, "CrewWorkedWithID_" + numCrew, "");
		addHiddenField(col, "CrewPersonID_" + numCrew, "");
		row.appendChild(col);
		
		col = document.createElement("td");
		addSelectFieldWithCopy(col, "CrewTitle_" + numCrew, e_CrewTitles);
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('CrewList');
		d.appendChild(row);
	}
}

function addProdCompWorkedWith(theForm)
{
	for (i=1; i<=2; i++)
	{
		numProdComp = theForm.NumProdCompWorkedWith.value;
		numProdComp++;
		theForm.NumProdCompWorkedWith.value=numProdComp;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveProdCompany", numProdComp);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "ProdCompName_" + numProdComp, "", 30, 50);
		addHiddenField(col, "CompaniesWorkedWithID_" + numProdComp, "");
		addHiddenField(col, "ProdCompID_" + numProdComp, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('ProdCompList');
		d.appendChild(row);
	}
}


function addMoviesWorkedOn(theForm)
{
	for (i=1; i<=3; i++)
	{
		numMovies = theForm.NumMoviesWorkedOn.value;
		numMovies++;
		theForm.NumMoviesWorkedOn.value=numMovies;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveMovie", numMovies);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "MovieTitle_" + numMovies, "", "25", "50");
		addHiddenField(col, "MoviesWorkedOnID_" + numMovies, "");
		addHiddenField(col, "ItemID_" + numMovies, "");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "MovieYear_" + numMovies, "", "4", "4");
		row.appendChild(col);
		
		col = document.createElement("td");
		addSelectFieldWithCopy(col, "MovieGenre1_" + numMovies, e_Genres);
		addHiddenField(col, "MovieGenre2_" + numMovies, "");
		row.appendChild(col);

		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('MovieList');
		d.appendChild(row);
	}
}

function findMoviesPopup(theFormName, ReturnFunction)
{
	urlParams='&formName=' + theFormName + '&ReturnFunction=' + ReturnFunction;
	moviesPopup=window.open('index.cfm?fuseaction=popups.findMovie'+urlParams, 'AssociatePopup', 'width=450,height=450,scrollbars=yes');
	moviesPopup.opener = top;
}

function addAssociatePopup(theFormName, thePageArea, PersonID, ProdCompanyID, AssociateType, ReturnFunction)
{
	urlParams='&profile_type_code=' + AssociateType + '&pageArea=' + thePageArea + '&formName=' + theFormName + '&ReturnFunction=' + ReturnFunction;
	if (ProdCompanyID != "")
	{
		associatePopup=window.open('index.cfm?fuseaction=associates.popupPC&pc='+ProdCompanyID+urlParams, 'AssociatePopup', 'width=450,height=450,scrollbars=yes');
	}
	else
	{
		associatePopup=window.open('index.cfm?fuseaction=associates.popup&p='+PersonID+urlParams, 'AssociatePopup', 'width=450,height=450,scrollbars=yes');
	}
	associatePopup.opener = top;
}

function addProdCompanyAssociatePopup(theFormName, ProdCompanyID, AssociateType, ReturnFunction)
{
	urlParams='&profile_type_code=' + AssociateType + '&formName=' + theFormName + '&ReturnFunction=' + ReturnFunction;
	associatePopup=window.open('index.cfm?fuseaction=associates.popupPC&pc='+ProdCompanyID+urlParams, 'AssociatePopup', 'width=450,height=450,scrollbars=yes');
	associatePopup.opener = top;
}

function addProfileAwards(theForm)
{
	for (i=1; i<=2; i++)
	{
		numAwards = theForm.NumAwards.value;
		numAwards++;
		theForm.NumAwards.value=numAwards;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveAward", numAwards);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "AwardOrganization_" + numAwards, "", "25", "30");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "AwardTitle_" + numAwards, "", "25", "30");
		addHiddenField(col, "AwardID_" + numAwards, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('AwardsList');
		d.appendChild(row);
	}
}

function addBandMembers(theForm)
{
	for (i=1; i<=2; i++)
	{
		numMembers = theForm.NumBandMembers.value;
		numMembers++;
		theForm.NumBandMembers.value=numMembers;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveBandMember", numMembers);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "BandMemberName_" + numMembers, "", "25", "50");
		addHiddenField(col, "BandMemberPersonID_" + numMembers, "");
		addHiddenField(col, "BandMemberID_" + numMembers, "");
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "BandMemberRole_" + numMembers, "", "25", "40");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('BandMemberList');
		d.appendChild(row);
	}
}

function addSoloistAbilities(theForm)
{
	for (i=1; i<=2; i++)
	{
		numAbilities = theForm.NumSoloistAbilities.value;
		numAbilities++;
		theForm.NumSoloistAbilities.value=numAbilities;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveSoloistAbility", numAbilities);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "SoloistAbility_" + numAbilities, "", "25", "40");
		addHiddenField(col, "SoloistAbilityID_" + numAbilities, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('SoloistList');
		d.appendChild(row);
	}
}

function addEvents(theForm)
{
	for (i=1; i<=2; i++)
	{
		numEvents = theForm.NumEvents.value;
		numEvents++;
		theForm.NumEvents.value=numEvents;
		
		row = document.createElement("tr");
		
		col = document.createElement("td");
		col.setAttribute("align", "center");
		addCheckboxField(col, "RemoveEvent", numEvents);
		row.appendChild(col);
		
		col = document.createElement("td");
		addTextField(col, "EventName_" + numEvents, "", "25", "50");
		addHiddenField(col, "EventID_" + numEvents, "");
		row.appendChild(col);
		
		row.appendChild(document.createElement("td"));
		
		d = document.getElementById('EventList');
		d.appendChild(row);
	}
}


/* return functions, all follow this format: functionName(FormName, personValuesArray) */
function addAssociate_Director(theFormName, person)
{
	theForm = document.forms[theFormName];
	numDirs = theForm.NumDirectors.value;
	numDirs++;
	theForm.NumDirectors.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveDirector", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["First_Name"] + ' ' + person["Last_Name"];
	addHiddenField(col, "Director_" + numDirs, person["First_Name"] + ' ' + person["Last_Name"]);
	addHiddenField(col, "DirectorCrewID_" + numDirs, "");
	addHiddenField(col, "DirectorPersonID_" + numDirs, person["Person_ID"]);
	addHiddenField(col, "DirectorProfileLink_" + numDirs, person["User_Name"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('DirectorList');
	d.appendChild(row);
}

function addAssociate_Writer(theFormName, person)
{
	theForm = document.forms[theFormName];
	numDirs = theForm.NumWriters.value;
	numDirs++;
	theForm.NumWriters.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveWriter", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["First_Name"] + ' ' + person["Last_Name"];
	addHiddenField(col, "Writer_" + numDirs, person["First_Name"] + ' ' + person["Last_Name"]);
	addHiddenField(col, "WriterCrewID_" + numDirs, "");
	addHiddenField(col, "WriterPersonID_" + numDirs, person["Person_ID"]);
	addHiddenField(col, "WriterProfileLink_" + numDirs, person["User_Name"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('WriterList');
	d.appendChild(row);
}

function addAssociate_Producer(theFormName, person)
{
	theForm = document.forms[theFormName];
	numDirs = theForm.NumProducers.value;
	numDirs++;
	theForm.NumProducers.value=numDirs;
	
	row = document.createElement("tr");
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveProducer", numDirs);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["First_Name"] + ' ' + person["Last_Name"];
	addHiddenField(col, "Producer_" + numDirs, person["First_Name"] + ' ' + person["Last_Name"]);
	addHiddenField(col, "ProducerCrewID_" + numDirs, "");
	addHiddenField(col, "ProducerPersonID_" + numDirs, person["Person_ID"]);
	addHiddenField(col, "ProducerProfileLink_" + numDirs, person["User_Name"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('ProducerList');
	d.appendChild(row);
}

function addAssociate_MovieCrew(theFormName, person)
{
	theForm = document.forms[theFormName];
	numCrew = theForm.NumCrewMembers.value;
	numCrew++;
	theForm.NumCrewMembers.value=numCrew;
	
	row = document.createElement("tr");

	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveCrew", numCrew);
	row.appendChild(col);
	
	col = document.createElement("td");
	addSelectFieldWithCopy(col, "CrewType_" + numCrew, theForm.CrewType_1);
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "OtherCrewType_" + numCrew, "", "20", "30");
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Full_Name"];
	addHiddenField(col, "CrewMember_" + numCrew, person["Full_Name"]);
	addHiddenField(col, "MovieCrewID_" + numCrew, "");
	addHiddenField(col, "CrewPersonID_" + numCrew, person["Person_ID"]);
	addHiddenField(col, "CrewProfileLink_" + numCrew, person["User_Name"]);
	row.appendChild(col);

	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('CrewList');
	d.appendChild(row);
}

function addAssociate_MovieCast(theFormName, person)
{
	theForm = document.forms[theFormName];
	numCast = theForm.NumCastMembers.value;
	numCast++;
	theForm.NumCastMembers.value=numCast;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveCast", numCast);
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "Character_" + numCast, "", "25", "30");
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Full_Name"];
	addHiddenField(col, "CastMember_" + numCast, person["Full_Name"]);
	addHiddenField(col, "MovieCastID_" + numCast, "");
	addHiddenField(col, "CastPersonID_" + numCast, person["Person_ID"]);
	addHiddenField(col, "CastProfileLink_" + numCast, person["User_Name"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('CastList');
	d.appendChild(row);
}

function addAssociate_TalentWorkedWith(theFormName, person)
{
	theForm = document.forms[theFormName];
	numTalent = theForm.NumTalentWorkedWith.value;
	numTalent++;
	theForm.NumTalentWorkedWith.value=numTalent;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveTalent", numTalent);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Full_Name"];
	addHiddenField(col, "TalentName_" + numTalent, person["Full_Name"]);
	addHiddenField(col, "TalentWorkedWithID_" + numTalent, "");
	addHiddenField(col, "TalentPersonID_" + numTalent, person["Person_ID"]);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Title"];
	addHiddenField(col, "TalentTitle_" + numTalent, person["TitleID"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('TalentList');
	d.appendChild(row);
}

function addAssociate_CrewWorkedWith(theFormName, person)
{
	theForm = document.forms[theFormName];
	numCrew = theForm.NumCrewWorkedWith.value;
	numCrew++;
	theForm.NumCrewWorkedWith.value=numCrew;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveCrew", numCrew);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Full_Name"];
	addHiddenField(col, "CrewName_" + numCrew, person["Full_Name"]);
	addHiddenField(col, "CrewWorkedWithID_" + numCrew, "");
	addHiddenField(col, "CrewPersonID_" + numCrew, person["Person_ID"]);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Primary_Title"];
	addHiddenField(col, "CrewTitle_" + numCrew, person["Primary_Title_ID"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('CrewList');
	d.appendChild(row);
}

function addAssociate_CompaniesWorkedWith(theFormName, company)
{
	theForm = document.forms[theFormName];
	numProdComp = theForm.NumProdCompWorkedWith.value;
	numProdComp++;
	theForm.NumProdCompWorkedWith.value=numProdComp;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveProdCompany", numProdComp);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=company["Company_Name"];
	addHiddenField(col, "ProdCompName_" + numProdComp, company["Company_Name"]);
	addHiddenField(col, "CompaniesWorkedWithID_" + numProdComp, "");
	addHiddenField(col, "ProdCompID_" + numProdComp, company["Profile_ID"]);
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('ProdCompList');
	d.appendChild(row);
}

function addAssociate_BandMember(theFormName, person)
{
	theForm = document.forms[theFormName];
	numMembers = theForm.NumBandMembers.value;
	numMembers++;
	theForm.NumBandMembers.value=numMembers;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveBandMember", numMembers);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=person["Full_Name"];
	addHiddenField(col, "BandMemberName_" + numMembers, person["Full_Name"]);
	addHiddenField(col, "BandMemberPersonID_" + numMembers, person["Person_ID"]);
	addHiddenField(col, "BandMemberID_" + numMembers, "");
	row.appendChild(col);
	
	col = document.createElement("td");
	addTextField(col, "BandMemberRole_" + numMembers, "", "25", "40");
	row.appendChild(col);
	
	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('BandMemberList');
	d.appendChild(row);
}

function addMoviesWorkedOn_LinkMovie(theFormName, movie)
{
	theForm = document.forms[theFormName];
	numMovies = theForm.NumMoviesWorkedOn.value;
	numMovies++;
	theForm.NumMoviesWorkedOn.value=numMovies;
	
	row = document.createElement("tr");
	
	col = document.createElement("td");
	col.setAttribute("align", "center");
	addCheckboxField(col, "RemoveMovie", numMovies);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=movie["Title"];
	addHiddenField(col, "MovieTitle_" + numMovies, movie["Title"]);
	addHiddenField(col, "MoviesWorkedOnID_" + numMovies, "");
	addHiddenField(col, "ItemID_" + numMovies, movie["Item_ID"]);
	addHiddenField(col, "OwnerID_" + numMovies, movie["Owner_ID"]);
	row.appendChild(col);
	
	col = document.createElement("td");
	col.innerHTML=movie["Year_Released"];
	addHiddenField(col, "MovieYear_" + numMovies, movie["Year_Released"]);
	row.appendChild(col);
	
	col = document.createElement("td");
	if (movie["Genre2"] != "")
		col.innerHTML=movie["Genre1"] + " / " + movie["Genre2"];
	else
		col.innerHTML=movie["Genre1"];
	addHiddenField(col, "MovieGenre1_" + numMovies, movie["Genre1_ID"]);
	addHiddenField(col, "MovieGenre2_" + numMovies, movie["Genre2_ID"]);
	row.appendChild(col);

	row.appendChild(document.createElement("td"));
	
	d = document.getElementById('MovieList');
	d.appendChild(row);

}

function addAffiliation(theFormName, company)
{
	theForm = document.forms[theFormName];
	
	col = document.getElementById('AffiliationField');
	col.innerHTML = company["Company_Name"] + col.innerHTML;
	theForm.Affiliation_ID.value=company["Profile_ID"];
	theForm.Other_Affiliation.value=company["Company_Name"];
	hideItem(theForm.Other_Affiliation);
	hideItem(theForm.bAddAffiliate);
	showItem(theForm.bClearAffiliate);
	theForm.bClearAffiliate.className="ProfileActionButton";
}
function clearAffiliation(theForm){
	col = document.getElementById('AffiliationField');
	tempStr = col.innerHTML;
	col.innerHTML = tempStr.replace(theForm.Other_Affiliation.value, "");

	
	theForm.Affiliation_ID.value="";
	theForm.Other_Affiliation.value="";
	showItem(theForm.Other_Affiliation);
	hideItem(theForm.bClearAffiliate);
	showItem(theForm.bAddAffiliate);
	theForm.bAddAffiliate.className="ProfileActionButton";
}
