document.write('<script type="text/javascript" src="' + location.protocol + '//www.active.com/SiteFiles/A2/config.js?ver=2.4.0"></scr' + 'ipt>');

/*All Channels*/
Effect.ChannelsUp=function(element){
element=$(element);
element.makeClipping();
return new Effect.Scale(element,0,
Object.extend({scaleContent:false,
scaleX:false,
restoreAfterFinish:true,
afterUpdate:function(effect){
updateOpaque();
},
afterFinishInternal:function(effect){
effect.element.hide();
effect.element.undoClipping();
updateOpaque();
$('all_channels_opaque').hide();
}
},arguments[1]||{})
);
}
Effect.ChannelsDown=function(element){
element=$(element);
var elementDimensions=element.getDimensions();
return new Effect.Scale(element,100,
Object.extend({scaleContent:false,
scaleX:false,
scaleFrom:0,
scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},
restoreAfterFinish:true,
afterSetup:function(effect){
effect.element.makeClipping();
effect.element.setStyle({height:'0px'});
effect.element.show();
},
afterUpdate:function(effect){
updateOpaque();
},
afterFinishInternal:function(effect){
effect.element.undoClipping();
updateOpaque();
}
},arguments[1]||{})
);
}
var allChannelsOpen=false;
var allChannelsClose=false;
updateOpaque=function(){
var ac=$('all_channels');
var opaque=$('all_channels_opaque');
opaque.style.top=ac.offsetTop+'px';
opaque.style.left=ac.offsetLeft+'px';
opaque.style.width=ac.offsetWidth+'px';
opaque.style.height=ac.offsetHeight+'px';
opaque.show();
}
function initAllChannels(){
if($('all_channels_button')){
insideAllChannels=0;
showAllChannelsHandle=null;
hideAllChannelsHandle=null;
blinding=false;
showAllChannels=function(){
if(blinding)return;
if(!$('all_channels').visible()&&allChannelsOpen){
blinding=true;
troubTab('hide')
new Effect.ChannelsDown('all_channels',{duration:.3,afterFinish:function(){blinding=false;}});
}
}
hideAllChannels=function(){
if(blinding)return;
if($('all_channels').visible()&&insideAllChannels==0){
blinding=true;
new Effect.ChannelsUp('all_channels',{duration:.3,afterFinish:function(){blinding=false;}});
setTimeout("troubTab('show')",200);
}
}
troubTab=function(action){
var f=$$('#mod_featured.tab_box .title');
for(var i=0;i<f.length;i++){
if(action=="show"){
Element.show(f[i]);
document.getElementById("mod_featured").style.paddingTop="0em";
}
else{
Element.hide(f[i]);
document.getElementById("mod_featured").style.paddingTop="3.14em";
}
}
}
fireHideAllChannels=function(wait){
if(hideAllChannelsHandle){
clearTimeout(hideAllChannelsHandle);
}
hideAllChannelsHandle=setTimeout("hideAllChannels()",wait);
}
$('all_channels_button').onmouseover=function(){
allChannelsOpen=true;
setTimeout("showAllChannels()",200);
}
$('all_channels_button').onmouseout=function(){
allChannelsOpen=false;
fireHideAllChannels(400);
}
$('all_channels_button').onclick=function(){
if(!$('all_channels').visible()){
showAllChannels();
}else{
hideAllChannels();
}
}
$('all_channels').onmouseout=function(){
allChannelsClose=true;
insideAllChannels--;
fireHideAllChannels(400);
}
$('all_channels').onmouseover=function(){
insideAllChannels++;
allChannelsClose=false;
}
}
}

