function displayArray(array) { var msg = ""; for (x in array) { msg = msg+" ["+x+"] => "+array[x]+"\r\n"; } return msg //alert(msg); } function fPopup(pk) { var popupDiv= document.getElementById("fPopup"); var popupPk= document.getElementById("pkInput"); popupDiv.style.display="block"; popupPk.value=pk; } function flyout(id,l) { if (id!=undefined) { var targetDiv= document.getElementById(id); var tLeft= targetDiv.style.left; if (tLeft == "-3000px") { targetDiv.style.left=l; } else if (tLeft == l) { targetDiv.style.left="-3000px"; } else if (tLeft == undefined) { targetDiv.style.left=l; } else { targetDiv.style.left=l; } } } function toggle(id,cN,cNshow) { if (id!=undefined) { var targetDiv= document.getElementById(id); var tClass=targetDiv.className; if (tClass==undefined) { targetDiv.className=cNshow; } else if (tClass==cNshow) { targetDiv.className=cN; } else if (tClass==cN) { targetDiv.className=cNshow; } else { targetDiv.className=cNshow; } } } function getSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } //window.alert( 'Width = ' + myWidth + ' and Height = ' + myHeight); //window.alert( 'Height = ' + myHeight ); size= new Array; size[0]= myWidth; size[1]= myHeight; return size; } function click_checkbox(e,pk) { single= (pk!==undefined) ? true : false; var inputs = e.getElementsByTagName("input"); //For forms where only one check is allowed, we remove all other checks first (including the one to be checked as added below); if (single) { var tableInputs = document.getElementById(pk).getElementsByTagName("input"); for (x in tableInputs) { if (tableInputs[x].type=="text") { tableInputs[x].value=null; } else if (tableInputs[x].type=="checkbox") { tableInputs[x].checked=false; tableInputs[x].style.backgroundColor="#fff"; tableInputs[x].style.color="#333"; if (tableInputs[x].parentNode.className=="checked") { tableInputs[x].parentNode.className=null; } } } } //Check the selected box for (x in inputs) { if (inputs[x].type=="checkbox") { if (e.style.backgroundColor=="rgb(255, 153, 51)") { inputs[x].checked=false; e.style.backgroundColor="#fff"; e.style.color="#333"; } else { inputs[x].checked=true; e.style.backgroundColor="#ff9933"; } } } } function reviewToggle(state) { if (state!=undefined && state===1) d= "block"; else if (state.type=='dblclick') d="none"; else d= "none"; opaque=document.getElementById("opaque").style.display=d; pane=document.getElementById("fixedReviewPane").style.display=d; } //-------------------AJAX--------------------------// var xmlHttp; //ajax object var listeners= []; //array function addEvent( thisE, evType, func, useCapture ) { // Updated version which captures passed events if (thisE.addEventListener) { thisE.addEventListener(evType, func, useCapture); //nb useCapture normally false; func should NOT be in quotes!!! - it's not a string return true; } else if (thisE.attachEvent) { var r = thisE.attachEvent('on' + evType, func); window.listeners[window.listeners.length] = [ thisE, evType, func ]; return r; } else { var xEventFn = thisE['on' + evType]; if (typeof thisE['on' + evType] != 'function') { thisE['on' + evType] = func; } else { thisE['on' + evType] = function(e) { xEventFu(e); func(e); }; } } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function showHide(id) { thisDiv= document.getElementById(id); if (thisDiv.style.display=="") { thisDiv.style.display="block"; } else if (thisDiv.style.display=="none") { thisDiv.style.display="block"; } else { thisDiv.style.display="none"; } } function alertMessage(msg) { document.getElementById('message').innerHTML=msg; document.getElementById('alert').style.display='block'; } function selectHex(thisE,id,hex) { thisHexInput = document.getElementById("hex"+id); thisHexInput.value=hex; thisHexView= document.getElementById("viewHex"+id); thisTableCols= thisHexView.getElementsByTagName('td'); for (x in thisTableCols) { thisTableCols[x].className==null; } thisE.className='selected'; thisHexView.style.display="none"; } function selectDate(thisE,id,d,m,y) { thisDateInput= document.getElementById("input"+id); thisDateInput.value=d+"/"+m+"/"+y; thisTableE= document.getElementById("viewCalendar"+id); thisTableCols= thisTableE.getElementsByTagName("td"); for (x in thisTableCols) { if (thisTableCols[x].className=='selected') { thisTableCols[x].className=null; } } thisE.className="selected"; thisTableE.parentNode.style.display="none"; if (typeof window['selectDateAddon'] == 'function') { selectDateAddon(id); } } function calendar(inputID,d,m,y) { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { //alert ("Browser does not support HTTP Request") return true; } if (d!=undefined && m!=undefined && y!=undefined) { window.inputID=inputID; var script= "/shared/ajax/calendar.php"; var url=script+"?inputID="+inputID+"&d="+d+"&m="+m+"&y="+y+"&rand="+Math.random(); xmlHttp.onreadystatechange=calendarDisplay; xmlHttp.open("GET",url,true); xmlHttp.send(null); } } function calendarDisplay() { if (xmlHttp.readyState==4) { divCalendar= document.getElementById("calendar"+window.inputID); divCalendar.innerHTML=xmlHttp.responseText; divCalendar.style.display="block"; } } function selectAjax(e,iRoot,iTable,iSearch,iName,iValue,iWhere) { if (iTable!=undefined && iSearch!=undefined && iName!=undefined && iValue!=undefined) { //req qstr="root="+iRoot+"&table="+iTable+"&search="+iSearch+"&name="+iName+"&value="+iValue+"&input="+e.value; //non-requ if (iWhere!=undefined && iWhere.length!="") qstr+="&where="+iWhere; var script= "/shared/ajax/selectAjax.php"; var url=script+"?"+qstr+"&rand="+Math.random(); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { //alert ("Browser does not support HTTP Request") return true; } xmlHttp.onreadystatechange=selectAjaxDisplay; xmlHttp.open("GET",url,true); xmlHttp.send(null); } } function selectAjaxDisplay() { if (xmlHttp.readyState==4) { divDisplay= document.getElementById("selectAjaxDisplay"); divDisplay.innerHTML=xmlHttp.responseText; divDisplay.style.display="block"; } } function selectAjaxClick(e,iValue) { inputs= e.parentNode.parentNode.parentNode.getElementsByTagName('input'); for (x in inputs) { if (inputs[x]!=undefined) { if (inputs[x].type!=undefined && inputs[x].type=="hidden") { inputs[x].value=iValue; } if (inputs[x].type!=undefined && inputs[x].type=="text") { inputs[x].value="You have selected "+iValue; } } } e.parentNode.style.display="none"; } function hexedit(root,table,target,col_pk,id,hex) { if (table!=undefined && target!=undefined && col_pk!=undefined && id!=undefined && hex!=undefined) { //val=document.getElementById("hex"+id).value var qstr="table="+table+"&target="+target+"&col_pk="+col_pk+"&id="+id+"&value="+hex; var url="/shared/ajax/hexedit.php?"+qstr+"&root="+root+"&rand="+Math.random(); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) return true; xmlHttp.onreadystatechange=yesnoDisplay; xmlHttp.open("GET",url,true); xmlHttp.send(null); inputElement= document.getElementById("hex"+id); inputElement.style.backgroundColor='#'+hex; inputElement.value=hex; } } function hexeditDisplay() { if (xmlHttp.readyState==4) { alertMessage(xmlHttp.responseText); } } function changeContents(id,content) { document.getElementById(id).innerHTML=unescape(content.replace('+',' ')); } function yesno(root,table,live,col_pk,pk) { if (table!=undefined && live!=undefined && col_pk!=undefined && pk!=undefined) { val=document.getElementById("select"+pk).value var qstr="table="+table+"&live="+live+"&col_pk="+col_pk+"&pk="+pk+"&value="+val; var url="/shared/ajax/yesno.php?"+qstr+"&root="+root+"&rand="+Math.random(); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) return true; xmlHttp.onreadystatechange=yesnoDisplay; xmlHttp.open("GET",url,true); xmlHttp.send(null); } } function yesnoDisplay() { if (xmlHttp.readyState==4) { alertMessage(xmlHttp.responseText); } }