//Toggles n no of divs Ex: test1, test2, test3 ...
//function toggle_divs( divname, count )
//{ 
//	if( count )
//	{
//		for( i=1;i<=count;i++ )
//		{
//			if( $('#'+divname+i).is(':visible') )
//			{	
//				$('#'+divname+i).hide();
//			}
//			else
//			{
//				$('#'+divname+i).show();
//			}	
//		}
//	}	
//}


//Toggles n no of divs Ex: test1, test2, test3 ...
function toggle_divs( divname, count )
{ 
	if( count )
	{
		for( i=1;i<=count;i++ )
		{
			//Conditional is to deal with a bug in jQuery 1.3.2 for having trouble showing/hiding TRs; this can be changed to .toggle() when new jQuery
			if($('#'+divname+i).css('display') == 'none'){
				$('#'+divname+i).show();
			}else{
				$('#'+divname+i).hide();
			}
		}
	}	
}

//Changes the text of a div based on the visibility of a second div.
function change_div_text( checkdivname, changediv, show_text, hide_text )
{
	if( $('#'+checkdivname).is(':visible') )
	{
		$('#'+changediv).innerHTML = show_text;
	}
	else
	{
		$('#'+changediv).innerHTML = hide_text;
	}
}

//Used in hospital profile page
function toggle_ids(imageid,toggleid,value,imgsrc)
{
	var image_src = '';
	//alert(imageid + ' ' + toggleid + ' ' + value + ' ' + imgsrc);
	toggle_divs( toggleid, value );
	if(imageid == 'csr' || imageid == 'ec' || imageid == 'cr')
	{
		for(i=1;i<=value;i++)
		{
			if($('#'+toggleid+i+'1').is(':visible'))
				$('#'+toggleid+i+'1').toggle();
		}
	}
	if(imgsrc != '')
	{
		image_src = 'e_gray';
	}	
	if($('#'+toggleid+value).is(':visible'))
	{
		$('#'+imageid).attr('src','images/minus'+image_src+'.gif');
	}	
	else
	{
		$('#'+imageid).attr('src','images/plus'+image_src+'.gif');
	}	
}	


