function ResumePage() {}

ResumePage.prototype.init = function() {
	
		try {
			var chart = new Chart(this.Experience);
			chart.init();
		} catch(e) {}
		
		
		var self = this;
		var cloud = new TagCloud(
			this.Experience,
			function(keyword, keepExisting) {
				try { chart.draw(keyword); } catch(e) { }
				
				self.filterSections(keyword, keepExisting);
				
			}
		);
		cloud.init();
		this.getTagSectionMap();
		
		$("h4[education], h4[work]").bind('click', $.setContext(this.toggleSection, this));
		
		
		this.colorSections();
		
		
};

ResumePage.prototype.colorSections = function() {
	
	var educationMap = this.Experience.education,
		workMap = this.Experience.work;

	var gradientGen = new GradientGenerator();

	var thisWork, color;
	for(var name in workMap) {
		
		thisWork = workMap[name];
		thisWork = (thisWork instanceof Array) ? thisWork : [thisWork];
		
		for(var i=0; i<thisWork.length; i++) {
			
			color = thisWork[i].color;
			color = color.replace("#","");
			$("h4[work=\""+name+"\"]")
				.css("color","#FFFFFF")
				.parent("li")
					.css({
						background : "url(../images/bg.php?color=" + color + ") repeat-x 0 0"
					});
			//.gradientify({
			//	startColor : color.replace("#",""),
			//	length : 35
			//});
		}
	}
	
	var thisEducation, courses, color;
	for(var name in educationMap) {
		
		courses = educationMap[name].courses;
		for(var i=0; i<courses.length; i++) {
			
			color = courses[i].color;
			color = color.replace("#","");
			$("h4[education=\""+name+"\"]")
				.css("color","#FFFFFF")
				.parent("li")
					.css({
						background : "url(../images/bg.php?color=" + color + ") repeat-x 0 0"
					});
			//.gradientify({
			//	startColor : color.replace("#",""),
			//	length : 35
			//});
			
		}
		
	}
	
}

ResumePage.prototype.getTagSectionMap = function(){

	var map = { work : {}, education : {} },
		workSectionMap = map.work,
		educationSectionMap = map.education,
		
		educationMap = this.Experience.education,
		workMap = this.Experience.work;

	var thisWork, tags;
	for(var name in workMap) {
		
		thisWork = workMap[name];
		thisWork = (thisWork instanceof Array) ? thisWork : [thisWork];
		
		for(var i=0; i<thisWork.length; i++) {
			
			tags = thisWork[i].tags;
			for(var kw in tags) {
				
				if(!workSectionMap[kw]) { workSectionMap[kw] = {}; }
				workSectionMap[kw][name] = true
			}
		}
	}
	
	var thisEducation, courses, tags;
	for(var name in educationMap) {
		
		courses = educationMap[name].courses;
		for(var i=0; i<courses.length; i++) {
			
			tags = courses[i].tags;
			for(var kw in tags) {
				if(!educationSectionMap[kw]) { educationSectionMap[kw] = {}; }
				educationSectionMap[kw][name] = true;
			}
			
		}
		
	}
	
	return (this.getTagSectionMap = function(){
		return map;
	})();
}

ResumePage.prototype.toggleSection = function(e, el) {
	
	var sibling = $(el).siblings(".expandable");
	(sibling.is(":visible"))
		? sibling.slideUp()
		: sibling.slideDown();
	
}

ResumePage.prototype.openSection = function(section, type, keepExisting, timelineObj) {
	
	if(!keepExisting) {
		$("#resume h4[work], #resume h4[education]").each(function() { 
			if(this.getAttribute(type) == section) {
				return;
			}
			$(this).siblings(".expandable").slideUp(); 
		});
	}
	
	$("#resume h4["+type+"=\""+section+"\"]").siblings(".expandable").slideDown();
}

