var arrUpImages = new Array();

var arrDownImages = new Array();

var arrPreloadImages = new Array();

var arrElement = new Array();

var arrIssue = new Array();

var arrVideo = new Array();

var nbrFadeTop = 100;

//var nbrFadeMiddle = 50;
var nbrFadeMiddle = 65;

//var nbrFadeBottom = 40;
var nbrFadeBottom = 50;

var nbrFadeInSpeed = 60;

var nbrFadeOutSpeed = 60;

var oDv=document.createElement("div");

var flgMoveDiv = false;

//Flash Detect Variables
var flashinstalled = 0;
var flashversion = 0;

function init() {

	oDv.style.position="absolute";
	oDv.style.display='none';
	document.body.appendChild(oDv);
	document.onmousemove=getMouseCoord;

	loadFadeDown('fadeImage1;fadeImage2;fadeImage3','');
	loadFadeUp('porn_film;divorce_film;preg_film;debt_film;loneliness_film;suddenloss_film;drug_film;suicide_film','');
}

function preloadImages() {

	for(i=0; i<preloadImages.arguments.length; i++) {
		arrPreloadImages[i] = new Image();
		arrPreloadImages[i].src = preloadImages.arguments[i];
	}
}

function preloadIndexImages(strPath) {

	preloadImages(strPath+"images/porn_film_middle.jpg",strPath+"images/divorce_film_middle.jpg",strPath+"images/preg_film_middle.jpg",strPath+"images/debt_film_middle.jpg",strPath+"images/loneliness_film_middle.jpg",strPath+"images/suddenloss_film_middle.jpg",strPath+"images/drug_film_middle.jpg",strPath+"images/suicide_film_middle.jpg",strPath+"images/newspaper_ads_center.gif",strPath+"images/billboard_ads_center.gif",strPath+"images/magazine_ads_center.gif",strPath+"images/video_left.png",strPath+"images/video_bottom.png",strPath+"images/subheader_left.png",strPath+"images/subheader_right.png");

}

function preloadResponseImages(strPath) {

	preloadImages(strPath+"images/who_cares_whole_white_noalpha.gif");
}

function preloadRotateImages(strPath) {

	preloadImages(strPath+"images/find_out_how_god_cares.png",strPath+"images/find_out_how_missing.png",strPath+"images/find_out_how_answers.png");
}

function rollOverWhoCares() {

	imgFlipOne = new Image();

	imgFlipOne.src = "images/who_cares_whole_white_noalpha.gif";

	document.getElementById("who_cares_img").src=imgFlipOne.src;
}

function rollOutWhoCares() {

	imgFlipOne = new Image();

	imgFlipOne.src = "images/who_cares_whole_black_noalpha.gif";

	document.getElementById("who_cares_img").src=imgFlipOne.src;
}

function fadeImages(strImages,strPath) {

	arrImages = strImages.split(";");

	for (i=0;i<arrImages.length;i++) {
		fadeOut(arrImages[i],nbrFadeTop,nbrFadeMiddle,nbrFadeOutSpeed,"",0,strPath);
	}
}

function loadFadeUp(strImages,strPath) {

	arrUpImages = strImages.split(";");

	for (i=0;i<arrUpImages.length;i++) {
		fadeIn(arrUpImages[i],70,100,nbrFadeInSpeed,"",0,strPath);
	}

	return true;
}

function loadFadeDown(strImages,strPath) {

	arrDownImages = strImages.split(";");

	for (i=0;i<arrDownImages.length;i++) {
		fadeOut(arrDownImages[i],nbrFadeTop,nbrFadeMiddle,"",nbrFadeOutSpeed,"",0,strPath);
	}

	return true;
}

function fadeMeIn(strImage,strPath) {

	hideDiv();

	fadeIn(strImage,nbrFadeMiddle,nbrFadeTop,nbrFadeInSpeed,"",0,strPath);
	
	/*for (i=0;i<arrImages.length;i++) {
		if (arrImages[i] != strImage) {
			fadeOut(arrImages[i],nbrFadeMiddle,nbrFadeBottom,nbrFadeOutSpeed,"",0,strPath);
		}
	} */
}

function fadeMeOut(strImage,strMessage,strPath) {

	fadeOut(strImage,nbrFadeTop,nbrFadeMiddle,strMessage,nbrFadeOutSpeed,"",0,strPath);
	
	/*for (i=0;i<arrImages.length;i++) {
		if (arrImages[i] != strImage) {
			fadeIn(arrImages[i],nbrFadeBottom,nbrFadeMiddle,nbrFadeInSpeed,"",0,strPath);
		}
	} */
}

function fadeAdIn(strImage,strPath) {

	hideDiv();

	fadeIn(strImage,nbrFadeMiddle,nbrFadeTop,nbrFadeInSpeed,"",0,strPath);
	
	for (i=0;i<arrDownImages.length;i++) {
		if (arrDownImages[i] != strImage) {
			fadeOut(arrDownImages[i],nbrFadeMiddle,nbrFadeBottom,"",nbrFadeOutSpeed,"",0,strPath);
		}
	}
}

function fadeAdOut(strImage,strMessage,strPath) {

	fadeOut(strImage,nbrFadeTop,nbrFadeMiddle,strMessage,nbrFadeOutSpeed,"",0,strPath);
	
	for (i=0;i<arrDownImages.length;i++) {
		if (arrDownImages[i] != strImage) {
			fadeIn(arrDownImages[i],nbrFadeBottom,nbrFadeMiddle,nbrFadeInSpeed,"",0,strPath);
		}
	}
}

