
function diosPopUpDefs(){url="/dios/help/definitions.php";hdl=window.open(url,'defs','width=500,height=600,scrollbars=yes,resizable=yes');hdl.focus();}
function diosPopUpHelp(){url="/dios/help/";hdl=window.open(url,'help','width=850,height=550,scrollbars=yes,resizable=yes,toolbar=yes');hdl.focus();}
function diosGo(dst){result=true;if((arguments.length>1)&&(arguments[1]=='delete')){result=confirm('Are you sure you want to permanantly delete this user?');}
if((arguments.length>1)&&(arguments[1]=='deleteDiv')){result=confirm('Are you sure you want to permanantly delete this division?');}
if(result){document.diosAdmin.pageDst.value=dst;if(arguments.length>1){document.diosAdmin.action.value=arguments[1];if(arguments.length>2){document.diosAdmin.params.value=arguments[2];}}
document.diosAdmin.submit();}}
function showHide(_id){if((obj=document.getElementById(_id))){if(typeof(obj.style.display)=='string'){if(obj.style.display=='none'){obj.style.display='inline';}else{obj.style.display='none';}}}}
function setTickCross(val,imgName){if(val){document.images[imgName].src='/dios/images/tick.gif';}else{document.images[imgName].src='/dios/images/cross.gif';}}
function validateNotEmpty(val,imgName){if(val==''){result=false;}else{result=true;}
setTickCross(result,imgName);return result;}
function validateEmail(val,imgName){re=/^[^\s\@]+\@[^\s\@]+\.[^\s\@]+$/;result=re.test(val);setTickCross(result,imgName);return result;}
function validatePwd(val,imgName){str=new String(val);if(str.length<6){result=false;}else{result=true;}
setTickCross(result,imgName);return result;}
function validateSame(val1,val2,imgName){if(val1==val2){result=true;}else{result=false;}
setTickCross(result,imgName);return result;}
function validateState(val,imgName,NotSet){if(val==NotSet){result=false;}else{result=true;}
setTickCross(result,imgName);return result;}
function pleaseSubmit(){document.getElementById('survey_finished_text').style.display='inline';return;}
function diosPopUpPrint(frm){for(i=0;i<document.diosPrintStyle.print_style.length;i++){if(document.diosPrintStyle.print_style[i].checked){frm.style.value=document.diosPrintStyle.print_style[i].value;}}
if(frm.style.value!="rtf"){var w=window.open('about:blank','Popup_Window','width=920,height=550,scrollbars=yes,menubar=yes,resizable=yes');frm.target='Popup_Window';if(window.focus){w.focus()}}
else{frm.target='';}
return true;}
function diosPopUpPrintPreview(frm){if(frm.style.value=="web"){var w=window.open('about:blank','Popup_Window','width=920,height=550,scrollbars=yes,menubar=yes,resizable=yes');frm.target='Popup_Window';if(window.focus){w.focus()}}
else{frm.target='';}
return true;}
function autoSuggestCode(control,codeName){frm=control.form;code="";arrayOfStrings=control.value.split(" ");for(var i=0;i<arrayOfStrings.length;i++){code=code+arrayOfStrings[i].charAt(0);}
for(var a=0;a<frm.length;a++){if(frm.elements[a].name==codeName){frm.elements[a].value=code.toUpperCase();break;}}
return;}
function displayCustPrintOpt(){document.getElementById('customisePrintPlan').style.display='inline';document.getElementById('CustPrintOptionLink').style.display='none';}
function hideCustPrintOpt(){document.getElementById('customisePrintPlan').style.display='none';document.getElementById('CustPrintOptionLink').style.display='inline';}
function displayCustSAOpt(){document.getElementById('customisePrintSA').style.display='inline';document.getElementById('CustSAOptLink').style.display='none';}
function hideCustSAOpt(){document.getElementById('customisePrintSA').style.display='none';document.getElementById('CustSAOptLink').style.display='inline';}
function displayPrintLandscape(){alert('This document is best printed on a LANDSCAPE page.\n\nSelect the "File" menu and "Page Setup" to select LANDSCAPE. Then select "File" and "Print".\n\nClick OK to continue...');return;}
function displayPrintPortrait(){alert('This document is best printed on a PORTRAIT page.\n\nSelect the "File" menu and "Page Setup" to select PORTRAIT (if necessary). Then select "File" and "Print".\n\nClick OK to continue...');return;}
function displayOutputFormatInfo(){document.getElementById('OutputFormatInfo').style.display='inline';document.getElementById('OutputFormatInfoLink').style.display='none';}
function hideOutputFormatInfo(){document.getElementById('OutputFormatInfo').style.display='none';document.getElementById('OutputFormatInfoLink').style.display='inline';}
function getComponentStatusPR(){flagPRDone=0;flagPR2Done=0;divProgress='';divCompleted='';divArchived='';headerProgress='<div class="statusTable"><p><nomarkup><b>Current items requiring completion or action:</b></nomarkup></p><table class="startlist">';headerCompleted='<div class="statusTable"><p><nomarkup><b>Recently submitted or approved items:</b></nomarkup></p><table class="startlist">';headerArchived='<div class="statusTable"><p class="cursor-link" onclick="toggle(\'archivedItemsList\', \'/dios/images/menu/expand\')"><nomarkup><img id="archivedItemsListButton" class="cursor-link" alt="[+]" src="/dios/images/menu/expandDown.gif"/>&nbsp;<b>Archived items:</b> (click to toggle)</nomarkup></p><table id="archivedItemsList" class="startlist" style="display: none;">';footerProgress='</table></div>';footerCompleted='</table></div>';footerArchived='</table></div>';$('#reload-link').html('<a id="reload-button" href="/dios/admin.php">Start Performing Tasks as New Organisation</a>');$('#reload-button').button();strRequest='/dios/ajaxGetItemStatus.php';sendRequest(strRequest,getComponentStatusPR_Callback);}
function getComponentStatusPR_Callback(req){var statusInProgress='';var statusCompleted='';var statusArchived='';s=req.responseText;flagPRDone=1;var arrResults=s.split('$$$$$');for(i=0;i<arrResults.length;i++){var ss=arrResults[i];if(ss.length>1){switch(i){case 0:statusInProgress=(ss.substring(1));break;case 1:statusCompleted=(ss.substring(1));break;case 2:statusArchived=(ss.substring(1));break;}}}
getObj('inProgressItems');if(flagPR2Done){divProgress=(headerProgress+divProgress+statusInProgress+footerProgress);}else{divProgress=(statusInProgress);}
getObj('completedItems');if(flagPR2Done){divCompleted=(headerCompleted+divProgress+divCompleted+footerCompleted);}else{divCompleted=(statusCompleted);}
getObj('archivedItems');if(flagPR2Done){divArchived=(headerArchived+divArchived+statusArchived+footerArchived);}else{divArchived=(statusArchived);}
getComponentStatusPR2();}
function getComponentStatusPR2(){strRequest='/dios/ajaxGetItemStatus2.php';sendRequest(strRequest,getComponentStatusPR2_Callback);}
function getComponentStatusPR2_Callback(req){var statusInProgress='';var statusCompleted='';var statusArchived='';s=req.responseText;flagPR2Done=1;var arrResults=s.split('$$$$$');for(i=0;i<arrResults.length;i++){var ss=arrResults[i];if(ss.length>1){switch(i){case 0:statusInProgress=(ss.substring(1));break;case 1:statusCompleted=(ss.substring(1));break;case 2:statusArchived=(ss.substring(1));break;}}}
if(flagPRDone){divProgress=(headerProgress+statusInProgress+divProgress+footerProgress);}else{divProgress=(statusInProgress);}
if(flagPRDone){divCompleted=(headerCompleted+statusCompleted+divCompleted+footerCompleted);}else{divCompleted=(statusCompleted);}
if(flagPRDone){divArchived=(headerArchived+statusArchived+divArchived+footerArchived);}else{divProgress=(statusArchived);}
getObj('inProgressItems');obj.innerHTML=divProgress;getObj('completedItems');obj.innerHTML=divCompleted;getObj('archivedItems');obj.innerHTML=divArchived;}
function addLoadHandler(handler)
{if(window.addEventListener)
{window.addEventListener("load",handler,false);}
else if(window.attachEvent)
{window.attachEvent("onload",handler);}
else if(window.onload)
{var oldHandler=window.onload;window.onload=function piggyback()
{oldHandler();handler();};}
else
{window.onload=handler;}}
function addUnloadHandler(handler)
{if(window.addEventListener)
{window.addEventListener("unload",handler,false);}
else if(window.attachEvent)
{window.attachEvent("onunload",handler);}
else if(window.onunload)
{var oldHandler=window.onunload;window.onunload=function piggyback()
{oldHandler();handler();};}
else
{window.onunload=handler;}}
function getElementsByTagNames(list,obj){if(!obj)obj=document;var tagNames=list.split(',');var resultArray=new Array();for(var i=0;i<tagNames.length;i++){var tags=obj.getElementsByTagName(tagNames[i]);for(var j=0;j<tags.length;j++){resultArray.push(tags[j]);}}
var testNode=resultArray[0];if(!testNode)return[];if(testNode.sourceIndex){resultArray.sort(function(a,b){return a.sourceIndex-b.sourceIndex;});}
else if(testNode.compareDocumentPosition){resultArray.sort(function(a,b){return 3-(a.compareDocumentPosition(b)&6);});}
return resultArray;}
function toggle(strId,imgUrl,strState){var imgUp='';var imgDown='';var objId=document.getElementById(strId);if(!imgUrl){imgUp='/dios/images/arrowUp.gif';imgDown='/dios/images/arrowDown.gif';}else{imgUp=imgUrl+'Up.gif';imgDown=imgUrl+'Down.gif';}
if(!objId)return false;objButton=document.getElementById(strId+'Button');if(strState===undefined){if($('#'+strId).is(':hidden')){$('#'+strId).slideDown('fast');if(objButton){objButton.src=imgUp;}}else{$('#'+strId).slideUp('fast');if(objButton){objButton.src=imgDown;}}}else{if(strState=='show'){$('#'+strId).slideDown('fast');if(objButton){objButton.src=imgUp;}}else{$('#'+strId).slideUp('fast');if(objButton){objButton.src=imgDown;}}}
return false;}
function toggleShow(strId,imgUrl,strState){var imgUp='';var imgDown='';var objId=document.getElementById(strId);if(!imgUrl){imgUp='/dios/images/arrowUp.gif';imgDown='/dios/images/arrowDown.gif';}else{imgUp=imgUrl+'Up.gif';imgDown=imgUrl+'Down.gif';}
if(!objId)return false;objButton=document.getElementById(strId+'Button');if(strState===undefined){if($('#'+strId).is(':hidden')){$('#'+strId).show('fast');if(objButton){objButton.src=imgUp;}}else{$('#'+strId).slideUp('fast');if(objButton){objButton.src=imgDown;}}}else{if(strState=='show'){$('#'+strId).show('fast');if(objButton){objButton.src=imgUp;}}else{$('#'+strId).slideUp('fast');if(objButton){objButton.src=imgDown;}}}
return false;}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function getElementsByClassName(oElm,strTagName,strClassName){var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);var arrReturnElements=new Array();strClassName=strClassName.replace(/\-/g,"\\-");var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");var oElement;for(var i=0;i<arrElements.length;i++){oElement=arrElements[i];if(oRegExp.test(oElement.className)){arrReturnElements.push(oElement);}}
return(arrReturnElements);}
function viewProfile(orgnum){url="/divisions/profiles/detail.php?div="+orgnum;hdl=window.open(url,'Division Profile','width=850,height=550,scrollbars=yes,resizable=yes,toolbar=yes');hdl.focus();}
