//premades -- Dont use &lt; or &gt; for < >
var divs = new Array;
var count = 1;
var global_div_id = null;

///news////

divs.sexualhealthprogram = '[title][link]/news-articles/78-news/168-new-sexual-health-program-focuses-on-girls-in-foster-care[linkname]New Sexual-health Program Focuses on Girls in Foster Care[/link][/title]<br><br> According to specialist in adolescent medicine at Washington University Dr. Katie Plax, half of the teenage girls in foster care become pregnant or give birth. The national average for teen pregnancy is 12%, but the St. Louis pregnancy rate is 17%.  <br><br> :bullet:<a href="/news-articles/78-news/168-new-sexual-health-program-focuses-on-girls-in-foster-care">Read More</a> - Read the rest of the article.'

divs.mentorsyouth = '[title][link]/news-articles/78-news/167-mentors-youth-aging-out-of-foster-care-benefit-from-program[linkname]Mentors, Youth Aging Out of Foster Care Benefit from Program[/link][/title]<br><br>Bree and Catherine, are they sisters or best friends? Coke is better than Pepsi, they:s:d concur. Reading is their love, they:s:d say. Bree said, "We both like Lady Gaga. Some of her songs, not all of them." And "We like some of her outfits, not all of them" Catherine added. Bree says that Catherine likes horror movies and listens to rock, not country or opera; while Catherine states that Bree:s:s introduced her to things she wouldn:s:t have experienced otherwise.<br><br> :bullet:<a href="/news-articles/78-news/167-mentors-youth-aging-out-of-foster-care-benefit-from-program">Read More</a> - Read the rest of the article.'



divs.peabody = '[title][link]/news-articles/78-news/166-peabody-energy-donates-50000-for-area-foster-care-program[linkname]Peabody Energy Donates $50,000 for Area Foster Care Program[/link][/title]<br><br>The St. Louis Aging-out program proved to have such outstanding results in serving the youth aging-out of the foster care system in St. Louis that they received a grant of $50,000 from St. Louis-based Peabody Energy.<br><br> :bullet:<a href="/news-articles/78-news/166-peabody-energy-donates-50000-for-area-foster-care-program">Read More</a> - Read the rest of the article.'
divs.lifeafter = 'Foster club:s:s All Stars share their stories. All Star are foster youth who are chosen by Foster Club to represent the organization. These remarkable youth evidently display resilience and a great commitment to work for a better future for all foster youth.<br><br> :bullet:<a href="/news-articles/78-news/149-life-after-foster-care-all-star-youth-share-their-stories">Read More</a> - Read the rest of the article.'

divs.womantaps = 'Daniela Ontiveroz is a youth specialist with Child Protective Services in Texas. Her own childhood experiences in foster care help her to understand and connect with youth in her work. She really hopes to make a difference. <br><br> :bullet:<a href="/news-articles/78-news/150-woman-taps-her-experience-with-foster-care">Read More</a> - Read the rest of the article.'

divs.highereducation = '[title][link]/news-articles/78-news/153-higher-education-for-washingtons-collective-children[linkname]Higher Education for Washington:s:s Collective Children[/link][/title]<br><br>James Harmon shares his story in the system. With the support of the UW Champions Program - a campus support service for youth and alumni of foster care - he is helping other students succeed in college. <br><br> :bullet:<a href="/news-articles/78-news/153-higher-education-for-washingtons-collective-children">Read More</a> - Read the rest of the article.'

divs.lilyeagle = '[title][link]/news-articles/78-news/154-lily-eagle-dorman-colby[linkname]Lily Eagle Dorman Colby[/link][/title]<br><br>Lily Dorman Colby is a Students Raising Above, former foster child, now a senior at Yale University and a phenomenal young leader whose efforts to reform America:s:s foster care system are remarkable. <br><br> :bullet:<a href="/news-articles/78-news/154-lily-eagle-dorman-colby">Read More</a> - Read the rest of the article.'

divs.agingout = '[title][link]/news-articles/78-news/155-aging-out-of-foster-care[linkname]Aging Out of Foster Care[/link][/title]<br><br>This PBS reports discusses some of the challenges that youth face as they leave foster care and try to find their path into adulthood.<br><br> :bullet:<a href="/news-articles/78-news/155-aging-out-of-foster-care">Read More</a> - Read the rest of the article.'




