var topicsredirects = new Array();
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660625"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Female-Infertility";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660703"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Male-Infertility";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660641"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Aftereffects-of-Cancer-Treatment";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660619"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Chronic-Pain";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660693"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Cognitive-Changes";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660667"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Fatigue";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660675"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Lymphedema";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660677"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Neuropathy";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660679"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Ostomies";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660707"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Osteoporosis";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660631"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Second-Cancers";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660713"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Urinary-Incontinence";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660673"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Healthy-Behaviors";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660709"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Physical-Rehabilitation";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662035"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Quality-of-Life-and-Palliative-Care";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662007"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/What-Hospice-Care-Means-for-Caregivers";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662011"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/What-Hospice-Care-Means-for-Survivors";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660627"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Female-Sexual-Dysfunction";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660705"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Physical-Effects-of-Cancer/Male-Sexual-Dysfunction";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660725"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Body-Image";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660695"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Emotional-Effects-of-Cancer";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660669"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Fear-of-Recurrence";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660757"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Finding-Meaning";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660629"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Grief-and-Loss";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660759"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Hope";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660701"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Living-With-Uncertainty";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660683"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Sadness-and-Depression";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660633"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Setting-Priorities";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660711"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Stress";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660643"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Communicating-With-Your-Partner";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660623"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Dating-and-New-Relationships";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660635"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Telling-Others-You-are-a-Survivor";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660755"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Emotional-Support";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660671"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Finding-a-Counselor";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660727"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Meeting-Other-Survivors";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=3038573"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Federal-and-State-Benefit-Programs";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660697"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Finding-and-Evaluating-Resources";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2786585"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Health-Care-Assistance-Programs";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2781049"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Prescription-Assistance";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2788581"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Transportation-and-Other-Support-Services";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660665"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Employment-Discrimination";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662697"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Employment-Law";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662687"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Preparing-for-Not-Working";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=3041451"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Assessing-and-Managing-Your-Financial-Situation";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662879"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Converting-Life-Insurance-into-Income";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662889"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Converting-Personal-Assets-into-Income";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2777865"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Converting-Retirement-Accounts-into-Income";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662421"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Credit-for-Survivors";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662453"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Investment-Planning";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660773"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Planning-Your-Financial-Future";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662479"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Retirement-Planning";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662371"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Tax-Planning";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662555"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Assisted-Living-and-Nursing-Home-Facilities";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660621"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Communicate-With-Your-Health-Care-Team";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662583"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Home-Health-Care";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660771"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Life-Expectancy";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660645"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Emotional-Effects-of-Cancer/Setting-Priorities"; // health insurance
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662381"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Disability-Income-Insurance";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662381"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Individual-and-Group-Health-Insurance";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660699"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Life-Insurance";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662671"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Property-and-Casualty-Insurance";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662659"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Creating-a-Will";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2660681"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Planning-Your-Medical-Future";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662477"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Providing-a-Guardian-for-Your-Children";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662593"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Housing";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662481"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/How-to-Organize-Important-Records";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662483"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Important-Records-Survivors-Should-Keep";
topicsredirects["http://www.livestrong.org/site/lookup.asp?c=khLXK1PxHmF&b=2662567"] = "/Get-Help/Learn-About-Cancer/Cancer-Support-Topics/Practical-Effects-of-Cancer/Funeral-and-Memorial-Service-Preplanning";

$(document).ready(function(){
	extend();
	setup();
	mainNav();
	searchBox();
	resourceDb();
	crosslinks();
	lTemplate();
	aTemplate();
	hTemplate();
	mTemplate();
	zmag();
	regForAnEvent();
	printBtn();
	video();
	aTemplateTopicsRedirects();
	ie6_check();
});

