//Question Wheel Functionsvar questionArray = [["If I try Meth, will I become an addict?", staticServer+"/answers/if-i-try-meth-will-i-become-an-addict.html", "/homepage/bg-if-i-try-meth-will-i-become-an-addict.jpg"],				["What's Meth made of?", staticServer+"/answers/whats-meth-made-of.html", "/homepage/bg-what-is-meth-made-of.jpg"],				["How can meth affect my friends and family?", staticServer+"/answers/how-can-meth-affect-my-friends-and-family.html", "/homepage/bg-how-can-meth-affect-my-friends-and-family.jpg"],								["How can Meth lead to unwanted sex?", staticServer+"/answers/how-can-meth-lead-to-unwanted-sex.html", "/homepage/bg-how-can-meth-lead-to-unwanted-sex.jpg"],				["Does Meth make you violent?", staticServer+"/answers/does-meth-make-you-violent.html", "/homepage/bg-does-meth-make-you-violent.jpg"],				["What is &#8220;chasing the high&#8221;?", staticServer+"/answers/what-is-chasing-the-high.html", "/homepage/bg-what-is-chasing-the-high.jpg"],				["Why does Meth cause paranoia?", staticServer+"/answers/why-does-meth-cause-paranoia.html", "/homepage/bg-why-does-meth-cause-paranoia.jpg"],				["Why do Meth users have open sores?", staticServer+"/answers/why-do-meth-users-have-open-sores.html", "/homepage/bg-why-do-meth-users-have-open-sores.jpg"],				["What is the high from Meth like?", staticServer+"/answers/what-is-the-high-from-meth-like.html", "/homepage/bg-what-is-the-high-from-meth-like.jpg"],								["What is Meth-induced psychosis?", staticServer+"/answers/what-is-meth-induced-psychosis.html", "/homepage/bg-what-is-meth-induced-psychosis.jpg"],							["What does Meth do to your brain?", staticServer+"/answers/what-does-meth-do-to-your-brain.html", "/homepage/bg-what-does-meth-do-to-your-brain.jpg"],				["What does Meth do to your body?", staticServer+"/answers/what-does-meth-do-to-your-body.html", "/homepage/bg-what-does-meth-do-to-your-body.jpg"],				["Will using Meth change how I look?", staticServer+"/answers/will-using-meth-change-how-i-look.html", "/homepage/bg-will-using-meth-change-how-i-look.jpg"],				["How dangerous is Meth?", staticServer+"/answers/how-dangerous-is-meth.html", "/homepage/bg-how-dangerous-is-meth.jpg"],								["What is &#8220;Meth Mouth&#8221;?", staticServer+"/answers/what-is-meth-mouth.html", "/homepage/bg-what-is-meth-mouth.jpg"],				["What are &#8220;crank bugs&#8221;?", staticServer+"/answers/what-are-crank-bugs.html", "/homepage/bg-what-are-crank-bugs.jpg"],									["Does Meth affect your heart?", staticServer+"/answers/does-meth-affect-your-heart.html", "/homepage/bg-does-meth-affect-your-heart.jpg"],								["What is Meth?", staticServer+"/answers/what-is-meth.html", "/homepage/bg-what-is-meth.jpg"],								["Does Meth have long-term effects?", staticServer+"/answers/does-meth-have-long-term-effects.html", "/homepage/bg-does-meth-have-long-term-effects.jpg"],				["Will Meth make me lose control?", staticServer+"/answers/will-meth-make-me-lose-control.html", "/homepage/bg-will-meth-make-me-lose-control.jpg"],				["What's it like to come down from Meth?", staticServer+"/answers/whats-it-like-to-come-down-from-meth.html", "/homepage/bg-whats-it-like-to-come-down-from-meth.jpg"],				["How can I tell if someone is using Meth?", staticServer+"/answers/how-can-i-tell-if-someone-is-using-meth.html", "/homepage/bg-how-can-i-tell-if-someone-is-using-meth.jpg"],				["What is &#8220;tweaking&#8221;?", staticServer+"/answers/what-is-tweaking.html", "/homepage/bg-what-is-tweaking.jpg"],				["Why are Meth users so thin?", staticServer+"/answers/why-are-meth-users-so-thin.html", "/homepage/bg-why-are-meth-users-so-thin.jpg"],				["Why do meth labs blow up?", staticServer+"/answers/why-do-meth-labs-blow-up.html", "/homepage/bg-why-do-meth-labs-blow-up.jpg"],				["What can I do if a friend is using Meth?", staticServer+"/answers/what-can-i-do-if-a-friend-is-using-meth.html", "/homepage/bg-what-can-i-do-if-a-friend-is-using-meth.jpg"]				];var nonTransBrowser = isNonTransBrowser();function isNonTransBrowser() {	//if(getInternetExplorerVersion() < 9 && getInternetExplorerVersion() != -1) return true;		return false;	}function imgPathEndsWith(str, suffix) {    return str.indexOf(suffix, str.length - suffix.length) !== -1;}function fadeHomeImageOut() {	if (scrollableIsSeeking) {		return; // do not continue if seeking	}	if (imgPathEndsWith($(".home_image img").attr("src"), "img/ask_large.png")) return;	$(".home_image").stop().animate({opacity: 0}, { duration: 250, complete: function() { 		$(".home_image img").stop();				$(".home_image img").css("width","544px");		$(".home_image img").css("height","412px");				$(".home_image img").css("margin-left",((($(document).width()/2) - ($(".home_image img").width()/2))+"px"));		$(".home_image img").css("margin-top","176px");				$(".home_image img").css("top","0px");		$(".home_image img").css("left","0px");		$(".home_image img").attr("src","img/ask_large.png");		$('.home_image img').imagesLoaded(function(img) {			$(".home_image").fadeTo(500,1);			$(".home_image img").animate({top: "-20px"},{ duration: 2000, queue: false, easing: 'swing' });		});		}});	}function resizeHomeBg() {	var iWidth = 1137;	var iHeight = 996;		$('.wrapper').css("width","100%");	$(".home_image").css("width","100%");	$(".home_screen").css("width","100%");		// only resize img if it is not the ask image	if (!imgPathEndsWith($(".home_image img").attr("src"), "img/ask_large.png")) {		if ($(document).width() > $(document).height()) {			var calcHeight = ($(document).width()*iHeight/iWidth)-20;			var scaler = (calcHeight < $(document).height())?($(document).height()/calcHeight*1.00):1.00;			$(".home_image img").css("width",($(document).width()*scaler)+"px");			$(".home_image img").css("height",($(document).width()*iHeight/iWidth*scaler)+"px");		} else {			$(".home_image img").css("height",($(document).height()+20)+"px");			$(".home_image img").css("width",($(document).height()*iWidth/iHeight)+"px");				}		$(".home_image img").css("margin-left",(Math.min(($(".home_image img").width()-$(".wrapper").width())/-2,0)+"px"));		$(".home_image img").css("margin-top",(Math.min(($(".home_image img").height()-$(".wrapper").height())/-2,0)+"px"));	} else {		// just move left or right		$(".home_image img").css("margin-left",((($(document).width()/2) - ($(".home_image img").width()/2))+"px"));	}	$(".home_image").css("height",Math.max(Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight),$('.wrapper').height())-((isIE8)?4:0)+"px");	$(".home_screen").css("height",Math.max(Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight),$('.wrapper').height())-((isIE8)?4:0)+"px");}var questionsAtOnce = 9;function populateLists() {	var listHTML = "";	for (i = 0; i < questionArray.length; i++) {		if ( i % questionsAtOnce == 0) listHTML +="<div class='group'>";		listHTML += "<div class='question' rel='"+questionArray[i][2]+"'><a href='"+questionArray[i][1]+"'>"+questionArray[i][0]+"</a></div>";		if ( i % questionsAtOnce == questionsAtOnce - 1) listHTML +="</div>";	}	// close the group div if we didn't end with a full group	if ( questionArray.length % questionsAtOnce != 0 ) listHTML +="</div>";		$('.scrollable .items').html(listHTML);	$('.scrollable').css("height",(43 * questionsAtOnce) +"px")	$('.scrollable .items').css("height",($($('.scrollable .items .question')[0]).height()*questionArray.length)+"px")}function questionHover(imgPath) {		if (scrollableIsSeeking) {		func = "questionHover('"+imgPath+"')";		hoverTimer = setTimeout(func);		return; // do not continue if seeking	}	if (imgPathEndsWith($(".home_image img").attr("src"), "img"+imgPath)) return; //Don't fade same image	curStyle = $(".home_image img").attr("style");	$(".home_image").stop().animate({opacity: 0}, { duration: 250, complete: function() { 		$(".home_image img").stop();		$(".home_image img").css("top","0px");		$(".home_image img").css("left","0px");		$(".home_image img").attr("src","img"+imgPath);				resizeHomeBg();				$('.home_image img').imagesLoaded(function(img) {			$(".home_image").fadeTo(500,1);				$(".home_image img").animate({top: "-20px"},{ duration: 2000, queue: false, easing: 'swing' });		});		}});	//$(".home_screen").stop().fadeTo(1000,.4);}function animateIntro() {		var sectionOffset = Number($(window).height()*0.5);	$('#intro').css({"top":(sectionOffset-$("#intro").height())+"px","marginTop":"0px","paddingTop":"0px"});	$('#intro').fadeTo(2000,1, function() { 		a = setTimeout("$('#intro').fadeTo(3000,0, function() {$('#intro').css('display','none')})", 1000);		a = setTimeout("animateLists();",3500);	} );}function animateLists() {	$('.btnAsk').animate({opacity: 0, left: (($(document).width() - $('.content').width())/2 + $('.content').width() - 88)+"px"},1);		$(".home_image img").css("width","544px");		$(".home_image img").css("height","412px");				$(".home_image img").css("margin-left",((($(document).width()/2) - ($(".home_image img").width()/2))+"px"));		$(".home_image img").css("margin-top","176px");				$(".home_image img").css("top","-20px");		$(".home_image img").css("left","0px");		$(".home_image img").attr("src","img/ask_large.png");	fadeHomeImageOut();		$('.scrollable,.prev,.next').fadeIn(1000);	$(".home_screen").fadeTo(1000,.4);			// if there are more than 2 pages of questions	if (questionArray.length > (questionsAtOnce * 2)) {		// move to the second page so prev and next buttons are both enabled		$('.scrollable').data('scrollable').seekTo(1, 0);	}		$(window).load(function() {	var bgImgArray = [];	for (i=0;i<questionArray.length;i++) {		bgImgArray.push("/img"+questionArray[i][2]);		}	$(bgImgArray).preload();	});}var hoverTimer;var scrollableIsSeeking = false;var seekingTimer;$(document).ready(function() {	//Password Protection Hack	/*	var passwordCookie = Get_Cookie("validated");	if (passwordCookie == null) return;*/	populateLists();	$(".scrollable").scrollable({		vertical: true,		mousewheel: true,		onBeforeSeek: function() {			scrollableIsSeeking = true;			clearTimeout(hoverTimer);			$(".home_image").stop();			$(".home_image img").stop();		},		onSeek: function() {			clearTimeout(seekingTimer);			seekingTimer = setTimeout(function() {				scrollableIsSeeking = false;			}, 500);		}	});		if(Get_Cookie("returnVisitor")) {		animateLists();		} else {		Set_Cookie("returnVisitor",true);		animateIntro();	}	$(".question a").hover(function() {		clearTimeout(hoverTimer);		var functionString = "questionHover('"+$(this).parent().attr('rel')+"')";		hoverTimer = setTimeout(functionString, 300);	},	function() {		clearTimeout(hoverTimer);		hoverTimer = setTimeout(fadeHomeImageOut, 300);	});	resizeHomeBg();});$.fn.imagesLoaded = function(callback){  var elems = this.filter('img'),      len = elems.length,      blank = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";        elems.bind('load.imgloaded',function(){      if (--len <= 0 && this.src !== blank){        elems.unbind('load.imgloaded');        callback.call(elems,this);      }  }).each(function(){     // cached images don't fire load sometimes, so we reset src.     if (this.complete || this.complete === undefined){        var src = this.src;        // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f        // data uri bypasses webkit log warning (thx doug jones)        this.src = blank;        this.src = src;     }  });  return this;};$(window).resize(function() {	resizeHomeBg();});