/*Breadcrumbs*/
function cnvrt2Upper(str){
newVal='';
val=str.split(' ');
for(var c=0;c<val.length;c++){
if(val[c]!="and"){
newVal+=val[c].substring(0,1).toUpperCase()+val[c].substring(1,val[c].length)+' ';
}else{
newVal+=val[c].substring(0,val[c].length)+' ';
}
}
return newVal.strip();
}
function splitAnd(str){
newVal='';
val=str.split('and');
for(var c=0;c<val.length;c++){
newVal+=val[c].substring(0,val[c].length)+' and ';
}
return newVal.slice(0,newVal.length-5);
}
function breadcrumbs(){
if($('breadcrumbs')&&location.host!=sCommunityUrl){
sURL=new String;
bits=new Object;
var x=0;
var stop=0;
var output="<a href=\"http://"+sActiveUrl+"/\">Active.com</a>&nbsp;&gt;&nbsp;";
var displayChan="";
sURL=location.pathname;
sURL=sURL.slice(1,sURL.length);
finalChar=sURL.slice(sURL.length-1,sURL.length);
if(finalChar=="/")sURL=sURL.slice(0,sURL.length-1);
while(!stop){
chunkStart=sURL.indexOf("/");
if(chunkStart!=-1){
bits[x]=sURL.slice(0,chunkStart)
sURL=sURL.slice(chunkStart+1,sURL.length);
}else{
stop=1;
}
x++;
}
for(i=0;i<x-1;i++){
if(bits[i]!="Articles"&&bits[i]!="articles"&&bits[i]!="A2"&&bits[i]!="page"&&bits[i]!="coolrunning"&&bits[i]!="getactive"){
output+="<a href=\"";
for(y=1;y<x-i;y++){
output+="../";
}
if(finalChar=="/")output+="../";
if(bits[i]=="mountainbiking"){
var displayChan="Mountain Biking";
}else if(bits[i]=="actionsports"){
var displayChan="Action Sports";
}else if(bits[i]=="mindandbody"){
var displayChan="Mind and Body";
}else if(bits[i]=="fieldhockey"){
var displayChan="Field Hockey";
}else if(bits[i]=="icehockey"){
var displayChan="Ice Hockey";
}else if(bits[i]=="healthandfitness"){
var displayChan="Fitness";
}else if(bits[i]=="lifestylevehicles"){
var displayChan="Lifestyle Vehicles";
}else if(bits[i]=="Holidaygiftguide"){
var displayChan="Holiday Gift Guide";
}else{
var displayChan=cnvrt2Upper(bits[i]);
if(bits[0].toLowerCase() == "directory"){
displayChan = displayChan.replace(/-/g," ")
}
}
output+=bits[i]+"/\">"+displayChan+"</a>&nbsp;&gt;&nbsp;";
}
}
if(x==1){
if(sURL=="mountainbiking.htm"||sURL=="mountainbiking"){
$('breadcrumbs').innerHTML=output+"Mountain Biking";
}else if(sURL=="actionsports.htm"||sURL=="actionsports"){
$('breadcrumbs').innerHTML=output+"Action Sports";
}else if(sURL=="mindandbody.htm"||sURL=="mindandbody"){
$('breadcrumbs').innerHTML=output+"Mind and Body";
}else if(sURL=="fieldhockey.htm"||sURL=="fieldhockey"){
$('breadcrumbs').innerHTML=output+"Field Hockey";
}else if(sURL=="icehockey.htm"||sURL=="icehockey"){
$('breadcrumbs').innerHTML=output+"Ice Hockey";
}else if(sURL=="healthandfitness.htm"||sURL=="healthandfitness"){
$('breadcrumbs').innerHTML=output+"Fitness";
}else if(sURL=="lifestylevehicles.htm"||sURL=="lifestylevehicles"){
$('breadcrumbs').innerHTML=output+"Lifestyle Vehicles";
}else if(sURL=="holidaygiftguide.htm"||sURL=="holidaygiftguide"){
$('breadcrumbs').innerHTML=output+"Holiday Gift Guide";
}else if(sURL=="allsports.htm"||sURL=="allsports"){
$('breadcrumbs').innerHTML=output+"All Sports";
}else{
if(sURL.indexOf(".")!=-1){
endHere=sURL.indexOf(".");
$('breadcrumbs').innerHTML=output+cnvrt2Upper(sURL.slice(0,endHere));
}else{
$('breadcrumbs').innerHTML=output+cnvrt2Upper(sURL);
}
}
}
else{
var title;
if(bits[0].toLowerCase() == "directory"){
title=cnvrt2Upper(sURL);
title = title.replace(/-/g," ");
}
else if(document.title.indexOf('| Active.com')!=-1){
title=document.title.slice(0,document.title.length-13);
}
else{
title=document.title;
}
$('breadcrumbs').innerHTML=output+title;
}
}
}

