<!--
// JavaScript Document

function refreshButton(displayDIV, moduleID, modType, strDisplayFieldName, filterValues, pageNumber, groupField, groupName, action, db, parentID, filterShow, expandedID, spare) {
	
	if (document.getElementById('sortField'+moduleID).value==strDisplayFieldName) {
		if (document.getElementById('upDown'+moduleID).value!='DESC') {
			document.getElementById('upDown'+moduleID).value='DESC';
		} else {
			document.getElementById('upDown'+moduleID).value='ASC';
		}
	} else {
		if (strDisplayFieldName != '') {
			document.getElementById('sortField'+moduleID).value=strDisplayFieldName;
			document.getElementById('upDown'+moduleID).value='ASC';
		} else {
			strDisplayFieldName = document.getElementById('sortField'+moduleID).value;

		}
	}
	if (document.getElementById('upDown'+moduleID).value=='ASC') {
		getRefreshedList(displayDIV, moduleID, modType, 'ASC', strDisplayFieldName, filterValues, expandedID, '', pageNumber, groupField, groupName, action, db, parentID, filterShow, spare);
	} else {
		getRefreshedList(displayDIV, moduleID, modType, 'DESC', strDisplayFieldName, filterValues, expandedID, '', pageNumber, groupField, groupName, action, db, parentID, filterShow, spare);
	}


}


function refreshInnerButton(moduleID, strDisplayFieldName, childDisplayID, expandedID, db, parentID, action) {
	

	if (document.getElementById('innersortField'+moduleID).value==strDisplayFieldName) {
		if (document.getElementById('innerupDown'+moduleID).value!='DESC') {
			document.getElementById('innerupDown'+moduleID).value='DESC';
		} else {
			document.getElementById('innerupDown'+moduleID).value='ASC';
		}
	} else {
		document.getElementById('innersortField'+moduleID).value=strDisplayFieldName;
		document.getElementById('innerupDown'+moduleID).value='ASC';
	}
	if (document.getElementById('innerupDown'+moduleID).value=='ASC') {
		getRefreshedList(childDisplayID+'inner', moduleID, 'InnerList', 'ASC', strDisplayFieldName, '', expandedID, childDisplayID,'','','',action, db, parentID,'','');
	} else {
		getRefreshedList(childDisplayID+'inner', moduleID, 'InnerList', 'DESC', strDisplayFieldName, '', expandedID, childDisplayID,'','','',action, db, parentID,'','');
	}

}


function refreshListPage(moduleID, modType, strDisplayFieldName, filterValues, db, parentID, filterShow) {
	
	if (document.getElementById('upDown'+moduleID).value=='ASC') {
		getRefreshedList('full', moduleID, modType, 'ASC', strDisplayFieldName, filterValues, '', '','1','','','', db, parentID, filterShow,'');
	} else {
		getRefreshedList('full', moduleID, modType, 'DESC', strDisplayFieldName, filterValues, '', '','1','','','', db, parentID, filterShow,'');
	}


}


function createxmlhttp()
{
    xmlhttpobj = false;
    try{//Create an object, have to try one by one because there is no standart for browers made by different companies.
        xmlhttpobj = new XMLHttpRequest();
    }catch(e){
        try{
            xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
        }catch(e2){
            try{
                xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e3){
                xmlhttpobj = false;
            }
        }
    }

    return xmlhttpobj; 
}



function showInnerList(myDisplayDIV, currentRecord, childDisplayID, expandedID, db, parentID, action) {
	
		getRefreshedList(myDisplayDIV, expandedID, 'list1', 'ASC', '', '', expandedID, childDisplayID,'','','',action, db, parentID, '', '');

}

