// JavaScript Document eventually call createPgView()

//recordOutboundLink as an event
function recordOutboundLinkFromFlash(action) {
	try {
		var pageTracker=_gat._getTracker("UA-826627-1");
		pageTracker._trackEvent('Outbound Links', action);
		//alert('recordOutboundLinkFromFlash '+action);
		}
	catch(err){}
}

//flushToAnalytics
function flushToAnalytics(kidsOrTeens, id, loginType){
	var stringToPass;
	var addLoginType = true;
	//verify its a kids call
	if(kidsOrTeens == "T"){
		//case statement to get string value of id	
		switch(id){
			case 201:
			  stringToPass = "/index.htm";
			  addLoginType = false;
			break;
			  
			case 202:
			  stringToPass = "/kits/index.htm";
			  addLoginType = false;
			break;
			  
			case 203:
			  stringToPass = "/kits/balance.htm";
			break;
			  
			case 204:
			  stringToPass = "/kits/fuel.htm";
			break;
			  
			case 205:
			  stringToPass = "/kits/nrg.htm";
			break;
			  
			case 206:
			  stringToPass = "/kits/face-the-music.htm";
			break;
			
			case 240:
			  stringToPass = "/kits/fmental-health.htm";
			break;
			  
			case 207:
			  stringToPass = "/health-tip.htm";
			  addLoginType = false;
			break;
			  
			case 208:
			  stringToPass = "/resources/index.htm";
			  addLoginType = false;
			break;
			  
			case 209:
			  stringToPass = "/tell-a-friend.htm";
			break;
			 
			case 210:
			  stringToPass = "/tell-a-friend-send.htm";
			break;
			  
			case 211:
			  stringToPass = "/register.htm";
			  addLoginType = false;
			break;
			
			case 212:
			  stringToPass = "/register-thank-you.htm";
			  addLoginType = false;
			break;
			
			case 213:
			  stringToPass = "/login.htm";
			  addLoginType = false;
			break;
			
			case 214:
			  stringToPass = "/premium-warning.htm";
			  addLoginType = false;
			break;
			
			case 215:
			  stringToPass = "/survey.htm";
			  addLoginType = false;
			break;
			
			case 216:
			  stringToPass = "/profile.htm";
			break;
			
			case 217:
			  stringToPass = "/message-board/respond.htm";
			  addLoginType = false;
			break;
			
			case 218:
			  stringToPass = "/message-board/details.htm";
			  addLoginType = false;
			break;
			
			case 219:
			  stringToPass = "/help/index.htm";
			  addLoginType = false;
			break;
			
			case 220:
			  stringToPass = "/journal.htm";
			break;
			
			case 221:
			  stringToPass = "/contact/index.htm";
			  addLoginType = false;
			break;
			
			case 222:
			  stringToPass = "/site-requirements.htm";
			  addLoginType = false;
			break;
			
			case 223:
			  stringToPass = "/sitemap.htm";
			  addLoginType = false;
			break;
			
			case 224:
			  stringToPass = "/forgot-password";
			  addLoginType = false;
			break;
			
			case 226:
			  stringToPass = "/quick-poll-vote.htm";
			  addLoginType = false;
			break;
			
			case 227:
			  //outbound link
			  recordOutboundLinkFromFlash('/outgoing/highmark.htm');
			  addLoginType = false;
			  stringToPass = "noValueFound"
			break;
			
			case 228:
			  //outbound link
			  recordOutboundLinkFromFlash('/outgoing/byrneshec.htm');
			  addLoginType = false;
			  stringToPass = "noValueFound"
			break;
			
			case 229:
			  //outbound link
			  recordOutboundLinkFromFlash('/outgoing/myspace.htm');
			  addLoginType = false;
			  stringToPass = "noValueFound"
			break;  
			  
			case 230:
			  stringToPass = "/health-log.htm";
			break;
			
			case 231:
			  stringToPass = "/healthResources/index.htm";
			  addLoginType = false;
			break;
			 
			default:
				stringToPass = "noValueFound"
			  //code to be executed if n is different from case 1 and 2
		}
		
		if(stringToPass != "noValueFound"){
			//add in login type
			if(addLoginType){
				//convert 'none' to 'samples'
				if(loginType == 'none'){
					loginType = 'samples';	
				}
				stringToPass = "/"+loginType+stringToPass;	
			}
			
			//prepend with kids
			stringToPass = "/teens"+stringToPass;
			//alert("tracking string sent to google: " + stringToPass);
			createPgView(stringToPass);
		}
		else{
			//alert('outbound link: '+id);
		}
	}
}
