function ajaxRequestReturn(strReturnCode) {
	if(strReturnCode == '1') { myLightbox.showSuccess();
	} else { myLightbox.showError(); }
}
function deleteTableRow(rowNameId) {
	var ele = document.getElementById(rowNameId);
	if(ele == null || ele == undefined) { return; }
	ele.parentNode.deleteRow(ele.sectionRowIndex);
}
function popUpPMSWin(howmany) {
	if(howmany > 0) {
		window.open("pmspopup.php?num="+howmany,"pmNotify","top="+((screen.availHeight/2)-50)+",left="+((screen.availWidth/2)-50)+",resizable=yes,width=200,height=150")
	}
	return 1
}
/* ############  Functions for row display  ############ */
var iRowPlace = 0;

function rowStartInit() { iRowPlace = 0;}
function rowStartCheck(iMax) {
	if(!iMax) {iMax=2;}
	if(iRowPlace <= 1) {
		document.write('<tr>');
		iRowPlace = 1;
	}
}
function rowEndCheck(iMax) {
	if(!iMax){iMax=2;}
	if(iRowPlace > (iMax-1)) {
		document.write('</tr>');
		iRowPlace = 0;
	} else {iRowPlace = iRowPlace + 1;}
}

/* ############  Other AJAX Calls  ############ */
function isUserNameAvailable(sUserName, callBack) {
	return myMicroAjax.makeGetRequest("ajax_backend.php?do=usernameavailable&username=" + sUserName, callBack);
}

function markInputFieldWithError(sFieldId, bError) {
	ele = document.getElementById(sFieldId);

	if(!ele)
		return;

	if(bError == 1) {
		ele.setAttribute("class", "input_error");
		ele.setAttribute("className", "input_error");
	} else {
		ele.setAttribute("class", "");
		ele.setAttribute("className", "");
	}
}

/* ############  Functions for photo management operations  ############ */
function submitPhotoDetails(formName) {
	myLightbox.showLoading();
	myLightbox.setFormsDefaultValues();
	return myMicroAjax.submitForm(formName, ajaxRequestReturn);
}
function submitDeletePhoto(formName, iPhotoId) {
	myLightbox.showLoading();
	return myMicroAjax.submitForm(formName, submitDeletePhotoReturn, iPhotoId);
}
function submitDeletePhotoReturn(strReturnCode, iPhotoId) {
	if(strReturnCode == '1') {
		myLightbox.showSuccess();
		Element.remove('photo_table_' + iPhotoId);
	} else { myLightbox.showError(); }
}
function submitDefaultPhoto(iPhotoId) {
	myLightbox.showLoading();
	return myMicroAjax.submitForm('default_' + iPhotoId + '_form', ajaxRequestReturn, iPhotoId);
}