this.extend = function(){
	$.extend($.expr[':'],{
		external: function(a,i){
		if(!a.href) {return false;}
			return a.hostname && a.hostname !== window.location.hostname;
		}
	});
	
	$('a:not([href*="youtube.com/watch"]):external, a[href*="youtube.com"]:not([href*="youtube.com/watch"]), #Ls-Shop .h_template .grid_4 a').click(function(e){
		if($(this).attr('href').toLowerCase().indexOf('livestrong') > -1 || $(this).attr('href').toLowerCase().indexOf('laf') > -1)
			pageTracker._getLinkerUrl($(this).attr('href'));
		
		window.open($(this).attr('href'));
		return false;
	});
	
	$('a[href*="/pdf"]').click(function(){
		//var href = $(this).attr('href');
		//var value = 'pdf/' + window.location + '/' + href.substring(href.lastIndexOf('/') + 1);
		//pageTracker._trackPageview(value);
		window.open($(this).attr('href'));
		return false;
	});
	
	$('a[href*="/ppt"]').click(function(){
		//var href = $(this).attr('href');
		//var value = 'ppt/' + window.location + '/' + href.substring(href.lastIndexOf('/') + 1);s
		//pageTracker._trackPageview(value);
		window.open($(this).attr('href'));
		return false;
	});
	
	$('a[href*="/doc"]').click(function(){
		//var href = $(this).attr('href');
		//var value = 'doc/' + window.location + '/' + href.substring(href.lastIndexOf('/') + 1);
		//pageTracker._trackPageview(value);
		window.open($(this).attr('href'));
		return false;
	});

	if (!Modernizr.input.placeholder){
		$('input[placeholder],textarea[placeholder]').each(function(){
			var input = $(this);
			if (!input.attr('placeholder')) return;
			var ph = input.attr('placeholder');
			input.val(ph);
			input.focus(function(){
				if (input.val() == ph) input.val('');
			});
			input.blur(function(){
				if (input.val() == '') input.val(ph);
			});
		});
	}

	// Search
    $('#global-search').bind({
        mouseenter: function(e){
            e.preventDefault();
            $('#search-tooltip').addClass('show');
            $('#email-tooltip').removeClass('show');
        },
        click: function(e){
        	e.preventDefault();
        }
    });
    
    $('#search-tooltip').bind({
        mouseleave: function(e){
            $('#search-tooltip').removeClass('show');
        }
    })
    
    $('#search-form-submit').bind({
        click: function(e){
            e.preventDefault();
            $("#search-form").submit();     
        }
    });
}

this.setup = function(){
	if(navigator.appVersion.indexOf('Macintosh') != -1 && navigator.userAgent.indexOf('10.6') != -1)
	{
			$('.gold_arrow').css({paddingTop: '8px'});
			$('#Ls-Livestrong-Day-2010').append('<style>.stbutton.stico_default{padding-top:8px !important;}</style>');
	}
	else if(navigator.appVersion.indexOf('Macintosh') != -1 && navigator.userAgent.indexOf('10.5') != -1)
	{
			$('.gold_arrow').css({paddingTop: '8px'});
			$('#Ls-Livestrong-Day-2010').append('<style>.stbutton.stico_default{padding-top:8px !important;}</style>');
	}	
	else if(navigator.appVersion.indexOf('Macintosh') != -1)
	{
		if(!$.browser.safari)
		{
			$('.a .grid_4 > ul li a').css({paddingTop: '1px'});
			$('.grey_arrow').css({paddingTop: '2px'});
			$('.gold_arrow').css({paddingTop: '3px'});
			$('.a .grid_4 > ul li h4').css({ paddingBottom: '0' });
		}
	}
	
	$('#crosslinks a').click(function(){
		if($.trim($(this).text()) == 'online' && $(this).attr('href').indexOf('/Get-Help/Get-One-On-One-Support/Online-Intake') > -1)
		{
			window.open('http://www.kintera.org/site/c.khLXK1PxHmF/b.2661783/k.9728/Intake_Form/apps/ka/ct/contactus.asp?c=khLXK1PxHmF&b=2661783&en=btITJ4NGKjJPLXMLLiKMLXONJjLXL9MHLcIVJgOTJpL5ImL');
			return false;
		}
	});
	
	$('body').prepend("<div id=\"video_callout\"></div>");
	
	if($.browser.msie && $.browser.version == 7)
	{
		$('.gold_arrow').each(function(){
			var $this = $(this);
			
			if($this.height() > 20 && $('#Ls-Livestrong-Day-2010').length == 0)
				$this.addClass('ie7_gold_arrow_fix').append('<img src="/images/icons/yellow-carrot-circle-arrow-jpg" alt="Gold Arrow" />');
		});
		$('.FeaturedHeading h4').each(function(){
			var $this = $(this);
			$this.add('span').css('padding-top', '15px');		
		});		
		
		$('.a .grid_4 ul li a').each(function(){
			var $this = $(this);
			
			if($this.height() > 20)
				$this.addClass('ie7_grey_arrow_fix').append('<img src="/images/icons/carrot-a-level-link_ie7" alt="Grey Arrow" />');
		});
	}
	// if($.browser.msie && $.browser.version == 8)
	// {

	// }	
}