////
//Education Resources
////
divs.educationstories = '<span id="title"><a href="/index.php/education">Education Stories</a> </span>- See all of our stories relating to foster youth education<br><br> :bullet: <a href="/index.php/education-r#scholarships">Scholarships and Grants Resources</a> - There are many grants to help you pay for your higher education <br><br> :bullet: <a href="/index.php/education-r#ged">Getting a High School Diploma / GED</a> - How to get a high school diploma or GED<br><br> :bullet: <a href="/index.php/education-r">Education Resources</a>- See all of our Education Resources ';

divs.education = '<span id="title"><a href="/index.php/education-r">Education Resources</a> </span>- See all of our Education Resources <br><br> :bullet: <a href="/index.php/education-r#ged">Getting a High School Diploma / GED</a> - How to get a high school diploma / GED<br><br> :bullet: <a href="/index.php/education-r#scholarships">Scholarships and Grants</a> - There are many grants to help you pay for your higher education<br><br>:bullet: <a href="/index.php/education-r#money">Loans and Assistance</a> - Information regarding loans and aid for college <br><br> :bullet: <a href="/index.php/education">Education Stories</a>- See all of our stories relating to foster youth education';

divs.ged = '<span id="title"><a href="/index.php/education-r#ged">GED</a> </span>- How to get a high school diploma / GED<br><br>:bullet: <a href="/index.php/education">Education Stories</a>- Find stories relating to foster youth education<br><br>:bullet:<a href="/index.php/education-r">Education Resources</a> - See all of our Education Resources';

divs.scholarships = '<span id="title"><a href="/index.php/education-r#scholarships">Scholarships and Grants</a> </span>- There are many grants to help you pay for your higher education<br><br>:bullet:<a href="/index.php/education-r#money">Loans and Assistance</a> - Information regarding loans and aid for college<br><br>:bullet:<a href="/index.php/education">Education Stories</a>- See all of our stories relating to foster youth education<br><br>:bullet:<a href="/index.php/education-r">Education Resources</a> - See all of our Education resources';


divs.college = '<span id="title"><a href="/index.php/education-r#goingtocollege">Going to College</a> </span>- How to get the most from your College<br><br> :bullet: <a href="/index.php/education-r#institutions">School Choices</a>- Public and private institutions in Kansas <br><br> :bullet: <a href="/index.php/education-r#scholarships">Scholarships and Grants</a> - There are many grants to help you pay for your higher education<br><br>:bullet: <a href="/index.php/education-r#money">Loans and Assistance</a> - Information regarding loans and aid for college<br><br> :bullet:<a href="/index.php/education-r">Education Resources</a> </span>- See all of our Education Resources <br><br> :bullet: <a href="/index.php/education">Education Stories</a>- See all of our stories relating to foster youth education'


/////
//Boxes that really shouldn't exist
/////

divs.badchecks = '<span id="title"><a href="/index.php/legal-issues-r#badchecks">Bad Checks</a> </span> - Legal resources regarding fraud charges<br><br> :bullet: <a href="/index.php/legal-issues-r">Legal Issues</a> - See all of our Legal Issues resources';

divs.drugpossession = '<span id="title"><a href="/index.php/legal-issues-r#drugpossession">Drug Possession</a> </span> - Legal resources regarding drug possession charges <br><br> :bullet: <a href="/index.php/legal-issues-r">Legal Issues</a> - See all of our Legal Issues resources'




/////
//General Resources
/////
divs.housing = '<span id="title"><a href="/index.php/housing-r">Housing Resources</a> </span>- A wide range of housing related resources';

divs.handlingmoney = '<span id="title"><a href="/index.php/handling-money-r">Handling Money</a> </span>- Resources to help you handle money';

divs.legalissues = '<span id="title"><a href="/index.php/legal-issues-r">Legal Issues</a> </span>- See all of our Legal Issues resources';

divs.mentalhealth = '<span id="title"><a href="/index.php/mental-health-r">Mental Health</a> </span>- See all of our Mental Health resources';