/*Geo-Targetting*/
function readCookie(name){
var nameEQ=name+"=";
var ca=document.cookie.split(';');
for(var i=0;i<ca.length;i++){
var c=ca[i];
while(c.charAt(0)==' ')c=c.substring(1,c.length);
if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);
}
return"";
}
var ScriptRequest=Class.create();
ScriptRequest.scriptCounter=1;
ScriptRequest.prototype={
initialize:function(url)
{
this._url=url;
this._noCacheIE='&noCacheIE='+(new Date()).getTime();
this._headLoc=document.getElementsByTagName("head").item(0);
this._scriptId='JscriptId'+ScriptRequest.scriptCounter++;
},
buildScriptTag:function()
{
this._scriptObj=document.createElement("script");
this._scriptObj.setAttribute("type","text/javascript");
this._scriptObj.setAttribute("charset","utf-8");
this._scriptObj.setAttribute("src",this._url+"&S="+this._scriptId+this._noCacheIE);
this._scriptObj.setAttribute("id",this._scriptId);
},
addScriptTag:function()
{
this._headLoc.appendChild(this._scriptObj);
},
removeScriptTag:function()
{
this._headLoc.removeChild(this._scriptObj);
}
};
function gtGeo()
{
if($("mod_geo_events"))
{
var sURL=location.pathname+"";
var channel="all";
var qty="10";
var distance="25";
var dateRange="future";
var cb="MappingAssetToMap";
var cbp="";
var chunkStart=sURL.indexOf("/");
var chunkEnd=sURL.indexOf(".htm");
if(chunkEnd==-1)chunkEnd=sURL.indexOf(".aspx");
//get the subchannel
var sSubChannel="";
if(sURL.indexOf("/",chunkStart+1)!=-1)
{
	var _start = sURL.indexOf("/",chunkStart+1);
	var _end = sURL.indexOf("/",_start+1)
	if(_end==-1)
	{sSubChannel=sURL.slice(_start+1,chunkEnd);}
	else {sSubChannel=sURL.slice(_start+1,_end);}
}
if(sSubChannel.toLowerCase()=="5k"||sSubChannel.toLowerCase()=="newbie-runners")
{
	channel="Running&mediaType=Event\\5k";
}
else
{

if(sURL.indexOf("/",chunkStart+1)!=-1)chunkEnd=sURL.indexOf("/",chunkStart+1);
if(chunkEnd==-1)
{
sURL=sURL.slice(chunkStart+1)
}
else
{
sURL=sURL.slice(chunkStart+1,chunkEnd)
}
if(sURL!="eteamz"
&&sURL!="Eteamz"
&&sURL!="home"
&&sURL!="Home_Page"
&&sURL!="nutrition"
&&sURL!="travel"
&&sURL!="gear"
&&sURL!="mindandbody"
&&sURL!="women"
&&sURL!="singles"
&&sURL!="experts"
&&sURL!="lifestylevehicles"){
if(sURL=="actionsports")sURL="Action Sports";
if(sURL=="fieldhockey")sURL="Field Hockey";
if(sURL=="icehockey")sURL="Ice Hockey";
if(sURL=="mountainbiking")sURL="Mountain Biking";
if(sURL=="healthandfitness")sURL="Fitness";
channel=sURL;
}
}
if(channel!="all")
{
channel=cnvrt2Upper(sURL);
}
new Ajax.Request("http://"+sActiveUrl+"/nonAcm/ajax/A2process.aspx",
{
method:'get',
parameters:"mode=getActivitiesList&geozip="+readCookie("geozip")+"&dateRange="+dateRange+"&channel="+channel+"&qty="+qty+"&distance="+distance,
onComplete:function(e){
var html=e.responseText;
if($('mod_geo_events_spinner')){
$('mod_geo_events_spinner').hide();
}
if(html!='getActivities Failed.'){
$('mod_geo_events').innerHTML=html;
var geozip=$('geozip').innerHTML;
$('geozip').remove();
if(geozip!="")
{
document.cookie="geozip="+geozip+";path=/;";
$('mod_geo_events_zip').value=geozip;
}
else{
var gzMsg="Zip";
var input=$('mod_geo_events_zip');
input.value=gzMsg;
input.style.color='#aaaaaa';
input.onfocus=function(){
if(this.value==gzMsg){
this.value='';
this.style.color='#000000';
}
}
input.onblur=function(){
if(this.value==''){
this.value=gzMsg;
this.style.color='#aaaaaa';
}
}
}
}
}
}
);
if($('mod_geo_events_channel')){
var cOpt=$('mod_geo_events_channel');
for(idx=0;idx<cOpt.options.length;idx++){
if(cnvrt2Upper(cOpt[idx].value)==cnvrt2Upper(sURL)){
cOpt.selectedIndex=idx
}
}
}
}
}
function MappingAssetToMap(status,data)
{
var result="";
var Name="";
var Location="";
var DateStart="";
var URL="";
var _html=new Array();
if(data.length>0)
{
if($('mod_geo_events_spinner')){
$('mod_geo_events_spinner').hide();
}
var obj=eval('('+data+')');
var oIframe=document.getElementById("mge_footer_search");
var oDoc=oIframe.contentWindow||oIframe.contentDocument;
if(oDoc.document){
oDoc=oDoc.document;
}
if(obj.zip!=null&&obj.zip!='undefined')
{
var geozip=obj.zip;
if(geozip!=""){
document.cookie="geozip="+geozip+";path=/;";
oDoc.getElementById('mod_geo_events_zip').value=geozip;
}
else{
var gzMsg="Zip";
var input=oDoc.getElementById('mod_geo_events_zip');
input.value=gzMsg;
input.style.color='#aaaaaa';
input.onfocus=function(){
if(this.value==gzMsg){
this.value='';
this.style.color='#000000';
}
}
input.onblur=function(){
if(this.value==''){
this.value=gzMsg;
this.style.color='#aaaaaa';
}
}
}
}
if(oDoc.getElementById('mod_geo_events_channel')){
var cOpt=oDoc.getElementById('mod_geo_events_channel');
for(idx=0;idx<cOpt.options.length;idx++){
if(cnvrt2Upper(cOpt[idx].value)==cnvrt2Upper(sURL)){
cOpt.selectedIndex=idx
}
}
}
if(obj.results.length>0)
{
for(var c=0;c<obj.results.length;c++)
{
var Asset=obj.results[c];
Name=Asset.Title;
Location=Asset.City;
Location+=", "+Asset.State;
_date=Asset.StartDate.toDateString();
_date=_date.substr(0,3)+", "+_date.substr(4);
StartDate=_date;
URL=Asset.Url;
_html.push("<div class=\"event\">");
_html.push("<div class=\"reg\"></div>");
_html.push("<div class='info'><a href='"+URL+"'>"+Name+"</a><br />"+Location+"<br />"+StartDate+"</div>");
_html.push("</div>");
Asset.IconPath="../SiteFiles/3/templates/images/AssetMap/MapMarker/MapMarker_"+eval(c+1)+".png";
if(Asset.Channel!='undefined'&&$('mod_geo_map'))
{
CreateMapAssetJson(Asset);
}
}
}
else
{
_html.push("No Results.");
}
if(_html!=""){
$('mod_geo_events').innerHTML=_html.join("");
}
_script.removeScriptTag();
}
}
function CreateMapAssetJson(asset)
{
var _EventID=asset.EventID;
var _AssetID=asset.AssetId;
var _Channel=asset.Channel;
var _Category=asset.category;
var _Address=asset.Address;
var _City=asset.City;
var _State=asset.State;
var _ZipCode=asset.ZipCode;
var _StartDate=asset.StartDate;
var _Description=asset.Description;
var _SubstitutionURL=asset.Url;
var _Name=asset.Title;
var _IconPath=asset.IconPath;
var _InfoWindowHTML=new Array();
var _MapPoint="";
var _MapMarker="";
var _IsDisplayed="";
var _TrackBackURL=asset.Url;
var _Category=asset.Category;
var _ratings="";
var _imageUrl="";
var _iconShadowPath="";
var _Phone=asset.PhoneNumber;
try
{
if((_Address==null)||(_Address=="null"))
{
_Address="";
}
_InfoWindowHTML.push("<table width='200px'>");
_InfoWindowHTML.push("   <tr>");
_InfoWindowHTML.push("       <td style='font-size: 9pt; font-weight: bold;' colspan='2'>");
_InfoWindowHTML.push(_Name);
_InfoWindowHTML.push("       </td>");
_InfoWindowHTML.push("   </tr>");
_InfoWindowHTML.push("   <tr>");
if(_ratings!="")
{
_InfoWindowHTML.push("       <td align='left' style='font-size: 8pt;'>");
_InfoWindowHTML.push("         Ratings");
_InfoWindowHTML.push("       </td>");
}
_InfoWindowHTML.push("       <td align='right' style='font-size: 8pt;'>");
_InfoWindowHTML.push("          <a href='"+_TrackBackURL+"' target='_blank'>More Info</a>");
_InfoWindowHTML.push("       </td>");
_InfoWindowHTML.push("   </tr>");
_InfoWindowHTML.push("   <tr>");
if(_imageUrl!="")
{
_InfoWindowHTML.push("       <td style='width: 33%; height: 33%;'>");
_InfoWindowHTML.push("           <img />");
_InfoWindowHTML.push("       </td>");
}
_InfoWindowHTML.push("       <td>");
_InfoWindowHTML.push("           <table>");
_InfoWindowHTML.push("              <tr>");
_InfoWindowHTML.push("                  <td style='font-size: 8pt;'>");
_InfoWindowHTML.push(_Address);
_InfoWindowHTML.push("                      <br>");
_InfoWindowHTML.push(_City+", "+_State+" "+_ZipCode);
_InfoWindowHTML.push("                  </td>");
_InfoWindowHTML.push("              </tr>");
_InfoWindowHTML.push("           </table>");
_InfoWindowHTML.push("       </td>");
_InfoWindowHTML.push("   </tr>");
_InfoWindowHTML.push("</table>");
assItem=new MapAsset(_SubstitutionURL,_AssetID,_Channel,_Category,_Address,_City,_State,_ZipCode,_StartDate,_Name,_Description,_IconPath,_iconShadowPath,_InfoWindowHTML.join(""),null,null,true,_TrackBackURL,_Phone);
assItem.CreateMarker();
}
catch(err)
{
alert(err);
}
}

