
// changes class of Element supplied //
function changeClass(element,className)
{
	var element;
	element = document.getElementById(element);
	element.attributes['class'].value = className;
}

if (document.images)
{
	folder = new Image();
	folder_open = new Image();
	icon_delete = new Image();
	icon_delete_on = new Image();
	icon_schedule = new Image();
	icon_schedule_on = new Image();
	icon_house2 = new Image();
	icon_house2_on = new Image();
	check_mark = new Image();
	check_mark_on = new Image();
	icon_camera = new Image();
	icon_camera_on = new Image();
	icon_doc = new Image();
	icon_doc_on = new Image();
	
	folder.src = "/myhome/images/icon_list_folder.gif";
	folder_open.src = "/myhome/images/icon_list_folder_on.gif";
	icon_delete.src = "/myhome/images/delete.gif";
	icon_delete_on.src = "/myhome/images/delete_on.gif";
	icon_schedule.src = "/myhome/images/icon_schedule.gif";
	icon_schedule_on.src = "/myhome/images/icon_schedule_on.gif";
	icon_house2.src = "/myhome/images/icon_house2.gif";
	icon_house2_on.src = "/myhome/images/icon_house2_on.gif";
	check_mark.src = "/myhome/images/check_mark.gif";
	check_mark_on.src = "/myhome/images/check_mark_on.gif";
	icon_camera.src = "/myhome/images/icon_camera.gif";
	icon_camera_on.src = "/myhome/images/icon_camera_on.gif";
	icon_doc.src = "/myhome/images/icon_doc.gif";
	icon_doc_on.src = "/myhome/images/icon_doc_on.gif";
}	

function chgImg(imgName, newImg)
{
	if (document.images)
	{
		document[imgName].src = eval(newImg + ".src")
	}
}

function confirmActivate(displayName, forwardPage)
{
	if (confirm('Are you sure that you wish to ACTIVATE:\n\t'+displayName+'\n\nPress \"OK\" to ACTIVATE, or \"Cancel\" to cancel activation.'))
	{
		document.location.href = forwardPage;
	}
}

function confirmDeActivate(displayName, forwardPage)
{
	if (confirm('Are you sure that you wish to DE-ACTIVATE:\n\t'+displayName+'\n\nPress \"OK\" to DE-ACTIVATE, or \"Cancel\" to cancel de-activation.'))
	{
		document.location.href = forwardPage;
	}
}

