function open_popup(url,w,h,resize,scroll,wname) {
/* place this in onclick or href:  "javascript:open_popup('[url]','[width of window]','[height of window]','[resize option]','[scroll opiton]','[windowname]');"  */
  var properties = "toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=0,width="+ w +",height="+ h;
  if((scroll==0)||(scroll==1)){  properties+=",scrollbars="+ scroll; }
  if((resize==0)||(resize==1)){  properties+=",resizable="+ resize; } 	
  wname = (wname == null) ? wname : "popwin";
 
  child = window.open(url,wname,properties);
  child.focus();
}

function swap(img,isrc) {
/* place this in href
onmouseover="swap('[imgname]','[imgurl]');"
onmouseout="swap('[imagname]','[imgurl]');"
*/
   if (!document.images) return;
   document.images[img].src = isrc;
}

function emailafriendWindow(theUrl) {
window.open("/emailafriend/emailafriend.html?url="+theUrl,"emailafriend","'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=350,height=435");
}

// this next script is for the popup window we use for CME post-tests

function openwin(x)
{
  var conWin = window.open (x,"post", "toolbar=no,location=yes,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=640,height=550");
} 


// and this next one is for elements that expand/contract when you click on parts of them

//here you place the ids of every element you want.

var ids=new Array('a1','a2','a3','a4','a5','a6','a7','a8','a9','a10','a11','a12','b1','b2','b3','b4');

function switchid(id){	
		showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

//functions for div toggling
		
function toggleDiv(linkId,DivId,textShow,textHide) {

	var link=document.getElementById(linkId);

	if (document.getElementById(DivId).style.display == "block") {
		document.getElementById(DivId).style.display = "none";
		link.innerHTML=textShow;
	} else {
		document.getElementById(DivId).style.display = "block";
		link.innerHTML=textHide;
	}
}