function fadeIn(strObject,nbrStart,nbrStop,nbrFade,strImages,nbrImage,strPath) {
	objFade = document.getElementById(strObject);

	if (nbrStart <= nbrStop) {
		setOpacity(objFade, nbrStart);
		nbrStart += 10;
		window.setTimeout("fadeIn('"+strObject+"',"+nbrStart+","+nbrStop+","+nbrFade+",\""+strImages+"\","+nbrImage+",'"+strPath+"')", nbrFade);
	} else {
		if (nbrImage == 0) {
			hideDiv();
		} else {
			window.setTimeout("fadeOut('"+strObject+"',"+nbrStop+",0,\"\","+nbrFade+",\""+strImages+"\","+nbrImage+",'"+strPath+"')", 4000);
		}
	}
}

function fadeOut(strObject,nbrStart,nbrStop,strMessage,nbrFade,strImages,nbrImage,strPath) {
	objFade = document.getElementById(strObject);

	if (nbrStart >= nbrStop) {
		setOpacity(objFade, nbrStart);
		nbrStart -= 10;
		window.setTimeout("fadeOut('"+strObject+"',"+nbrStart+","+nbrStop+",\""+strMessage+"\","+nbrFade+",\""+strImages+"\","+nbrImage+",'"+strPath+"')", nbrFade);
	} else {
		if (nbrImage == 0) {
			viewDiv(strMessage);
		} else {
			rotateImages(strImages,strObject,nbrImage,strPath);
		}
	}
}

function setOpacity(objFade, nbrOpacity) {
	nbrOpacity = (nbrOpacity == 100)?99.999:nbrOpacity;

	// Newer Mozilla, Safari and Firefox
	objFade.style.opacity = nbrOpacity/100; 

	// Internet Explorer 
	objFade.style.filter = "alpha(opacity:"+nbrOpacity+")";
  
	// Konqueror and Old Safari
	objFade.style.KHTMLOpacity = nbrOpacity/100;
  
	// Old Firefox/Mozilla
	objFade.style.MozOpacity = nbrOpacity/100;

}

function getOpacity(strObject) {

	objFade = document.getElementById(strObject);

	if (objFade.style.opacity) {
		// Newer Mozilla, Safari and Firefox
		return objFade.style.opacity; 
	}

	if (objFade.filters && objFade.filters.alpha && objFade.filters.alpha.opacity) {

		// Internet Explorer 
		return objFade.filters.alpha.opacity;
	}
  
	if (objFade.style.KHTMLOpacity) {
		// Konqueror and Old Safari
		return objFade.style.KHTMLOpacity;
	}
  
	if (objFade.style.MozOpacity) {
		// Old Firefox/Mozilla
		return objFade.style.MozOpacity;
	}
}

function viewDiv(strText) {

	oDv.innerHTML="<span style=\"font-family:verdana,sans-serif;color:#ffffff;font-size:10px;font-weight:bold;margin-left:10px;\">"+ strText +"</span>";

	//oDv.style.visibility='visible';
	oDv.style.display='block';
}

function hideDiv() {

	//oDv.style.visibility='hidden';
	oDv.style.display='none';
	oDv.innerHTML='';
}

function getMouseCoord(objMouse) {

	if (flgMoveDiv == true) {
		if (objMouse) {
			var nbrX = 10+objMouse.pageX;
			var nbrY = 5+objMouse.pageY;
			oDv.style.left=nbrX+"px";
			oDv.style.top=nbrY+"px";

		} else {
			oDv.style.left = 10 + window.event.clientX + document.body.scrollLeft;	
			oDv.style.top = 5 + window.event.clientY + document.body.scrollTop;	
		}
	}

	return true;
}

function flipMoveDivOff() {
	hideDiv();
	flgMoveDiv = false;
}

function flipMoveDivOn() {
	flgMoveDiv = true;
}

function rotateImages(strImages,strImage,nbrImage,strPath) {

	var arrRotateImages = strImages.split(";");

	var imgCurrent = new Image();

	if (nbrImage > arrRotateImages.length) {
		nbrImage = 1;
	}

	nbrImage = nbrImage - 1;

	imgCurrent.src = strPath+arrRotateImages[nbrImage];

	document.getElementById(strImage).src = imgCurrent.src;

	nbrImage = nbrImage + 2;

	fadeIn(strImage,0,100,100,strImages,nbrImage,strPath);
}