function confirmDelete(displayName, forwardPage)
{
	if (confirm('Are you sure that you wish to DELETE:\n\t'+displayName+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = forwardPage;
	}
}

function confirmAdminUserDelete(adminUserName, user_id)
{
	if (confirm('Are you sure that you wish to DELETE Admin User:\n\t'+adminUserName+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?admins&delete='+user_id;
	}
}

function confirmCMSAdminUserDelete(cmsAdminUserName, user_id)
{
	if (confirm('Are you sure that you wish to DELETE CMS Admin User:\n\t'+cmsAdminUserName+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?cmsadmins&delete='+user_id;
	}
}

function confirmCustomerDelete(customerName, customer_id)
{
	if (confirm('Are you sure that you wish to DELETE Customer:\n\t'+customerName+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?customers&delete='+customer_id;
	}
}

function confirmSegmentDelete(segmentTitle, segment_id)
{
	if (confirm('Are you sure that you wish to DELETE Project Segment:\n\t'+segmentTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?segments&delete='+segment_id;
	}
}

function confirmTemplateDelete(templateTitle, template_id)
{
	if (confirm('Are you sure that you wish to DELETE Project Template:\n\t'+templateTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?templates&delete='+template_id;
	}
}

function confirmProjectDelete(projectTitle, project_id)
{
	if (confirm('Are you sure that you wish to DELETE Project:\n\t'+projectTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?projects&delete='+project_id;
	}
}

function confirmProjToDoDelete(toDoTitle, todo_id, project_id)
{
	if (confirm('Are you sure that you wish to DELETE ToDo Titled:\n\t'+toDoTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/myadmin/util/libs/projectToDoDelete.php?project_id='+project_id+'&todo_id='+todo_id;
	}
}

function confirmChangeOrderDelete(changeOrderTitle, changeOrder_id, project_id)
{
	if (confirm('Are you sure that you wish to DELETE Project Change Order:\n\t'+changeOrderTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '?projects&changeorder='+project_id+'&delete='+changeOrder_id;
	}
}

function confirmProjSegDelete(segmentTitle, segment_id, project_id)
{
	if (confirm('Are you sure that you wish to DELETE Project Segment:\n\t'+segmentTitle+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/myadmin/util/libs/projectSegmentDelete.php?project_id='+project_id+'&delProjSeg='+segment_id;
	}
}

function confirmPaymentDelete(paymentAmount, payment_id, project_id)
{
	if (confirm('Are you sure that you wish to DELETE this Payment in the amount of:\n\t'+paymentAmount+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/myadmin/util/libs/projectPaymentDelete.php?project_id='+project_id+'&payment_id='+payment_id;
	}
}

function confirmGallIntDelete(interiors_title, interiors_id)
{
	if (confirm('Are you sure that you wish to DELETE Interior Gallery:\n\t'+interiors_title+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/mycms/util/libs/galleryInteriorsDelete.php?interiors_id='+interiors_id;
	}
}

function confirmExteriorsDelete(exteriors_title, exteriors_id)
{
	if (confirm('Are you sure that you wish to DELETE Exterior Gallery:\n\t'+exteriors_title+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/mycms/util/libs/galleryExteriorsDelete.php?exteriors_id='+exteriors_id;
	}
}

function confirmFloorplanDelete(floorplan_title, floorplan_id)
{
	if (confirm('Are you sure that you wish to DELETE Floor Plan:\n\t'+floorplan_title+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/mycms/util/libs/floorplanDelete.php?floorplan_id='+floorplan_id;
	}
}

function confirmLotForSaleDelete(lot_title, lot_id)
{
	if (confirm('Are you sure that you wish to DELETE Lot:\n\t'+lot_title+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/mycms/util/libs/forsaleLotDelete.php?forsale_lot_id='+lot_id;
	}
}

function confirmHomeForSaleDelete(home_title, home_id)
{
	if (confirm('Are you sure that you wish to DELETE Lot:\n\t'+home_title+'\n\nPress \"OK\" to DELETE, or \"Cancel\" to cancel deletion.'))
	{
		document.location.href = '/mycms/util/libs/forsaleHomeDelete.php?forsale_home_id='+home_id;
	}
}

function openSmallWindow(h, w, page)
{
	var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var menuargs = "location=no,menubar=no,toolbar=no,directories=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition;
	var win = window.open(page, 'smallWin', menuargs);
	win.focus();
}

function openEditWindow(h, w, page)
{
	var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var menuargs = "location=no,menubar=no,toolbar=no,directories=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition;
	var win = window.open(page, 'editWin', menuargs);
	win.focus();
}

function checkFeaturedItems(maxItems, fieldArray, thisField)
{
	var featuredItemsArray = document.getElementsByName(fieldArray);
	var i=0;
	var count = 0;
	
	for (i = 0; i<featuredItemsArray.length; i++)
	{
		if (featuredItemsArray[i].checked == true)
		{
			count++;
			if (count > maxItems)
			{
				
				alert("You may only have 5 items featured.");
				
				thisField.checked = false;
			}
		}
	}
}

function focusOnField(field)
{
	var fieldForFocus = document.getElementById(field);
	fieldForFocus.focus();
}

/*
function submitCityForm()
{
	var inputForm = document.getElementById("contactSearchForm");
	if (inputForm.city.options[inputForm.city.selectedIndex].value != "")
	{
		return true;
	} 
	else
	{
		alert( "You must select a City." );
		return false;
	}
}

function checkForDirectDepositFunction()
{
	var inputForm = document.getElementById("affiliateSettingsInfo");
	var routingObj = document.getElementById("affiliateRoutingNum");
	var accountObj = document.getElementById("affiliateAccountNum");
	var accountTypeObj = document.getElementById("affiliateAccountType");

	if (inputForm.affiliatePaymentType[0].checked == true)
	{
		routingObj.value = "";
		accountObj.value = "";
		accountTypeObj.value = "";
		
		routingObj.disabled = true;
		accountObj.disabled = true;
		accountTypeObj.disabled = true;
	}
	else
	{
		routingObj.disabled = false;
		accountObj.disabled = false;
		accountTypeObj.disabled = false;
	}
}

function goTo(goToPage)
{
	document.location.href = "../director/" + goToPage + ".php";
}


function goToEmail()
{
	var menuargs = "location=yes,menubar=yes,toolbar=yes,directories=yes,scrollbars=yes,resizable=yes,width=600,height=400";
	newWin = window.open('http://webmail.rgc-mail.com','RevenueGoalsMail', menuargs);
	newWin.focus();
}
*/

