if we use the full script tag iphone pull this out and it causes an error
var javaScript = ajaxRequest.responseText.slice(scriptStart+7, scriptEnd);
//alert(javaScript);
eval(javaScript);
}
}
if(callback){
//redirect(ajaxRequest.responseText);
//alert("calling "+callback+" with "+output+""+ajaxRequest.responseText);
callback(output, ajaxRequest.responseText);
}
else if(output != ""){
var ajaxDisplay = document.getElementById(output);
if(!ajaxDisplay){
alert ("ajaxDisplay is NULL for "+output);
}
else{
ajaxDisplay.innerHTML = ajaxRequest.responseText;
//alert("innerHTML => "+ajaxDisplay.innerHTML);
//move user to specified anchor
if(moveToAnchor == "TOP")
window.scrollTo(0,1);
else if (moveToAnchor !=""){
window.location.hash=moveToAnchor;
//alert("Moving to Anchor "+moveToAnchor)
}
}
}
}
if(reload != ""){
if(reload == "2" || reload == "full_reload")
window.location.replace(location.pathname);
else if(reload == "reload" || reload == "1")
window.location.reload();
else
window.location = reload;
}
}
}
if(url_params.length > 500){
ajaxRequest.open("POST", target, true);
ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajaxRequest.send(url_params);
}else{
ajaxRequest.open("GET", target+"?"+ url_params, true);
ajaxRequest.send(null);
}
}
function callBrandFunctiona(target, functionName, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction(functionName, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction(functionName, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
var url_params = "function=callBrandFunction&functionName="+functionName;
if(reload)
SendAjaxRequest(url_params, '', reload, '', returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', '', returnFunction, target, containsScript);
}
function callBrandFunction1a(target, functionName, arg1, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction1(functionName, arg1, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction1(functionName, arg1, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
var url_params = "function=callBrandFunction1&functionName="+functionName+"&arg1="+arg1;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
var editSessionTimer = null;
function callBrandFunction2Delayed(obj, delay, count, functionName, arg1, arg2, updateDIV, reload){
if(obj.value.length >= count && obj.value.length != 0){
if(editSessionTimer != null)
clearTimeout(editSessionTimer);
if(delay == "0")
callBrandFunction2(functionName, arg1, arg2, updateDIV, reload);
else{
//Need to filte out natigation keys
editSessionTimer = setTimeout(function() { callBrandFunction2(functionName, arg1, arg2, updateDIV, reload); }, delay);
}
}else{
//alert("setSESSION_value");
callBrandFunction2(functionName, arg1, arg2, updateDIV, reload);
}
}
function callBrandFunction2a(target, functionName, arg1, arg2, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction2(functionName, arg1, arg2, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction2(functionName, arg1, arg2, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
var url_params = "function=callBrandFunction2&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction3a(target, functionName, arg1, arg2, arg3, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction3(functionName, arg1, arg2, arg3, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction3(functionName, arg1, arg2, arg3, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
var url_params = "function=callBrandFunction3&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction4a(target, functionName, arg1, arg2, arg3, arg4, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction4(functionName, arg1, arg2, arg3, arg4, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction4(functionName, arg1, arg2, arg3, arg4, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
returnFunction = typeof returnFunction !== 'undefined' ? returnFunction : '';
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
var url_params = "function=callBrandFunction4&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction5a(target, functionName, arg1, arg2, arg3, arg4, arg5, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction5(functionName, arg1, arg2, arg3, arg4, arg5, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction5(functionName, arg1, arg2, arg3, arg4, arg5, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
var url_params = "function=callBrandFunction5&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction6a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction6(functionName, arg1, arg2, arg3, arg4, arg5, arg6, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction6(functionName, arg1, arg2, arg3, arg4, arg5, arg6, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
var url_params = "function=callBrandFunction6&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction7a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction7(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction7(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
var url_params = "function=callBrandFunction7&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction8a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction8(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction8(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
var url_params = "function=callBrandFunction8&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8;
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction9a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction9(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction9(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
var url_params = "function=callBrandFunction10&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction10a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction10(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction10(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
var url_params = "function=callBrandFunction10&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction11a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction11(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction11(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
arg11 = encodeURIComponent(arg11);
var url_params = "function=callBrandFunction11&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10+"&arg11="+arg11;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction12a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction12(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction12(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
arg11 = encodeURIComponent(arg11);
arg12 = encodeURIComponent(arg12);
var url_params = "function=callBrandFunction12&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10+"&arg11="+arg11+"&arg12="+arg12;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction13a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction13(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction13(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
arg11 = encodeURIComponent(arg11);
arg12 = encodeURIComponent(arg12);
arg13 = encodeURIComponent(arg13);
var url_params = "function=callBrandFunction13&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10+"&arg11="+arg11+"&arg12="+arg12+"&arg13="+arg13;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction19a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction19(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction19(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
arg11 = encodeURIComponent(arg11);
arg12 = encodeURIComponent(arg12);
arg13 = encodeURIComponent(arg13);
arg14 = encodeURIComponent(arg14);
arg15 = encodeURIComponent(arg15);
arg16 = encodeURIComponent(arg16);
arg17 = encodeURIComponent(arg17);
arg18 = encodeURIComponent(arg18);
arg19 = encodeURIComponent(arg19);
var url_params = "function=callBrandFunction19&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10+"&arg11="+arg11+"&arg12="+arg12+"&arg13="+arg13+"&arg14="+arg14+"&arg15="+arg15+"&arg16="+arg16+"&arg17="+arg17+"&arg18="+arg18+"&arg19="+arg19;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function callBrandFunction20a(target, functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, updateDiv, reload, moveToAnchor, returnFunction, containsScript){
callBrandFunction20(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target);
}
function callBrandFunction20(functionName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, updateDiv, reload, moveToAnchor, returnFunction, containsScript, target){
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
containsScript = typeof containsScript !== 'undefined' ? containsScript : '';
target = typeof target !== 'undefined' ? target : '';
arg1 = encodeURIComponent(arg1);
arg2 = encodeURIComponent(arg2);
arg3 = encodeURIComponent(arg3);
arg4 = encodeURIComponent(arg4);
arg5 = encodeURIComponent(arg5);
arg6 = encodeURIComponent(arg6);
arg7 = encodeURIComponent(arg7);
arg8 = encodeURIComponent(arg8);
arg9 = encodeURIComponent(arg9);
arg10 = encodeURIComponent(arg10);
arg11 = encodeURIComponent(arg11);
arg12 = encodeURIComponent(arg12);
arg13 = encodeURIComponent(arg13);
arg14 = encodeURIComponent(arg14);
arg15 = encodeURIComponent(arg15);
arg16 = encodeURIComponent(arg16);
arg17 = encodeURIComponent(arg17);
arg18 = encodeURIComponent(arg18);
arg19 = encodeURIComponent(arg19);
arg20 = encodeURIComponent(arg20);
var url_params = "function=callBrandFunction20&functionName="+functionName+"&arg1="+arg1+"&arg2="+arg2+"&arg3="+arg3+"&arg4="+arg4+"&arg5="+arg5+"&arg6="+arg6+"&arg7="+arg7+"&arg8="+arg8+"&arg9="+arg9+"&arg10="+arg10+"&arg11="+arg11+"&arg12="+arg12+"&arg13="+arg13+"&arg14="+arg14+"&arg15="+arg15+"&arg16="+arg16+"&arg17="+arg17+"&arg18="+arg18+"&arg19="+arg19+"&arg20="+arg20; ;
//alert(url_params);
if(reload)
SendAjaxRequest(url_params, '', reload, moveToAnchor, returnFunction, target, containsScript);
else
SendAjaxRequest(url_params, updateDiv, '', moveToAnchor, returnFunction, target, containsScript);
}
function ajax_post_formLookup(formID, action, updateDiv, reload, moveToAnchor){
reload = typeof reload !== 'undefined' ? reload : '';
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
var formObj = document.getElementById(formID);
if(formObj == null){
alert("Form "+formID+" not found.");
return;
}
//also need to get reason for edit
var reasonForEditObj = document.getElementById("edit_reason");
var edit_resaon = "";
if(reasonForEditObj == null)
edit_reason = "User Update";
else
edit_reason = reasonForEditObj.value;
if(edit_reason == ""){
alert("You must give an edit reason.");
return;
}
ajax_post_form(formObj, action, updateDiv, reload, moveToAnchor, edit_reason);
}
function ajax_post_formButton(formButton, updateDiv, reload, moveToAnchor){
reload = typeof reload !== 'undefined' ? reload : '';
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
//alert(formButton.form);
ajax_post_form(formButton.form, formButton.name, updateDiv, reload, moveToAnchor);
}
function ajax_post_form(formObj, action, updateDiv, reload, moveToAnchor, edit_reason){
//need to serialize all name and value paramters
//need to send this to approprioate ajax handler
reload = typeof reload !== 'undefined' ? reload : '';
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
edit_reason = typeof edit_reason !== 'undefined' ? edit_reason : '';
var elem = formObj.elements;
var serializedNames = "";
var serializedValues = "";
var serializedVisibility = "";
var spearator = "¬";
//alert(action+" "+ elem.length);
//Need to write which button was pressed to submit this
serializedNames = action;
serializedValues = action;
serializedVisibility = action;
//alert(formButton.name);
for(var i = 0; i < elem.length; i++)
{
serializedNames += spearator;
serializedValues += spearator;
serializedVisibility += spearator;
//To replicate form submission on write checkbox and radios that are checked
write = true;
if(elem[i].type == "button"){
write = false;
}else if(elem[i].type == "radio" || elem[i].type == "checkbox"){
//alert(elem[i].name);
if(elem[i].checked == false){
write = false;
//alert(elem[i].checked+" : "+elem[i].name+" : "+elem[i].value);
}
//alert(elem[i].name+" : "+elem[i].value);
}
if(elem[i].name != ""){
if(write && elem[i].name != ""){
serializedValues += elem[i].value;
}else{
serializedValues += "#unchecked";
}
serializedNames += elem[i].name;
if(elem[i].offsetParent === null){ //best way to tell if object is hidden
serializedVisibility += "none";
//console.log(elem[i].name+" : "+elem[i].value+" : none");
}else{
serializedVisibility += "block";
//console.log(elem[i].name+" : "+elem[i].value+" : block");
}
}
//serializedVisibility += elem[i].style.display;
//console.log(elem[i].name+" : "+elem[i].value);
//}else{
;//console.log("Skipping "+elem[i].name+" : "+elem[i].value);
//}
}
if(edit_reason != ""){
serializedNames += spearator+"edit_reason";
serializedValues += spearator+edit_reason;
serializedVisibility += spearator+"block";
}
//console.log(serializedNames);
//console.log(serializedValues);
//console.log(serializedVisibility);
callBrandFunction6('submitForm', serializedNames, serializedValues, serializedVisibility, spearator, elem.length, updateDiv, updateDiv,reload,moveToAnchor, '', '1');
}
function setObjText(objID, text){
var textObj = document.getElementById(objID);
if(textObj == null){
alert("Unable to find screen object "+objID);
}
textObj.innerHTML = text;
}
function requestPasscode(userIDField, outputDiv){
var textObj = document.getElementById(outputDiv);
if(textObj == null){
alert("Unable to find screen object "+outputDiv);
}
var usernameObj = document.getElementById(userIDField);
if(usernameObj == null){
alert("Unable to find screen object "+userIDField);
}
if(usernameObj.value == "" || usernameObj.value == "Username"){
textObj.innerHTML = "
You must specify a valid username before requesting a passcode.
";
}
callBrandFunction1("./ajax_system.php", "requestPasscode", usernameObj.value, outputDiv);
}
function exePopupMenu(buttonObj, showTxt, hideTxt, menu){
//alert(buttonObj.innerHTML);
if(buttonObj.innerHTML == showTxt){
menuObj = document.getElementById(menu);
menuObj.style.display = "block";
buttonObj.innerHTML = hideTxt;
}else if(buttonObj.innerHTML == hideTxt){
menuObj = document.getElementById(menu);
menuObj.style.display = "none";
buttonObj.innerHTML = showTxt;
}
}
function ajax_post_formOLD(formButton, updateDiv, reload, moveToAnchor){
//need to serialize all name and value paramters
//need to send this to approprioate ajax handler
reload = typeof reload !== 'undefined' ? reload : '';
moveToAnchor = typeof moveToAnchor !== 'undefined' ? moveToAnchor : '';
target = typeof target !== 'undefined' ? target : '';
var elem = formButton.form.elements;
var serializedNames = "";
var serializedValues = "";
var spearator = "¬";
//Need to write which button was pressed to submit this
serializedNames = formButton.name;
serializedValues = formButton.name;
//alert(formButton.name);
for(var i = 0; i < elem.length; i++)
{
//To replicate form submission on write checkbox and radios that are checked
write = true;
if(elem[i].type == "button"){
write = false;
}else if(elem[i].type == "radio" || elem[i].type == "checkbox"){
//alert(elem[i].checked);
if(elem[i].checked == false){
write = false;
//alert(elem[i].checked+" : "+elem[i].name+" : "+elem[i].value);
}
//alert(elem[i].name+" : "+elem[i].value);
}
if(write && elem[i].name != ""){
//if(serializedNames != ""){
serializedNames += spearator;
serializedValues += spearator;
//}
serializedNames += elem[i].name;
serializedValues += elem[i].value;
//console.log(elem[i].name+" : "+elem[i].value);
}else{
;//console.log("Skipping "+elem[i].name+" : "+elem[i].value);
}
}
console.log(serializedNames);
console.log(serializedValues);
callBrandFunction5('submitForm', serializedNames, serializedValues, spearator, elem.length, updateDiv, updateDiv,reload,moveToAnchor);
}
var helpObj;
function showHelp(fieldObj){
//alert(fieldObj.name);
if(helpObj != null) //hide last help item
helpObj.style.display = "none";
helpObj = document.getElementById(fieldObj.name+"Help");
if(helpObj != null){
helpObj.style.display = "block";
}
}
function hideOnValue(currentValue, compareValue, objID){
obj = document.getElementById(objID);
if(obj == null)
return;
if(compareValue == "true")
compareValue = true;
if(compareValue == "false")
compareValue = false;
if(currentValue == compareValue){
obj.style.display = "none";
}else{
obj.style.display = "block";
}
}
function showOnValue(currentValue, compareValue, objID){
obj = document.getElementById(objID);
if(obj == null)
return;
if(compareValue == "true")
compareValue = true;
if(compareValue == "false")
compareValue = false;
if(currentValue == compareValue){
obj.style.display = "block";
}else{
obj.style.display = "none";
}
}
function hideHelp(fieldObj){
var helpObj = document.getElementById(fieldObj.name+"Help");
if(helpObj != null)
helpObj.style.display = "none";
}
function showObj(id){
var obj = document.getElementById(id);
if(obj != null){
obj.style.display = "block";
}
//else alert("Unable to fine "+id);
}
function hideObj(id){
var obj = document.getElementById(id);
if(obj != null){
obj.style.display = "none";
}
//else alert("Unable to fine "+id);
}
function setpMenu(name, menu){
callBrandFunction2('setpMenu', name, menu, "none", "index.php");
}
function setURLArg(Obj){
//alert(Obj.value);
window.location.assign("./index.php?URLArg="+Obj.name+"&URLArgValue="+Obj.value);
}
function setURLArgDirect(Obj){
//alert(Obj.value);
window.location.assign("./index.php?"+Obj.name+"="+Obj.value);
}
function setURLParam(name, value){
window.location.assign("./index.php?URLArg="+name+"&URLArgValue="+value);
}
function setURLParamDirect(name, value){
window.location.assign("./index.php?"+name+"="+value);
}
function applyFilter(filterObj, name){
window.location.replace("./index.php?"+name+"="+filterObj.value);
}
//used to clear prompts to input boxes
function clearValue(obj, value){
if(obj.value == value)
obj.value = "";
obj.style.color = "black";
}
function setEmptyValue(obj, value){
if(obj.value == ""){
obj.value = value;
obj.style.color = "#C0C0C0";
}
}
//used to clear prompts to input boxes
function clearPasswordValue(obj, value, type, setObjName){
setObjName = typeof setObjName !== 'undefined' ? setObjName : '';
if(obj.value == value){
obj.value = "";
obj.type = "password";
}
console.log("setObjName :"+setObjName);
if(setObjName != ""){
var setObj = document.getElementById(setObjName);
setObj.style.display = "inline";
}
}
//used to add prompts to input boxes
function setEmptyPasswordValue(obj, value, setObjName){
setObjName = typeof setObjName !== 'undefined' ? setObjName : '';
if(obj.value == ""){
obj.value = value;
obj.type = "text";
var setObj = document.getElementById(setObjName);
setObj.style.display = "none";
}
}
function invisibleWhenChecked(checkObj, visObjID){
var visObj = document.getElementById(visObjID);
if(visObj == null){
alert("Unable to find screen Obj with ID "+visObjID);
return;
}
if(checkObj.checked == true)
visObj.style.display = "block";
else
visObj.style.display = "none";
}
function hScrollRightDiv(objID, amount){
obj = document.getElementById(objID);
if(obj == null){
alert("Unable to find screen Obj"+objID);
return;
}
obj.scrollLeft += screen.width-65;
}
function hScrollLeftDiv(objID, amount){
obj = document.getElementById(objID);
if(obj == null){
alert("Unable to find screen Obj"+objID);
return;
}
obj.scrollLeft -= screen.width-65;
}
function zoomIn(objID, amount){
obj = document.getElementById(objID);
if(obj == null){
alert("Unable to find screen Obj"+objID);
return;
}
var width = obj.style.width;
width = width.replace("%", "");
var TableWidth = parseInt(width)*2;
obj.style.width = TableWidth+"%";
//obj.style.fontSize = TableWidth/2+"%";
}
function zoomOut(objID, amount){
obj = document.getElementById(objID);
if(obj == null){
alert("Unable to find screen Obj"+objID);
return;
}
var width = obj.style.width;
width = width.replace("%", "");
var TableWidth = parseInt(width)/2;
obj.style.width = TableWidth+"%";
//obj.style.fontSize = TableWidth/2+"%";
}
function setSESSION_value(objID){
obj = document.getElementById(objID);
if(obj == null){
alert("Unable to find screen Obj"+objID);
return;
}
callBrandFunction2("setSESSION_value", objID, obj.value, "", "1");
}
var editSessionTimer = null;
function setFilterSESSION_value(obj, delay, count, page, updateDIV){
if(obj.value.length >= count){
if(editSessionTimer != null)
clearTimeout(editSessionTimer);
if(delay == "0")
callBrandFunction3("setClientEditSESSION_value", obj.name, obj.value, page, updateDIV);
else{
//Need to filte out natigation keys
editSessionTimer = setTimeout(function() { callBrandFunction3_delayed("setClientEditSESSION_value", obj.name, obj.value, page, updateDIV); }, delay);
}
}else{
//alert("setSESSION_value");
callBrandFunction2("setSESSION_value", obj.name, obj.value, "", "");
}
}
//function filters the table contents
var editDelayTimer = null;
function filterTableIfIncludeDelayed(delay, count, obj, id, photo){
//console.log("filterTableIfIncludeDelayed");
if(obj.value.length >= count){
if(editDelayTimer != null)
clearTimeout(editDelayTimer);
if(delay == "0")
filterTableIfInclude(obj, id, photo);
else{
//Need to filte out natigation keys
editDelayTimer = setTimeout(function() { filterTableIfInclude(obj, id, photo); }, delay);
}
}else{
filterTableIfInclude(obj, id, photo);
}
}
function filterTableIfInclude(obj, id, photo){
//console.log("filterTableIfInclude Calld");
var filter = obj.value;
filter = filter.toUpperCase()
var filterCol = obj.name;
//alert(filterCol+" "+filter+" "+filter.length);
if(filter.length == 0){
clearFilters();
//alert("Reset");
return;
}
var membersTable = document.getElementById("membersTable");
var tr = membersTable.getElementsByTagName("tr");
//alert(tr.length);
//tr.length = 10;
var found=0;
for (i = 2; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[filterCol];
if (td) {
//alert(td.innerHTML);
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
found = found +1;
} else {
tr[i].style.display = "none";
}
}
}
if(found > 0 && found<10){
for (i = 2; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[filterCol];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
td = tr[i].getElementsByTagName("td")[id];
if(td.innerHTML != "" && td.innerHTML.indexOf("id_scans/") == -1){
//alert("Adding image"+td.innerHTML);
var fname = td.innerHTML;
fname = fname.replace("", "");
fname = fname.replace("
", "");
if(fname != "")
//td.innerHTML = "";
td.innerHTML = "";
}
td = tr[i].getElementsByTagName("td")[photo];
if(td.innerHTML != "" && td.innerHTML.indexOf("id_scans/") == -1 ){
//alert("Adding image"+td.innerHTML);
var fname = td.innerHTML;
fname = fname.replace("", "");
fname = fname.replace("
", "");
if(fname != "")
//td.innerHTML = "";
td.innerHTML = "";
}
}
}
}
}
}
function filterTableIfEqual(obj, id, photo){
//alert("filterTableIfEqual("+obj+", "+id+", "+photo+")");
if(obj != ""){
var filter = obj.value;
filter = filter.toUpperCase()
var filterCol = obj.name;
if(obj.name == "membersID_filter")
filterCol = 1;
}else{
var filter = "";
var filterCol = 1;
}
//filterCol = 1;
//alert(filterCol+" "+filter);
var membersTable = document.getElementById("membersTable");
var tr = membersTable.getElementsByTagName("tr");
//alert(tr.length);
//tr.length = 10;
var found=0;
for (i = 2; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[filterCol];
if (td) {
//alert(td.innerHTML);
if(filter == ""){
//make first 50 visibile
//alert(td.innerHTML.toUpperCase()+" == "+filter);
if(i>10)
tr[i].style.display = "none";
else
tr[i].style.display = "table-row";
}
else if (td.innerHTML.toUpperCase() == filter) {
tr[i].style.display = "";
found = found +1;
}else {
tr[i].style.display = "none";
}
}
}
//alert(found);
if(found > 0 && found<10){
for (i = 2; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[filterCol];
if (td) {
if (td.innerHTML.toUpperCase() == filter) {
td = tr[i].getElementsByTagName("td")[id];
if(td.innerHTML != "" && td.innerHTML.indexOf("id_scans/") == -1){
//alert("Adding image"+td.innerHTML);
var fname = td.innerHTML;
fname = fname.replace("", "");
fname = fname.replace("
", "");
if(fname != "")
td.innerHTML = "";
}
td = tr[i].getElementsByTagName("td")[photo];
if(td.innerHTML != "" && td.innerHTML.indexOf("id_scans/") == -1 ){
//alert("Adding image"+td.innerHTML);
var fname = td.innerHTML;
fname = fname.replace("", "");
fname = fname.replace("
", "");
if(fname != "")
td.innerHTML = "";
}
}
}
}
}
}
function checkIn(membershipID){
callBrandFunction1("checkIn", membershipID, "checkin_"+membershipID, "");
}
function showCheckin(obj_name, id, photo){
//alert("showCheckin");
var obj = document.getElementById(obj_name);
filterTableIfEqual(obj, id, photo);
}
function clearFilters(){
var obj = document.getElementById("membersID_filter");
obj.value="";
obj = document.getElementById("membersName_filter");
obj.value="";
obj = document.getElementById("postcode_filter");
obj.value="";
filterTableIfEqual("", 5, 6);
}
function clearCheckinFilters(){
var obj = document.getElementById("membersID_filter");
obj.value="";
obj = document.getElementById("membersName_filter");
obj.value="";
obj = document.getElementById("postcode_filter");
obj.value="";
obj = document.getElementById("tableBookings");
if(obj != null)
obj.innerHTML = "";
callBrandFunction('clearCheckinFilters', '', '');
}
function clearFilter(filter, filter2){
var obj = document.getElementById(filter);
obj.value="";
var obj2 = document.getElementById(filter2);
obj2.value="";
}
// file selection
function FileSelectHandler(e, tag, target_dir, max_file_size) {
// cancel event and hover styling
//FileDragHover(e);
// fetch FileList object
//var files = e.target.files || e.dataTransfer.files;
var files = e.files;
// process all File objects
for (var i = 0, f; f = files[i]; i++) {
//ParseFile(f, tag);
UploadFile(f, tag, target_dir, max_file_size);
}
}
// output file information
function ParseFile(file, tag) {
Output(
"File information: " + file.name +
" type: " + file.type +
" size: " + file.size +
" bytes
"
,tag);
// display an image
if (file.type.indexOf("image") == 0) {
var reader = new FileReader();
reader.onload = function(e) {
Output(
"" + file.name + ":
" +
'
'
,tag);
}
reader.readAsDataURL(file);
}
// display text
if (file.type.indexOf("text") == 0) {
var reader = new FileReader();
reader.onload = function(e) {
Output(
"" + file.name + ":
" +
e.target.result.replace(//g, ">") +
"
"
,tag);
}
reader.readAsText(file);
}
}
// upload JPEG files
function UploadFile(file, tag, target_dir, max_file_size) {
// following line is not necessary: prevents running on SitePoint servers
//if (location.host.indexOf("sitepointstatic") >= 0) return
var xhr = new XMLHttpRequest();
//alert(file.type);
if (xhr.upload && (file.type == "image/jpeg" || file.type == "application/pdf") && file.size <= max_file_size) {
//if (xhr.upload && file.size <= $id("MAX_FILE_SIZE").value) {
// create progress bar
var o = $id("progress"+tag);
o.innerHTML = ""; //Need to clear this as it could have last image in it
var progress = o.appendChild(document.createElement("p"));
progress.appendChild(document.createTextNode("upload " + file.name));
// progress bar
xhr.upload.addEventListener("progress", function(e) {
var pc = parseInt(100 - (e.loaded / e.total * 100));
progress.style.backgroundPosition = pc + "% 0";
}, false);
// file received/failed
xhr.onreadystatechange = function(e) {
if (xhr.readyState == 4) {
Status(xhr.responseText, tag);
}
};
// start upload
xhr.open("POST", "upload.php?target_dir="+target_dir, true);
//xhr.setRequestHeader("X_FILENAME", file.name);
xhr.setRequestHeader("X-FILENAME", file.name);
xhr.send(file);
}else{
if(file.size >= max_file_size){
Status("Upload Failed - file to big ( "+file.size/1000 +" > "+max_file_size/1000 +"KB).", tag);
}else
Status("Upload Failed - Not a valid upload file format.", tag);
}
}
function $id(id) {
var obj = document.getElementById(id);
if(obj == null)
alert("Obj '"+id+"' not found");
return document.getElementById(id);
}
// output information
function Output(msg, tag) {
var m = $id("messages"+tag);
m.innerHTML = msg;// + m.innerHTML;
}
// output information
function Status(msg, tag) {
var m = $id("status"+tag);
m.innerHTML = msg;// + m.innerHTML;
}
function streamFile(dmID, filename, version, userID, iframeID){
//iframeObj = $id(iframeID);
//iframeObj
var iframeObj = document.getElementById(iframeID);
if(iframeObj == null){
alert("iframeObj '"+iframeID+"' not found");
return;
}
//alert("setting iframe src to /filestream.php?"+filename);
iframeObj.src = "./filestream.php?filename="+filename;
if(dmID != "")
callBrandFunction4("recordDownload", dmID, filename, version, userID, "", "");
}
function setBanDetails(memberID){
var ban_lengthObj = document.getElementById("ban_length_"+memberID);
var ban_reasonObj = document.getElementById("ban_reason_"+memberID);
callBrandFunction3("setBanDetails", memberID, ban_lengthObj.value, ban_reasonObj.value, "member_status_"+memberID);
}
function setSearchDetails(memberID){
var search_reasonObj = document.getElementById("search_reason_"+memberID);
var search_resultObj = document.getElementById("search_result_"+memberID);
var search_notesObj = document.getElementById("search_notes_"+memberID);
callBrandFunction4("setSearchDetails", memberID, search_reasonObj.value, search_resultObj.value, search_notesObj.value, "member_status2_"+memberID);
}
function checkformember(statusDiv){
//alert("Checking member details");
//first_name
var firstnameObj = document.getElementById("first_name");
if(firstnameObj == null)
alert("Unable to find first_name Obj");
//last_name
var lastnameObj = document.getElementById("last_name");
if(lastnameObj == null)
alert("Unable to find last_name Obj");
//dob
var dobnameObj = document.getElementById("dob");
if(dobnameObj == null)
alert("Unable to find dob Obj");
//postcode
var postcodenameObj = document.getElementById("postcode");
if(postcodenameObj == null)
alert("Unable to find postcode Obj");
//look through table to see if yser already exists
var membersTable = document.getElementById("membersTable");
if(membersTable == null){
//alert("Unable to find membersTable");
return;
}
var tr = membersTable.getElementsByTagName("tr");
//alert(tr.length);
//tr.length = 10;
//var filter = obj.value;
//filter = filter.toUpperCase()
//var filterCol = obj.name;
//alert(filterCol+" "+filter);
var foundMembers = new Array();
for (i = 2; i < tr.length; i++) {
var td_name = tr[i].getElementsByTagName("td")[2];
var td_postcode = tr[i].getElementsByTagName("td")[3];
if (td_name) {
//alert(td_name.innerHTML);
//alert(firstnameObj.value.toUpperCase());
if(td_name.innerHTML.toUpperCase().indexOf(firstnameObj.value.toUpperCase()) > -1
&& td_name.innerHTML.toUpperCase().indexOf(lastnameObj.value.toUpperCase()) > -1
&& td_postcode.innerHTML.toUpperCase().indexOf(postcodenameObj.value.toUpperCase()) > -1
) {
//tr[i].style.display = "";
//found = found +1;
//alert("Found "+td_name.innerHTML);
var membershipID = tr[i].getElementsByTagName("td")[1];
var image = tr[i].getElementsByTagName("td")[5];
if(image == "")
image = tr[i].getElementsByTagName("td")[4];
if(image == "")
image = "No image found for "+tr[i].getElementsByTagName("td")[2]+" "+tr[i].getElementsByTagName("td")[3];
//foundMembers[membershipID] = image;
foundMembers.push(i);
}
}
}
var statusObj = document.getElementById(statusDiv);
if(statusObj == null)
alert("Unable to find checkformember status Div");
else{
statusObj.innerHTML = "Members Status Check:
";
statusObj.innerHTML += "Found "+foundMembers.length+" members
";
//neeed to construct this as if done directly via innerhtml incomplete html is automatically closed
if(foundMembers.length != 0){
//alert("Found "+foundMembers.length+" members");
if(foundMembers.length < 5){
//insert photos of found users
var statusStr = "";
for(m=0; m";
statusStr += ""+tr[foundMembers[m]].getElementsByTagName("td")[2].innerHTML+"
"; //name
//statusObj.innerHTML += "**"+tr[foundMembers[m]].getElementsByTagName("td")[6].innerHTML; //photo
var photo = tr[foundMembers[m]].getElementsByTagName("td")[6];
//alert(photo.innerHTML);
var fname = photo.innerHTML;
if(fname.innerHTML != "" && fname.indexOf("id_scans/") == -1 ){
fname = fname.replace("
", "");
fname = fname.replace("
", "");
if(fname != "")
statusStr += "
";
}
else{
//need to update link
statusStr += fname;
}
statusStr += "
";
statusObj.innerHTML +=statusStr;
}
}
}
}
}
function getObjValue(name, showError){
var obj = document.getElementById(name)
if(obj == null){
if(showError)
alert("Unable to find "+name);
return "";
}
else
return obj.value;
}
function getObjCheck(name){
var obj = document.getElementById(name)
if(obj == null){
alert("Unable to find "+name);
return "";
}
else
return obj.checked;
}
function getRadioObjValue(name){
var obj = document.getElementsByName(name);
if(obj == null){
alert("Unable to find "+name);
return "";
}
for(var i = 0; i < obj.length; i++){
if(obj[i].checked){
return obj[i].value;
}
}
return "";
}
function editMember(memberID, action, directory, submission_time, formCount, checkin){
var first_name = getObjValue("first_name");
var last_name = getObjValue("last_name");
var gender = getRadioObjValue("gender");
var dob = getObjValue("dob");
var permission = getObjValue("permission");
var email = getObjValue("email");
var phone = getObjValue("phone");
var address = getObjValue("address");
var postcode = getObjValue("postcode");
var id_seen = getObjValue("id_seen");
var fileUpload_id = getObjValue("fileUpload_id");
var fileUpload0_id = getObjValue("fileUpload0_id"); //current name
var fileUpload_photo = getObjValue("fileUpload_photo");
var fileUpload0_photo = getObjValue("fileUpload0_photo"); //current name
//var checkin = getObjCheck("checkin");
callBrandFunction20("editMember", memberID, action, submission_time, formCount, first_name, last_name, gender, dob, permission, email, phone, address, postcode, id_seen, directory, fileUpload_id, fileUpload0_id, fileUpload_photo, fileUpload0_photo, checkin, "membersForm", "");
}
//same as above but handles by`editMember_min function
function editMember_min(memberID, action, directory, submission_time, formCount, checkin){
var first_name = getObjValue("first_name");
var last_name = getObjValue("last_name");
var gender = getRadioObjValue("gender");
var dob = getObjValue("dob");
var permission = getObjValue("permission");
var email = getObjValue("email");
var phone = getObjValue("phone");
var address = getObjValue("address");
var postcode = getObjValue("postcode");
var id_seen = getObjValue("id_seen");
var id_data = getObjValue("id_data");
//var fileUpload_id = getObjValue("fileUpload_id");
var fileUpload0_id = getObjValue("fileUpload0_id"); //current name
var id = getObjValue("ID", false);
var photo = getObjValue("PHOTO", false);
//console.log(photo);
//var fileUpload_photo = getObjValue("fileUpload_photo");
var fileUpload0_photo = getObjValue("fileUpload0_photo"); //current name
//var checkin = getObjCheck("checkin");
callBrandFunction20("editMember_min2", memberID, action, submission_time, formCount, first_name, last_name, gender, dob, permission, email, phone, address, postcode, id_seen, fileUpload0_id, id, fileUpload0_photo, photo, checkin, id_data, "membersForm", "");
//callBrandFunction20("editMember_min", memberID, action, submission_time, formCount, first_name, last_name, gender, dob, permission, email, phone, address, postcode, id_seen, directory, fileUpload_id, fileUpload0_id, fileUpload_photo, fileUpload0_photo, checkin, "membersForm", "");
}
function clearHTML(divName){
var Obj = document.getElementById(divName);
if(Obj)
Obj.innerHTML = "";
}
function selectMember(memberID){
var membersIDFilterObj = document.getElementById("membersID_filter");
membersIDFilterObj.value = memberID;
filterTableIfEqual(membersIDFilterObj, 5, 6);
}
function selectMember2(memberID){
var membersIDFilterObj = document.getElementById("membersID_filter");
membersIDFilterObj.value = memberID;
callBrandFunction2("setCustomerFilter", "membersID_filter", memberID, "customerArea", "");
}
function downloadCSV(csv, filename) {
var csvFile;
var downloadLink;
// CSV file
csvFile = new Blob([csv], {type: "text/csv"});
// Download link
downloadLink = document.createElement("a");
// File name
downloadLink.download = filename;
// Create a link to the file
downloadLink.href = window.URL.createObjectURL(csvFile);
// Hide download link
downloadLink.style.display = "none";
// Add the link to DOM
document.body.appendChild(downloadLink);
// Click download link
downloadLink.click();
}
function exportTableToCSV(filename, missRow) {
var csv = [];
var rows = document.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td, th");
for (var j = 0; j < cols.length; j++){
//var contents = cols[j].querySelectorAll("select");
//for (var c = 0; c < contents.length; c++){
// alert(contents[c].value);
//}
//if(typeof(cols[j]) === 'object')
// row.push(cols[j].value);
//else
row.push(cols[j].innerText);
}
if(i != missRow)
csv.push(row.join(","));
}
// Download CSV file
downloadCSV(csv.join("\n"), filename);
}
//as abobe but just processes passed in table
function exportTable1ToCSV(filename, missRow, table) {
var csv = [];
tableObj = document.getElementById(table)
var rows = tableObj.querySelectorAll("table tr");
for (var i = 0; i < rows.length; i++) {
var row = [], cols = rows[i].querySelectorAll("td, th");
for (var j = 0; j < cols.length; j++){
//var contents = cols[j].querySelectorAll("select");
//for (var c = 0; c < contents.length; c++){
// alert(contents[c].value);
//}
//if(typeof(cols[j]) === 'object')
// row.push(cols[j].value);
//else
row.push(cols[j].innerText);
}
if(i != missRow)
csv.push(row.join(","));
}
// Download CSV file
downloadCSV(csv.join("\n"), filename);
}
//VM functions
function nextCat(categoryList, currentCategory){
//Should add a check to ensure all product data has been added.
if(document.getElementsByName('lastLevel')[0].value == ""){
document.getElementById("statusMsg_cat").innerHTML = "You need to add stock levels for all products before moving to the next category.";
return;
}
var categoryListObj = document.getElementById(categoryList);
if(categoryListObj.selectedIndex < categoryListObj.length-1){
categoryListObj.selectedIndex = categoryListObj.selectedIndex+1;
window.location.assign("./index.php?URLArg=stock_category&URLArgValue="+categoryListObj.value);
if(categoryListObj.selectedIndex == 1)
document.getElementById("previousCatButton").disabled = false;
}
//else
//document.getElementById("nextCatButton").disabled = true;
//alert("end reached");
}
function previousCat(categoryList, currentCategory){
var categoryListObj = document.getElementById(categoryList);
//alert(categoryListObj.selectedIndex);
if(categoryListObj.selectedIndex != 0){
categoryListObj.selectedIndex = categoryListObj.selectedIndex-1;
window.location.assign("./index.php?URLArg=stock_category&URLArgValue="+categoryListObj.value);
}
//else
//document.getElementById("previousCatButton").disabled = true;
//alert("start reached");
}
function checkForEnter(obj, e, numRows){
if (e.keyCode == 13) {
//alert("Enter detected");
if(obj.value != "")
nextRow(numRows);
else
document.getElementById("statusMsg_product").innerHTML = "You must enter a stock value";
}
return true;
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function setStockLevel(editObj, locationID, stockLevelID, productID, product, updateDiv, numRows){
console.log(updateDiv);
/*if(!isNumber(editObj.value)){
if(editObj.value != 'x' && editObj.value != 'X'){
document.getElementById("statusMsg_product").innerHTML = "You must enter a valid numeric stock value, not '"+editBoxObj.value+"'";
return;
}
}*/
var enteredVal = editObj.value;
/*if(enteredVal.toString() == ""){
document.getElementById("statusMsg_product").innerHTML = "You must enter a stock value for "+product+" (Enter '-' to skip.)";
return;
}else{
document.getElementById("statusMsg_product").innerHTML = "";
}*/
//alert("setStockLevel");
//lastStockLevelChange =
var reload = "";
//if(stockLevelID == ""){
// reload = "1";
//alert("Reload set");
//}
var name = editObj.name;
if(name == "lastLevel") //need to correct name of last stock item as this was renamed to confirm that user can move to next category, see function nextCat(....
name = "currentLevel";
callBrandFunction6("setStockLevel", locationID, name, editObj.value, stockLevelID, productID, product, updateDiv, reload, "", "", "", "ajax_vm.php");
//NextRow only needs to be called if setStockLevel was called via enter
//if(numRows)
//nextRow(numRows);
}
var currentRow = 0;
function nextRow(numRows){
var textboxObj = document.getElementById("currentLevel_"+currentRow);
if(textboxObj == null){
alert("Could not find object currentLevel_"+currentRow);
return;
}
var statusObj = document.getElementById("statusMsg_product");
statusObj.innerHTML = "";
if(!isNumber(textboxObj.value)){
if(textboxObj.value != 'x' && textboxObj.value != 'X'){
statusObj.innerHTML = "You must enter a valid numeric stock value, not '"+textboxObj.value+"'";
return;
}
}
if(textboxObj.value == ""){
statusObj.innerHTML = "You must enter a stock value";
return;
}
if(currentRow < numRows-1){
var currentRowObj = document.getElementById("row_"+currentRow);
currentRowObj.style.display = "none";
currentRow = currentRow +1;
var nextRowObj = document.getElementById("row_"+currentRow);
if(nextRowObj == null){
alert("Could not find object row_"+currentRow);
return;
}
nextRowObj.style.display = "";
//keep two rows highlighted so iphone etc can use next
//additionalRow = currentRow +1;
//nextRowObj = document.getElementById("row_"+additionalRow);
//nextRowObj.style.display = "";
var textboxObj = document.getElementById("currentLevel_"+currentRow);
textboxObj.focus();
if(currentRow == numRows){
document.getElementById("nextRowButton").disabled = true;
}
else if(currentRow == 1){
document.getElementById("previousRowButton").disabled = false;
}
}
else if(currentRow == numRows-1){
document.getElementById("nextRowButton").disabled = true;
}
}
function previousRow(numRows){
var statusObj = document.getElementById("statusMsg_product");
statusObj.innerHTML = "";
if(currentRow > 0){
var currentRowObj = document.getElementById("row_"+currentRow);
currentRowObj.style.display = "none";
currentRow = currentRow -1;
var nextRowObj = document.getElementById("row_"+currentRow);
nextRowObj.style.display = ""; //did not use block as this fails to render the table tds correctly.
var textboxObj = document.getElementById("currentLevel_"+currentRow);
textboxObj.focus();
if(currentRow == 0){
document.getElementById("previousRowButton").disabled = true;
}
else if(currentRow == numRows-2){
document.getElementById("nextRowButton").disabled = false;
}
}
}
function orderKeypress(e, thisRow, lastRow, last_locationID, last_stockLevelID, lastProductID, updateDiv){
if (e.keyCode == 13) {
//alert("Enter detected");
orderStatus(thisRow, lastRow, last_locationID, last_stockLevelID, lastProductID, updateDiv);
}else if(e.keyCode == 27){
//alert("escapeKey");
var lastRowObj = document.getElementById(lastRow);
var currentRowObj = document.getElementById(thisRow);
lastRowObj.style.display = "none";
currentRowObj.style.dsiplay = ""
var nextButton = document.getElementById("b"+thisRow);
nextButton.focus();
}
return true;
}
function supplerChanged(radioObj, productID){
var radioGrouop = document.getElementsByName(radioObj.name);
for(var i = 0; i < radioGrouop.length; i++){
//alert("cost_"+productID+"_"+radioGrouop[i].value);
var costObj = document.getElementById("cost_"+productID+"_"+radioGrouop[i].value);
costObj.style.color = "#C0C0C0";
if(radioGrouop[i].checked){
costObj.style.color = "black";
}
}
}
function orderStatus(thisRow, lastRow, stockLevelID, locationID, productID, quantity, updateDiv){
addToOrder(thisRow, lastRow, stockLevelID, locationID, productID, quantity, updateDiv);
}
function addToOrder(thisRow, lastRow, stockLevelID, locationID, productID, quantity, updateDiv){
document.getElementById("statusMsg_"+lastRow).innerHTML = "";//do this to clear old error message.
//find out which supplier has been selected from radio "p_"+productID
var name = "input[name=p_"+thisRow+"]:checked";
var selectedSupplier;
if(document.querySelector(name) == null){
document.getElementById("statusMsg_"+thisRow).innerHTML = "ERROR: You must select a supplier.";
//alert("ERROR: You must select a supplier");
return;
}else
selectedSupplier = document.querySelector(name).value;
//This value for quantity may be wrong, if it has been chnaged since page load;
var quantityObj = document.getElementById("quantity_"+lastRow);
//alert(quantityObj.value);
if(quantityObj.value == ""){
document.getElementById("statusMsg_"+thisRow).innerHTML = "ERROR: You must specify a quantity.";
return;
}
if(locationID == ""){
alert("No Location");
locationID = document.getElementById("locationID").value;
alert(locationID);
return;
}
//Hides completed row
var lastRowObj = document.getElementById(lastRow);
var currentRowObj = document.getElementById(thisRow);
lastRowObj.style.display = "none";
currentRowObj.style.dsiplay = ""
var nextButton = document.getElementById("b"+lastRow);
nextButton.focus();
//find out which supplier has been selected from radio "p_"+productID
callBrandFunction5a("./ajax_vm.php", "addToOrder", stockLevelID, locationID, productID, quantityObj.value, selectedSupplier, updateDiv, "");
}
function addStockDeliveryCount(stockOrderID, orderQuantity, deliveryQuantity){
if(orderQuantity != deliveryQuantity){
alert("Different order to delivery Quantities");
var deliveryQuantityIssueObj = document.getElementById("deliveryQuantityIssue_"+stockOrderID);
if(deliveryQuantityIssueObj != null){
deliveryQuantityIssueObj.style.display = "block";
}
//Need to show action and notes boxes
}else{
//Need to add delivery quantity
if(deliveryQuantityIssueObj.style.display == block){
//Need to clear out issue values
alert("Looking to clear out issue values as issue no longer exists");
}
}
//Need to make sure stock can only be checked in while in ordered state
var checked; //true/false
var stockLevelID;
//callBrandFuntion("checkinOrderItem", checked, stockOrderID, stockLevelID, orderQuantity, deliveryQuantity, $productTitle, $supplierID, $orderNumber){
// \"".$dbarray['stockOrderID']."\", \"".$dbarray['stockLevelID']."\", \"".$dbarray['orderQuantity']."\", \"".$dbarray['product']."\", \"".$dbarray['supplierID']."\", \"".$dbarray['orderNumber']."\", \"deliveryStatus\")'>";
}
function setPreferredSupplier(locationID, stockLevelID, supplierID, productID, updateDiv){
//alert("setPreferredSupplier");
callBrandFunction5a("./ajax_vm.php","setStockLevel", locationID, "preferredSupplier", supplierID, stockLevelID, productID, updateDiv, "");
}
function selectDelivery(selObj, outputDiv){
callBrandFunction1a("./ajax_vm.php", "checkinOrder", selObj.value, outputDiv);
}
function orderItemCheckin(checkboxObj, stockOrderID, stockLevelID, orderQuantity, productTitle, supplierID, orderNumber, updateDiv){
//alert(updateDiv);
//alert(checkboxObj.checked);
//need to check quantity
console.log("Looking for deliveryQuantity_"+stockOrderID);
var receivedQuantity = document.getElementById("deliveryQuantity_"+stockOrderID).value;
callBrandFunction8a("./ajax_vm.php", "checkinOrderItem", checkboxObj.checked, stockOrderID, stockLevelID, orderQuantity, receivedQuantity, productTitle, supplierID, orderNumber, updateDiv);
}
function feedbackMoveStockResults(objKey, sourceLevel, destinationLevel, requestLevel){
$sourceLevelObj = document.getElementById("SL_"+objKey);
if($sourceLevelObj != null)
$sourceLevelObj.innerHTML = sourceLevel;
else
alert("Could not find obj SL_"+objKey);
$destinationLevelObj = document.getElementById("DL_"+objKey);
if($destinationLevelObj != null)
$destinationLevelObj.innerHTML = destinationLevel;
$requestLevelObj = document.getElementById("RL_"+objKey);
if($requestLevelObj != null)
$requestLevelObj.value = requestLevel;
}
function setMoveProduct(stockMovementSource, stockMovementDestination, productID, amount, updateDiv){
//remove confirm button so it cannot be pressed
var outputObj = document.getElementById(updateDiv);
if(outputObj != null)
outputObj.innerHTML = "";
callBrandFunction4a("./ajax_vm.php", "setMoveProduct", stockMovementSource, stockMovementDestination, productID, amount, updateDiv, "", "", "", "1");
}
function addTrainingMatrix(moduleID, userID, alias){
var indexKey = "_"+moduleID+"_"+userID;
var certification_levelObj = document.getElementById("certification_level"+indexKey);
var certification_statusObj = document.getElementById("certification_status"+indexKey);
var certification_dateObj = document.getElementById("certification_date"+indexKey);
if(certification_levelObj == null || certification_statusObj == null || certification_dateObj == null){
alert("Unable to find updateTrainingMatrix object level = "+certification_levelObj+" status = "+certification_statusObj+" date = "+certification_dateObj);
return;
}
callBrandFunction6a("./ajax_vm.php", "addTrainingMatrix", moduleID, userID, certification_levelObj.value, certification_statusObj.value, certification_dateObj.value, alias, "status"+indexKey, "");
}
function updateTrainingMatrix(matrixID, moduleID, userID){
var indexKey = "_"+moduleID+"_"+userID;
var certification_levelObj = document.getElementById("certification_level"+indexKey);
var certification_statusObj = document.getElementById("certification_status"+indexKey);
var certification_dateObj = document.getElementById("certification_date"+indexKey);
if(certification_levelObj == null || certification_statusObj == null || certification_dateObj == null){
alert("Unable to find updateTrainingMatrix object level = "+certification_levelObj+" status = "+certification_statusObj+" date = "+certification_dateObj);
return;
}
callBrandFunction4a("./ajax_vm.php", "updateTrainingMatrix", matrixID, certification_levelObj.value, certification_statusObj.value, certification_dateObj.value, "status"+indexKey, "");
}
function addRotaData(rotaEntryID, bookingDate, companyID, editRotaID, day_starts, sleep_start, sleep_end, status){
var start = document.getElementById("rotaStart_"+rotaEntryID);
if(start == null){
alert("Unable to find screen Obj rotaStart_"+rotaEntryID);
return;
}
var end = document.getElementById("rotaEnd_"+rotaEntryID);
if(end == null){
alert("Unable to find screen Obj rotaEnd_"+rotaEntryID);
return;
}
var employeeID = document.getElementById("rotaEmployeeID_"+rotaEntryID);
if(employeeID == null){
alert("Unable to find screen Obj rotaEmployeeID_"+rotaEntryID);
return;
}
var onCallObj = document.getElementById("rotaOnCall_"+rotaEntryID);
if(onCallObj == null){
alert("Unable to find screen Obj rotaOnCall_"+rotaEntryID);
return;
}
var onCall = 0;
if(onCallObj.checked == true)
onCall = 1;
var waking_nightObj = document.getElementById("rotaWaking_night_"+rotaEntryID);
if(waking_nightObj == null){
alert("Unable to find screen Obj rotaWaking_nightObj_"+rotaEntryID);
return;
}
var waking_night = 0;
if(waking_nightObj.checked == true)
waking_night = 1;
if(editRotaID == "")
callBrandFunction12a("./ajax_vm.php", "addRotaEntry", bookingDate, companyID, employeeID.value, start.value, end.value, onCall, waking_night, rotaEntryID, day_starts, sleep_start, sleep_end, status, "rotaEntryDiv_"+rotaEntryID, "");
else
callBrandFunction13a("./ajax_vm.php", "editRotaEntry", editRotaID, bookingDate, companyID, employeeID.value, start.value, end.value, onCall, waking_night, rotaEntryID, day_starts, sleep_start, sleep_end, status, "rotaEntryDiv_"+rotaEntryID, "");
}
function deleteRotaEntry(rotaEntryID, rotaDate, companyID, editRotaID){
var delete_Obj = document.getElementById("rotaDelete_"+rotaEntryID);
if(delete_Obj == null){
alert("Unable to find screen Obj delete_"+rotaEntryID);
return;
}
callBrandFunction5a("./ajax_vm.php", "deleteRotaEntry", editRotaID, delete_Obj.checked, rotaDate, companyID, rotaEntryID, "rotaEntryDiv_"+rotaEntryID, "");
}
function clearAllRotaDay(rotaEntryID, rotaDate, companyID, editRotaID){
var delete_Obj = document.getElementById("rotaClearAll_"+rotaDate+"_"+companyID);
if(delete_Obj == null){
alert("Unable to find screen Obj rotaClearAll_"+rotaDate+"_"+companyID);
return;
}
callBrandFunction4a("./ajax_vm.php", "clearAllRotaDay", delete_Obj.checked, rotaDate, companyID, rotaEntryID, "rotaEntryDiv_"+rotaEntryID, "");
}
function LoadRotaData(rotaEntryID, rotaDate, companyID){
var loadDateObj = document.getElementById("rotaLoad_"+rotaEntryID);
if(loadDateObj == null){
alert("Unable to find screen Obj rotaLoad_"+rotaEntryID);
return;
}
callBrandFunction4a("./ajax_vm.php", "CopyRotaDay", loadDateObj.value, rotaDate, companyID, rotaEntryID, "rotaEntryDiv_"+rotaEntryID);
}
function LoadRotaWeek(targetDate, companyID){
var sourceDateObj = document.getElementById("rotaWeekStartDate");
if(sourceDateObj == null){
alert("Unable to find screen Obj rotaWeekStartDate");
return;
}
callBrandFunction3a("./ajax_vm.php", "CopyRotaWeek", sourceDateObj.value, targetDate, companyID, "", "1");
}
function submitTimesheet(timesheetID,rotaID, type, rotaTime, employeeID, bookingDate, ts_start){
var costCenter_Obj = document.getElementById("costCenter_"+rotaID);
if(costCenter_Obj == null){
alert("Unable to find screen Obj costCenter_"+rotaID);
return;
}
//alert(costCenter_Obj.value);
if(type == "start"){
var startObj = document.getElementById("ts_start_"+rotaID);
if(startObj == null){
alert("Unable to find screen Obj ts_start_"+rotaID);
return;
}
var start_explanation_Obj = document.getElementById("start_explanation_"+rotaID);
if(start_explanation_Obj == null && rotaID != 1){
alert("Unable to find screen Obj start_explanation_"+rotaID);
return;
}
var waking_night_Obj = document.getElementById("ts_waking_night_"+rotaID);
if(waking_night_Obj == null){
alert("Unable to find screen Obj ts_waking_night_"+rotaID);
return;
}
callBrandFunction11a("./ajax_vm.php", "submitTimesheet", timesheetID, type, rotaID, costCenter_Obj.value, startObj.value, start_explanation_Obj.value, rotaTime, employeeID, bookingDate, ts_start, waking_night_Obj.checked, "", "1");
}else if(type == "finish"){
var Obj = document.getElementById("ts_finish_"+rotaID);
if(Obj == null){
alert("Unable to find screen Obj ts_finish_"+rotaID);
return;
}
var explanation_Obj = document.getElementById("finish_explanation_"+rotaID);
if(explanation_Obj == null){
alert("Unable to find screen Obj finish_explanation_"+rotaID);
return;
}
callBrandFunction10a("./ajax_vm.php", "submitTimesheet", timesheetID, type, rotaID, costCenter_Obj.value, Obj.value, explanation_Obj.value, rotaTime, employeeID, bookingDate, ts_start, "", "1");
}
}
function updateTimesheet(timesheetID,rotaID, type, rotaTime, employeeID, bookingDate, ts_start){
var costCenter_Obj = document.getElementById("costCenter_"+rotaID);
if(costCenter_Obj == null){
alert("Unable to find screen Obj costCenter_"+rotaID);
return;
}
if(type == "start"){
var startObj = document.getElementById("ts_start_"+rotaID);
if(startObj == null){
alert("Unable to find screen Obj ts_start_"+rotaID);
return;
}
var start_explanation_Obj = document.getElementById("start_explanation_"+rotaID);
if(start_explanation_Obj == null){
alert("Unable to find screen Obj start_explanation_"+rotaID);
return;
}
var waking_night_Obj = document.getElementById("ts_waking_night_"+rotaID);
if(waking_night_Obj == null){
alert("Unable to find screen Obj ts_waking_night_"+rotaID);
return;
}
callBrandFunction11a("./ajax_vm.php", "updateTimesheet", timesheetID, type, rotaID, costCenter_Obj.value, startObj.value, start_explanation_Obj.value, rotaTime, employeeID, bookingDate, ts_start, waking_night_Obj.checked, "", "2");
}else if(type == "finish"){
var Obj = document.getElementById("ts_finish_"+rotaID);
if(Obj == null){
alert("Unable to find screen Obj ts_finish_"+rotaID);
return;
}
var explanation_Obj = document.getElementById("finish_explanation_"+rotaID);
if(explanation_Obj == null){
alert("Unable to find screen Obj finish_explanation_"+rotaID);
return;
}
callBrandFunction10a("./ajax_vm.php", "updateTimesheet", timesheetID, type, rotaID, costCenter_Obj.value, Obj.value, explanation_Obj.value, rotaTime, employeeID, bookingDate, ts_start, "", "2");
}
}
function submitUnshceduledTimesheet(rotaID, employeeID, companyID, bookingDate, additionalHours){
callBrandFunction5a("./ajax_vm.php", "unsheduledTimesheet", rotaID, employeeID, companyID, bookingDate, additionalHours, "", "1");
}
function loadMissingTime(rotaID, startHHMM, nextHHMM){
//should we clear the select employee box
var employeeObj = document.getElementById("rotaEmployeeID_"+rotaID);
if(employeeObj == null){
alert("Unable to find screen Obj rotaEmployeeID_"+rotaID);
return;
}
employeeObj.value = 0;
var startObj = document.getElementById("rotaStart_"+rotaID);
if(startObj == null){
alert("Unable to find screen Obj rotaStart_"+rotaID);
return;
}
startObj.value = startHHMM;
var finishObj = document.getElementById("rotaEnd_"+rotaID);
if(finishObj == null){
alert("Unable to find screen Obj rotaEnd_"+rotaID);
return;
}
finishObj.value = nextHHMM;
}
function setDateFilters(fromDate, toDate){
var fromDate_Obj = document.getElementById(fromDate);
if(fromDate_Obj == null){
alert("Unable to find screen Obj fromDate");
return;
}
var toDate_Obj = document.getElementById(toDate);
if(toDate_Obj == null){
alert("Unable to find screen Obj toDate");
return;
}
callBrandFunction4("setDateFilters", fromDate_Obj.value, toDate_Obj.value, fromDate, toDate, "", "1");
}
//Cashup functions
function setv(obj, id, number, previousBankedAmount){
var valueObj = document.getElementById(id);
valueObj.value = (obj.value*number).toFixed(2);
sumCash(previousBankedAmount);
//Need to check if float is still valid
var cf_obj = document.getElementById("cf"+id.slice(1));
if(Number(obj.value) >= Number(cf_obj.value)){
//alert("setv OK "+obj.value+" > "+cf_obj.value);
cf_obj.style.border= "1px solid #7F9DB9";
}else{
//alert("setv too small "+obj.value+" > "+cf_obj.value);
cf_obj.style.border= "1px solid red"
}
}
function setc(obj, id, number, previousBankedAmount){
var valueObj = document.getElementById(id);
valueObj.value = (obj.value/number);
obj.value = (Number(obj.value)).toFixed(2); //make sure this has 2 decimal places
sumCash(previousBankedAmount);
//Need to check if float is still valid
var cf_obj = document.getElementById("cf"+id.slice(1));
if(Number(valueObj.value) >= Number(cf_obj.value)){
//alert("setv OK "+valueObj.value+" > "+cf_obj.value);
cf_obj.style.border= "1px solid #7F9DB9";
}else{
//alert("setv too small "+valueObj.value+" > "+cf_obj.value);
cf_obj.style.border= "1px solid red"
}
}
function setcc(obj, previousBankedAmount){
obj.value = (Number(obj.value)).toFixed(2);
sumCash(previousBankedAmount);
}
function set_zreport(obj){
var zreportValue = (Number(obj.value)).toFixed(2);
//Need to show balance total - zreport
var totalObj = document.getElementById("total");
document.getElementById("balanceValue").value = (Number(totalObj.innerHTML) - zreportValue).toFixed(2);
document.getElementById("balance").innerHTML = (Number(totalObj.innerHTML) - zreportValue).toFixed(2);
}
/*function addCashVoucher(tillID, date, outputDiv){
var cash_voucherID = document.getElementById("cash_voucherID");
var cash_voucher_value = document.getElementById("cash_voucher_value");
callBrandFunction4("addCashVoucher", tillID, date, cash_voucherID.value, cash_voucher_value.value, outputDiv, "");
}*/
function addCashVoucher(tillID, date, outputDiv){
var cash_vouchersHidden = document.getElementById("cash_vouchersHidden");
var cash_voucherID = document.getElementById("cash_voucherID");
if(cash_voucherID.value == 0)
return;
var cash_voucher_value = document.getElementById("cash_voucher_value");
if(cash_voucher_value.value.indexOf("-") == -1)
cash_voucher_value.value = "-"+cash_voucher_value.value;
if(cash_vouchersHidden.value != "")
cash_vouchersHidden.value += "¬0"
cash_vouchersHidden.value += cash_voucherID.value+"¬1"+cash_voucher_value.value;
renderCashVoucherList(cash_vouchersHidden.value, outputDiv);
//need to also clear controls ready for next selection
cash_voucherID.value = "";
cash_voucher_value.value = "";
}
function renderCashVoucherList(strList, outputDiv){
var indexArrayObj = document.getElementById("cash_voucherID");
var voucher_total = 0;
var outputStr = "";
var actionImage = "./images/delete.png"
var strListArray = strList.split("¬0");
for (var i = 0; i < strListArray.length; i++){
console.log("* "+strListArray[i]);
if(strListArray[i] != ""){
var strArray = strListArray[i].split("¬1");
voucher_total = voucher_total + (strArray[1])*1;
outputStr = outputStr + "";
outputStr = outputStr+ indexArrayObj.options[strArray[0]].text+": "+parseFloat(strArray[1]).toFixed(2);
outputStr = outputStr + "
";
outputStr = outputStr + "
";
}
}
//alert(outputStr);
document.getElementById(outputDiv).innerHTML = outputStr;
document.getElementById("total_cash_vouchers").value = voucher_total;
sumCash("");
}
//looks to remove value from
// cash_voucher_total
// cash_vouchers
// cashVouchers display list
function removeFromCashVoucher(del_value, outputDiv){
//get cash_voucher object
var cash_voucherObj = document.getElementById("cash_vouchersHidden");
var strListArray = cash_voucherObj.value.split("¬0");
var reworkededList = "";
for (var i = 0; i < strListArray.length; i++){
console.log(i+": "+strListArray[i]);
if(del_value != i){
if(reworkededList != "")
reworkededList += "¬0";
reworkededList += strListArray[i]
}
}
cash_voucherObj.value = reworkededList;
renderCashVoucherList(cash_voucherObj.value, outputDiv);
}
function sumCash(previousBankedAmount){
console.log("Entering sumCash "+previousBankedAmount);
if(previousBankedAmount == ""){
var previousBankedAmountObj = document.getElementById("previousBankedAmount");
if(previousBankedAmountObj != null)
previousBankedAmount = previousBankedAmountObj.value;
else
alert("**Unable to find previousBankedAmount");
console.log("previousBankedAmount: "+previousBankedAmount);
if(previousBankedAmount == "")
previousBankedAmount = 0;
}
var total = 0;
var temp = 0;
if(document.getElementById("creditCard").value != "")
total += Number(document.getElementById("creditCard").value);
if(document.getElementById("v5000").value != "")
total += Number(document.getElementById("v5000").value);
if(document.getElementById("v2000").value != ""){
console.log("Looking to add 20s to total:"+total);
total += Number(document.getElementById("v2000").value);
console.log("Added "+document.getElementById("v2000").value+" to get "+total);
}
if(document.getElementById("v1000").value != "")
total += Number(document.getElementById("v1000").value);
if(document.getElementById("v500").value != "")
total += Number(document.getElementById("v500").value);
if(document.getElementById("v200").value != "")
total += Number(document.getElementById("v200").value);
if(document.getElementById("v100").value != "")
total += Number(document.getElementById("v100").value);
if(document.getElementById("v50").value != "")
total += Number(document.getElementById("v50").value);
if(document.getElementById("v20").value != "")
total += Number(document.getElementById("v20").value);
if(document.getElementById("v10").value != "")
total += Number(document.getElementById("v10").value);
if(document.getElementById("v5").value != "")
total += Number(document.getElementById("v5").value);
if(document.getElementById("v2").value != "")
total += Number(document.getElementById("v2").value);
if(document.getElementById("v1").value != "")
total += Number(document.getElementById("v1").value);
console.log("total:"+total);
var total_cash_vouchers = document.getElementById("total_cash_vouchers");
if(total_cash_vouchers.value != "" ){
console.log("Add cash voucher of "+total_cash_vouchers.value);
total += Number(total_cash_vouchers.value);
}
//not sure about this but need to also add banked cash vouchers
var banked_cash_vouchers = document.getElementById("banked_cash_vouchers");
if(banked_cash_vouchers.value != "" ){
console.log("Add banked cash voucher of "+banked_cash_vouchers.value);
total += Number(banked_cash_vouchers.value);
}
console.log("total:"+total);
document.getElementById("total").innerHTML = total.toFixed(2);
document.getElementById("totalValue").value = total.toFixed(2);
//also need to update banked
var cf_float = document.getElementById("cf_totalValue").value;
//var previousBankedAmount = document.getElementById("previousBanked").value;
document.getElementById("bank").innerHTML = (total.toFixed(2) - cf_float - previousBankedAmount).toFixed(2);
document.getElementById("bankedValue").value = (total.toFixed(2) - cf_float- previousBankedAmount).toFixed(2);
console.log(total);
console.log(cf_float);
console.log(previousBankedAmount);
zReportObj = document.getElementById("zreport");
if(zReportObj.value != "")
set_zreport(zReportObj);
manual_countObj = document.getElementById("manual_count");
if(manual_countObj.value != ""){
document.getElementById("manual_count_variance").innerHTML = (Number(total) - manual_countObj.value).toFixed(2);
}
}
function set_cfv(obj, previousBankedAmount){
var c_float = 0;
if(document.getElementById("cf5000").value != "")
c_float += Number(document.getElementById("cf5000").value) * 50;
if(document.getElementById("cf2000").value != "")
c_float += Number(document.getElementById("cf2000").value) * 20;
if(document.getElementById("cf1000").value != "")
c_float += Number(document.getElementById("cf1000").value) * 10;
if(document.getElementById("cf500").value != "")
c_float += Number(document.getElementById("cf500").value) * 5;
if(document.getElementById("cf200").value != "")
c_float += Number(document.getElementById("cf200").value) * 2;
if(document.getElementById("cf100").value != "")
c_float += Number(document.getElementById("cf100").value) * 1;
if(document.getElementById("cf50").value != "")
c_float += Number(document.getElementById("cf50").value) * 0.5;
if(document.getElementById("cf20").value != "")
c_float += Number(document.getElementById("cf20").value) * 0.2;
if(document.getElementById("cf10").value != "")
c_float += Number(document.getElementById("cf10").value) * 0.1;
if(document.getElementById("cf5").value != "")
c_float += Number(document.getElementById("cf5").value) * 0.05;
if(document.getElementById("cf2").value != "")
c_float += Number(document.getElementById("cf2").value) * 0.02;
if(document.getElementById("cf1").value != "")
c_float += Number(document.getElementById("cf1").value) * 0.01;
document.getElementById("cf_total").innerHTML = c_float.toFixed(2);
document.getElementById("cf_totalValue").value = c_float.toFixed(2);
var totalObj = document.getElementById("total");
document.getElementById("bank").innerHTML = (Number(totalObj.innerHTML) - c_float - previousBankedAmount).toFixed(2);
document.getElementById("bankedValue").value = (Number(totalObj.innerHTML) - c_float - previousBankedAmount).toFixed(2);
//Need to check if float is still valid
var cashNumber = obj.name.slice(2); //remove cf and you will have the number
//alert("Looking for c"+cashNumber);
var valueObj = document.getElementById("c"+cashNumber);
if(Number(valueObj.value) >= Number(obj.value)){
//alert("setv OK "+valueObj.value+" > "+obj.value);
obj.style.border= "1px solid #7F9DB9";
}else{
//alert("setv too small "+valueObj.value+" > "+obj.value);
obj.style.border= "1px solid red"
}
//alert("setv "+cashNumber);
}
function cashUpButtonVis(){
//document.getElementById("cashUPReload").style.display = "block";
checkForSavedTillData();
return false;
}
function checkForSavedTillData(){
var dateObj = document.getElementById("date");
var tillObj = document.getElementById("tillID")
window.location.assign("./index.php?cashUPDate="+dateObj.value+"&cashUpTillID="+tillObj.value);
}
function mirrorFloat(){
document.getElementById("c5000").value = document.getElementById("cf5000").value;
document.getElementById("v5000").value = document.getElementById("c5000").value * 50;
document.getElementById("c2000").value = document.getElementById("cf2000").value;
document.getElementById("v2000").value = document.getElementById("c2000").value * 20;
document.getElementById("c1000").value = document.getElementById("cf1000").value;
document.getElementById("v1000").value = document.getElementById("c1000").value * 10;
document.getElementById("c500").value = document.getElementById("cf500").value;
document.getElementById("v500").value = document.getElementById("c500").value * 5;
document.getElementById("c200").value = document.getElementById("cf200").value;
document.getElementById("v200").value = document.getElementById("c200").value * 2;
document.getElementById("c100").value = document.getElementById("cf100").value;
document.getElementById("v100").value = document.getElementById("c100").value * 1;
document.getElementById("c50").value = document.getElementById("cf50").value;
document.getElementById("v50").value = document.getElementById("c50").value * 0.5;
document.getElementById("c20").value = document.getElementById("cf20").value;
document.getElementById("v20").value = document.getElementById("c20").value * 0.2;
document.getElementById("c10").value = document.getElementById("cf10").value;
document.getElementById("v10").value = document.getElementById("c10").value * 0.1;
document.getElementById("c5").value = document.getElementById("cf5").value;
document.getElementById("v5").value = document.getElementById("c5").value * 0.05;
document.getElementById("c2").value = document.getElementById("cf2").value;
document.getElementById("v2").value = document.getElementById("c2").value * 0.02;
document.getElementById("c1").value = document.getElementById("cf1").value;
document.getElementById("v1").value = document.getElementById("c1").value * 0.01;
sumCash("");
}
function timesheetButtonVis(){
document.getElementById("timeSheetReloadID").style.display = "block";
return false;
}
function set_manual_count(obj){
var manual_countValue = (Number(obj.value)).toFixed(2);
//Need to show balance total - zreport
var totalObj = document.getElementById("total");
document.getElementById("manual_count_variance").innerHTML = (Number(totalObj.innerHTML) - manual_countValue).toFixed(2);
}
function addHostessSalesProduct(salesID, outputDiv){
var quantityObj = document.getElementById("quantity");
if(quantityObj == null){
alert("Could not find quantity Object");
return;
}
var productObj = document.getElementById("productID");
if(productObj == null){
alert("Could not find product Object");
return;
}
callBrandFunction4a("./ajax_vm.php", "addHostessSalesProduct", salesID, productObj.value, quantityObj.value, outputDiv, outputDiv);
quantityObj.value = "";
productObj.value = "";
}
function showOther(value, id_name){
var showObj = document.getElementById(id_name);
if(showObj != null)
{
if(value == "999999"){
alert(value);
showObj.style.display = "block";
}else{
showObj.style.display = "none";
}
}
}
function updateAlertStatus(alertID, alert_trigger_date, load_timescale, updateDiv){
var notes = "";
var statusObj = document.getElementById("alert_status_"+alertID);
if(statusObj == null){
alert("Unable to find screen status Obj alert_status_"+alertID);
return;
}
else
status = statusObj.value;
//alert(status);
var notesObj = document.getElementById("notes_"+alertID);
if(notesObj == null){
alert("Unable to find screen notes Obj notes_"+alertID);
return;
}
else
notes = notesObj.value;
var timescale = "";
var timescaleObj = document.getElementById("timescale_"+alertID);
if(timescaleObj != null){
timescale = timescaleObj.value;
}else{
alert("Unable to find screen notes Obj timescale_"+alertID);
return;
}
//if(timescale == "")
callBrandFunction6('setAlertStatus', alertID, status, notes, alert_trigger_date, timescale, load_timescale, updateDiv, "");
//else
// callBrandFunction5('setAlertStatus', alertID, status, notes, alert_trigger_date, timescale, "", "1");
}
function toggleVisibility(objName){
var obj = document.getElementById(objName);
if(obj != null){ //hide last help item
if(obj.style.display == "none")
obj.style.display = "block";
else
obj.style.display = "none";
}
}
function showAlertLink(buttonObj, alertID, link_type, link, title, description, companyID, trigger_date, followupSurveyIDS){
var alertLinkRow = document.getElementById("alertlink_"+alertID);
//need to show the appropriate row
//need too hide show link button and hide hide link button
if(buttonObj.value == "Show Link"){
alertLinkRow.style.display = "table-row";
buttonObj.value = "Hide Link";
callBrandFunction8("showAlertLink", alertID, link_type, link, title, description, companyID, trigger_date, followupSurveyIDS, "alertlinkDIV_"+alertID);
}else{
alertLinkRow.style.display = "none";
buttonObj.value = "Show Link";
callBrandFunction1("setSESSION_value", "dashBoardLink", "");
}
}
function clearDIV(divID){
var divToClear = document.getElementById(divID);
if(divToClear != null)
divToClear.innerHTML = "";
}
function executeQuestionAction(answer, actions, submission_time){
submission_time = typeof submission_time !== 'undefined' ? submission_time : '';
answer = answer.trim();
var actionArray = actions.split(";");
var arrayLength = actionArray.length;
for (var i = 0; i < arrayLength; i++) {
var anyAnswer = false;
var actionParameters = actionArray[i].split(":");
actionParameters[0] = actionParameters[0].trim();
if(actionParameters[0] != ""){
if(actionParameters[0].indexOf('$answer') != -1){
//console.log("Action Parameter: "+actionParameters[0]);
actionParameters[0] = actionParameters[0].replace("$answer", answer);
}else{
if(actionParameters[0] == "*")
anyAnswer = true;
actionParameters[0] = "'"+answer+"' == '"+actionParameters[0]+"'";
}
console.log("Look at "+actionParameters[0]);
if(eval(actionParameters[0]) || anyAnswer){
//if(answer == actionParameters[0]){
for (var e = 1; e < actionParameters.length; e++){
console.log(actionParameters[e]);
if(actionParameters[e].indexOf("show")!= -1){
actionParameters[e] =actionParameters[e].replace("show(","");
actionParameters[e] =actionParameters[e].replace(")","");
show(actionParameters[e]);
}else if(actionParameters[e].indexOf("hide") != -1){
actionParameters[e] =actionParameters[e].replace("hide(","");
actionParameters[e] =actionParameters[e].replace(")","");
hide(actionParameters[e]);
}else if(actionParameters[e].indexOf("calculate") != -1){
actionParameters[e] =actionParameters[e].replace("calculate(","");
actionParameters[e] =actionParameters[e].replace(")","");
calculate(actionParameters[e], submission_time);
}
}
}
}
}
}
function showHideObj(id, checkbox){
var obj = document.getElementById(id);
if(obj != null){
if(obj.style.display == "none")
obj.style.display = "block";
else
obj.style.display = "none";
}
//else alert("Unable to fine "+id);
}
function showObj(id){
var obj = document.getElementById(id);
if(obj != null){
obj.style.display = "block";
}
//else alert("Unable to fine "+id);
}
function hideObj(id){
var obj = document.getElementById(id);
if(obj != null){
obj.style.display = "none";
}
//else alert("Unable to fine "+id);
}
function show(ids){
//alert("show function called with IDs "+ids);
var actionParameters = ids.split(",");
for (var e = 0; e < actionParameters.length; e++){
var obj = document.getElementById("visabilityBlock_"+actionParameters[e]);
if(obj != null){
obj.style.display = "block";
}
else alert("Unable to fine visabilityBlock_"+actionParameters[e]);
}
}
function hide(ids){
//alert("hide function called with IDs "+ids);
var actionParameters = ids.split(",");
for (var e = 0; e < actionParameters.length; e++){
var obj = document.getElementById("visabilityBlock_"+actionParameters[e]);
if(obj != null){
obj.style.display = "none";
obj.value = ""; //also need to delete value so this is not submitted to answer engine
//need to find all children and clear their value;
var elms = obj.getElementsByTagName("*");
for (var i = 0; i < elms.length; i++) {
if(elms[i].type == "checkbox" || elms[i].type == "radio")
elms[i].checked = "";
else if(typeof elms[i].type != "undefined")
elms[i].value = "";
}
//alert(" Hiding visabilityBlock_"+actionParameters[e]);
}
//else alert("Unable to fine visabilityBlock_"+actionParameters[e]);
}
}
function calculate(ids, submission_time){
//console.log(ids);
var actionParameters = ids.split(",");
head = foot = ""; //Need to account for when ids are encoded into a table
if(submission_time != ""){
head = "#EncodedID_";
foot = "_"+submission_time;
}
var resultObj = null;
var sum = "";
for (var e = 0; e < actionParameters.length; e++){
if(e == 0){
resultObj = document.getElementById(head+actionParameters[e]+foot);
if(resultObj == null)
console.log("Results obj Not found "+actionParameters[e]);
//else
//console.log("Results obj = "+actionParameters[e]);
}
else if(actionParameters[e] == "="){
;//no nothing
}else if(actionParameters[e] == "+" || actionParameters[e] == "-" || actionParameters[e] == "*" || actionParameters[e] == "/"){
sum = sum+actionParameters[e];
}
else{
var obj = document.getElementById(head+actionParameters[e]+foot);
if(obj != null){
if(obj.value != "")
sum = sum+obj.value;
else
return ""; //if any of the sum value have not benn set do not calculate
}
}
}
if(resultObj != null){
//console.log(sum);
resultObj.value = eval(sum);
}
//else
//console.log("No result obj found. "+sum);
}
function setObjValue(objID, obj_value, objID2, obj_value2){
var obj = document.getElementById(objID);
if(obj != null){
if(obj.value == "")
obj.value = obj_value;
else{
alert("Can only set "+objID+" value when it is not already set.");
return;
}
}
objID2 = typeof objID2 !== 'undefined' ? objID2 : '';
if(objID2 != ""){
var obj2 = document.getElementById(objID2);
if(obj2 != null){
//if(obj2.value == "")
obj2.value = obj_value2;
//else
// alert("Can only set "+objID2+" value when it is not already set.");
}
}
}
//disables the obj for ? seconds ~ stop double clicks
function disableFor1sec(obj, disbale_time){
obj.disabled = true;
setTimeout(
function() {
obj.disabled = false;
}, disbale_time);
}
/*function renderStingList(objid, outputDivID, action, actionImage, listObjId){
var listObj = document.getElementById(listObjId);
var id_to_text = [];
for(var t=0; t";
//console.log("Looking to render :"+strListObjArray[i]);
if(actionImage != ""){
outputDiv.innerHTML = outputDiv.innerHTML+"";
}
outputDiv.innerHTML = outputDiv.innerHTML+id_to_text[strListObjArray[i]]+"";
}
}
}
*/
function calculateCrossCheck(crossCheckAmount, safeKeyList, totalDiv, crossCheckDiv){
var safeKeyArray = safeKeyList.split(";");
var amount = 0;
for(var i=0; i 0)
crossCheckTotalObj.style.color = "green";
else
crossCheckTotalObj.style.color = "black";
}
function saveDM(dmID, errorID){
title = document.getElementById("title").value;
description = document.getElementById("description").value;
doc_security_level = document.getElementById("doc_security_level").value;
doc_status = document.getElementById("doc_status").value;
doc_owner =document.getElementById("doc_owner").value;
callBrandFunction7("saveDM", dmID, title, description, doc_security_level, doc_status, doc_owner, errorID, "", "1");
}
function streamFile(dmID, filename, version, userID, iframeID){
//iframeObj = $id(iframeID);
//iframeObj
var iframeObj = document.getElementById(iframeID);
if(iframeObj == null){
alert("iframeObj '"+iframeID+"' not found");
return;
}
//alert("setting iframe src to /filestream.php?"+filename);
iframeObj.src = "./filestream.php?filename="+filename;
if(dmID != "")
callBrandFunction4("recordDownload", dmID, filename, version, userID, "", "");
}
function toggleVisibility(objName){
var obj = document.getElementById(objName);
if(obj != null){ //hide last help item
if(obj.style.display == "none")
obj.style.display = "block";
else
obj.style.display = "none";
}
}
function toggleTableRowVisibility(objName){
var obj = document.getElementById(objName);
if(obj != null){ //hide last help item
if(obj.style.display == "none")
obj.style.display = "table-row";
else
obj.style.display = "none";
}
}
function setFormValue(field, value, set_when_empty, quiet){
quiet = typeof quiet !== 'undefined' ? quiet : '0';
var obj = document.getElementById(field);
set_when_empty = typeof set_when_empty !== 'undefined' ? set_when_empty : "false";
//alert(value);
if(obj != null){
//if(obj.value == "")
// obj.value = "0";
if( obj.value == "0" || obj.value == "" || (set_when_empty == "true")){
obj.value = value;
}else{
if(quiet == "0")
alert("Cannot set field once set");
}
}
}
/*function getOtherBookings(){
var membersIDObj = document.getElementById("add_membersID");
var membersNameObj = document.getElementById("add_name");
callBrandFunction2("getOtherBookings", );
}*/