ResumePage.prototype.filterSections = function(keyword, keepExisting) {
	
	var tagMap = this.getTagSectionMap(),
		workMap = tagMap.work,
		educationMap = tagMap.education;
		
	if(!keepExisting) {
		$("#resume h4[work], #resume h4[education]").each(function() { 
			$(this).siblings(".expandable").slideUp(); 
		});
	}
	
	var els = [], el;
	var workSections = workMap[keyword] || [];
	for(var name in workSections) {
		el = $("#resume h4[work=\""+name+"\"]");
		if (el && el.length) { els.push(el); }
	}
	var educationSections = educationMap[keyword] || [];
	for(var name in educationSections) {
		el = $("#resume h4[education=\""+name+"\"]");
		if(el && el.length) { els.push(el); }
	}
	
	for(var i=0; i<els.length; i++) {
		els[i].siblings(".expandable").slideDown();
	}
	
}

ResumePage.prototype.Experience = {
	'work' : {
		'Time Warner Cable' : [{
			title : "IT Specialist",
			color : "#003EBA",
			date : { start : "06/01/2003", end : "08/01/2003" },
			tags : {
				'php' : 						15,
				'mysql' : 						15,
				'microsoftaccess' : 			30,
				'marketing' : 					40
			}
		},{
			title : "IT Specialist",
			color : "#5D7CBA",
			date : { start : "06/01/2004", end : "08/01/2004" },
			tags : {
				'microsoftaccess' : 			40,
				'oracle' : 						40,
				'lotusapproach' : 				20
			}
		},{
			title : "IT Specialist",
			color : "#8B9BBA",
			date : { start : "06/01/2005", end : "08/01/2005" },
			tags : {
				'marketing' : 					15,
				'windowsserver2003' : 			20,
				'disaster-contingency' :		20,
				'data-retention' : 				20,
				'activedirectory' : 			25
			}
		}],
		'NSFive Design' : {
			title : "Owner/Founder",
			color : "#29447B",
			date : { start : "07/01/2005", end : "03/15/2007"},
			tags : {
				'php' : 						10,
				'mysql' :						10,
				'asp' : 						5,
				'xhtml' : 						10,
				'css' : 						10,
				'javascript' : 					10,
				'hosting' : 					10,
				'consulting' : 					10,
				'marketing' : 					5,
				'searchengineoptimization' : 	5,
				'teamlead' : 					5,
				'projectmanagement' :			10
			}
		},
		'Marshall University' : {
			title : "Web Developer",
			color : "#14223D",
			date: { start : "05/01/2006", end : "03/15/2007"},
			tags : {
				'asp' : 						15,
				'mysql' : 						15,
				'css' : 						5,
				'javascript' : 					5,
				'xhtml' : 						10,
				'moderator' : 					5,
				'searchengineoptimization' : 	5,
				'technical-presentations' : 	10,
				'teamlead' : 					10,
				'projectmanagement' : 			10,
				'vbscript' : 					10
			}
		},
		'Bulldog Creative Services' : {
			title : "Web Director",
			color : "#455D8B",
			date : { start : "03/01/2005", end : "05/01/2008" },
			tags : {
				'xhtml' : 						5,
				'css' : 						5,
				'javascript' : 					5,
				'php' : 						5,
				'asp' : 						5,
				'mysql' : 						5,
				'mssql' : 						5,
				'searchengineoptimization' : 	5,
				'marketing' : 					5,
				'technical-presentations' : 	5,
				'disaster-contingency' : 		5,
				'data-retention' : 				5,
				'projectmanagement' : 			5,
				'hosting' : 					5,
				'technical-support' : 			5,
				'teamlead' : 					10,
				'interviewing' : 				5,
				'mentoring' : 					5,
				'hardware' : 					5
			}
		},
		'Wall Street On Demand' : {
			title : "Senior Developer",
			color : "#7986A1",
			date : { start : "05/19/2008", end : "10/15/2010" },
			tags : {
				'xhtml' : 						5,
				'css' : 						5,
				'asp' : 						5,
				'jscript' : 					10,
				'javascript' : 					15,
				'.net' : 						5,
				'c#' : 							5,
				'teamlead' : 					10,
				'i18n' : 						5,
				'interviewing' : 				5,
				'xml' : 						5,
				'xslt' : 						5,
				'accessibility' :				5,
				'mentoring' : 					5,
				'adobeair' : 					5,
				'visualstudio' : 				5
			}
		},
		'Yahoo' : {
			title : "Senior Engineer",
			color : "#687691",
			date : { start : "10/18/2010" },
			tags : {
				'xhtml' : 						5,
				'css' : 						5,
				'php' : 						15,
				'javascript' : 					10,
				'i18n' : 						15,
				'interviewing' : 				5,
				'xml' : 						5,
				'mysql' :  						15,
				'reporting' : 					10,
				'projectmanagement' : 			10,
				'technical-presentations' : 	5
			}
		}
	},
	'education' : {
		'Bridgeport High School' : {
			degree : "Emphasis in Communications",
			courses : [{
				title : "Cisco Networking",
				color : "#FF9000",
				date : [],
				tags : {}
			}]
		},
		'Marshall University' : {
			degree : "Bachelors of Science: Computer Information Technology (Web Applications and Software Development)",
			courses : [
				{ 
					title : "Programming Practicum with C++", 
					color : "#FF9000",
					date : { start : "01/01/2005", end : "05/01/2005"},
					tags : {
						"c++" : 				85,
						"visualstudio" : 		15
					} 
				},
				{ 
					title : "Data Structures",
					color : "#FFC77F", 
					date : { start : "09/01/2005", end : "12/01/2005"},
					tags : {
						"c++" : 				85,
						"visualstudio" : 		15
					} 
				},
				{ 
					title : "Algorithms",
					color : "#FFE3BF",  
					date : { start : "09/01/2005", end : "12/01/2005"},
					tags : {
						"c++" : 				75,
						"java" : 				25
					} 
				},
				{ 
					title : "Advanced C++",
					color : "#A97838", 
					date : { start : "01/01/2006", end : "05/01/2006"},
					tags : {
						"c++" : 				50,
						".net" : 				25,
						"visualstudio" : 		25
					} 
				},
				{ 
					title : "Software Engineering I && II",
					color : "#543C1C", 
					date : [
						{ start : "09/01/2006", end : "12/01/2006"},
						{ start : "01/01/2007", end : "05/01/2007"}
					],
					tags : {
						'projectmanagement' : 			25,
						'technical-presentations' : 	75
					}
				},
				{ 
					title : "Hardware Technology",
					color : "#BF955F", 
					date : { start : "01/01/2005", end : "05/01/2005"},
					tags : {
						'windows' : 					25,
						'linux' : 						25,
						'hardware' : 					50
					} 
				},
				{ 
					title : "Web Programming",
					color : "#DDC5A6", 
					date : [
						{ start : "09/01/2005", end : "12/01/2005"},
						{ start : "01/01/2008", end : "05/01/2008"}
					],
					tags : {
						'php' : 						30,
						'mysql' : 						20,
						'xhtml' : 						20,
						'javascript' : 					20,
						'css' : 						10
					}
				},
				{ 
					title : "E-Commerce",
					color : "#FFAE00",  
					date : { start : "01/01/2006", end : "05/01/2006"},
					tags : {
						'php' :							10,
						'mysql' : 						15,
						'projectmanagement' : 			20,
						'technical-presentations' : 	20,
						'xhtml' : 						10,
						'javascript' : 					15,
						'css' : 						5,
						'asp' : 						5
					}
				},
				{ 
					title : "Database Management",
					color : "#FFD67F", 
					date : { start : "09/01/2006", end : "12/01/2006"},
					tags : {
						'mysql' : 						50,
						'oracle' : 						50
					}
				},
				{ 
					title : "Multimedia Systems",
					color : "#FFEABF", 
					date : { start : "09/01/2005", end : "12/01/2005"},
					tags : {
						'flash' : 						50,
						'javascript' : 					30,
						'php' : 						10,
						'gd' : 							10
					} 
				},
				{ 
					title : "Java", 
					color : "#A98638",
					date : { start : "01/01/2007", end : "05/01/2007"},
					tags : {
						'java' : 						100
					}
				},
				{ 
					title : "Operating Systems",
					color : "#54431C", 
					date : { start : "01/01/2007", end : "05/01/2007"},
					tags : {
						'windows' : 					50,
						'linux' : 						50
					} 
				},
				{ 
					title : "Scripting Languages", 
					color : "#BFA05F",
					date : { start : "01/01/2007", end : "05/01/2007"},
					tags : {
						'jscript' : 					34,
						'wsh' : 						33,
						'vbscript' : 					33
					} 
				}
			]
		}
	}
};