function buildCategories() {

	arrIssue[0] = "Divorce";
	arrIssue[1] = "Financial Hardship";
	arrIssue[2] = "Loneliness";
	arrIssue[3] = "Porn Addiction";
	arrIssue[4] = "Stress";
	arrIssue[5] = "Substance Addiction";
	arrIssue[6] = "Sudden Loss";
	arrIssue[7] = "Unexpected Pregnancy";
	arrIssue[8] = "Miscellaneous";

	//SWF Names
	arrVideo[0] = "Divorce";
	arrVideo[1] = "Debt";
	arrVideo[2] = "Loneliness";
	arrVideo[3] = "Porn";
	arrVideo[4] = "Suicide";
	arrVideo[5] = "Drugs";
	arrVideo[6] = "Lost";
	arrVideo[7] = "Preg";
	arrVideo[8] = "ResourceFix";
	arrVideo[9] = "Intro";

	for (i=0;i<arrIssue.length;i++) {
		arrElement[i] = new Array();
	}

	//Category Items

	//Divorce
	arrElement[0][0] = "Crown Financial Ministries|http://www.crown.org/NAMB/divorce.asp|Financial problems have been identified as the #1 issue in over 50% of all divorces.  Providing a wealth of services, seminars, products, and online resources, Crown Financial Ministries is an International, non-profit organization that exists to teach you how to apply Christ-centered Financial Principles in your life, your home, and your marriage.||crown.gif";
	arrElement[0][1] = "FamilyLife|http://www.familylife.com/seewhocares/divorce.htm|Your marriage is not hopeless.  Find out how your marriage can thrive as you explore God's plan for couples.  It's never too late.||";
	arrElement[0][2] = "National Domestic Violence/Abuse Hotline|http://www.ndvh.org|At the National Domestic Violence Hotline... We believe that every caller deserves to be treated with dignity and respect. We believe that every family deserves to live in a world free from violence. We believe that safe homes and safe families are the foundation of a safe society.|1-800-799-SAFE (799-7233)|";
	arrElement[0][3] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about divorce, please visit our website by clicking the link below.||";

	//Financial HardShip
	arrElement[1][0] = "Crown Financial Ministries|http://www.crown.org/NAMB/debt.asp|Crown Financial Ministries is an International, non-profit organization that exists to teach you how to apply Christ-centered Financial Principles in your life, your business, your home, and your marriage.  Our goal is to give you the wisdom and practical help to be successful in handling all the money issues in your life.||crown.gif";
	arrElement[1][1] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about financial debt, please visit our website by clicking the link below.||";
	arrElement[1][2] = "Texas Council on Problem and Compulsive Gambling|http://www.gamblinghelpline.org/|We strive to prevent the onset and progression of problem, compulsive and pathological gambling by providing information using a variety of communication resources to increase the general public's awareness of gambling addiction, by providing training to professionals to recognize, treat and help gamblers and their families and by developing presentation models for at-risk populations, particularly youth, college-aged and older gamblers.|1-800-522-4700|";

	//Loneliness
	arrElement[2][0] = "FamilyLife|http://www.familylife.com/seewhocares/loneliness.htm|If you're married and lonely, you're not the only one.  Find out what causes isolation in marriage and how to overcome it.||";
	arrElement[2][1] = "National Foundation for Depressive Illness|http://www.depression.org/|The National Foundation For Depressive Illness (NAFDI) was established in 1983 to provide public and professional information about Affective Disorders, the availability of treatment, and the urgent need for further research. The Foundation is committed to an extensive, ongoing public information campaign addressed to this pervasive, costly, and hidden national emergency.|1-800-248-4344|";
	arrElement[2][2] = "National HopeLine|http://www.hopeline.com/|Support from across the country helps KBHC achieve its mission to prevent suicide and educate people about depressive disorders.|1-800-SUICIDE (784-2433)|";
	arrElement[2][3] = "National Institute of Mental Health Information Line|http://www.nimh.nih.gov/|The NIMH is the lead Federal agency for research on mental and behavioral disorders. Our mission is to reduce the burden of mental illness and behavioral disorders through research on mind, brain, and behavior. NIMH is also committed to educating the public about mental disorders and has developed many booklets and fact sheets that provide the latest research-based information on these illnesses.|1-800-421-4211|";
	arrElement[2][4] = "National Mental Health Association|http://www.nmha.org/|The National Mental Health Association is the country's oldest and largest nonprofit organization addressing all aspects of mental health and mental illness. With more than 340 affiliates nationwide, NMHA works to improve the mental health of all Americans, especially the 54 million people with mental disorders, through advocacy, education, research and service.|1-800-969-6642|";
	arrElement[2][5] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about loneliness, please visit our website by clicking the link below.||";

	//Porn
	arrElement[3][0] = "National Coalition|http://www.nationalcoalition.org/whocares/|The National Coalition for the Protection of Children & Families has partnered with \"Who Cares?\" to assist people struggling with sexual or pornographic addiction.  The Victim Assistance HelpLine is a great resource in the battle against these addictions.||";
	arrElement[3][1] = "FamilyLife|http://www.familylife.com/seewhocares/pornography.htm|Pornography can ruin a marriage, but you don't have to live with the guilt any longer. Find out how you can receive hope and healing.||";
	arrElement[3][2] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about pornographic addiction, please visit our website by clicking the link below.||";

	//Stress
	arrElement[4][0] = "Eating Disorders Awareness and Prevention|http://www.nationaleatingdisorders.org/|The National Eating Disorders Association (NEDA) is the largest not-for-profit organization in the United States working to prevent eating disorders and provide treatment referrals to those suffering from anorexia, bulimia and binge eating disorder and those concerned with body image and weight issues.|1-800-931-2237|";
	arrElement[4][1] = "National Foundation for Depressive Illness|http://www.depression.org/|The National Foundation For Depressive Illness (NAFDI) was established in 1983 to provide public and professional information about Affective Disorders, the availability of treatment, and the urgent need for further research. The Foundation is committed to an extensive, ongoing public information campaign addressed to this pervasive, costly, and hidden national emergency.|1-800-248-4344|";
	arrElement[4][2] = "National HopeLine|http://www.hopeline.com/|Support from across the country helps KBHC achieve its mission to prevent suicide and educate people about depressive disorders.|1-800-SUICIDE (784-2433)|";
	arrElement[4][3] = "National Institute of Mental Health Information Line|http://www.nimh.nih.gov/|The NIMH is the lead Federal agency for research on mental and behavioral disorders. Our mission is to reduce the burden of mental illness and behavioral disorders through research on mind, brain, and behavior. NIMH is also committed to educating the public about mental disorders and has developed many booklets and fact sheets that provide the latest research-based information on these illnesses.|1-800-421-4211|";
	arrElement[4][4] = "National Mental Health Association|http://www.nmha.org/|The National Mental Health Association is the country's oldest and largest nonprofit organization addressing all aspects of mental health and mental illness. With more than 340 affiliates nationwide, NMHA works to improve the mental health of all Americans, especially the 54 million people with mental disorders, through advocacy, education, research and service.|1-800-969-6642|";
	arrElement[4][5] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about suicide, please visit our website by clicking the link below.||";
	arrElement[4][6] = "Remuda Ranch Programs for Anorexia and Bulimia|http://www.remuda-ranch.com/|Remuda Ranch offers programs and settings that are distinctively different from the traditional, institutional format offered at hospitals and clinics. We provide a balanced approach, which produces a continuing lifestyle change through individualized, Biblically based programs designed to treat the whole person and meet her unique medical, nutritional and psychological needs.|1-800-445-1900|";

	//Substance Addiction
	arrElement[5][0] = "Al-Anon/Alateen Family Group Headquarters, Inc.|http://www.al-anon.alateen.org/|No matter what relationship you have with an alcoholic, whether they are still drinking or not, all who have been affected by someone else's drinking can find solutions that lead to serenity in the Al-Anon/Alateen fellowship.|1-800-344-2666 (U.S.)<br>1 800 443-4525 (Canada)|";
	arrElement[5][1] = "American Council for Drug Education|http://www.acde.org/|The American Council for Drug Education is a substance abuse prevention and education agency that develops programs and materials based on the most current scientific research on drug use and its impact on society.|1-800-488-3784|";
	arrElement[5][2] = "Cocaine Anonymous (CA)|http://www.ca.org/|Cocaine Anonymous is a fellowship of men and women who share their experience, strength and hope with each other that they may solve their common problem and help others to recover from their addiction. The only requirement for membership is a desire to stop using cocaine and all other mind-altering substances. There are no dues or fees for membership.|1-800-347-8998|";
	arrElement[5][3] = "Marijuana Anonymous|http://www.marijuana-anonymous.org/|Marijuana Anonymous is a fellowship of men and women who share our experience, strength, and hope with each other that we may solve our common problem and help others to recover from marijuana addiction. The only requirement for membership is a desire to stop using marijuana. There are no dues or fees for membership.|1-800-766-6779|";
	arrElement[5][4] = "National Clearinghouse for Alcohol and Drug Information|http://www.health.org|SAMHSA's National Clearinghouse for Alcohol and Drug Information (NCADI) is the Nation's one-stop resource for information about substance abuse prevention and addiction treatment.|1-800-729-6686|";
	arrElement[5][5] = "National Council on Alcoholism and Drug Dependence Hopeline|http://www.ncadd.org/|Founded in 1944 by Mrs. Marty Mann, a pioneer in the alcoholism field, the National Council on Alcoholism and Drug Dependence, Inc. (NCADD) provides education, information, help, and hope to the public.|1-800-622-2255|";
	arrElement[5][6] = "National Treatment Referral Hotline|http://www.nationalhotline.org/|Drug addiction help and alcoholism help is available for those persons desiring freedom from drug or alcohol addiction.|1-800-662-HELP (662-4357)|";
	arrElement[5][7] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about drug addiction, please visit our website by clicking the link below.||";

	//Sudden Loss
	arrElement[6][0] = "National Foundation for Depressive Illness|http://www.depression.org/|The National Foundation For Depressive Illness (NAFDI) was established in 1983 to provide public and professional information about Affective Disorders, the availability of treatment, and the urgent need for further research. The Foundation is committed to an extensive, ongoing public information campaign addressed to this pervasive, costly, and hidden national emergency.|1-800-248-4344|";
	arrElement[6][1] = "National HopeLine|http://www.hopeline.com/|Support from across the country helps KBHC achieve its mission to prevent suicide and educate people about depressive disorders.|1-800-SUICIDE (784-2433)|";
	arrElement[6][2] = "National Institute of Mental Health Information Line|http://www.nimh.nih.gov/|The NIMH is the lead Federal agency for research on mental and behavioral disorders. Our mission is to reduce the burden of mental illness and behavioral disorders through research on mind, brain, and behavior. NIMH is also committed to educating the public about mental disorders and has developed many booklets and fact sheets that provide the latest research-based information on these illnesses.|1-800-421-4211|";
	arrElement[6][3] = "National Mental Health Association|http://www.nmha.org/|The National Mental Health Association is the country's oldest and largest nonprofit organization addressing all aspects of mental health and mental illness. With more than 340 affiliates nationwide, NMHA works to improve the mental health of all Americans, especially the 54 million people with mental disorders, through advocacy, education, research and service.|1-800-969-6642|";
	arrElement[6][4] = "North American Mission Board|namb_landingpage.shtml|If you have questions or concerns about a sudden loss, please visit our website by clicking the link below.||";

	//Unexpected Pregnancy
	arrElement[7][0] = "Buckner Pregnancy Counseling|http://www.buckneradoption.org/|Throughout its history, Buckner has been on the cutting edge of serving the needs of children and families in society experiencing challenging life situations. That willingness to grow and adapt to change has made Buckner a leader in issues related to social care throughout Texas. It has also meant expanding into a wide array of programs and services.|1-800-441-2670|";
	arrElement[7][1] = "Crisis Help Line (United Way Helpline - Information and Referral)|http://www.unitedway.org/|Our experience tells us that the best way to help the most people is to focus on the root causes of a community's most serious problems. It takes the whole community--working together--to pull it off.</p><p>So we bring together people from all across the community--people from government, business, faith groups, nonprofits, the labor movement, and ordinary citizens--to tackle the issues that matter most.|1-800-233-4357|";
	arrElement[7][2] = "National Center for Victims of Crime (for rape or assault)|http://www.ncvc.org/|The National Center for Victims of Crime is the nation's leading resource and advocacy organization for crime victims. Since 1985, we have worked with more than 10,000 grassroots organizations and criminal justice agencies serving millions of crime victims. The mission of the National Center for Victims of Crime is to forge a national commitment to help victims of crime rebuild their lives. We are dedicated to serving individuals, families, and communities harmed by crime.|1-800-FYI-CALL (394-2255)|";
	arrElement[7][3] = "North American Mission Board Alternatives for Life|http://www.namb.net/|The objective of the North American Mission Board's Pregnancy Care Ministries is to assist 	churches, associations, and state conventions in providing ministries to:<ul><li>women of all ages who are facing crisis pregnancies</li><li>women who have experienced abortion</li><li>men whose children have been aborted</li><li>children and young people who are forming their morals and values</li><li>people who need to be educated and motivated to get involved in long-term, positive actions concerning abortion</li></ul>|1-800-962-0851|";
	arrElement[7][4] = "Option Line|http://www.optionline.org/|Your needs are important to us. Our trained consultants are available 24/7 to listen to your concerns and to answer your questions about pregnancy, abortion and related issues.||";
	arrElement[7][5] = "Rape, Abuse, and Incest National Network (RAINN)|http://www.rainn.org/|The Rape, Abuse & Incest National Network is the nation's largest anti-sexual assault organization. 	RAINN operates the National Sexual Assault Hotline and carries out programs to prevent sexual assault, help victims and ensure that rapists are brought to justice.|1-800-656-HOPE (656-4673)|";
	arrElement[7][6] = "Sexual Assault Crisis Line - Hotlines and Information||A national 24-hour hotline located in Mississippi, that can provide support and refer you to a crisis center locally.|1-800-643-6250|";

	//Miscellaneous
	arrElement[8][0] = "Alzheimer's Association|http://www.alz.org/|Our toll free, 24/7 Nationwide Contact Center is a vital resource for information, assistance, care consultation and referrals 24 hours a day, seven days a week.|1-800-272-3900|";
	arrElement[8][1] = "Association for Children for Enforcement of Support (ACES)|http://www.ismi.net/aces/index.html|ACES offers \"how to\" instructions and educational information about child support enforcement, visitation rights and paternity determination. ACES provides a telephone \"hot-line\" for affected families across the country whoare seeking information and understanding.|1-800-537-7072|";
	arrElement[8][2] = "Girls/Boys Town National Hotline|http://www.girlsandboystown.org/|Girls and Boys Town, the original Father Flanagan's Boys' Home, is a leader in the treatment and care of abused, abandoned and neglected girls and boys. Throughout its 88-year history, the nonprofit, nonsectarian organization has provided these children with a safe, caring, loving environment where they gain confidence to get better and learn skills to become productive citizens.|1-800-448-3000|";
	arrElement[8][3] = "Kids Help Phone (Canada)|http://www.kidshelphone.ca/|Every day, Kids Help Phone counsellors answer calls and online questions from across Canada. No matter what the problem or concern, our counsellors are there to provide immediate and caring support, information and, if necessary, referral to a local community or social service agency.|1-800-668-6868|";
	arrElement[8][4] = "National Center For Missing and Exploited Children|http://www.missingkids.com/|NCMEC offers the resources noted below to assist in cases of child sexual exploitation.<ul><li>A 24-hour Call Center and web site to report incidents</li><li>Case analysis, trained on-site response, and lead dissemination in coordination with law enforcement</li><li>Victim-identification assistance</li><li>Family and victim-support referrals</li><li>Legal-resource referrals</li></ul>|1-800-843-5678|";
	arrElement[8][5] = "National Child Abuse Hotline Childhelp USA|http://www.childhelpusa.org/|The Childhelp USA&#174; National Child Abuse Hotline is dedicated to the prevention of child abuse. Serving the United States, Canada, U.S. Virgin Islands, Puerto Rico, and Guam, the Hotline is staffed 24 hours daily with professional crisis counselors who utilize a database of thousands of resources. Communication in 140 languages is available through state-of-the-art technology that also makes possible three-way conversations with the counselor, the caller, and the nearest assistance.|1-800-4-A-Child (722-4453)|";
	arrElement[8][6] = "National Child Safety Council||The National Child Safety Council furnishes preventative child safety educational materials to school age children by means of programs conducted by local law enforcement departments and schools.|1-800-327-5107|";
	arrElement[8][7] = "National Runaway Hotline||Provides crisis intervention and travel assistance to runaways. Referrals to shelters nationwide. Relays messages to set up conference calls to parent at the request of the child. Operates 24 hours.|1-800-621-4000|";
	arrElement[8][8] = "National Youth Crisis Hotline|http://www.1800hithome.com/|Provides counseling and referrals to local drug treatment centers, shelters, and counseling services. Responds to youth dealing with pregnancy, molestation, suicide, and child abuse. Operates 24 hours, seven days a week.|1-800-448-4663|";
}

