
function GenericResponse () {
  	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
		this.msg = xml.getAttribute ( "msg" );
	 }
	 
	 this.toString = function () {
	    var str = GenericResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\", ";
		str += "msg=\"" + this.msg + "\"";
		str += "}";
		return str;
	 }
}

GenericResponse.TAG_NAME = "vbresponse";



// "GET USER INFO" Data
function LogOutUserFromGameServerResponse () {

  

     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
	 }
	 
	 this.toString = function () {
		 
	    var str = LogOutUserFromGameServerResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";		
		str += "}";
		return str;
	 }
}
LogOutUserFromGameServerResponse.TAG_NAME = "vbresponse";


/*
="10" ="100" ="1000"  ="123" ="5" ="10" ="3" ="3" ="4"
*/

// "GET USER INFO" Data
function GetUserStatsResponse () {

  
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
		this.dailyScore = xml.getAttribute ( "dailyScore" );
		this.weeklyScore = xml.getAttribute ( "weeklyScore" );
		this.monthlyScore = xml.getAttribute ( "monthlyScore" );
		this.lifetimeScore = xml.getAttribute ( "lifetimeScore" );
		this.rank = xml.getAttribute ( "rank" );
		this.rankIsOutOfThisMany = xml.getAttribute ( "rankIsOutOfThisMany" );
		this.level = xml.getAttribute ( "level" );
		this.totalGame = xml.getAttribute ( "totalGame" );
		this.popQuiz = xml.getAttribute ( "popQuiz" );
		this.pop4 = xml.getAttribute ( "pop4" );
		this.popSpin = xml.getAttribute ( "popSpin" );

	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		
	 }
	 
	 this.toString = function () {
		 
	    var str = GetUserStatsResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\",";
		str += "dailyScore=\"" + this.dailyScore + "\",";
		str += "weeklyScore=\"" + this.weeklyScore + "\",";
		str += "monthlyScore=\"" + this.monthlyScore + "\",";
		str += "lifetimeScore=\"" + this.lifetimeScore + "\",";
		str += "rank=\"" + this.rank + "\",";
		str += "rankIsOutOfThisMany=\"" + this.rankIsOutOfThisMany + "\",";
		str += "level=\"" + this.level + "\",";
		str += "totalGame=\"" + this.totalGame + "\",";
		str += "popQuiz=\"" + this.popQuiz + "\",";
		str += "pop4=\"" + this.pop4 + "\",";
		str += "popSpin=\"" + this.popSpin + "\",";
		
		
		str += "}";
		return str;
	 }
}
GetUserStatsResponse.TAG_NAME = "vbresponse";


// "GET USER INFO" Data
function GetUserInfoResponse () {

  
     this.isLoggedIn = function () {
		 if ( this.code == "GET_USER_OK" ) {
			 return true;
		 } else {
			 return false; 
		 }
	 }
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
		this.name = xml.getAttribute ( "name" );
		this.email = xml.getAttribute ( "email" );
		this.dailyScore = xml.getAttribute ( "dailyScore" );
		this.weeklyScore = xml.getAttribute ( "weeklyScore" );
		this.monthlyScore = xml.getAttribute ( "monthlyScore" );
		this.yearlyScore = xml.getAttribute ( "yearlyScore" );
		this.lifetimeScore = xml.getAttribute ( "lifetimeScore" );
		this.totalNumberOfGamesPlayed = xml.getAttribute ( "totalNumberOfGamesPlayed" );

	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		
	 }
	 
	 this.toString = function () {
		 
	    var str = GetUserInfoResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\",";
		str += "name=\"" + this.name + "\",";
		str += "email=\"" + this.email + "\",";
		str += "dailyScore=\"" + this.dailyScore + "\",";
		str += "weeklyScore=\"" + this.weeklyScore + "\",";
		str += "monthlyScore=\"" + this.monthlyScore + "\",";
		str += "yearlyScore=\"" + this.yearlyScore + "\",";
		str += "lifetimeScore=\"" + this.lifetimeScore + "\",";
		str += "totalNumberOfGamesPlayed=\"" + this.totalNumberOfGamesPlayed + "\",";
		
		str += "}";
		return str;
	 }
}
GetUserInfoResponse.TAG_NAME = "vbresponse";



