window.onload=bl_init;function bl_init()
{if(navigator.appVersion.indexOf("MSIE 6")!=-1){pngfix();}
if(document.getElementById("home_ticker")){bl_ticker_init();}
on_exit_popup_init();}
var bl_ticker_array=new Array();var bl_ticker_t;var bl_ticker_current;function bl_ticker_init()
{var elements=document.getElementById("home_ticker").getElementsByTagName("li");var i;for(i=0;i<elements.length;i++)
{if(elements[i].id!=""){bl_ticker_array.push(elements[i].id);}}
bl_ticker_move(0,true);}
function bl_ticker_move(current,auto)
{if(current>=bl_ticker_array.length){current=0;}
if(current<0){current=(bl_ticker_array.length-1);}
clearTimeout(bl_ticker_t);var i;for(i=0;i<bl_ticker_array.length;i++)
{if(document.getElementById(bl_ticker_array[i]))
{document.getElementById(bl_ticker_array[i]).style.display='none';document.getElementById(bl_ticker_array[i]).style.visibility='hidden';}}
if(document.getElementById(bl_ticker_array[current]))
{document.getElementById(bl_ticker_array[current]).style.display='block';document.getElementById(bl_ticker_array[current]).style.visibility='visible';}
bl_ticker_current=current;if(auto)
{current+=1;bl_ticker_t=setTimeout("bl_ticker_move("+current+",true);",4000);}
else
{document.getElementById("widgets_ticker_play_pause").src=document.getElementById("widgets_ticker_play_pause").src.replace("pause_","play_");}}
function bl_ticker_play_pause(obj)
{if(navigator.appVersion.indexOf("MSIE 6")!=-1)
{if(obj.style.filter.indexOf('play_')!=-1)
{obj.style.filter=obj.style.filter.replace("play_","pause_");bl_ticker_move((bl_ticker_current-1),true);}
else
{obj.style.filter=obj.style.filter.replace("pause_","play_");bl_ticker_move(bl_ticker_current,false);}}
if(obj.src.indexOf('play_')!=-1)
{obj.src=obj.src.replace("play_","pause_");bl_ticker_move((bl_ticker_current-1),true);}
else
{obj.src=obj.src.replace("pause_","play_");bl_ticker_move(bl_ticker_current,false);}}
function button_state_change(obj,new_state)
{var states=new Array("_ia","_mo","_md");var changed=0;var i;for(i=0;i<states.length;i++)
{if(navigator.appVersion.indexOf("MSIE 6")!=-1)
{if(obj.style.filter.indexOf(states[i])!=-1&&changed==0)
{obj.style.filter=obj.style.filter.replace(states[i],new_state);changed=1;}}
if(obj.src.indexOf(states[i])!=-1&&changed==0)
{obj.src=obj.src.replace(states[i],new_state);changed=1;}}}
function pngfix()
{if(navigator.appVersion.indexOf("MSIE 6")!=-1)
{var tag_array=new Array("a","b","br","div","embed","font","form","frame","h","h1","h2","h3","h4","h5","h6","i","img","iframe","li","p","select","span","strong","table","td","textarea","ul");var img_array=document.getElementsByTagName("img");var bg_array=new Array();var bg_path;var temp_path;var i=0;var j=0;var img_width=0;var img_height=0;for(i=0;i<img_array.length;i++)
{if(img_array[i].src.indexOf(".png")!=-1||img_array[i].src.indexOf(".php")!=-1)
{img_width=img_array[i].offsetWidth;img_height=img_array[i].offsetHeight;img_array[i].style.width=img_width+"px";img_array[i].style.height=img_height+"px";if(img_array[i].src.indexOf("%26%23039%3B")!=-1){img_array[i].src=img_array[i].src.replace("%26%23039%3B","%27");}
img_array[i].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod='none',src=\'"+img_array[i].src+"\')";img_array[i].src="http://media.boyslife.org/old/images/test/spacer.png";}}
for(i=0;i<tag_array.length;i++)
{bg_array=document.getElementsByTagName(tag_array[i]);for(j=0;j<bg_array.length;j++)
{if(bg_array[j].currentStyle['backgroundImage'].indexOf(".png")!=-1)
{bg_path=bg_array[j].currentStyle['backgroundImage'];bg_path=bg_path.replace(".png",".gif");bg_array[j].style.backgroundImage=bg_path;}}}}}
var exit_popup_toggle=false;var bl_href=new Array();var bl_href_count=0;var safe_sites=Array();var embed_array=Array();function on_exit_popup_init()
{var a_array=document.getElementsByTagName("a");embed_array=document.getElementsByTagName("embed");safe_sites=Array("bldevsite.com","scouting.org","boyslife.org","kintera.org","doubleclick.net","traffic.outbrain.com","magcomm.securesites.com","javascript:","scoutstuff.org","wordpress.com");var i;var j;bl_href_count=0;bl_href=new Array();var safe_site_missing=true;document.getElementById('global_footer').innerHTML+="<div id=\"boyslife_exit_popup\" class=\"exit_popup\" onclick=\"on_exit_popup(0);\"></div><div id=\"boyslife_exit_window\" class=\"exit_window\"><h3>YOU'RE LEAVING <i>BOYSLIFE.ORG</i>...</h3><div class=\"exit_text\"><p>The link you clicked will take you to a site that is not controlled by <i>Boys' Life</i> magazine or the Boy Scouts of America. This website's privacy policy and security practices might differ from <i>Boys' Life</i> and BSA standards.</p></div><div class=\"exit_buttons\"><a href=\"\" onclick=\"on_exit_popup(0); return false;\">Go Back to <i>Boys' Life</i></a><a id=\"boyslife_exit_link\" href=\"#\" target=\"_blank\" onclick=\"setTimeout('on_exit_popup(0);',1000);\">Continue</a></div></div>";for(i=0;i<a_array.length;i++)
{var current_index=i;safe_site_missing=true;for(j=0;j<safe_sites.length;j++)
{if(a_array[i].href.indexOf(safe_sites[j])!=-1){safe_site_missing=false;}}
if(a_array[i].href!=""&&safe_site_missing){bl_href.push(a_array[i]);a_array[i].onclick=new Function("on_exit_popup("+bl_href_count+"); return false;");bl_href_count++;}}}
function on_exit_popup(url_index)
{var i;exit_popup_toggle=!exit_popup_toggle;if(exit_popup_toggle)
{window.scrollTo(0,0);document.getElementById('boyslife_exit_popup').style.display="block";document.getElementById('boyslife_exit_popup').style.visibility="visible";document.getElementById('boyslife_exit_window').style.display="block";document.getElementById('boyslife_exit_window').style.visibility="visible";document.getElementById('boyslife_exit_link').href=bl_href[url_index].href;if(bl_href[url_index].target!=""){document.getElementById('boyslife_exit_link').target=bl_href[url_index].target;}
else{document.getElementById('boyslife_exit_link').target="_self";}
document.body.style.overflowY="hidden";document.body.style.overflowX="hidden";for(i=0;i<embed_array.length;i++)
{embed_array[i].style.display="none";}
if(navigator.appVersion.indexOf("MSIE 6")!=-1||navigator.appVersion.indexOf("MSIE 7")!=-1)
{document.getElementById('boyslife_exit_popup').style.width=document.body.scrollWidth+"px";document.getElementById('boyslife_exit_popup').style.height=document.body.scrollHeight+"px";document.getElementById('boyslife_exit_window').style.left=((document.body.offsetWidth/2)-200)+"px";var html_tag=document.getElementsByTagName("html");html_tag[0].style.overflowY="hidden";html_tag[0].style.overflowX="hidden";}
else
{document.getElementById('boyslife_exit_popup').style.width="100%";document.getElementById('boyslife_exit_popup').style.height=document.body.scrollHeight+"px";}}
else
{for(i=0;i<embed_array.length;i++)
{embed_array[i].style.display="";}
if(navigator.appVersion.indexOf("MSIE 6")!=-1||navigator.appVersion.indexOf("MSIE 7")!=-1)
{document.getElementById('boyslife_exit_popup').style.width=1+"px";document.getElementById('boyslife_exit_popup').style.height=1+"px";document.getElementById('boyslife_exit_window').style.left=0+"px";var html_tag=document.getElementsByTagName("html");html_tag[0].style.overflowY="auto";html_tag[0].style.overflowX="hidden";}
else
{document.getElementById('boyslife_exit_popup').style.width="100%";document.getElementById('boyslife_exit_popup').style.height=document.body.scrollHeight+"px";}
document.getElementById('boyslife_exit_link').href="#";document.getElementById('boyslife_exit_window').style.display="none";document.getElementById('boyslife_exit_window').style.visibility="hidden";document.getElementById('boyslife_exit_popup').style.display="none";document.getElementById('boyslife_exit_popup').style.visibility="hidden";document.body.style.overflowY="auto";document.body.style.overflowX="auto";}}