divs.usingresources = '<span id="title"><a href="/index.php/using-resources-r">Using Resources</a> </span>- See a wide range of resources for young adults';


divs.relationships = '<span id="title"><a href="/index.php/relationships-r">Relationship Resources</a> </span>- Full of information on how to develop healthy relationships';

divs.health = '[title][link]/index.php/health-r[linkname]Health[/link][/title] - See all of our Health resources<br><br> :bullet: <a href="/index.php/health-r?start=1">Insurance</a> - Information on health & dental insurance<br><br> :bullet: <a href="/index.php/mental-health-r">Mental Health</a> - View our Mental Health resources';


////
//Google Search
////
divs.gsearch = '<div id="search_box" style="width: 100%; overflow: hidden;"><b>Kansas Independence Search Engine</b><form action="http://dev.kansasindependence.org/index.php/search" id="cse-search-box">     <input type="hidden" name="cx" value="010786889021798768523:t1bxbh-gpze" />    <input type="hidden" name="cof" value="FORID:10" />    <input type="hidden" name="ie" value="UTF-8" />    <input type="text" name="q" size="31" />    <input type="submit" name="sa" value="Search" />  </form><script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script></div>'

////
//Drug Facts
////


divs.rehab = '[title][link]/index.php/drug-abuse-r#rehab[linkname]Rehabilitation[/link][/title] - Find drug rehabilitation help<br><br> :bullet: <a href=:d:/index.php/drug-abuse-r?start=1:d:>Teen Drug Abuse</a> - Resources for teens dealing with their own alcohol/drug abuse problems<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction<br><br> :bullet: <a href="/index.php/drug-abuse-r">Drug Abuse</a> - See all of our Drug Abuse resources'





divs.drugabuse = '[title][link]/index.php/drug-abuse-r[linkname]Drug Abuse[/link][/title] - See all of our Drug Abuse resources<br><br> :bullet: <a href=:d:/index.php/drug-abuse-r?start=1:d:>Teen Drug Abuse</a> - Resources for teens dealing with their own alcohol/drug abuse problems<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction ';

divs.parentaladdiction = '<span id="title"><a href="/index.php/parental-addiction-r">Parental Addiction</a> </span>- Resources for dealing with a parents addiction<br><br> :bullet: [link]/index.php/drug-abuse-r[linkname]Drug Abuse[/link] - See all of our Drug Abuse resources';

divs.heroin = '<span id="title"><a href="/index.php/heroin">Heroin</a> </span>- View the facts and dangers of Heroin<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.marijuana = '<span id="title"><a href="/index.php/marijuana">Marijuana</a> </span>- View the facts and dangers of Marijuana<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.meth = '<span id="title"><a href="/index.php/meth">Methamphetamine</a> </span>- View the facts and dangers of Methamphetamine<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.amphetamines = '<span id="title"><a href="/index.php/meth">Amphetamines</a> </span>- View the facts and dangers of Amphetamines<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.alcohol = '<span id="title"><a href="/index.php/alcohol">Alcohol</a> </span>- View the facts and dangers of Alcohol<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.tobacco = '<span id="title"><a href="/index.php/tobacco">Tobacco</a> </span>- View the facts and dangers of Tobacco<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.cocaine = '<span id="title"><a href="/index.php/cocaine">Cocaine</a> </span>- View the facts and dangers of Cocaine<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.rxpainkillers = '<span id="title"><a href="/index.php/rx-painkillers">Prescription Painkillers</a> </span>- View the facts and dangers of Prescription Painkillers<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.sedatives = '<span id="title"><a href="/index.php/sedatives">Sedatives</a> </span>- View the facts and dangers of Sedatives<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';


divs.ecstasy = '<span id="title"><a href="/index.php/ecstasy">Ecstasy</a> </span>- View the facts and dangers of Ecstasy<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.shrooms = '<span id="title"><a href="/index.php/shrooms">Psilocybin Mushrooms</a> </span>- View the facts and dangers of Magic Mushrooms<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';

divs.lsd = '<span id="title"><a href="/index.php/lsd">LSD (Acid)</a> </span>- View the facts and dangers of LSD (lysergic acid diethylamide)<br><br> :bullet: <a href="/index.php/parental-addiction-r">Parental Addiction</a> - Resources for dealing with a parents addiction <br><br> :bullet: <a href=:d:/index.php/drug-abuse-r:d:>Drug Abuse</a> - See all of our Drug Abuse resources';


