// JavaScript Document

function bookmark(){

var title = 'WellnessRaising.com';

var url = 'http://www.wellnessraising.com';

   if (document.all)

     window.external.AddFavorite(url, title);

   else if (window.sidebar)

     window.sidebar.addPanel(title, url, "")

   else if (window.sidebar&&window.sidebar.addPanel)

     window.sidebar.addPanel(title,url,"");

}



function P7_Uberlink(cl,d){

	var i,ob,tA,h=document.location.href;

	if(document.getElementById){

	ob=(d)?document.getElementById(d):document;

	if(ob){

	tA=ob.getElementsByTagName('A');

	for(i=0;i<tA.length;i++){

	if(tA[i].href==h){

	tA[i].className=cl;

}}}}}



function navon(img,name){

	img.src = '/images/nav_'+name+'_on.png';

}

function navoff(img,name){

	img.src = '/images/nav_'+name+'_off.png';

}

function t10click($charity){

	document.getElementById($charity).style.display = 'none';

	document.getElementById('t10form').style.display = '';

	document.getElementById('topcharity').options[$charity.substring(1)-1].selected = true;

	clearTimeout(timer);

}

function t10submit(){

	if(document.getElementById('t10Email').value !=''){

		$links = new Array();

			$links[0]='http://www.ymca.net/';

			$links[1]='http://www.theanimalrescuesite.com/tpc/ARS_linktous_125_01';

			$links[2]='http://www.thebreastcancersite.com/tpc/BCS_linktous_125_01';

			$links[3]='http://www.wish.org/';

			$links[4]='http://www.care.org/';

			$links[5]='http://www.samaritanspurse.org/';

			$links[6]='http://www.care2.com/';

			$links[7]='http://www.iloveschools.com/';

			$links[8]='http://www.directrelief.org/';

			$links[9]='http://www.redcross.org/psa/bannerorder/all/redirMM.asp?OID=Your CharityShop LLC&DID=01062009&BanID=HH1&TargetID=http://www.redcross.org/hometownheroes';

			

		document.getElementById('t10URL').value = $links[document.getElementById('topcharity').selectedIndex];

		document.getElementById('t10charity').submit();

	} else {

		alert('Please enter your email address.');

	}

}

function goCharity($url){

	if(document.getElementById('Email').value !='' && document.getElementById('Charity').options[document.getElementById('Charity').selectedIndex].value !='No_Charity_Selected'){

		document.getElementById('URL').value = $url;

		document.getElementById('shopcharity').submit();

	} else {

		alert('Please enter your email address and select a charity.');

	}

}



function testimonials($need){

	$picks = new Array();

	$picks[0] = "<p>Shop for great products, get paid and donate to your favorite cause...what more is there to say. <span class='sourceref'>Danny S. - Oshkosh, WI</span></p>";

	$picks[1] = "<p>I love the Pet Health products, I have it on Autoship so each month I donate to the Humane Society without even having to do anything. <span class='sourceref'>Michelle D. - St. Louis, MO</span></p>";

	$picks[2] = "<p>I made this site my homepage, I can find everything through their partner stores and contribute to my charity. <span class='sourceref'>Jennifer W. - San Diego, CA</span></p>";

	$picks[3] = "<p>Get paid to shop and help great causes, I love it!! <span class='sourceref'>Anne P. - Milwaukee, WI</span></p>";

	$picks[4] = "<p>My favorite product is the Isotonix Vitamin line, My husband and I feel great from it and I give back at the same time. <span class='sourceref'>Cheryl B. - New Orleans, LA</span></p>";

	$picks[5] = "<p>Makes sense to me, buy the same products I'm already using and the profits go to the cause I want, kudos! <span class='sourceref'>Barry A. - Chicago, IL</span></p>";

	$picks[6] = "<p>As a woman I love the make-up, the Motives line is the best I've tried and I support Breast Cancer Research with every purchase. <span class='sourceref'>Sarah K. - Ft. Lauderdale, FL</span></p>";

	$picks[7] = "<p>This is now on my favorites, I donated over $100 already just for buying the same products my family is alreasy using. <span class='sourceref'>The Hoffman Family - St. Paul, MN</span></p>";

	

	$numChoices = 8;

	$picked = '';

	$i=0;

	

	while($i<$need){

		var $randomnum=Math.floor(Math.random()*$numChoices);

		$picked += $picks[$randomnum];

		$picks.splice($randomnum,1);

		$numChoices--;

		$i++;

	}

	document.getElementById('block_testimonials').innerHTML = $picked;

}



function launchVideo(){

	document.getElementById('vidStatic').style.display = 'none';

	document.getElementById('vidLive').style.display = '';

}



function closeVideo(){

	document.getElementById('vidLive').style.display = 'none';

	document.getElementById('vidStatic').style.display = '';

}



/*  FADING CODE  */



var TimeToFade = 1000.0;

var logosCount = 10;

var charityNumIn = 1;

var charityNumOut = 0;

var picsSetup = 1;



function startFades(){

	if(picsSetup<=logosCount){

		for(picsSetup; picsSetup<=logosCount; picsSetup++){

			fade('t'+picsSetup);

		}

	}

	if(charityNumIn > charityNumOut) {

		if(charityNumOut > 0 && charityNumOut <= logosCount){

			document.getElementById('t'+charityNumOut).style.display = 'none';

		}

		if(charityNumOut == 0 ){

			document.getElementById('t'+logosCount).style.display = 'none';

		}

		document.getElementById('t'+charityNumIn).style.display = '';

		fade("t"+charityNumIn);

		if(charityNumOut < logosCount){

			charityNumOut++;

		}else{

			charityNumOut=0;

		}

		timer = setTimeout("startFades()",4000);

	} else {

		fade("t"+charityNumOut);

		

		if(charityNumIn < logosCount){

			charityNumIn++;

		}else{

			charityNumIn=1;

			charityNumOut=0;

		}

		timer = setTimeout("startFades()",1000);

	}

	

}



function fade(eid)

{

  var element = document.getElementById(eid);

  if(element == null)

    return;

    

   

  if(element.FadeState == null)

  {

    if(element.style.opacity == null || element.style.opacity == '' 

       || element.style.opacity == '1')

      element.FadeState = 2;

    else

      element.FadeState = -2;

  }

    

  if(element.FadeState == 1 || element.FadeState == -1)

  {

    element.FadeState = element.FadeState == 1 ? -1 : 1;

    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;

  }

  else

  {

    element.FadeState = element.FadeState == 2 ? -1 : 1;

    element.FadeTimeLeft = TimeToFade;

    setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);

  }  

}



function animateFade(lastTick, eid)

{  

  var curTick = new Date().getTime();

  var elapsedTicks = curTick - lastTick;

  

  var element = document.getElementById(eid);

 

  if(element.FadeTimeLeft <= elapsedTicks)

  {

    element.style.opacity = element.FadeState == 1 ? '1' : '0';

    element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')';

    element.FadeState = element.FadeState == 1 ? 2 : -2;

    return;

  }

 

  element.FadeTimeLeft -= elapsedTicks;

  var newOpVal = element.FadeTimeLeft/TimeToFade;

  if(element.FadeState == 1)

    newOpVal = 1 - newOpVal;



  element.style.opacity = newOpVal;

  element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';

  

  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);

}