this.mainNav = function(){
	$('#header #menuElem a').each(function(i){
		if($(this).text().toLowerCase().indexOf('livestrong') > -1)
			$(this).html($(this).text().replace('LIVESTRONG', 'LIVE<strong>STRONG</strong>'));
	});
	
	$('#header #menuElem a.CMSListMenuLinkHighlighted').parentsUntil('#menuElem').addClass('CMSListMenuHighlightedLI').find('a:first-child').addClass('CMSListMenuLinkHighlighted');
	
	$('#header #menuElem > li > ul').each(function(){
		var maxHeight = 0;
		$(this).css({display: 'block'}).find('> li').each(function(){
			maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
		}).css({minHeight: maxHeight}).parent().removeAttr('style');
	});
	
	if($.trim($('#breadcrumbs #crumbs').text()) != '' && $.trim($('#breadcrumbs #crumbs').text()) != '>')
	{
		$('#breadcrumbs').show();
		
		$('#breadcrumbs #crumbs a').each(function(i){
			if($(this).text().toLowerCase().indexOf('livestrong') > -1)
				$(this).html($(this).text().replace('LIVESTRONG', 'LIVE<strong>STRONG</strong>'));
		});
	}
}

this.searchBox = function(){
	$('#search-form input:text').keypress(function(e){
		if(e.which == 13)
		{
			e.preventDefault();
			window.location.href = "/Search?SearchText="+$.trim($(this).val());
		}
	});

	$('#search-form-submit').click(function(e){
		e.preventDefault();
		window.location.href = "/Search?SearchText="+$.trim($("#search-form input:text").val());
	});
}

this.resourceDb = function(){
	if($('body').attr('id') === 'Ls-Find-More-Resources')
	{
		var embed = {
			swf: '/App_Themes/Livestrong/flash/resource_db/ResourceDatabaseLoader.swf',
			container: 'movie',
			width: '976',
			height: '590',
			minWidth: '975',
			minHeight: '620',
			version: '9.0.124.0',
			expressInstall: '/App_Themes/Livestrong/flash/resource_db/expressInstall.swf'
		};

		var flashvars = {};

		var params = {
			menu: 'false',
			allowScriptAccess: 'always',
			wmode: 'transparent'
		};

		var attributes = {
			id: 'swf'
		};

		swfobject.embedSWF(embed.swf, embed.container, embed.width, embed.height, embed.version, embed.expressInstall, flashvars, params, attributes);

		if(swfmacmousewheel) {
			swfmacmousewheel.registerObject(attributes.id);
		}
		
		$('#flash_off').show();
	}
}

this.crosslinks = function(){
	if($.trim($('#crosslinks').text()) == '')
		$('#crosslinks').hide();
}

this.lTemplate = function(){
	$('#content .l').append('<div id="hoverCallOut"></div>');

	$('.l > .grid_3 > li > a').hover(function(){
		var $this = $(this);
		var $thisParent = $this.parent();
		var $contentL = $('#content .l');
		
		var thisParentHeight = $thisParent.height() / 2;
		var top = $thisParent.offset().top - $contentL.offset().top;
		
		var left = $thisParent.offset().left - $contentL.offset().left;
		var leftOffset = 222;
		
		if($thisParent.parent().hasClass('omega'))
		{
			leftOffset = -259;
			$('#content .l #hoverCallOut').addClass('leftSide');
		}
		
		var $html = $thisParent.find('> div').html();
		
		if($html)
		{
			$('#content .l #hoverCallOut').html($thisParent.find('> div').html()).show().css({
				top: top + (thisParentHeight - $contentL.find('#hoverCallOut').height() / 2),
				left: left + leftOffset
			});
		}
	}, function(){
		$('#content .l #hoverCallOut').hide().empty().removeClass('leftSide');
	});
}

this.aTemplate = function(){
	$('.a .grid_8 table tr:even').addClass('alt');
}

this.hTemplate = function(){
	var maxHeight = 0;
	$('.h_template > .grid_4, .h_template > .grid_6').each(function(){
		maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
	}).css({ height: maxHeight });
}