/////
//Daily Life Resources
/////

divs.cooking = '<span id=:d:title:d:><a href=:d:/index.php/daily-life-r#cooking:d:>Cooking</a> </span>- Cooking recipes and tips<br> <br>:bullet: :link:/index.php/daily-life-r#breakfast:d:>Breakfast Recipes</a> - Want to treat yourself with something nice, but fast in the morning?<br> <br>:bullet: :link:/index.php/daily-life-r#groceryshopping:d:>Grocery Shopping</a> - Great tips on how to shop for groceries and save money<br><br> :bullet: <a href=:d:/index.php/daily-life-r:d:>Daily Life</a> - See all of our Daily Life resources';

divs.recipes = '<span id=:d:title:d:><a href=:d:/index.php/daily-life-r#recipes:d:>Recipes</a> </span>- Easy and quick recipes<br> <br>:bullet: :link:/index.php/daily-life-r#breakfast:d:>Breakfast Recipes</a> - Want to treat yourself with something nice, but fast in the morning?<br> <br>:bullet: :link:/index.php/daily-life-r#groceryshopping:d:>Grocery Shopping</a> - Great tips on how to shop for groceries and save money<br><br> :bullet: <a href=:d:/index.php/daily-life-r:d:>Daily Life</a> - See all of our Daily Life resources';

divs.groceryshopping = '<span id=:d:title:d:><a href=:d:/index.php/daily-life-r#groceryshopping:d:>Grocery Shopping</a> </span>- Helpful and tips and tricks for grocery shopping<br> <br>:bullet: :link:/index.php/daily-life-r#cooking:d:>Cooking</a> - Cooking recipes and tips for great meals<br> <br>:bullet: :link:/index.php/daily-life-r#breakfast:d:>Breakfast Recipes</a> - Want to treat yourself with something nice, but fast in the morning?<br><br> :bullet: <a href=:d:/index.php/daily-life-r:d:>Daily Life</a> - See all of our Daily Life resources';

divs.dailylife = '<span id=:d:title:d:><a href=:d:/index.php/daily-life-r:d:>Daily Life</a> </span>- See all of our Daily Life resources<br><br>:bullet: :link:/index.php/daily-life-r#insurance:d:>Insurance</a> - Information on how insurance works and where to get insurance<br> <br>:bullet: :link:/index.php/daily-life-r#groceryshopping:d:>Grocery Shopping</a> - Great tips on how to shop for groceries<br><br> :bullet: <a href=:d:/index.php/daily-life-r#cooking:d:>Cooking</a> - Cooking recipes and tips for great meals<br> <br>:bullet: :link:/index.php/daily-life-r#breakfast:d:>Breakfast Recipes</a> - Want to treat yourself with something nice, but fast in the morning?<br><br> :bullet: <a href=:d:/index.php/daily-life-r#chores:d:>Chores</a> - Resources to help make chores a breeze';

divs.laundry = '[title][link]/index.php/daily-life-r#laundry[linkname]Laundry[/link][/title] - With these helpful tips laundry is a snap<br><br> :bullet: <a href=:d:/index.php/daily-life-r#chores:d:>Chores</a> - Resources to help make chores a breeze<br><br> :bullet: <a href=:d:/index.php/daily-life-r:d:>Daily Life</a> - See all of our Daily Life resources'

divs.insurance = '<span id=:d:title:d:><a href=:d:/index.php/daily-life-r#insurance:d:>Insurance</a> </span>- Information on how insurance works and where to get insurance<br><br>:bullet: :link:/index.php/daily-life-r:d:>Daily Life</a> - See all of our Daily Life resources';
/////

divs.sexuality = '[title][link]/index.php/sexuality-r[linkname]Sexuality[/link][/title] - See resources relating to sexuality<br><br> :bullet: <a href=:d:/index.php/overcoming-abuse-r#sexualabuse:d:>Sexual Abuse</a> - Resources for those dealing with sexual abuse<br><br> :bullet: <a href=:d:/index.php/sexuality-r#pregnancy:d:>Pregnancy Prevention</a> - Pregnancy Prevention information<br><br> :bullet: <a href="/index.php/pregnancy">Stories Relating to Sexuality</a>- See all of our stories relating to sexuality'