function displayCategories(strId,strContentId) {

	var strHTML = "<h1>Categories:</h1><ul>";

	for (i=0;i<arrIssue.length;i++) {
		strHTML = strHTML + "<li><a onmousedown=\"selectCategory('"+strId+"','"+strContentId+"',"+i+",0,3)\" href=\"#\">"+arrIssue[i]+"</a></li>";
	}

	strHTML = strHTML + "</ul>";

	document.getElementById(strId).innerHTML=strHTML;
	document.getElementById(strContentId).innerHTML="<h1>Get the help you need.</h1><p>Welcome to the Who Cares resource page, where you will find real help to deal with your problems.</p><p>To the left of this text is a list of resources.  These are links to people and organizations that want to help you.  Just pick a link that relates to whatever issue you are facing right now.  All you have to do is click on it and ask for help.  Use as many resources as you need to deal with the issues in your life.</p>";
}

function selectCategory(strId,strContentId,nbrCategory,nbrBegin,nbrEnd) {

	var strHTML = "<h1>" + arrIssue[nbrCategory] + ":</h1><ul>";

	if (nbrEnd > (arrElement[nbrCategory].length - 1)) {
		nbrEnd = (arrElement[nbrCategory].length - 1);
	}

	for (i=nbrBegin;i<=nbrEnd;i++) {
		var arrSplit = arrElement[nbrCategory][i].split("|");
		strHTML = strHTML + "<li><a onmousedown=\"displayContent('"+strContentId+"',"+nbrCategory+","+i+")\" href=\"#\">"+arrSplit[0]+"</a></li>";
	}

	document.getElementById(strId).innerHTML = strHTML + "</ul><span><a class=\"other_issues\" onmousedown=\"displayCategories('"+strId+"','"+strContentId+"');\" href=\"#\">&#62;&#62;&nbsp;Categories&nbsp;&#60;&#60;</a></span>";

	document.getElementById(strContentId).innerHTML = "<h1>Get the help you need.</h1><p>Welcome to the Who Cares resource page, where you will find real help to deal with your problems.</p><p>To the left of this text is a list of resources.  These are links to people and organizations that want to help you.  Just pick a link that relates to whatever issue you are facing right now.  All you have to do is click on it and ask for help.  Use as many resources as you need to deal with the issues in your life.</p>";

	if (!eval(document.getElementById("embed_video")) || arrVideo[nbrCategory] != document.getElementById("embed_video").standby) {
		document.getElementById("video_box_right").innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/swf/Gal_" + arrVideo[nbrCategory] + ".swf\" width=\"262\" height=\"225\" id=\"embed_video\" standby=\"" + arrVideo[nbrCategory] + "\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"/swf/Gal_" + arrVideo[nbrCategory] + ".swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /></object>";
	}

	displayPagination(strId,strContentId,nbrCategory,nbrBegin,nbrEnd);
}

