
var _name = "";
function revealByName(_name,_action) {
	var theElement = document.getElementById(_name).style;
	if (_action=="") {
			((theElement.display=="")||(theElement.display=="block")) ? 
				theElement.display = "none" : theElement.display = "block";
		} else if ((_action=="open")||(_action=="show")||(_action=="display")||(_action=="block")) {
			 theElement.display = "block" 
		} else {
			theElement.display = "none";
	}
}


/* This function is temporary for the "search_results" page in demo mode. It needs to be 
   more generic.  TODO */
var _imagename = "";
function openReveal(_group,_action) {
	
	/*First hide everthing that's open*/
	hideAll('sr',0)
	
	
	/*Then set all the images to the closed state ("+")*/
	var alltags=document.getElementsByTagName("*");
	ccollect=getElementbyClass(alltags, "ic");
	var inc=0;
	var imgSrc = "/assets/images/icons/icon_plus.gif";
	while (ccollect[inc]) {
		ccollect[inc].src=imgSrc;
		inc++;
	}
	
	/*Then open the current request*/
	var divName = "sr_"  + _group;
	//alert(divName);
	var imgName = "ic_"  + _group;
	//alert(imgName);
	var theElement = document.getElementById(divName).style;
	//var theImage = document.images[imgName];
	if (_action=="") {
			if ((theElement.display=="")||(theElement.display=="block")) { 
				theElement.display="none";
				document.images[imgName].src = "/assets/images/icons/icon_plus.gif";
			} else {
				theElement.display = "block";
				document.images[imgName].src = "/assets/images/icons/icon_minus.gif";
			}
		} else if ((_action=="open")||(_action=="show")||(_action=="display")||(_action=="block")) {
			 theElement.display = "block";
			document.images[imgName].src = "/assets/images/icons/icon_plus.gif";
		} else {
			theElement.display = "none";
			document.images[imgName].src = "/assets/images/icons/icon_minus.gif";
	}
	//alert(document.images[imgName].src);
}



function revealItem(_group,_action) {
	
	/*First hide everthing that's open*/
	hideAll('sr',0)
	
	
	/*Then set all the images to the closed state ("+")*/
	var alltags=document.getElementsByTagName("*");
	ccollect=getElementbyClass(alltags, "ic");
	var inc=0;
	var imgSrc = "/assets/images/icons/icon_plus.gif";
	while (ccollect[inc]) {
		ccollect[inc].src=imgSrc;
		inc++;
	}
	
	/*Then open the current request*/
	var divName = "sr_"  + _group;
	//alert(divName);
	var imgName = "ic_"  + _group;
	//alert(imgName);
	var theElement = document.getElementById(divName).style;
	//var theImage = document.images[imgName];
	if (_action=="") {
			if ((theElement.display=="")||(theElement.display=="block")) { 
				theElement.display="none";
				document.images[imgName].src = "/assets/images/icons/icon_plus.gif";
			} else {
				theElement.display = "block";
				document.images[imgName].src = "/assets/images/icons/icon_none.gif";
			}
		} else if ((_action=="open")||(_action=="show")||(_action=="display")||(_action=="block")) {
			 theElement.display = "block";
			document.images[imgName].src = "/assets/images/icons/icon_plus.gif";
		} else {
			theElement.display = "none";
			document.images[imgName].src = "/assets/images/icons/icon_none.gif";
	}
	document.images[imgName].title = "Click on any other Practice Area to switch view";
	//alert(document.images[imgName].src);
}

function reverseReveal(imgName) {
	document.images[imgName].src = "/assets/images/icons/icon_none.gif";
}

function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}





var bv = "User Name";
var old = "";
function checkUN(obj,_method) {
	//var un = document.getElementById("txtuserid");
	//alert(obj.name);
	if (obj.value!=bv) { 
			old = obj.value;
		} else {
	}
	if(_method=="in") {
			if ((obj.value.length>0)&&(obj.value!=bv)) {
					old = obj.value;
				} else {
			}
			obj.value = "";
		} else if (_method=="out") {
			if ((obj.value.length>0)&&(obj.value!=bv)) {
					old = obj.value;
				} else {
					obj.value = bv;
			}
		} else {
	}
}

function hiLite (obj,_method) {
	obj.className = _method;
}

var displayMethod = new Array("none","block");
function expandAll(_what,_how) {
	var alltags=document.getElementsByTagName("*");
	ccollect=getElementbyClass(alltags, _what);
	var inc=0;
	while (ccollect[inc]) {
		ccollect[inc].style.display=displayMethod[_how];
		inc++;
	}
}