// Email Contact List
function WebEmailContactListResponse () {
   
     this.contacts = new WebEmailContactList ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
		this.errorMessage = xml.getAttribute ( "errorMessage" );
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
	    if ( xml.getElementsByTagName (WebEmailContactList.TAG_NAME).length > 0 ) {
		   this.contacts.parseXML ( xml.getElementsByTagName (WebEmailContactList.TAG_NAME).item(0) );
		}
	 }
	 
	 this.toString = function () {
	    var str = WebEmailContactListResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += "errorMessage=\"" + this.errorMessage + "\"";
		str += this.contacts;
		str += "}";
		return str;
	 }
}
WebEmailContactListResponse.TAG_NAME = "vbresponse";


function WebEmailContactList () {

     this.contacts = new Array ();
	 
     this.parseXML = function ( xml ) {
	 	 
	     var childElements = xml.getElementsByTagName ( WebEmailContact.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var contact = new WebEmailContact ();
			 contact.parseXML (childElements.item(idx));
			 this.contacts.push(contact);
		 }
		 
	     
	 };
	 
	 this.toString = function () {
	    var str = WebEmailContactList.TAG_NAME + "{";
		for ( var idx = 0; idx < this.contacts.length; idx++ ) {
			str += this.contacts[idx];
		}
		str += "}";
		return str;
	 }
	 
}
WebEmailContactList.TAG_NAME = "contacts";


function WebEmailContact () {

     this.parseXML = function ( xml ) {	 
	     var _contactName = unescape(xml.getAttribute ( "contactName" )); 
		 // str.replace(/Microsoft/, "W3Schools")
	     this.contactName = _contactName.replace(/\+/g, " ");
		 this.emailAddress = xml.getAttribute ( "emailAddress" );
	 };
	 
	 this.toString = function () {
	    var str = WebEmailContact.TAG_NAME + "{";
		str += "contactName:\"" + this.contactName + "\", ";
		str += "emailAddress:\"" + this.emailAddress + "\", ";
		str += "}";
		return str;
	 }
	 
}
WebEmailContact.TAG_NAME = "contact";



//  Winning Questions Data
function WinningQuestion () {

     this.parseXML = function ( xml ) {
	 
	     this.questionText = xml.getAttribute ( "questionText" );
		 this.questionPreviewUrl = xml.getAttribute ( "questionPreviewUrl" );
		 this.winnerName = xml.getAttribute ( "winnerName" );
		 this.winnerId = xml.getAttribute ( "winnerId" );
	 };
	 
	 this.toString = function () {
	    var str = WinningQuestion.TAG_NAME + "{";
		str += "questionText:\"" + this.questionText + "\", ";
		str += "questionPreviewUrl:\"" + this.questionPreviewUrl + "\", ";
		str += "winnerName:\"" + this.winnerName + "\"";
		str += "}";
		return str;
	 }
	 
}
WinningQuestion.TAG_NAME = "winningQuestion";