function displayPagination(strId,strContentId,nbrCategory,nbrBegin,nbrEnd) {

	var nbrElements = arrElement[nbrCategory].length;
	var nbrMax = (nbrElements - 1);
	var nbrIncrement = 4;
	var nbrPages = Math.ceil(nbrElements/nbrIncrement);
	var nbrStart = 0;
	var nbrStop = 3;
	var strHTML = "<span>";

	if (nbrBegin != 0) {
		strHTML = strHTML + "<a href=\"javascript:selectCategory('" + strId + "','" + strContentId + "'," + nbrCategory + "," + (nbrBegin - nbrIncrement) + "," + (nbrBegin - 1) + ");\">&#60;&#60;</a>&nbsp;";
	} else {
		strHTML = strHTML + "&#60;&#60;&nbsp;";
	}

	for (i=1;i<=nbrPages;i++) {

		if (nbrStop > nbrMax) {
			nbrStop = nbrMax;
		}

		strHTML = strHTML + "&nbsp;<a href=\"javascript:selectCategory('" + strId + "','" + strContentId + "'," + nbrCategory + "," + nbrStart + "," + nbrStop + ");\">&#91;" + i + "&#93;</a>";
		nbrStart = nbrStart + nbrIncrement;
		nbrStop = nbrStop + nbrIncrement;
	}

	if (nbrEnd != nbrMax) {
		if ((nbrEnd + nbrIncrement) > nbrMax) {
			strHTML = strHTML + "&nbsp;<a href=\"javascript:selectCategory('" + strId + "','" + strContentId + "'," + nbrCategory + "," + (nbrEnd + 1) + "," + nbrMax + ");\">&#62;&#62;</a>";
		} else {
			strHTML = strHTML + "&nbsp;<a href=\"javascript:selectCategory('" + strId + "','" + strContentId + "'," + nbrCategory + "," + (nbrEnd + 1) + "," + (nbrEnd + nbrIncrement) + ");\">&#62;&#62;</a>";
		}
	} else {

		strHTML = strHTML + "&nbsp;&#62;&#62;";

	}

	strHTML = strHTML + "</span>";

	document.getElementById("menu").innerHTML = document.getElementById("menu").innerHTML + strHTML;
}

