// Move an item up or down in a select list

function combo_Move(oCombo, Cursor) {

	var iCurrent = oCombo.selectedIndex;
	
	if (Cursor > 0) Cursor = 1;
	else if (Cursor < 0) Cursor = -1;
		else Cursor = 0;

	if (iCurrent >= 0) {
	
		switch (Cursor) {
		
			case -1:
				if (iCurrent > 0) {
					combo_Swap(oCombo, iCurrent, iCurrent - 1);
					oCombo.selectedIndex = iCurrent - 1;
				} else alert('You cannot move the topmost item upwards');
				break;
		
			case 1:
				if (iCurrent < (oCombo.length-1)) {
					combo_Swap(oCombo, iCurrent, iCurrent + 1);
					oCombo.selectedIndex = iCurrent + 1;
				} else alert('You cannot move the bottommost item downwards');
				break;
	
		}

	} else alert('Please select an item to move ' + ((Cursor > 0) ? 'downwards' : 'upwards'));
}

// Swap two items in a select list

function combo_Swap(oCombo, iCurrentPos, iNewPos) {

	var sValue = oCombo[iNewPos].value;
	var sText = oCombo[iNewPos].text;
	oCombo[iNewPos].value = oCombo[iCurrentPos].value;
	oCombo[iNewPos].text = oCombo[iCurrentPos].text;
	oCombo[iCurrentPos].value = sValue;
	oCombo[iCurrentPos].text = sText;
}

var clickmessage='Copyright NTP. No use without permission. Contact gary@smudge.co.za'
 function disableclick(e) {
   if (document.all) {
     if (event.button==2||event.button==3) {
       if (event.srcElement.tagName=='IMG'){ alert(clickmessage); return false; }
     }
   } else if (document.layers) {
     if (e.which == 3) { alert(clickmessage); return false; }
   } else if (document.getElementById) {
     if (e.which==3&&e.target.tagName=='IMG'){ alert(clickmessage); return false; }
   }
 }

 <!--
 //disable right-click
 var message="";
 
 function clickIE() {if (document.all) {(message);return false;}}
 function clickNS(e) {if 
 (document.layers||(document.getElementById&&!document.all)) {
 if (e.which==2||e.which==3) {(message);return false;}}}
 if (document.layers) 
 {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
 else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
 // --> 

document.oncontextmenu = function () {
	return false;
};

//ajax
var xmlHttp

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 addLoadEvent(func) {   
	var oldonload = window.onload;   
	if (typeof window.onload != 'function') {   
		window.onload = func;   
	} else {   
		window.onload = function() {   
			if (oldonload) {   
				oldonload();   
			}   
			func();   
		}   
	}   
}
function toggleDiv(divid,divstoclose){
	var arr = divstoclose.split(",");
	for (i=0;i<arr.length;i++ ) {
		document.getElementById(arr[i]).style.display = 'none';
	}	
	if(document.getElementById(divid).style.display == 'none'){
		document.getElementById(divid).style.display = '';
	} else {
		document.getElementById(divid).style.display = 'none';
	}
}