divs.overcomingabuse = '<span id="title"><a href="/index.php/overcoming-abuse-r">Overcoming Abuse</a> </span>- See all resources for overcoming abuse<br><br> :bullet:<a href=:d:/index.php/overcoming-abuse-r#violence:d:>Children Exposed to Violence</a> - Resources for children dealing with violence and abuse<br><br> :bullet:<a href=:d:/index.php/overcoming-abuse-r#sexualabuse:d:>Sexual Abuse</a> - Resources for those dealing with sexual abuse';


divs.domesticviolence = '<span id="title"><a href="/index.php/overcoming-abuse-r">Overcoming Abuse</a> </span>- See all resources for overcoming abuse<br><br> :bullet:<a href=:d:/index.php/overcoming-abuse-r#datingviolence:d:>Dating Violence</a> - Resources for those dealing with dating violence and abuse<br><br> :bullet:<a href=:d:/index.php/overcoming-abuse-r#resources:d:>Kansas Resource for Dating Violence</a> - Local resources for those dealing with abuse and violence'

divs.parenting = '<span id=:d:title:d:><a href=:d:/index.php/parenting-r:d:>Parenting</a> </span>- See all of our Parenting resources<br><br>:bullet: :link:/index.php/parenting-r?start=2:d:>Child Care</a> - Child care information and resources<br> <br>:bullet: :link:/index.php/parenting-r?start=3:d:>Child Support</a> - Resources for Child Support<br> <br> :bullet: :link:/index.php/parenting-r?start=4:d:>Child Development</a> - Resources for Child Development<br><br>:bullet: :link:/index.php/parenting-r?start=5:d:> Activities for Children</a> - Fun Activities for Children <br>';



/////
//Employment Resources 
/////

divs.employment = '<span id=:d:title:d:><a href=:d:/index.php/employment-r:d:>Employment</a> </span>- See all of our Employment resources<br><br>:bullet: :link:/index.php/employment-r?start=1:d:> Getting Hired</a> - How to get hired <br> <br>:bullet: :link:/index.php/employment-r?start=2:d:>Working</a> - Moving ahead at work<br> <br> :bullet: :link:/index.php/employment-r?start=3:d:> Choosing a Career</a> - Resources to help you with career choices';

divs.gettingajob = '<span id=:d:title:d:><a href=:d:/index.php/employment-r:d:>Getting a Job</a> </span>- Resources to help you get hired<br> <br>:bullet: :link:/index.php/employment-r?start=2:d:>Working</a> - Moving ahead at work<br> <br> :bullet: :link:/index.php/employment-r?start=3:d:> Choosing a Career</a> - Resources to help you with career choices<br> <br>:bullet: <a href=:d:/index.php/employment-r:d:>Employment Resources</a> - See all of our Employment resources';

divs.choosingacareer = '<span id=:d:title:d:><a href=:d:/index.php/employment-r?start=3:d:>Choosing a Career</a> </span>- Resources to help you with your career choices<br> <br>:bullet: :link:/index.php/employment-r?start=2:d:>Working</a> - Moving ahead at work<br><br>:bullet: :link:/index.php/employment-r?start=1:d:> Getting Hired</a> - How to get hired <br> <br><br> <br>:bullet: <a href=:d:/index.php/employment-r:d:>Employment Resources</a> - See all of our Employment resources';




//outside click and multi box handle

//Global onclick
document.onclick = function (e) {
	//alert(count);
	e = e || event
	var target = e.target || e.srcElement
	if (global_div_id != null){
	var box = document.getElementById(global_div_id);
	//alert(global_div_id);
	       //Let us click here without closing box
		if (target == box || target.name == "q" || target.name == "sa" || target.id == "cse-search-box" || target.parentNode == box)
			 {///alert('same');
			}
		else { 
			//alert('different')
			if (count == 0){
			//used to find something to check against if we want to click without closing box (used above)
			 //alert(target.type);
			 //alert(target.name);
			 //alert(target.id);
				delete_this(global_div_id);
			 	};
			 count = 0;
			};
	//count = 1;
	
	};
}