function displayContent(strContentId,nbrCategory,nbrElement) {

	var arrSplit = arrElement[nbrCategory][nbrElement].split("|");
	//document.getElementById(strContentId).innerHTML = "<h1>" + arrSplit[0] + "</h1><p>" + arrSplit[2] + "</p><p><a href=\""+arrSplit[1]+"\">"+arrSplit[1]+"</a></p>";

	var strImage = "";
	var strPhone = "";
	var strWebsite = "";

	if (arrSplit[1] != "") {
		strWebsite = "<p><a class=\"other_issues\" onMouseUp=\"stopVideo();\"onclick=\"openWindow('" + arrSplit[1] + "',850,650); return false;\" onkeypress=\"openWindow('" + arrSplit[1] + "',850,650); return false;\" href=\""+arrSplit[1]+"\">Get help from this organization.</a></p>";
	}

	if (arrSplit[3] != "") {
		strPhone = "<em>" + arrSplit[3] + "</em>";
	}

	if (arrSplit[4] != "") {
		strImage = "<a onMouseUp=\"stopVideo();\" onclick=\"openWindow('" + arrSplit[1] + "',850,650); return false;\" onkeypress=\"openWindow('" + arrSplit[1] + "',850,650); return false;\" style=\"border-style:none;\" href=\""+arrSplit[1]+"\"><img style=\"float:right;border-style:solid;border-width:1px;border-color:#ffffff;\" src=\"images/logos/" + arrSplit[4] + "\"></a>";
	}

	document.getElementById(strContentId).innerHTML = strImage + "<h1>" + arrSplit[0] + "</h1>" + strPhone + strWebsite + "<p>" + arrSplit[2] + "</p>";
}