/*Login Message*/
function  randomChar(num)  {
  var  x="0123456789qwertyuioplkjhgfdsazxcvbnm";
  var  tmp="";
  for(var  i=0;i<num;i++)  {
	tmp  +=  x.charAt(Math.ceil(Math.random()*100000000)%x.length);
  }
  return  tmp;
}

function A2LogOut(){
window.location.href="http://"+sActiveUrl+"/CM/WebUI/PageTypes/A2Login/A2LoginHome.aspx?logout=1";
}
function loginMsg(){
if($('sign')){
var loginMessage=new String;
var fname=readCookie("firstName");
dest=document.location.href.replace(/&/g,"|");
dest=dest.replace(/\?/g,"%3f");
dest=dest.replace("#","%23"); //BP 10.22.09
if(dest.indexOf("post!reply.jspa")!=-1){
if(dest.indexOf("?threadID=")!=-1){
threadStart=dest.indexOf("=");
threadId=dest.slice(threadStart+1,dest.length);
dest="http://"+sCommunityUrl+"/thread/"+threadId;
}else{
dest="http://"+sCommunityUrl+"/";
}
}else if(dest.indexOf("myactive.jspa")!=-1){
dest="http://"+sActiveUrl+"/";
}

//append unique string for community login
if(dest.indexOf("/people") != -1){
	//already have a unique string - replace and add new string
	if (dest.indexOf("%3f") != -1) {
		dest=dest.replace(new RegExp('cachekey=.{6}', "g"),"cachekey="+randomChar(6));
	}
	//first time thru
	else {
		dest=dest+"?cachekey="+randomChar(6);
	}
} 
	
if((fname != null) && (fname != "")){
		                            
         if (readCookie("loginRecord") == "unauth"){
                   loginMessage='<span style="float:left;height:21px;margin-top:0.2em;color:red;"><strong>Sorry, there was a problem with your login. If the issue persists, please report the issue <a href="http://www.active.com/Support/Contact_Active_Support/">here</a>.</strong></span><span id="login-button"><a href="http://'+sActiveUrl+'/page/Login_to_Active_com/?referrerUrl='+dest+'"><span>Log In</span></a></span> <span id="create-account-button"><a href="http://'+sActiveUrl+'/page/Add_or_Edit_Account/?show=create&referrerUrl='+dest+'"><span>Create Account</span></a></span>';
         }
         else{
                   loginMessage="<strong>Welcome, "+unescape(fname)+"</strong> | <a href=\"http://"+sCommunityUrl+"/people/"+fname+"/\" name=\"Second navbar My Active\">My Active</a> | ";
                   var strHref=window.location.href;
                   if(strHref.indexOf("edit.htm")>-1){
                            loginMessage+="<a href=\"http://"+sActiveUrl+"/video/mymovies/\">My Videos</a> | ";
                   }
                   loginMessage+="<a href=\"http://"+sCommunityUrl+"/logout.jspa?referrerUrl="+dest+"\" name=\"Second navbar Log Out\">Log Out</a>";
                   document.getElementById("sign").style.paddingTop=".5em";
                   }
}
else{
loginMessage='<span id="login-button"><a href="http://'+sActiveUrl+'/page/Login_to_Active_com/?referrerUrl='+dest+'"><span>Log In</span></a></span> <span id="create-account-button"><a href="http://'+sActiveUrl+'/page/Add_or_Edit_Account/?show=create&referrerUrl='+dest+'"><span>Create Account</span></a></span>';
}
$('sign').innerHTML=loginMessage;
}
}