//fade time
var TimeToFade = 233.3;

//global XY variables to hold box coordinates
var global_x;
var global_y;


//Grabs browser name to check in case we need custom constructed IE boxes
var browserName=navigator.appName;

//Fades the box
function fade(div_id){
//alert('fading ' + div_id);
  var element = document.getElementById(div_id);
  //alert(div_id);
  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() + ",'" + div_id + "')", 33);
  };
  
   
};

function animateFade(lastTick, div_id)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var element = document.getElementById(div_id);
 if(element == null) { return;};
  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;
    
    //if (element.FadeState == 2){fade_in_finished(div_id);};  function not needed & doesn't exist
    
    //we need fade out complete to know when to remove child
    if (element.FadeState == -2){fade_out_finished(div_id);};
    
    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 + ",'" + div_id + "')", 33);

    };


function fade_out_finished(div_id){
//alert('Div '+div_id+' out');
ele = document.getElementById(div_id);
try{
      ele.parentNode.removeChild(ele);
    }catch(e){};

};


//function that grabs mouse event
function mouser(e){
//alert('move over fire');

if(e.pageX == null)
   {
      // IE case
      var d= (document.documentElement && 
              document.documentElement.scrollLeft != null) ?
             document.documentElement : document.body;
     var docX= e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft);
     var docY= e.clientY + (document.documentElement.scrollTop || document.body.scrollTop);
   } else { //For FireFox
  x=e.pageX;
  y=e.pageY;
 };
if (docX != null){x = docX};
if (docY != null){y = docY};
 global_x = x;
 global_y = y;
  

};



//creates divs on the fly
function create_div(div_id,div_input,e){
mouser(e);

if (global_div_id != null) {
delete_this(global_div_id)};



//alert(global_x+'and'+global_y);


//grab element to see if div exists
var check = document.getElementById(div_id)
//alert(check);


//see if div exists. If so skip creating
if (check == null){
var divTag = document.createElement('div');

//set id & name
divTag.id = div_id;
divTag.className = 'jpop';

//set styles
divTag.style.top = (global_y +'px');
divTag.style.left = (global_x +'px');
divTag.style.position = 'absolute';
divTag.style.display = 'block';

//opacity for chrome moz etc
divTag.style.opacity = '0';

//opacity for IE
divTag.style.filter = 'alpha(opacity = 0)';


//set div contents

//find and replace all :d: with " and :s: with ' regardless of caps
var div_link = div_input.replace(/:link:/gi,'<a href="');
var div_link = div_link.replace("[link]",'<a href="');
var div_link = div_link.replace("[linkname]",'">');
var div_link = div_link.replace("[/link]",'</a>');
var div_title = div_link.replace("[title]",'<span id=:d:title:d:>');
var div_title = div_title.replace("[/title]",'</span>');
var div_s = div_title.replace(/:s:/gi,"'");
var div_d = div_s.replace(/:d:/gi,'"');

//add in bullets if there are any
var div_p = div_d.replace(/:bullet:/gi,'<img src="/jpop/BlueBullets.png" style="padding-right:5px"></image>');



// take out the ///// if you want IE to make its own rounded boxes with corner images. NOT WORKING
if (browserName=="////Microsoft Internet Explorer")
 {divTag.innerHTML = '<div class="bl"><div class="br"><div class="tl"><div class="tr" > <!--<div class="but_close"> <button type="button" onClick="delete_this(&#39;'+div_id+'&#39;)">Close </button></div>--><br>'+div_p+'</div></div></div></div>';
 divTag.className = 'iedrag';
 }
 else{divTag.innerHTML = div_p;


    };


//create div
document.body.appendChild(divTag);
fade(div_id);
global_div_id = div_id;
count = 1;
	};
};


//Close button function to fade div out and delete on fade out
function delete_this(div_id) {
var ele = document.getElementById(div_id);
count = 0;
    if (ele == null) {
    //alert('yes pin');
    }
	else{
	
	ele.FadeState = null;
	fade(div_id);
	//alert(div_id);
		};
		global_div_id = null;
};



//easy create function
function jpop(box,e){

create_div(box,divs[box],e);

};

