function tabswitch(str) {
	document.getElementById('tab1').style.backgroundImage = 'url(images/bg_tab_off.jpg)';
	document.getElementById('tab2').style.backgroundImage = 'url(images/bg_tab_off.jpg)';
	document.getElementById('tab6').style.backgroundImage = 'url(images/bg_tab_off.jpg)';
	document.getElementById('video_watch').style.display = 'none';
	document.getElementById('video_fox').style.display = 'none';
	document.getElementById('photo_block').style.display = 'none';
	document.getElementById('tab1').style.borderBottom = 'none';
	document.getElementById('tab2').style.borderBottom = 'none';
	document.getElementById('tab6').style.borderBottom = 'none';
	document.getElementById(str).style.backgroundImage = 'url(images/bg_tab_on.jpg)';
	document.getElementById(str).style.borderBottom = '1px solid #000';
	if (str == 'tab1'){
		document.getElementById('video_watch').style.display = 'block';
		}
	else if (str == 'tab2'){
		document.getElementById('video_fox').style.display = 'block';
		}
	else if (str == 'tab6'){
		document.getElementById('photo_block').style.display = 'block';
		}
}
function tabswitchfeed(str) {
	document.getElementById('tab3').style.backgroundImage = 'url(images/bg_tabb_off.jpg)';
	document.getElementById('tab4').style.backgroundImage = 'url(images/bg_tabb_off.jpg)';
	document.getElementById('tab5').style.backgroundImage = 'url(images/bg_tabb_off.jpg)';
	document.getElementById('feed_fb').style.display = 'none';
	document.getElementById('feed_tw').style.display = 'none';
	document.getElementById('feed_yt').style.display = 'none';
	document.getElementById(str).style.backgroundImage = 'url(images/bg_tabb_on.jpg)';
	if (str == 'tab3'){
		document.getElementById('feed_fb').style.display = 'block';
		}
	else if (str == 'tab4'){
		document.getElementById('feed_tw').style.display = 'block';
		}
	else if (str == 'tab5'){
		document.getElementById('feed_yt').style.display = 'block';
		}
}
function popup(url)
{
	newwindow=window.open(url,'name','menubar=0,scrollbars=1,width=600,height=700');
	if (window.focus) {newwindow.focus()}
}
if(navigator.userAgent.indexOf('Mac') != -1) {
	document.write("<link rel='stylesheet' type='text/css' href='includes/style_mac.css' />");
}
if (navigator.userAgent.indexOf("Firefox")!=-1) {
		document.write("<link rel='stylesheet' type='text/css' href='includes/style_ff.css' />");
}

function videotoggle(str) {
	document.getElementById("video_fox").scrollTop = 0;
	document.getElementById('categories').style.display = 'none';
	document.getElementById('tv').style.display = 'none';
	document.getElementById('live').style.display = 'none';
	document.getElementById('myfox').style.display = 'none';
	document.getElementById('about').style.display = 'none';
	document.getElementById(str).style.display = 'block';
}
function treat_toggle(str) {
	document.getElementById('treat_main').style.display = 'none';
	document.getElementById('treat_medx').style.display = 'none';
	document.getElementById('treat_mc').style.display = 'none';
	document.getElementById('treat_faq').style.display = 'none';
	document.getElementById(str).style.display = 'block';
	if (str == 'treat_medx'){
		document.getElementById('btn_med').style.color = '#777033';
		document.getElementById('btn_mc').style.color = '#0072bc';
		document.getElementById('btn_faq').style.color = '#0072bc';
		}
	if (str == 'treat_mc'){
		document.getElementById('btn_med').style.color = '#0072bc';
		document.getElementById('btn_mc').style.color = '#777033';
		document.getElementById('btn_faq').style.color = '#0072bc';
		}
	if (str == 'treat_faq'){
		document.getElementById('btn_med').style.color = '#0072bc';
		document.getElementById('btn_mc').style.color = '#0072bc';
		document.getElementById('btn_faq').style.color = '#777033';
		}
}
function checkbookmark() {
	if(document.location.href.indexOf("#medx") >= 0){ 
		treat_toggle('treat_medx');
	} else if (document.location.href.indexOf("#mckinzie") >= 0){ 
		treat_toggle('treat_mc');
	} else if (document.location.href.indexOf("#faq") >= 0){ 
		treat_toggle('treat_faq');
	}
}
$(document).ready(function() {
	var menuopen = false;
	$('#location_menu').animate({
			zIndex: '-1',
			opacity: 0,
			height: '0px'
			}, 0, function() { 
				menuopen = false;
				if (navigator.userAgent.indexOf('MSIE 7') != -1){
					  document.getElementById('header_shadow').style.zIndex = '0';
				  }
			});
	$('.cta_bluebtn').click(function() {
		if (menuopen == false) {
			  $('#location_menu').animate({
				zIndex: '99',
				opacity: 1,
				height: '270px'
			  }, 120, function() {
				  menuopen = true;
				  if (navigator.userAgent.indexOf('MSIE 7') != -1){
					  document.getElementById('header_shadow').style.zIndex = '-1';
				  }
			  });
		}
		else if (menuopen == true) {
			  $('#location_menu').animate({
				zIndex: '-1',
				opacity: 0,
				height: '0px'
			  }, 120, function() {
				  menuopen = false;
				  if (navigator.userAgent.indexOf('MSIE 7') != -1){
					  document.getElementById('header_shadow').style.zIndex = '0';
				  }
			  });
		}
	});
	$('#location_menu').mouseleave(function(){
		$('#location_menu').animate({
			zIndex: '-1',
			opacity: 0,
			height: '0px'
			}, 120, function() { 
				menuopen = false;
				if (navigator.userAgent.indexOf('MSIE 7') != -1){
					  document.getElementById('header_shadow').style.zIndex = '0';
				  }
			});
	});
	var doc = null;
	var faq = null;
	var test = null;
		$.extend({
			doc_expand: function(str,height){
				if(doc == null || doc == str) {
					$('#' + str + '_doc').animate ({
						height: height + 'px'
					}, 200, function() { doc = str; });
				} if (doc != null && doc != str) {
					$('#' + str + '_doc').animate ({
						height: height + 'px'
					}, 200, function() { 
						$('#' + doc + '_doc').animate ({
							height: '0px'
						}, 200, function() { doc = str;});
					});
				} if (doc == str && doc != null) {
					$('#' + doc + '_doc').animate ({
						height: '0px'
					}, 200, function() { doc = null;});
				}
			},
			faq_expand: function(str,height){
				if(faq == null || faq == str) {
					$('#' + str).animate ({
						height: height + 'px'
					}, 200, function() { faq = str; });
				} if (faq != null && faq != str) {
					$('#' + str).animate ({
						height: height + 'px'
					}, 200, function() { 
						$('#' + faq).animate ({
							height: '24px'
						}, 200, function() { faq = str;});
					});
				} if (faq == str && faq != null) {
					$('#' + faq).animate ({
						height: '24px'
					}, 200, function() { faq = null;});
				}
			},
			test_expand: function(str,height){
				if(test == null || test == str) {
					$('#' + str).animate ({
						height: height + 'px'
					}, 200, function() { test = str; });
				} if (test != null && test != str) {
					$('#' + str).animate ({
						height: height + 'px'
					}, 200, function() { 
						$('#' + test).animate ({
							height: '106px'
						}, 200, function() { test = str;});
					});
				} if (test == str && test != null) {
					$('#' + test).animate ({
						height: '106px'
					}, 200, function() { test = null;});
				}
			}
	});
});

