


function newprofiles(trigger_div,spacer_num,args,edit_or_new,curlayout) {
	//within edit_or_new, carry the RID of the profile.
	//within curlayout, carry the current layout for default editing purposes.
	if (edit_or_new == "new") {
		var editor = "new_profile_row";
	} else {
		var editor = "edit_profile_row";
		var rid = "&rid="+edit_or_new+"&row=layout_id";
	}
	
	makeBox(trigger_div,0,0,"360px","100px","#647bad","lightblue","#444","hover_newprofilerow")
	
	var hoverdiv = $("hover_newprofilerow");
	
	
	var titlebar = document.createElement("p");
	hoverdiv.appendChild(titlebar);
	titlebar.id = "titlebar_p";
	titlebar.className = "para_smltxt smltxt_b";
	titlebar.appendChild(document.createTextNode("Select a layout for the new row:"));
	
	var opts = new Array('img_left',
								'img_right',
								'img_above',
								'just_text',
								'title',
								'left-right',
								'img_only',
								'img_only_l',
								'three');
	
	var radionames = new Array("Image Left, Text Right",
								"Image Right, Text Left",
								"Image Above, Text Below",
								"Text Box",
								"Title/Large Caption",
								"Image Left and Image Right",
								"Image Only (small)",
								"Image Only (large)",
								"Portrait left, text and small (landscape) image right");

	//build p element to hold the menu 
	var p0 = document.createElement("p");
	hoverdiv.appendChild(p0);
	p0.className = "para_smltxt";
	
	//build menu (select) element 
	var mEl = document.createElement("select");
	p0.appendChild(mEl);
	mEl.id = "sel_layout_id";
	mEl.name = "sel_layout_id";
	
	//add options from opts array above 
	for (i=0; i < opts.length; i++) {
		var el0 = document.createElement("option");
		el0.id = "sel_layout_id"+i;
		el0.value = opts[i];
		el0.name = "radlayout_id";
	//		el0.text = radionames[i];
		mEl.appendChild(el0);
		el0.appendChild(document.createTextNode(radionames[i]));
		if (edit_or_new == "new") {
			if (i == 0) {
				el0.selected = true;
			}
		} else {
			if (opts[i] == curlayout) {
				el0.selected = true;
			}
		}
	}

	slp = document.createElement("p");
	slp.className = "para_smltxt smltxt_b";
	slp.style.textAlign = "center";
	hoverdiv.appendChild(slp);
	
	var err = document.createElement("p");
	hoverdiv.appendChild(err);
	err.className = "para_smltxt smltxt_b";
	err.style.color = "red";
	err.id = "error_p";
	
/*
	//spacer
	var p1 = document.createElement("p");
	hoverdiv.appendChild(p1);
	p1.className = "para_smltxt";
	p1.appendChild(document.createElement("br"));
	p1.appendChild(document.createElement("br"));
*/	
	
	//create submit "button"/link 
	sl = document.createElement("a");
	slp.appendChild(sl);
	sl.style.cursor = "pointer";
	sl.onclick = function() {
			var ind = $('sel_layout_id').selectedIndex;
			var loid = $('sel_layout_id').options[ind].value;
			followLink("?layout_id="+loid+"&edit=y&spacer="+spacer_num+args+"&"+editor+"=xxx&to="+loid+rid,"pagebody");
			return false;
	}
	if (edit_or_new == 'new') {
		sl.appendChild(document.createTextNode("Create Row"));
	} else {
		sl.appendChild(document.createTextNode("Edit Row"));
	}
}


function quick_add_parent(trigger_div,args,sireordam) {
//	alert(trigger_div+"   "+args+"   asdf"+sireordam+"   ");


	//make dialog box to quick add a sire or dam 
	if (sireordam == "sire") {
		var sd = "Sire";
		var sex = 'm';
	} else {
		var sd = "Dam";
		var sex = 'f';
	}
	
	makeBox(trigger_div,-40,-20,"260px","130px","#647bad","lightblue","#444","newsirebox");
	var hoverdiv = $("newsirebox");
	
	
	var titlebar = document.createElement("p");
	titlebar.className = "para_smltxt smltxt_b";
	titlebar.appendChild(document.createTextNode("Quick Add a "+sd+":"));
	hoverdiv.appendChild(titlebar);
	
	titlebar2 = document.createElement("p");
	titlebar2.className = "para_smltxt";
	titlebar2.className = "para_smltxt instructions";
	titlebar2.style.color = "#555";
	titlebar2.appendChild(document.createTextNode("Type registered name of "+sd+" below. NOTE: This form is only for NEW "+sd+"s."));
	hoverdiv.appendChild(titlebar2);
	
	make_el_dom("p","para_smltxt",sd+": ","newsirebox","inputp");
	
		
	inputbox = document.createElement("input");
	$("inputp").appendChild(inputbox);	

	inputbox.id = "sirename";
	inputbox.type = "text";
	inputbox.name = "sirename";
	inputbox.style.background = "lightblue";
	inputbox.style.border = "1px solid #666";
	inputbox.style.color = "#555";
//	inputbox.style.marginLeft = ".5em;";
	
	var err = document.createElement("p");
	hoverdiv.appendChild(err);
	err.className = "para_smltxt smltxt_b";
	err.style.color = "red";
	err.id = "error_p";
	
	var submitp = document.createElement("p");
	hoverdiv.appendChild(submitp);	
	submitp.className = "para_smltxt smltxt_b";
	
	
	var submitbutton = document.createElement("a");
	submitp.appendChild(submitbutton);	
	
	submitbutton.style.cursor = "pointer";
	submitbutton.appendChild(document.createTextNode("Click to Add "+sd));
	submitbutton.onclick = function () {
								var sub = $("sirename").value;
								if (sub.length > 1) {
//									alert("done: under construction still");
									followLink("?quick_add_new_dog=true&sx="+sex+"&newname="+sub+args,"pagebody");
								} else {
									//alert("Error! Please enter a name in the box.");
									
									$("error_p").appendChild(document.createTextNode("ERROR: Please enter a registered name!"));	
								}
								return false;
							}

	

	$("sirename").focus;

}