/*CAS*/
function cookieCheck(){
var cookieEnabled=(navigator.cookieEnabled)?true:false;
if(typeof navigator.cookieEnabled=="undefined"&&!cookieEnabled){
document.cookie="testcookie";
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)?true:false;
}
return cookieEnabled;
}
function casRedirect()
{
if(cookieCheck())
{
var cookieCAST=readCookie("CAST");
var lastPage=readCookie("CASLastPage");
if(document.referrer.indexOf(sActiveUrl)==-1)
{
lastPage="";
}
document.cookie="CASLastPage="+window.location+";path=/;";
if(cookieCAST=="")
{
doCASRedirect();
}
else
{
var cookieCAST=readCookie("CAST");
var lastCheck=new Date(readCookie("CASLastCheck"));
var now=new Date();
if((cookieCAST!="new session")&&(cookieCAST!="done"))
{
if((cookieCAST!="new session")&&(cookieCAST!="done")&&(now-lastCheck)/1000>iCASCheckInterval)
{
new Ajax.Request(sA2ProcessUrl,
{
method:'get',
parameters:"mode=validateCAS&CAST="+cookieCAST,
onComplete:function(e){
document.cookie="CASLastCheck="+new Date()+";path=/;";
if(e.responseText=="False")
{
doCASRedirect();
}
}
});
}
return;
}
if(((now-lastCheck)/1000>iCASCheckInterval)&&lastPage!=window.location)
{
doCASRedirect();
}
}
}
}
function doCASRedirect()
{
var loc=window.location+"";
if(loc.toLowerCase().indexOf("login_to_active")!=-1||loc.toLowerCase().indexOf("page/coolrunning/login")!=-1||
loc.toLowerCase().indexOf("signup_confirmation")!=-1|| loc.toLowerCase().indexOf( "page/EDA-admin" ) != -1)
{
document.cookie="CAST=done;path=/;";
}
else if(loc.toLowerCase().indexOf(sActiveUrl)!=-1)
{
//document.cookie="CASReturnPage="+window.location+";path=/;";
document.cookie="CAST=new session;path=/;";
//window.location=sCASUrl;
var   frm   =   document.createElement("iframe");   
	frm.id = "ifrmCAS";
	frm.src = sCASUrl;
	frm.style.display = "none";
	Event.observe(frm,'load',loginMsg);
	document.body.appendChild(frm); 
}
document.cookie="CASLastCheck="+new Date()+";path=/;";
}