function clickExpand(myDisplayDIV, currentRecord, childDisplayID, expandedID, db, parentID, action) {
	

	if (currentRecord!='') {
		var curRecord = document.getElementById(currentRecord);
		
		if(Right(curRecord.src,11)=='icoPlus.gif') {
			getRefreshedList(myDisplayDIV, expandedID, 'InnerList', '', '', '', expandedID, childDisplayID,'','','','', db, parentID, '', '');
			curRecord.src='images/icoMinus.gif';
		} else {
			getRefreshedList(myDisplayDIV, expandedID, 'blank', 'ASC', '', '', expandedID, childDisplayID,'','','','', db, parentID, '', '');
			curRecord.src='images/icoPlus.gif';
		} 
	} else {
		getRefreshedList(myDisplayDIV, expandedID, 'innerlist', 'ASC', '', '', expandedID, childDisplayID,'','','',action, db, parentID, '', '');
	}
}


function getRefreshedList(myDisplayDIV, myModuleID, myPage, myUpDown, mySortField, myFilterValues, myExpandedID, myChildDisplayID, myPageNumber, myGroupField, myGroupValue, myAction, myDB, myParentID, myFilterShow, mySpare)
{
	var xmlhttpobj = createxmlhttp();
	var divName;

	//alert("in refresh");
	
	if (Right(myDisplayDIV,5) == 'inner') {
		divName = myDisplayDIV+'Display'+myExpandedID; 
	} else {
		divName = myDisplayDIV+'Display'+myModuleID; 	
	}
	

	if (xmlhttpobj)
	{
		
		//alert(myPage+".asp?displayDIV="+myDisplayDIV+"&moduleID="+myModuleID+"&modtype="+myPage+"&upDown="+myUpDown+"&sortField="+mySortField+"&filterValues="+myFilterValues+"&expandedID="+myExpandedID+"&childDisplayID="+myChildDisplayID+"&pageNumber="+myPageNumber+"&groupField="+myGroupField+"&groupValue="+myGroupValue+"&action="+myAction+"&db="+myDB+"&parentID="+myParentID+"&filterShow="+myFilterShow+"&spare="+mySpare+"&number="+Math.random());
		
		xmlhttpobj.open("get",myPage+".aspx?displayDIV="+myDisplayDIV+"&moduleID="+myModuleID+"&modtype="+myPage+"&upDown="+myUpDown+"&sortField="+mySortField+"&filterValues="+myFilterValues+"&expandedID="+myExpandedID+"&childDisplayID="+myChildDisplayID+"&pageNumber="+myPageNumber+"&groupField="+myGroupField+"&groupValue="+myGroupValue+"&action="+myAction+"&db="+myDB+"&parentID="+myParentID+"&filterShow="+myFilterShow+"&spare="+mySpare+"&number="+Math.random(),true); //get method, add a random para for IE bug fix - so it thinks it's a new request - otherwise, it does nothing on 2nd time through
		xmlhttpobj.send(null);
		
		xmlhttpobj.onreadystatechange=function()
		{  
				
			if (xmlhttpobj.readyState==4)
			{
			
			//alert(xmlhttpobj.status);
			//alert(xmlhttpobj.responseText);

			if (xmlhttpobj.status==200)
				{
					var html = xmlhttpobj.responseText;
					if (myAction=='print') {
						window.open('PDFs/report'+mySpare+'.pdf');
					} else if (myAction=='export') {
						window.open('PDFs/report'+mySpare+'.csv');
					} else if (myAction=='sendPDF') {
						window.open('http://www.pigpass.com.au/cms/sendreport.asp?pdf=http://www.pigpass.com.au/cms/PDFs/report'+myModuleID+'.pdf','sendpdf','width=450,height=480,copyhistory=no,menubar=no,status=no,location=no,toolbars=no,scrollbars=no,resizable=no');
					}
					document.getElementById(divName).innerHTML=html;
				}
				else
				{
					document.getElementById(divName).innerHTML="No data to display.";
				}
				
					
			}
			else
			{
				document.getElementById(divName).innerHTML="Processing. Please wait ...";//server is processing
			}
		}
	}
}
-->