this.mTemplate = function(){
	$('.m > .grid_8 > ul li.alpha').each(function(){
		var height = $(this).height() > $(this).next('.omega').height() ? $(this).height() : $(this).next('.omega').height()
		$(this).css({ height: height }).next('.omega').css({ height: height });
	});
}

this.zmag = function(){
	$('a[href*="/zmag?id="]').click(function(e){
		var href = $(this).attr('href');
		var title = '';
		var options = 'toolbar=0,status=0,location=0,resizeable=0,menubar=0,width=900,height=660';
		
		window.open(href, title, options);
		
		e.preventDefault();
	});
}

this.regForAnEvent = function(){
	$('#event_select #submit').click(function(e){
		e.preventDefault();
		
		var selected_event = $('#event_select option:selected').val();
		
		if(selected_event != '')
		{
			if(selected_event.indexOf('/') == 1 || selected_event.indexOf('livestrong.org') > -1)
				window.location = selected_event;
			else
				window.open(selected_event);
		}
		else
		{
			alert('Please Select an Event');
		}
	});
}

this.printBtn = function(){
	// if(!$('#content > div').hasClass('a'))
	// 	$('#print').hide();
	
	$('#print').click(function(e){
		window.print();
		e.preventDefault();
	});
}

this.video = function(){
	$('a[href*="youtube.com/watch"]').click(function(e){
		e.preventDefault();
		
		var vid = $(this).attr('href');
		
		p = new Array();
		var params = vid.substring(vid.indexOf('?') + 1).split('&');
		
		/*for(i in params)
		{
			s = params[i].split('=');
			p[s[0]] = s[1];
		}
		*/
		s = params[0].split('=');
			p[s[0]] = s[1];
		
		$('#video_callout').html('<object width="480" height="295"><param name="movie" value="http://www.youtube.com/v/' + p.v + '&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + p.v + '&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295"></embed></object>');
		$("#video_callout").dialog({
			height: 360,
			width: 506,
			modal: true,
			
			close: function(){
				$("#video_callout").empty();
			}
		});
	});
}

this.aTemplateTopicsRedirects = function(){
	$('.a #related_cancer_topics a').unbind('click').click(function(){
		window.location = topicsredirects[$(this).attr('href')] == undefined ? $(this).attr('href') : topicsredirects[$(this).attr('href')];
		return false;
	});
}

function _url_param(k)
{
	p = new Array();
	u = window.location.href;
	q = u.substring(u.indexOf('?') + 1).split('&');
	
	if(u.indexOf('?') === -1)
		return '';
	
	for(v in q){
		s = q[v].split('=');
		p[s[0]] = s[1];
	}
	
	if(!p[k])
		return '';
	
	return p[k];
}

this.ie6_check = function(){
	if($.browser.msie && $.browser.version < 7){
		$('body').prepend('<div style="background: #fecb00; text-align: center; padding: 4px 0;">For optimal viewing, please use <a href="http://www.microsoft.com/ie8" title="Internet Explorer 8">Internet Explorer 8</a> or <a href="http://www.getfirefox.com" title="Firefox">Firefox</a>.</div>');
	}
}

function closeImageView() {
    $('#moviewrap').hide();
    $('#movie').hide();

}

function getQueryParams(type, id) {
    $('body').append('<div id="moviewrap" style="z-index:101;"><div id="movie">&nbsp;</div></div>');

    //Set the rest of the styles styles
    $('#moviewrap').css({
        left: '0',
        position: 'fixed',
        top: '0',
        width: '100%',
        height: '100%',
        display: 'block'
    });


    var embed = {
        swf: "/app_themes/Livestrong/flash/image_viewer/ImageViewerLoader.swf",
        //swf: "ImageViewerLoader.swf",
        container: "movie",
        width: "100%",
        height: "100%",
        minWidth: "900",
        minHeight: "700",
        version: "10.0.0.0",
        //expressInstall: "expressInstall.swf"
        expressInstall: "/app_themes/Livestrong/flash/image_viewer/expressInstall.swf"
    };

    var flashvars = {};
    //flashvars["app.username"] = "livestrong_army";
    flashvars["app.collectionId"] = type;
    flashvars["app.collectionId"] = id;

    var params = {
        menu: "false",
        allowScriptAccess: "always",
        wmode: "transparent"
    };

    var attributes = {
    };
        swfobject.embedSWF(embed.swf, embed.container, embed.width, embed.height, embed.version, embed.expressInstall, flashvars, params, attributes);
}