/*Text Ads*/
function textAds(){
if($('h_t_ad')){
if(location.pathname.indexOf('outdoors')!=-1){
$('h_t_ad').innerHTML='<a href="http://aml.active.com/newsletter_redirect.jsp?U=27363&M=0&MS=0" target="_blank"><span style="font-weight:bold;">HUMMER</span>&reg; <span style="font-size:.9em;text-transform:uppercase;">LIKE NOTHING ELSE&trade;</span></a><img src="http://ad.doubleclick.net/ad/N3880.active.com/B2873541.39;dcove=o;sz=1x1" alt="" />';
}
}
}

/*Save to MyActive*/
var MyActive=function(){
var _userId=readCookie("userId");
return{
CssClassSave:"",
CssClassSaved:"",
CssClassError:"",
AssetSaved:false,
Show:function(assetId)
{
var that=this;
new Ajax.Request(sA2ProcessUrl,
{
method:'get',
parameters:"mode=isSavedToMyActive&id="+assetId+"&uid="+_userId,
onComplete:function(e)
{
try
{
if(e.responseText.toLowerCase()=="true")
{
that.ShowSaved(assetId);
that.AssetSaved=true;
}
else
{
that.ShowSave(assetId);
that.AssetSaved=false;
}
}
catch(error)
{
that.ShowMessage(assetId,"");
}
}
});
},
Save:function(assetId)
{
if(_userId!="")
{
$(assetId).update('<img src="/SiteFiles/3/templates/images/common/spinners/spinner.gif"/> Saving...');
var that=this;
new Ajax.Request(sA2ProcessUrl,
{
method:'get',
parameters:"mode=saveToMyActive&id="+assetId+"&uid="+_userId,
onComplete:function(e)
{
try
{
if(e.responseText.toLowerCase()=="true")
{
that.ShowSaved(assetId);
that.AssetSaved=true;
}
else
{
that.ShowError(assetId);
}
}
catch(error)
{
that.ShowError(assetId);
}
}
});
}
else
{
var location=window.location+"";
document.cookie="stma_assetId="+assetId+";path=/;";
document.cookie="stma_url="+location+";path=/;";
window.location="http://"+sActiveUrl+"/page/Login_To_Active_Com.htm?referrerUrl=http://"+sActiveUrl+"/NonACM/STMA/A2MyActiveAssetsSave.aspx";
}
},
ShowSaved:function(assetId)
{
var fname=readCookie("firstName");
$(assetId).update('<a href="http://'+sCommunityUrl+'/people/myactive.jspa?username='+unescape(fname)+'&view=tab-savedstufftab" class="'+this.CssClassSaved+'"><span>Saved!</span></a>');
},
ShowSave:function(assetId)
{
$(assetId).update('<a href="javascript:MyActive.Save(\''+assetId+'\')" title="Save to My Active." class="'+this.CssClassSave+'">Save</a>');
},
ShowError:function(assetId)
{
$(assetId).update('<a class="'+this.CssClassError+'"><span>Error</span></a>');
}
};
}();