function makeItStop(nbrVideo) {

	//SWF Names
	arrVideo[0] = "Divorce";
	arrVideo[1] = "Debt";
	arrVideo[2] = "Loneliness";
	arrVideo[3] = "Porn";
	arrVideo[4] = "Suicide";
	arrVideo[5] = "Drugs";
	arrVideo[6] = "Lost";
	arrVideo[7] = "Preg";
	arrVideo[8] = "ResourceFix";
	arrVideo[9] = "Intro";

	if (getCookie(arrVideo[nbrVideo]) == 1) {
		document.getElementById("video_box_right").innerHTML = "<div style=\"padding: 65px 0px 0px 85px;\"><a href=\"javascript:playVideo('" + arrVideo[nbrVideo] + "');\"><img style=\"margin: 0px 0px 0px 12px;\" src=\"/images/film.smallest2.gif\" /><br /><a class=\"gold\" href=\"javascript:playVideo('" + arrVideo[nbrVideo] + "');\">Click to Play Video</a></div>";
	} else {
		setCookie(arrVideo[nbrVideo],"1",0,".seewhocares.com","/");
	}
}

function playVideo(strVideo) {
	document.getElementById("video_box_right").innerHTML = "<object type=\"application/x-shockwave-flash\" data=\"/swf/Gal_" + strVideo + ".swf\" width=\"262\" height=\"225\" id=\"embed_video\" standby=\"" + strVideo + "\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"/swf/Gal_" + strVideo + ".swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /></object>";
}

function displayInitialCategory() {

	buildCategories();

	arrIssue[0] = "Divorce";
	arrIssue[1] = "Financial Hardship";
	arrIssue[2] = "Loneliness";
	arrIssue[3] = "Porn Addiction";
	arrIssue[4] = "Stress";
	arrIssue[5] = "Substance Addiction";
	arrIssue[6] = "Sudden Loss";
	arrIssue[7] = "Unexpected Pregnancy";
	arrIssue[8] = "Miscellaneous";

	if (document.referrer.indexOf("porn") != -1) {
		selectCategory('menu','box_content',3,0,3);
	}
	else if (document.referrer.indexOf("divorce") != -1) {
		selectCategory('menu','box_content',0,0,3);
	}
	else if (document.referrer.indexOf("preg") != -1) {
		selectCategory('menu','box_content',7,0,3);
	}
	else if (document.referrer.indexOf("debt") != -1) {
		selectCategory('menu','box_content',1,0,3);
	}
	else if (document.referrer.indexOf("loneliness") != -1) {
		selectCategory('menu','box_content',2,0,3);
	}
	else if (document.referrer.indexOf("sudden") != -1) {
		selectCategory('menu','box_content',6,0,3);
	}
	else if (document.referrer.indexOf("drug") != -1) {
		selectCategory('menu','box_content',5,0,3);
	}
	else if (document.referrer.indexOf("suicide") != -1) {
		selectCategory('menu','box_content',4,0,3);
	}
	else {
		displayCategories('menu','box_content');
	}
} 

