
/* Collection of javascript functions for dynamic .js behaviour on www.webfusion.co.uk 
Unless stated (c)2005 PIPEX - author TJS  */


/* ***************************************************************************** */


/* function used to clean whiteSpace in the DOM tree - 02/10/2005 TJS
This fixes Moz behaviour which adds text nodes in html white-space */
var notWhitespace = /\S/
function cleanWhitespace(node) {
	for (var x = 0; x < node.childNodes.length; x++) {
		var childNode = node.childNodes[x]
		if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {
			// that is, if it's a whitespace text node
			node.removeChild(node.childNodes[x])
			x--
		}
		if (childNode.nodeType == 1) {
			// elements can have text child nodes of their own
			cleanWhitespace(childNode)
		}
	}
} 


/* function used to pop elastic windows - 23/09/05 TJS SW */
// pop-up function
var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}
function popUp(strURL,strType,strHeight,strWidth) {
closeWin();
var strOptions="";
var dateNow = new Date();
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="scrollbars,resizable,height="+strHeight+",width="+strWidth;
newWin = window.open(strURL, 'newWin' + dateNow.getTime(), strOptions);
newWin.focus();
}





/* function used to toggle expand drop-down tables - Oct 2005 TJS */
function getEl(id) { return document.getElementById(id); }

function showhide(id,widget) { getEl(id).style.display =  getEl(id).style.display == 'none' ? '' : 'none';  // show-hide the table
getEl(widget).className = getEl(widget).className == 'widget' ? 'widget2' : 'widget'; // swap the button class 
}



/* function used to show / hide input box value on focus / blur - 15/11/05 TJS */
function clearbox(box,defaulttxt) {
	if (box.value == defaulttxt) {
		box.value = '';
	} 
} 

function unclearbox(box,defaulttxt) {
	if (box.value == '') {
		box.value = defaulttxt; 
	} 
}
















// PVII SwapClass function - toggle expands left nav

<!--  //toggles menu open and or closed.
function P7_swapClass(){ // by PVII
 var i,x,tB,j=0,tA=new Array(),arg=P7_swapClass.arguments;
 if(document.getElementsByTagName){
  for(i=4;i<arg.length;i++){tB=document.getElementsByTagName(arg[i]); 
  for(x=0;x<tB.length;x++){tA[j]=tB[x];j++;}}for(i=0;i<tA.length;i++){
  if(tA[i].className){if(tA[i].id==arg[1]){if(arg[0]==1){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}else{tA[i].className=arg[2];}
  }else if(arg[0]==1 && arg[1]=='none'){if(tA[i].className==arg[2] || tA[i].className==arg[3]){
  tA[i].className=(tA[i].className==arg[3])?arg[2]:arg[3];}
  }else if(tA[i].className==arg[2]){tA[i].className=arg[3];}}}}
}
function P7_writeStyles(op,a){ // adapted from PVII by TS
if(op==0||document.getElementById){var tS="<sty"+"le type=\"text/css\">";
tS+=a+"<"+"/sty"+"le>";document.write(tS);document.close();}
}
P7_writeStyles(1,'.closed ul{ display:none;}.open ul{ display:block;}');
P7_writeStyles(1,'.closed2 ul{ display:none;}.open2 ul{ display:block;}');
//-->