function hideAll(_what,_how) {
	var alltags=document.getElementsByTagName("*");
	ccollect=getElementbyClass(alltags, _what);
	var inc=0;
	while (ccollect[inc]) {
		ccollect[inc].style.display=displayMethod[_how];
		inc++;
	}
}

function getElementbyClass(rootobj, classname){
	var temparray=new Array()
	var inc=0
	for (i=0; i<rootobj.length; i++){
	if (rootobj[i].className==classname)
	temparray[inc++]=rootobj[i]
	}
	return temparray
}

function closeAll() {
	expandAll('office',0);
	expandAll('offices',0);
	expandAll('directions',0);
	/*expandAll('maps',0);*/
	/*expandAll('usmap',0);*/
	expandAll('attorneys',0);
	expandAll('label',0);
}

var setFieldText = "";
var setFieldDefaultText = "";
function setField(obj,_method,_defaultText) {
	setFieldText = obj.value;
	if(_method=="in") {
			if (setFieldText!=_defaultText) {
				} else {
					obj.value = "";
			}
		} else if (_method=="out") {
			if (setFieldText=="") {
					obj.value = _defaultText;
				} else {
					//obj.value = _defaultText;
			}
		} else {
	}
}

/*
if (document.images) {
  butCorpOff = new Image();
  butCorpOff.src = "/assets/images/banner/images/but_ccc_ovr.gif";
  butCorpOn = new Image();
  butCorpOn.src = "/assets/images/banner/images/but_ccc_ovr.gif";
  butExecOff = new Image();
  butExecOff.src = "/assets/images/banner/images/but_hrc_off.gif";
  butExecOn = new Image();
  butExecOn.src = "/assets/images/banner/images/but_hrc_ovr.gif";
}
*/

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

function showContent(divID, toHide) {
	var mapDiv = document.getElementById( divID );
	var toHideElement = document.getElementById( toHide );
	toHideElement.style.display = "none";
	
	if( mapDiv.style.display == "none" ) {
		mapDiv.style.display = "block";
	} else {
		mapDiv.style.display = "none";
	}
}

function displayAll(_what,_how) {
	var alltags=document.getElementsByTagName("*");
	ccollect=getElementbyClass(alltags, _what);
	var inc=0;
	while (ccollect[inc]) {
		ccollect[inc].style.display=displayMethod[_how];
		inc++;
	}
}

var putItThere = null; 
var cWidth = screen.availWidth;
var cHeight = screen.availHeight;
var w = 0;
var h = 0;
//alert(cWidth+"x"+cHeight);
//alert("H: "+((cHeight - h - 30) * .5));
//alert("W: "+((cWidth - w - 10) * .5));
function putWindow(url,name,w,h) {
  putItThere = window.open(url,name,'width=' + w + ',height=' + h + ',left=' + ((cWidth - w - 10) * .5) + ',top=' + ((cHeight - h - 30) * .5) + ',scrollbars=yes,toolbar=yes,status=yes');
  //putWindow(url,name,scrollbars=yes/no,toolbar=yes/no,status=yes/no,w,h);
}
function putEmployerWindow(url,name,w,h) {
  putItThere = window.open(url,name,'width=' + w + ',height=' + h + ',left=' + ((cWidth - w - 10) * .5) + ',top=' + ((cHeight - h - 30) * .5) + ',scrollbars=yes,toolbar=no,status=no,resizable=yes');
  //putWindow(url,name,scrollbars=yes/no,toolbar=yes/no,status=yes/no,w,h);
}
function putMovie(url,name,w,h) {
  putMovieThere = window.open(url,name,'width=' + w + ',height=' + h + ',left=' + ((cWidth - w - 10) * .5) + ',top=' + ((cHeight - h - 30) * .5) + ',scrollbars=no,toolbar=no,status=yes');
  //putWindow(url,name,scrollbars=yes/no,toolbar=yes/no,status=yes/no,w,h);
}
function printWindow(url,name,w,h) {
	if(name == 'print' && url.slice(-5) == '.html')
		putItThere = window.open(url,name,'width=' + w + ',height=' + h + ',left=' + ((cWidth - w - 10) * .5) + ',top=' + ((cHeight - h - 30) * .5) + ',scrollbars=yes,toolbar=yes,status=no,resizable=yes');
	else
		putItThere = window.open(url,name,'width=' + w + ',height=' + h + ',left=' + ((cWidth - w - 10) * .5) + ',top=' + ((cHeight - h - 30) * .5) + ',scrollbars=no,toolbar=no,status=no,resizable=yes');
	//putWindow(url,name,scrollbars=yes/no,toolbar=yes/no,status=yes/no,w,h);
}

/*
function checkMail(obj)
{
	var x = obj.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) 
	else alert('Not a valid email address');
	
}
*/