function checkFlash(nbrFlashversion) {

	if (nbrFlashversion < 1) {
		/* This Flash detection code was originally written by Peter-Paul Koch at http://www.quirksmode.org/.  He has allowed for this to be freely distributed per his copyright located at http://www.quirksmode.org/about/copyright.html. */

		if (navigator.plugins && navigator.plugins.length) {
			x = navigator.plugins["Shockwave Flash"];
			if (x) {

				flashinstalled = 2;
				if (x.description) {
					y = x.description;
					nbrFlashversion = y.charAt(y.indexOf('.')-1);
				}
			} else {
				flashinstalled = 1;
			}

			if (navigator.plugins["Shockwave Flash 2.0"]) {
				flashinstalled = 2;
				nbrFlashversion = 2;
			}

		} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
			x = navigator.mimeTypes['application/x-shockwave-flash'];
			if (x && x.enabledPlugin) {
				flashinstalled = 2;
			} else {
				flashinstalled = 1;
			}
		}
	}

	if (nbrFlashversion < 8) {
		document.getElementById("video_box_right").innerHTML = "<div class=\"video_box_right\"><p>This site requires Flash 8 in order for the videos to display properly.</p><p>Please click <a onclick=\"openWindow('http://www.macromedia.com/go/getflashplayer',850,650); return false;\" onkeypress=\"openWindow('http://www.macromedia.com/go/getflashplayer',850,650); return false;\" href=\"http://www.macromedia.com/go/getflashplayer\">here</a> to open a new window where you will be able to install or upgrade your version of Flash.</p><p>Once you have Flash 8 installed, please return to this window and click <a href=\"javascript:window.location.href = location;\">here</a>.  If the video doesn't start playing, you made need to restart your web browser.</p></div>";
	}
}

function stopVideo() {
	document.getElementById('video_box_right').innerHTML='';
}

function setGoBack(location) {
	var strLocation = '' + location;
	var strQuery = strLocation.substring((strLocation.indexOf('?')) + 1);
	if (strLocation.indexOf('?') == -1) {

		document.getElementById('comm_divorce').href = document.getElementById('comm_divorce').href + "?" + document.referrer;
		document.getElementById('comm_drug').href = document.getElementById('comm_drug').href + "?" + document.referrer;
		document.getElementById('comm_debt').href = document.getElementById('comm_debt').href + "?" + document.referrer;
		document.getElementById('comm_loneliness').href = document.getElementById('comm_loneliness').href + "?" + document.referrer;
		document.getElementById('comm_porn').href = document.getElementById('comm_porn').href + "?" + document.referrer;
		document.getElementById('comm_suicide').href = document.getElementById('comm_suicide').href + "?" + document.referrer;
		document.getElementById('comm_suddenloss').href = document.getElementById('comm_suddenloss').href + "?" + document.referrer;
		document.getElementById('comm_preg').href = document.getElementById('comm_preg').href + "?" + document.referrer;
	} else {
		document.getElementById('comm_divorce').href = document.getElementById('comm_divorce').href + "?" + strQuery;
		document.getElementById('comm_drug').href = document.getElementById('comm_drug').href + "?" + strQuery;
		document.getElementById('comm_debt').href = document.getElementById('comm_debt').href + "?" + strQuery;
		document.getElementById('comm_loneliness').href = document.getElementById('comm_loneliness').href + "?" + strQuery;
		document.getElementById('comm_porn').href = document.getElementById('comm_porn').href + "?" + strQuery;
		document.getElementById('comm_suicide').href = document.getElementById('comm_suicide').href + "?" + strQuery;
		document.getElementById('comm_suddenloss').href = document.getElementById('comm_suddenloss').href + "?" + strQuery;
		document.getElementById('comm_preg').href = document.getElementById('comm_preg').href + "?" + strQuery;
	}
}

function goBack(location) {
	var strLocation = '' + location;
	var strQuery = strLocation.substring((strLocation.indexOf('?')) + 1);
	if (strLocation.indexOf('?') == -1) {
		history.back();
	} else {
		window.location.href = strQuery;
	}
	//window.location.href = strQuery;
}

function openWindow(strLocation,nbrWidth,nbrHeight) { 
	var strOptions = "location=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=" + nbrWidth + ",height=" + nbrHeight;
	var nbrRandom=Math.floor(Math.random()*100001);

	var objWindow = window.open(strLocation, String(nbrRandom), strOptions);
	objWindow.focus();

	return true;
}

function getExpiryDate(intDays) {

	var strUTC; //This will hold the UTC value

	strToday = new Date(); //Get the current date.
	strToday.setTime(strToday.getTime() + 3600000*24*intDays); //Add the number of days to keep alive
	strUTC = strToday.toUTCString(); //Convert the UTC back to a string.

	return strUTC; //Return the date.
}

function getCookie(strName) {

	var strCookie = document.cookie;
	var strPrefix = strName + "=";
	var intBegin = strCookie.indexOf(";" + strPrefix);

	if (intBegin == -1) {

		intBegin = strCookie.indexOf(strPrefix);

		if (intBegin != 0) {
			return "";
		}

	} else {

		intBegin += 1;

	}

	var intEnd = document.cookie.indexOf(";",intBegin);

	if (intEnd == -1) {
		intEnd = strCookie.length;
	}

	return unescape(strCookie.substring(intBegin + strPrefix.length, intEnd));
}

function setCookie(strName,strValue,strDuration,strDomain,strPath) {

	var strCookie="";

	if (strDuration == 0) {
		strCookie=strName+"="+escape(strValue)+";DOMAIN="+strDomain+";PATH="+strPath;
	} else {
		strCookie=strName+"="+escape(strValue)+";EXPIRES="+getExpiryDate(strDuration)+";DOMAIN="+strDomain+";PATH="+strPath;
	}

	document.cookie=strCookie;

	if(!getCookie(strName)){
		return false;
	}
	else{
		return true;
	}
}

function deleteCookie(strName) {
	setCookie(strName,"",-1,".seewhocares.com","/");
}

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