function WinningQuestions () {

     this.parseXML = function ( xml ) {
	 
	     this.winningQuestions = new Array ();
		 
	     var childElements = xml.getElementsByTagName ( WinningQuestion.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var winningQuestion = new WinningQuestion ();
			 winningQuestion.parseXML (childElements.item(idx));
			 this.winningQuestions.push(winningQuestion);
		 }
		 
	     
	 };
	 
	 this.toString = function () {
	    var str = WinningQuestions.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.winningQuestions.length; idx++ ) {
			str += this.winningQuestions[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
WinningQuestions.TAG_NAME = "winningQuestions";


function WinningQuestionResponse () {
   
     this.winningQuestions = new WinningQuestions ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		this.winningQuestions.parseXML ( xml.getElementsByTagName (WinningQuestions.TAG_NAME).item(0) );
	 }
	 
	 this.toString = function () {
	    var str = WinningQuestionResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += this.winningQuestions;
		str += "}";
		return str;
	 }
}
WinningQuestionResponse.TAG_NAME = "vbresponse";



// "HIT" Questions Data
function HitQuestionsResponse () {
   
     this.hitQuestions = new HitQuestions ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		this.hitQuestions.parseXML ( xml.getElementsByTagName (HitQuestions.TAG_NAME).item(0) );
	 }
	 
	 this.toString = function () {
	    var str = HitQuestionsResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += this.hitQuestions;
		str += "}";
		return str;
	 }
}
HitQuestionsResponse.TAG_NAME = "vbresponse";

function HitQuestions () {

     this.parseXML = function ( xml ) {
	 
	     this.hitQuestions = new Array ();
		 
	     var childElements = xml.getElementsByTagName ( HitQuestion.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var hitQuestion = new HitQuestion ();
			 hitQuestion.parseXML (childElements.item(idx));
			 this.hitQuestions.push(hitQuestion);
		 }
		 
	     
	 };
	 
	 this.toString = function () {
	    var str = HitQuestions.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.hitQuestions.length; idx++ ) {
			str += this.hitQuestions[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
HitQuestions.TAG_NAME = "hitQuestions";


function HitQuestion () {

     this.parseXML = function ( xml ) {
	 
	     this.questionText = xml.getAttribute ( "questionText" );
		 this.questionPreviewUrl = xml.getAttribute ( "questionPreviewUrl" );
	 };
	 
	 this.toString = function () {
	    var str = HitQuestion.TAG_NAME + "{";
		str += "questionText:\"" + this.questionText + "\", ";
		str += "questionPreviewUrl:\"" + this.questionPreviewUrl + "\"";
		str += "}";
		return str;
	 }
	 
}
HitQuestion.TAG_NAME = "hitQuestion";









// "Drawing Winners" Data

function DrawingWinnersResponse () {
   
     this.parseXML = function ( xml ) {
		 
		 this.drawingWinnersObjects = new Array(); // DrawingWinners ();
		 
	     this.code = xml.getAttribute ( "code" );
		 
	     var childElements = xml.getElementsByTagName ( DrawingWinners.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var drawingWinners = new DrawingWinners ();
			 drawingWinners.parseXML (childElements.item(idx));
			 this.drawingWinnersObjects.push(drawingWinners);
		 }
		 
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		 // this.drawingWinners.parseXML ( xml.getElementsByTagName (DrawingWinners.TAG_NAME).item(0) );
	 }
	 
	 this.getDrawingWinnersByType = function ( winnerType, threshold ) {
		 var drawingWinners = null;
		 
//alert ( "ENTRY getDrawingWinnersByType called with winnerType: " + winnerType + "  threshold: " + threshold +
//	     " this.drawingWinnersObjects.length: " + this.drawingWinnersObjects.length );

         for ( var idx = 0; idx < this.drawingWinnersObjects.length; idx++ ) {
			 drawingWinners = this.drawingWinnersObjects[idx];
			 
//alert ( " drawingWinners: " + drawingWinners );

//alert ( " 	drawingWinners.type: " + drawingWinners.type + " winnerType: " + winnerType );		
			
			 if ( drawingWinners.type == winnerType ) {
				 
//alert ( "MATCHES WINNER TYPE! drawingWinners.type: " + drawingWinners.type + " winnerType: " + winnerType + " IDX: " + idx  );

				 if ( threshold ) {
					 
//alert ( " threshold:  " + threshold + " drawingWinners.threshold: " + drawingWinners.threshold );

					 if ( drawingWinners.threshold == threshold ) {
						 break;
					 }
				 } else {
				    break;
				 }
				 
			 } else {
				 drawingWinners = null;
			 }
			 
			 
		 }
	
//alert ( " ABOUT TO RETURN: " + drawingWinners );

		 return drawingWinners;
	 }
	 
	 this.toString = function () {
	    var str = DrawingWinnersResponse.TAG_NAME + "{";
		
		str += "code=\"" + this.code + "\"";
		
		for ( var idx = 0; idx < this.drawingWinnersObjects.length; idx++ ) {
			str += this.drawingWinnersObjects[idx];
		}
		str += "}";
		return str;
	 }
}
DrawingWinnersResponse.TAG_NAME = "vbresponse";


function DrawingWinners () {

     this.parseXML = function ( xml ) {
		 
		 this.type = xml.getAttribute ( "type" );
		 this.threshold = xml.getAttribute ( "threshold" );
	 
	     this.drawingWinners = new Array ();
		 
	     var childElements = xml.getElementsByTagName ( DrawingWinner.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var drawingWinner = new DrawingWinner ();
			 drawingWinner.parseXML (childElements.item(idx));
			 this.drawingWinners.push(drawingWinner);
		 }
		 
	     
	 };
	 
	 this.toString = function () {
	    var str = DrawingWinners.TAG_NAME + "{";
		str += "type=\"" + this.type + "\"";
		for ( var idx = 0; idx < this.drawingWinners.length; idx++ ) {
			str += this.drawingWinners[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
DrawingWinners.TAG_NAME = "drawingWinners";


function DrawingWinner () {

     this.parseXML = function ( xml ) {
	     this.winnerId = xml.getAttribute ( "winnerId" );
	     this.winnerName = xml.getAttribute ( "winnerName" );
		 this.winnerPersonPageUrl = xml.getAttribute ( "winnerPersonPageUrl" );
		 this.prizeType = xml.getAttribute ( "prizeType" );
		 this.prizeWon = xml.getAttribute ( "prizeWon" );
	 };
	 
	 this.toString = function () {
	    var str = DrawingWinner.TAG_NAME + "{";
		str += "winnerName:\"" + this.winnerName + "\", ";
		str += "winnerPersonPageUrl:\"" + this.winnerPersonPageUrl + "\", ";
		str += "prizeType:\"" + this.prizeType + "\", ";
		str += "prizeWon:\"" + this.prizeWon + "\"";
		str += "}";
		return str;
	 }
	 
}
DrawingWinner.TAG_NAME = "drawingWinner";




// "HIT GAMES GAMEBOARD" Data

function LandingPageHitGamesResponse () {
   
     this.landingPageHitGames = new LandingPageHitGames ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		this.landingPageHitGames.parseXML ( xml.getElementsByTagName (LandingPageHitGames.TAG_NAME).item(0) );
	 }
	 
	 this.toString = function () {
	    var str = LandingPageHitGamesResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += this.landingPageHitGames;
		str += "}";
		return str;
	 }
}
LandingPageHitGamesResponse.TAG_NAME = "vbresponse";


function LandingPageHitGames () {

     this.parseXML = function ( xml ) {
	 
	     this.landingPageHitGames = new Array ();
		 
	     var childElements = xml.getElementsByTagName ( LandingPageHitGame.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var landingPageHitGame = new LandingPageHitGame ();
			 landingPageHitGame.parseXML (childElements.item(idx));
			 this.landingPageHitGames.push(landingPageHitGame);
		 }
		 
	     
	 };
	 
	 this.toString = function () {
	    var str = LandingPageHitGames.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.landingPageHitGames.length; idx++ ) {
			str += this.landingPageHitGames[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
LandingPageHitGames.TAG_NAME = "landingPageHitGames";


function LandingPageHitGame () {

     this.parseXML = function ( xml ) {
	 
	     this.row = xml.getAttribute ( "row" );
		 this.col = xml.getAttribute ( "col" );
		 this.videoPath = xml.getAttribute ( "videoPath" );
		 this.title = xml.getAttribute ( "title" );
		 this.hitGameId = xml.getAttribute ( "hitGameId" );
		 this.longCaption = xml.getAttribute ( "longCaption" );
	 };
	 
	 this.toString = function () {
	    var str = LandingPageHitGame.TAG_NAME + "{";
		str += "row:\"" + this.row + "\", ";
		str += "col:\"" + this.col + "\", ";
		str += "videoPath:\"" + this.videoPath + "\", ";
		str += "title:\"" + this.title + "\", ";
		str += "hitGameId:\"" + this.hitGameId + "\", ";
		str += "longCaption:\"" + this.longCaption + "\"";
		str += "}";
		return str;
	 }
	 
}
LandingPageHitGame.TAG_NAME = "landingPageHitGame";




// "Recent Qualifiers" Data

function QualifiersResponse () {
	
	this.qualifierGroups = new Array ();
	this.qualifierGroupsHashtable = new Object ();
	
	this.parseXML = function ( xml ) {
	//	alert ( "PARSE XML CALLED" );
		
		this.code = xml.getAttribute ( "code" );
		
		var childElements = xml.getElementsByTagName ( QualifiersGroup.TAG_NAME );
		
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var qualifiersGroup = new QualifiersGroup ();
			 qualifiersGroup.parseXML (childElements.item(idx));
			 this.qualifierGroups.push(qualifiersGroup);
			 this.qualifierGroupsHashtable[qualifiersGroup.prizeType] = qualifiersGroup;
		 }		
	}
	
	 this.getQualifiersGroupForPrizeType = function ( prizeType ) {
		 var retval = null;
		
		 try {
			 if ( this.qualifierGroupsHashtable  && this.qualifierGroupsHashtable[prizeType] ) {
				 retval = this.qualifierGroupsHashtable[prizeType];
			 }
		 } catch ( exchide ) {
		 }
		 //return this.qualifierGroupsHashtable[prizeType];
		 
		 return retval;
	 }	
	 
	 this.toString = function () {
	    var str = QualifiersResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		
		for ( var idx = 0; idx < this.qualifierGroups.length; idx++ ) {
			str += this.qualifierGroups[idx];
		}
		
		//str += this.recentQualifiers;
		str += "}";
		return str;
	 }	 
}




function QualifiersGroup () {
   
	 this.qualifiers = new Array ();
	
	 
     this.parseXML = function ( xml ) {
		 
	    this.prizeType = xml.getAttribute ( "prizeType" );
		
         var childElements = xml.getElementsByTagName ( Qualifier.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var qualifier = new Qualifier ();
			 qualifier.parseXML (childElements.item(idx));
			 this.qualifiers.push(qualifier);
			 
		 }		
		
	 }
	 

	 
	 this.toString = function () {
	    var str = QualifiersGroup.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		
		for ( var idx = 0; idx < this.qualifiers.length; idx++ ) {
			str += this.qualifiers[idx];
		}
		
		//str += this.recentQualifiers;
		str += "}";
		return str;
	 }
}
QualifiersGroup.TAG_NAME = "qualifiers";
QualifiersGroup.WEEKLY_PRIZE_TYPE = "weekly";
QualifiersGroup.MONTHLY_PRIZE_TYPE = "monthly";




function Qualifier () {

     this.parseXML = function ( xml ) {
	     this.qualifierName = xml.getAttribute ( "qualifierName" );
		 this.qualifierUrl = xml.getAttribute ( "qualifierUrl" );
	 };
	 
	 this.toString = function () {
	    var str = Qualifier.TAG_NAME + "{";
		str += "qualifierName:\"" + this.qualifierName + "\", ";
		str += "qualifierUrl:\"" + this.qualifierUrl + "\"";
		str += "}";
		return str;
	 }
	 
}
Qualifier.TAG_NAME = "qualifier";





// "High Scores" Data

function HighScoresResponse () {
   
     this.highScores = new HighScores ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
//alert ( "PARSE HighScoresResponse XML CALLED, code: " + this.code );
		this.highScores.parseXML ( xml.getElementsByTagName (HighScores.TAG_NAME).item(0) );
	 }
	 
	 this.toString = function () {
	    var str = HighScoresResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += this.highScores;
		str += "}";
		return str;
	 }
}
HighScoresResponse.TAG_NAME = "vbresponse";


function HighScores () {

     this.parseXML = function ( xml ) {
		 
		// alert ( "PARSE HIGH SCORES" );
	 
		 this.leaderRecordsList = new Array ();
		 this.leaderRecordsHashTable = new Object ();
		 this.leaderRecordsHashTableByScoreType = new Object ();

         var childElements = xml.getElementsByTagName ( LeaderRecords.TAG_NAME );
		 
	//alert ( " childElements: " + childElements + " childElements.length: " + childElements.length );
	
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var leaderRecords = new LeaderRecords ();
			 leaderRecords.parseXML (childElements.item(idx));
			 this.leaderRecordsList.push(leaderRecords);
			 this.leaderRecordsHashTable[leaderRecords.gameType] = leaderRecords;
			 
		//	 alert ( " leaderRecords.scoreType: " + leaderRecords.scoreType );
			 
			 this.leaderRecordsHashTableByScoreType[leaderRecords.scoreType] = leaderRecords;
		 }
		 
	 };
	 
	 this.getLeaderRecordsForGameType = function ( gameType ) {
		 
		// alert ( " GAME TYPE: " + gameType + " HASH TABLE: " + 
		 return this.leaderRecordsHashTable[gameType];
	 }
	 
	 this.getLeaderRecordsForScoreType = function ( scoreType ) {
		 return this.leaderRecordsHashTableByScoreType[scoreType];
	 }
	 
	 
	 this.toString = function () {
	    var str = HighScores.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.leaderRecordsList.length; idx++ ) {
			str += this.leaderRecordsList[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
HighScores.TAG_NAME = "highScores";


function LeaderRecords () {

     this.parseXML = function ( xml ) {
	 
	     // OLD attribute.  depecrate.
	     this.gameType = xml.getAttribute ( "gameType" );
		 
		 // NEW
		 this.scoreType = xml.getAttribute ( "scoreType" );
		 this.ranking = xml.getAttribute ( "ranking" );
		 this.scope = xml.getAttribute ( "scope" );
		 
		 
		 this.leaderRecords = new Array ();

         var childElements = xml.getElementsByTagName ( LeaderRecord.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var leaderRecord = new LeaderRecord ();
			 leaderRecord.parseXML (childElements.item(idx));
			 this.leaderRecords.push(leaderRecord);
		 }
		 
	 };
	 
	 this.toString = function () {
	    var str = LeaderRecords.TAG_NAME + "{";
		
		str += "gameType: \"" + this.gameType + "\",";
		for ( var idx = 0; idx < this.leaderRecords.length; idx++ ) {
			str += this.leaderRecords[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
LeaderRecords.TAG_NAME = "leaderRecords";
LeaderRecords.GAME_TYPE_POP_SPIN = "popspin";
LeaderRecords.GAME_TYPE_POP_QUIZ = "popquiz";
LeaderRecords.GAME_TYPE_POP_4 = "popjax4";
LeaderRecords.SCORE_TYPE_DAILY = "daily";
LeaderRecords.SCORE_TYPE_MONTHLY = "monthly";
LeaderRecords.SCORE_TYPE_LIFETIME = "lifetime";

function LeaderRecord () {

     this.parseXML = function ( xml ) {
	     this.name = xml.getAttribute ( "name" );
		 this.personPageUrl = xml.getAttribute ( "personPageUrl" );
		 //this.highScoringGameUrl = xml.getAttribute ( "highScoringGameUrl" );
		 
		 // OLD. Deprecate.
		 this.score = xml.getAttribute ( "score" );
		 
		 // NEW.
		 this.dailyScore = xml.getAttribute ( "dailyScore" );
		 this.weeklyScore = xml.getAttribute ( "weeklyScore" );
		 this.monthlyScore = xml.getAttribute ( "monthlyScore" );
		 this.yearlyScore = xml.getAttribute ( "yearlyScore" );
		 this.lifetimeScore = xml.getAttribute ( "lifetimeScore" );
		 
	 };
	 
	 this.toString = function () {
	    var str = LeaderRecord.TAG_NAME + "{";
		str += "name:\"" + this.name + "\", ";
		str += "personPageUrl:\"" + this.personPageUrl + "\", ";
		//str += "highScoringGameUrl:\"" + this.highScoringGameUrl + "\", ";
		str += "score:\"" + this.score + "\"";
		str += "}";
		return str;
	 }
	 
}
LeaderRecord.TAG_NAME = "leaderRecord";


// "Hit Games" Data

function HitGameInfoResponse () {
   
     this.hitGameGroups = new HitGameGroups ();
	 this.hitGames = new HitGames ();
	 
     this.parseXML = function ( xml ) {
	    this.code = xml.getAttribute ( "code" );
	  //  alert ( "PARSE XML CALLED, code: " + this.code );
		this.hitGameGroups.parseXML ( xml.getElementsByTagName (HitGameGroups.TAG_NAME).item(0) );
		
		this.hitGames.parseXML ( xml.getElementsByTagName (HitGames.TAG_NAME).item(0) );
		
		this.hitGameGroups.fillAllGroupsWithTheirHitGames (this.hitGames);
		
	 }
	 
	 this.toString = function () {
	    var str = HitGameInfoResponse.TAG_NAME + "{";
		str += "code=\"" + this.code + "\"";
		str += this.hitGameGroups;
		str += ", " + this.hitGames;
		str += "}";
		return str;
	 }
}
HitGameInfoResponse.TAG_NAME = "vbresponse";

function HitGameGroups () {

     this.parseXML = function ( xml ) {
	 
	     this.hitGameGroups = new Array ();
		 
	     var childElements = xml.getElementsByTagName ( HitGameGroup.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var hitGameGroup = new HitGameGroup ();
			 hitGameGroup.parseXML (childElements.item(idx));
			 this.hitGameGroups.push(hitGameGroup);
		 }
		 
	     
	 };
	 
	 this.fillAllGroupsWithTheirHitGames = function ( hitGames ) {
		 
		for ( var idx = 0; idx < this.hitGameGroups.length; idx++ ) {
			var hitGameGroup = this.hitGameGroups[idx];
			hitGameGroup.fillWithChildHitGames (hitGames);
		}
		
	 };
	 
	 this.toString = function () {
	    var str = HitGameGroups.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.hitGameGroups.length; idx++ ) {
			str += this.hitGameGroups[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
HitGameGroups.TAG_NAME = "hitGameGroups";

function HitGameGroup () {
	
	 this.hitGames = new Array ();
	 
     this.parseXML = function ( xml ) {
	     this.id = xml.getAttribute ( "id" );
		 this.title = xml.getAttribute ( "title" );
		 this.smallVideoPath = xml.getAttribute ( "smallVideoPath" );
		 this.largeVideoPath = xml.getAttribute ( "largeVideoPath" );
		 this.smallImagePath = xml.getAttribute ( "smallImagePath" );
		 this.largeImagePath = xml.getAttribute ( "largeImagePath" );
		 this.flashPath = xml.getAttribute ( "flashPath" );
		 this.thumbnailPath = xml.getAttribute ( "thumbnailPath" );
		 this.childCategoryIds = xml.getAttribute ( "childCategoryIds" );
		 
		 this.gameIdsArray = this.childCategoryIds.split( " " );
	 };
	 
	 this.fillWithChildHitGames = function ( _hitGames ) {
		
		
		 for ( var idx = 0; idx < this.gameIdsArray.length; idx++ ) {
			 var id = this.gameIdsArray[idx];
			 if ( id != "" && id != " " ) {
				 var hitGame = _hitGames.getGameById (id);
				 if ( hitGame != null ) {
					 this.hitGames.push(hitGame);
				 }
			 }
		 }
		 
	 };
	 
	
	 
	 this.toString = function () {
	    var str = HitGameGroup.TAG_NAME + "{";
		str += "id:\"" + this.id + "\", ";
		str += "title:\"" + this.title + "\", ";
		str += "smallVideoPath:\"" + this.smallVideoPath + "\", ";
		str += "largeVideoPath:\"" + this.largeVideoPath + "\", ";
		str += "smallImagePath:\"" + this.smallImagePath + "\", ";
		str += "largeImagePath:\"" + this.largeImagePath + "\", ";
		str += "flashPath:\"" + this.flashPath + "\", ";
		str += "thumbnailPath:\"" + this.thumbnailPath + "\", ";
		str += "childCategoryIds:\"" + this.childCategoryIds + "\"";
		str += "}";
		return str;
	 }
	 
}
HitGameGroup.TAG_NAME = "hitGameGroup";


///

function HitGames () {

     this.parseXML = function ( xml ) {
	 
	     this.hitGames = new Array ();
		 this.hitGamesHashtable = new Object;
		 
	     var childElements = xml.getElementsByTagName ( HitGame.TAG_NAME );
		 
		 for ( var idx = 0; idx < childElements.length; idx++ ) {
			 var hitGame = new HitGame ();
			 hitGame.parseXML (childElements.item(idx));
			 this.hitGames.push(hitGame);
			 
			 this.hitGamesHashtable[hitGame.id] = hitGame;
		 }
		 
	     
	 };
	 
	 this.getGameById = function ( id ) {
		 return this.hitGamesHashtable[id];
	 };
	 
	 this.toString = function () {
	    var str = HitGames.TAG_NAME + "{";
		
		for ( var idx = 0; idx < this.hitGames.length; idx++ ) {
			str += this.hitGames[idx];
		}
		
		str += "}";
		return str;
	 }
	 
}
HitGames.TAG_NAME = "hitGames";

function HitGame () {
	
     this.parseXML = function ( xml ) {
	     this.id = xml.getAttribute ( "id" );
		 this.name = xml.getAttribute ( "name" );
		 this.smallVideoPath = xml.getAttribute ( "smallVideoPath" );
		 this.largeVideoPath = xml.getAttribute ( "largeVideoPath" );
		 this.smallImagePath = xml.getAttribute ( "smallImagePath" );
		 this.largeImagePath = xml.getAttribute ( "largeImagePath" );
		 this.flashPath = xml.getAttribute ( "flashPath" );
		 this.thumbnailPath = xml.getAttribute ( "thumbnailPath" );
		 this.childCategoryIds = xml.getAttribute ( "childCategoryIds" );
	 };
	 
	 this.toString = function () {
	    var str = HitGame.TAG_NAME + "{";
		str += "id:\"" + this.id + "\", ";
		str += "name:\"" + this.name + "\", ";
		str += "smallVideoPath:\"" + this.smallVideoPath + "\", ";
		str += "largeVideoPath:\"" + this.largeVideoPath + "\", ";
		str += "smallImagePath:\"" + this.smallImagePath + "\", ";
		str += "largeImagePath:\"" + this.largeImagePath + "\", ";
		str += "flashPath:\"" + this.flashPath + "\", ";
		str += "thumbnailPath:\"" + this.thumbnailPath + "\", ";
		str += "childCategoryIds:\"" + this.childCategoryIds + "\"";
		str += "}";
		return str;
	 }
	 
}
HitGame.TAG_NAME = "hitGame";




