
function hideDescription(theGroup,theGroupShow){
		
	$('#' + theGroup).hide();
	$('#' + theGroupShow).show();

}

function showDescription(theGroup,theGroupHide){
	
	$('.longDesc').hide();
	$('.shortDesc').show();
	
	$('#' + theGroupHide).hide();
	$('#' + theGroup).show();

}

function showGroup(theGroup){
	
	$('.mediaGroup').hide();
	$('#' + theGroup).show();

}
function ShowMenu(themenu){

	var el = document.getElementById(themenu);
	
	if (el){
		el.style.visibility = 'visible';
	}
}

function HideMenu(themenu){
	var el = document.getElementById(themenu);
	
	if (el){
		el.style.visibility = 'hidden';
	}
}

function offsite(url){
	var xpos = 0;
	var ypos = 0;
	var width=1024;
	var height=768;
	winOptions = 'toolbar=1,location=1,menubar=1,directories=1,screenx=' +  xpos + ',screeny='+ ypos + ',top='+ ypos +',left=' + xpos + ',status=1,menubar=1,scrollbars=1,resizable=1,width=' + width + ',height=' + height;
	var temp = window.open(url, '', winOptions);
	temp.focus();
}

function validateAmount(amount){
	if(amount.value.match( /^[0-9]+(\.([0-9]+))?$/)){
		return true;
	}else{
		alert('You must enter a valid donation.');
		amount.focus();
		return false;
	}
}

function amountFocus(){
	theElement = document.getElementById("item_price_1");
	theElement.value = "";
	theElement.style.color='black'; 
}

function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

$(document).ready(function() {
	
	$($(".slider > a")).click(function () {
		$(this).next("div").addClass("slider_temp");
		$(this).next("div").slideToggle("fast");		
		$(".slider > a").next("div").not(".slider_temp").hide();	
		$(this).next("div").removeClass("slider_temp");
	});

	$("#easyslider").easySlider({auto:true, continuous:true,speed:1200,pause:5000,numeric:true});
	
	$(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:385});
	$(".mediaAudio").colorbox({iframe:true, innerWidth:540, innerHeight:200});

	$("#relatedphysicians > .viewmore").toggle(
		function() {
			$(this).html("Hide More &raquo;");
			$("#relatedphysicians li.hidden").addClass("override");
			$("#relatedphysicians ul").css("height","100%");
			clearInterval(teamTimer);
  		}, 

		function() {
	  		$(this).html("View More &raquo;");
			$("#relatedphysicians li.hidden").removeClass("override");
			teamTimer = setInterval("changeTeam()", 20000);
			$("#relatedphysicians ul").css("height","70px");
		}
	);

	$("#relatedarticles > .viewmore").toggle(
		function() {
			$(this).html("Hide More &raquo;");
			$("#relatedarticles li.hidden").addClass("override");
  		}, 

		function() {
	  		$(this).html("View More &raquo;");
			$("#relatedarticles li.hidden").removeClass("override");
		}
	);

	$("#relatedmedia > .viewmore").toggle(
		function() {
			$(this).html("Hide More &raquo;");
			$("#relatedmedia li.hidden").addClass("override");
  		}, 

		function() {
	  		$(this).html("View More &raquo;");
			$("#relatedmedia li.hidden").removeClass("override");
		}
	);

	$("#relatedservices > .viewmore").toggle(
		function() {
			$(this).html("Hide More &raquo;");
			$("#relatedservices li.hidden").addClass("override");
  		}, 

		function() {
	  		$(this).html("View More &raquo;");
			$("#relatedservices li.hidden").removeClass("override");
		}
	);

	$("a.slideshow").each(function(){ $(this).colorbox({ title:$(this).attr('rev') }) });	
	$("a.slideshow").colorbox({current:""});

	
});


function bindSubSpecialties(subspecElemID) {
	//disable child select list
	$("#subspecialty1").attr("disabled", true);
	//clear child select list's options
	$("#subspecialty1").html('');
 
	//querystring value is selected value of parent drop down list
	var qs = $("#specialty1").val();
	//if user selected a separator, show error
	if(qs == '') {
		alert('You cannot select this option. Please make a different selection.');
	}
	else {
		//show message indicating we're getting new values
		$("#subspecialty1").append(new Option('Getting sub-specialties list ...'));
		//declare options array and populate
		var subspecialtyOptions = new Array();
		$.get("/includes/modules/physicianspecialties/_subspecialties_options.html?specialtyID=" + qs, function(data) {
				eval(data);
				if(subspecialtyOptions.length > 0) {
					addOptions(subspecialtyOptions);
				}
			}
		);
	}
}

function addOptions(cl) {
	//enable child select and clear current child options
	$("#subspecialty1").removeAttr("disabled");
	$("#subspecialty1").html('');
	//repopulate child list with array from helper page
	var subspecialty = document.getElementById('subspecialty1');
	for(var i = 0; i < cl.length; i++) {
		subspecialty.options[i] = new Option(cl[i].text, cl[i].value);
	}
}


function bindOffices() {
	//disable child select list
	$("#office1").attr("disabled", true);
	//clear child select list's options
	$("#office1").html('');
 
	//querystring value is selected value of parent drop down list
	var qs = $("#practice1").val();
	//if user selected a separator, show error
	if(qs == '') {
		alert('You cannot select this option. Please make a different selection.');
	}
	else {
		//show message indicating we're getting new values
		$("#office1").append(new Option('Getting offices list ...'));
		//declare options array and populate
		var officeOptions = new Array();
		$.get("/includes/modules/physicianpractices/_offices_options.html?practiceID=" + qs, function(data) {
				eval(data);
				if(officeOptions.length > 0) {
					addOfficeOptions(officeOptions);
				}
			}
		);
	}
}

function addOptions(cl) {
	//enable child select and clear current child options
	$("#subspecialty1").removeAttr("disabled");
	$("#subspecialty1").html('');
	//repopulate child list with array from helper page
	var subspecialty = document.getElementById('subspecialty1');
	for(var i = 0; i < cl.length; i++) {
		subspecialty.options[i] = new Option(cl[i].text, cl[i].value);
	}
}

function addOfficeOptions(cl) {
	//enable child select and clear current child options
	$("#office1").removeAttr("disabled");
	$("#office1").html('');
	//repopulate child list with array from helper page
	var office = document.getElementById('office1');
	for(var i = 0; i < cl.length; i++) {
		office.options[i] = new Option(cl[i].text, cl[i].value);
	}
}







