
// Pops Window
function popupWindow(URL,width,height) {
  day = new Date();
  id = day.getTime();
  var left = (screen.width-width)/2;
  var top = (screen.height-height)/2;
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=yes,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "');");
}

// Pops Window
function popupStaticWindow(name,URL,width,height) {
	var left = (screen.width-width)/2;
	var top = (screen.height-height)/2;
	var popup = window.open(URL, name, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=yes,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);
	if(popup.opener) popup.opener = self;
}

// restore tell friend text
function setInputText(field,text) {
	if (field.value == "") {
		field.value = text;
	}
}

// hide tell friend text
function clearInputText(field,text) {
	if (field.value == text) {
		field.value = "";
	}
}

function SetFactDate(BY,BM,BD,DY,DM,DD){
	if(document.ContactAddFact.facttypeid.options[document.ContactAddFact.facttypeid.selectedIndex].value == '7'){
	    if(BM){ document.ContactAddFact.month1.value = BM; }
		if(BD){ document.ContactAddFact.day1.value = BD; }
		if(BY){ document.ContactAddFact.year1.value = BY; }
	}else if(document.ContactAddFact.facttypeid.options[document.ContactAddFact.facttypeid.selectedIndex].value == '15'){
	    if(DM){ document.ContactAddFact.month1.value = DM; }
		if(DD){ document.ContactAddFact.day1.value = DD; }
		if(DY){ document.ContactAddFact.year1.value = DY; }
	}else{
		document.ContactAddFact.month1.value = 'mm';
		document.ContactAddFact.day1.value = 'dd';
		document.ContactAddFact.year1.value = 'yyyy';
	}
}

// navigates using menu
function menu_nav(url) {
  if(url!=""){window.location.href=url;}
}

// navigates using menu
function delete_warning(type,url) {
	if(type=="forum"){
		resp1 = confirm("Are you sure you want to permanently delete this forum? All topics and posts will be lost.");
	}
	if(type=="family"){
		resp1 = confirm("Are you sure you want to delete this family page? All information, news, guestbook entries, and photo galleries for this page will be lost.");
	}
	if(type=="gallery"){
		resp1 = confirm("Are you sure you want to delete this photo gallery? All photos and information will be lost.");
	}
	if(type=="contact"){
		resp1 = confirm("Are you sure you want to permanently delete this family member? All information and photos will be lost.");
	}
	if(type=="fact"){
		resp1 = confirm("Are you sure you want to permanently delete this fact? All information and photos attached to this fact only will be lost.");
	}
	if(type=="wordlist"){
		resp1 = confirm("Are you sure you want to permanently delete this word list? All words in your word search will be lost.");
	}
	if (resp1 == true){
		resp2 = confirm("Are you sure?");
		if(resp2 == true){
			window.location.href=url;
		}
	}
}

// check all approve boxes
function CheckAll(FormName,InputName,Max) {
  for(i=1; i <= Max; i++){
  	eval("document."+FormName+"."+InputName+"_" + i + ".checked = true;");
  }
}

// uncheck all approve boxes
function UncheckAll(FormName,InputName,Max) {
  for(i=1; i <= Max; i++){
  	eval("document."+FormName+"."+InputName+"_" + i + ".checked = false;");
  }
}