/*Global Navigation*/
function globalNav(){
if(navigator.appVersion.indexOf("MSIE")==-1){return;}
var i,k,g,lg,r=/\s*gnhvr/,nn='',c,cs='gnhvr',bv='global-nav';
for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
this.className=cl;};lg[k].onmouseout=function(){c=this.className;
this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

/*****************************************************************************/
/*
/* Check the userID cookie to see if the user is logged in
/* Bryan Paijit:  1.20.2009
/*****************************************************************************/		
function isLoggedIn()
    {
        //Check the userId cookie to see if the user is logged in.
            _currentUserId = readCookie("userId");
        
        //alert(_currentUserId);
        if ((_currentUserId != null) && (_currentUserId != "")) 
            {
                return true;
                //return false;  // Used for testing
            }
        else
            {
                //return true;  // Used for testing
                return false;
            }
            
    }

/*****************************************************************************/
/* Read the specified query string value. */
/*****************************************************************************/
function readQueryStringValue(itemName) {

	var query = window.location.search.substring(1); 
	var vars = query.split("&"); 
	for (var i = 0; i < vars.length; i++) { 
		var pair = vars[i].split("="); 
		if (pair.length > 1) {
		    if (pair[0] == itemName) {
			    return pair[1]; 
		    } 
		}
	}  
	
	return "";
}

/*****************************************************************************/
/* Read the cookie value from a multi valued cookie. */
/*****************************************************************************/
function readCookieItem(cookieName, itemName, defaultValue) {

	var cookieValue = readCookie(cookieName);
	var resultValue = defaultValue;
	
	if (cookieValue != '') {
		var itemIndex = cookieValue.indexOf(itemName + '=');
		if (itemIndex > -1) {
		
			// Get the index of the delimitor after the item we want
			var multiValueSplitIndex = cookieValue.indexOf('&', itemIndex);
			if (multiValueSplitIndex == -1) { 
				// No delimitor, so we reached the end of the values
				multiValueSplitIndex = cookieValue.length; 
			}

			// Make sure the indexes are valid
			if (multiValueSplitIndex > -1 && itemIndex < multiValueSplitIndex) {
				resultValue = cookieValue.substring(itemIndex + itemName.length + 1, multiValueSplitIndex);
			}
		}
	}
	
	return resultValue;
}

function readGenderValue() {

    // First look for the value in the cookie
	var resultValue = readCookieItem('Details', 'G', 'NG');
	if (resultValue.length > 0) {
	
	    // Parse out the start value
	    var genderValue = resultValue.substring(0, 1);
	    
	    // If not in the cookie, look in the querystring
	    if (genderValue != 'M' && genderValue != 'F') {
	        var dartValue = readQueryStringValue('dart').toUpperCase();
	        if (dartValue == 'M' || dartValue == 'F') {
	            resultValue = dartValue;
	        }
	    }	
	}
	
	if (resultValue == '') {
	    resultValue = 'NG';
	}
	
	return resultValue;
}
		
/*Page Load*/
Event.observe(window,'load',function(){
	casRedirect();
	if(!$('ifrmCAS')) loginMsg();
//loginMsg();
globalNav();
initAllChannels();
breadcrumbs();
});
