/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/

function showImage(dataView, index) {
	var record = dataView.store.getAt(index);
	window.open(record.get('url'));
//	window.open(record.get('url'), 'View Image - ' + record.get('title'));
}


function shorten(s, length) {
	if(s.length <= length) {
		return s;
	}
	var sideLen = length / 2;
	return s.substr(0, sideLen) + '...' + s.substr( s.length-sideLen, sideLen);
}

function stripFileExtension(s) {
	return s.substr(0, s.lastIndexOf('.'));
}

/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/

var ArticlesExpander = new Ext.grid.RowExpander({
	tpl : new Ext.Template(
		'<table class="expanded-table">',
		'<tr><td class="expanded-table-firstTD">Date:</td><td class="expanded-table-secondTD">{date}</td></tr>',
		'<tr><td class="expanded-table-firstTD">Link:</td><td class="expanded-table-secondTD"><a class="link" target="_blank" href="{url}">{shortUrl}</a></td></tr>',
		'<tr><td class="expanded-table-firstTD">Intro:</td><td class="expanded-table-secondTD">{description}</td></tr>',
		'</table>')
});

var ArticlesStore = new Ext.data.SimpleStore({
	fields: ['url', 'date', 'title', 'description', 'shortUrl'],
	data: [
		['http://www.gadberry.com/aaron/2006/03/06/compression-testing/', '3/5/2006', 'Compression Testing', 'So something\'s wrong with your car. No? Then somethings wrong with your truck, suv, motorcycle, boat, etc. Why else would your be reading this? I recently began having problems with my truck running very roughly. I figured a misfiring cylinder and started off by replacing sparkplugs and wires. When that didn\'t fix it, I rebuilt the distributor. That didn\'t do it either. I decided to try and find out if I had a different problem with the cylinders. I did a little research and decided that it wasn\'t very hard to check the compression. The basic idea is that if the compression in a cylinder is considerably lower than the other cylinders, then you have a problem. The problem could be a valve, piston, piston ring, or probably a few other things that I don\'t know about. Here\'s how to do it.'],
		['http://www.gadberry.com/aaron/2006/02/22/changing-stylesheets-dynamically/', '2/21/2006', 'Changing Stylesheets Dynamically', 'If you are one of those select few who have multiple stylesheets for their website, then this article is for you. On the other hand, whether you know CSS or not, this might be a good way for you to learn. I know of 4 ways to change between styles dynamically in a page. They are listed below with some code examples.'],
		['http://www.gadberry.com/aaron/2006/01/26/cryptarithmatic/', '1/25/2006', 'Cryptarithmatic', 'Write a program to solve a simple class of cryptarithmetic problems MORE EFFICIENTLY THAN BY BRUTE FORCE (EXHAUSTIVE SEARCH) by using deductions about even/odd, digit range, etc.'],
		['http://www.gadberry.com/aaron/2006/01/26/inference-engine/', '1/25/2006', 'Inference Engine', 'The purpose of this assignment is to create a Horn clause solver. This solver must read in logical expressions, or rules, and then be able to determine if it is possible to prove a certain variable true or false. The structure of the input, rules maintenance, and proving algorithm is not specified. The significance of this problem is simple. Input can be related to percepts, and deductions can be related to actions. This program is a simple way of representing logical thinking in an AI machine. A simple conditional agent responds logically based on the rules the user/programmer inputs. Although limited, it can be very powerful if implemented correctly.'],
		['http://www.gadberry.com/aaron/2006/01/26/pop-up-photographs-automatic-2d-3d-scene-creation/', '1/25/2006', 'Pop up Photographs', 'Our original plan had been to implement our own version of the SIGGRAPH paper "Automatic Photo Pop-up", from the 2005 SIGGRAPH proceedings. We researched ourselves into a corner, realizing that what we had taken on a project that was going to take many, many more months to complete than the time we had to work on this project. We decided, then, to plan out and research what we would have done if we had more time to work on this. This paper explains the approach that we took in an attempt to implement the paper. Even the simplified version that we had planned on still turned out to be too much to tackle in one semester.'],
		['http://www.gadberry.com/aaron/2006/01/26/rule-based-tic-tac-toe/', '1/25/2006', 'Rule-Based Tic Tac Toe', 'This program is an implementation of a rule-based AI game. The game has 5 difficulty levels based on how good you want the computer to be. It can range from making many mistakes to being impossible to beat. There is also an option for who gets to move first.'],
		['http://www.gadberry.com/aaron/2006/01/24/binary_search/', '1/23/2006', 'Searching: Binary Search', 'A binary search algorithm (or or binary chop) is a computer science technique for finding a particular value in a linear array, by "ruling out" half of the data at each step. A binary search finds the median, makes a comparison to determine whether the desired value comes before or after it, and then searches the remaining half in the same manner. A binary search is an example of a divide and conquer algorithm(more specifically a decrease and conquer algorithm) and a dichotomic search (more at Search algorithm).'],
		['http://www.gadberry.com/aaron/2006/01/24/balanced_binary_tree_search/', '1/23/2006', 'Searching: Binary Tree (Balanced)', 'In computer science, a binary search tree (BST) is a binary tree where every node has a value, every node\'s left subtree contains only values less than or equal to the node\'s value, and every node\'s right subtree contains only values that are greater than or equal. This requires that the values have a linear order. New nodes are added as leaves. Sort algorithms and search algorithms exist for binary search trees. The values of a binary search tree can be retrieved in ascending order using an in-order traversal.'],
		['http://www.gadberry.com/aaron/2006/01/24/unbalanced_binary_tree_search/', '1/23/2006', 'Searching: Binary Tree (Unbalanced)', 'In computer science, a binary search tree (BST) is a binary tree where every node has a value, every node\'s left subtree contains only values less than or equal to the node\'s value, and every node\'s right subtree contains only values that are greater than or equal. This requires that the values have a linear order. New nodes are added as leaves. Sort algorithms and search algorithms exist for binary search trees. The values of a binary search tree can be retrieved in ascending order using an in-order traversal.'],
		['http://www.gadberry.com/aaron/2006/01/24/search_driver/', '1/23/2006', 'Searching: Driver Program for Searches', 'This code implements and runs the search algorithm code in other articles. * Linear Search  * Hash Table Search  * Binary Search  * Binary Tree (Unbalanced)  * Binary Tree (Balanced)'],
		['http://www.gadberry.com/aaron/2006/01/24/hash_table_search/', '1/23/2006', 'Searching: Hash Table', 'In computer science, a hash table, or a hash map, is a data structure that associates keys with values. The primary operation it supports efficiently is a lookup: given a key (e.g. a person\'s name), find the corresponding value (e.g. that person\'s telephone number). It works by transforming the key using a hash function into a hash, a number that the hash table uses to locate the desired value.'],
		['http://www.gadberry.com/aaron/2006/01/24/linear_search/', '1/23/2006', 'Searching: Linear Search', 'In computer science, linear search is a search algorithm, also known as sequential search, that is suitable for searching a set of data for a particular value. It operates by checking every element of a list until a match is found. Linear search runs in O(N). If the data are distributed randomly, on average N/2 comparisons will be needed. The best case is that the value is equal to the first element tested, in which case only 1 comparison is needed. The worst case is that the value is not in the list, in which case N comparisons are needed.'],
		['http://www.gadberry.com/aaron/2006/01/13/bubble_sort/', '1/12/2006', 'Sorting: Bubble Sort', 'Bubble sort, also known as exchange sort, is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing two items at a time, swapping these two items if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which means the list is sorted. The algorithm gets its name from the way smaller elements "bubble" to the top (i.e. head) of the list via the swaps. Because it only uses comparisons to read elements, it is a comparison sort.'],
		['http://www.gadberry.com/aaron/2006/01/13/sort_driver/', '1/12/2006', 'Sorting: Driver Program for Sorts', 'This code implements and runs the sort algorithm code in other sort articles found here.  * Quick Sort  * Heap Sort  * Selection Sort  * Insertion Sort  * Merge Sort  * Bubble Sort'],
		['http://www.gadberry.com/aaron/2006/01/13/heap_sort/', '1/12/2006', 'Sorting: Heap Sort', 'Heapsort is one of the best general-purpose sort algorithms, a comparison sort and part of the selection sort family. It was created by Jason "Plugs" Palagios while doing his dissertation at MIT in 1994 while eating bon bons and playing Doom on the LAN. Although somewhat slower in practice on most machines than a good implementation of quicksort, it has the advantages of worst-case O(n log n) runtime and being an in-place algorithm. Heapsort is not a stable sort.'],
		['http://www.gadberry.com/aaron/2006/01/13/insertion_sort/', '1/12/2006', 'Sorting: Insertion Sort', 'Insertion sort is a simple sort algorithm, a comparison sort in which the sorted array (or list) is built one entry at a time. It is much less efficient on large lists than the more advanced algorithms such as quicksort, heapsort, or merge sort, but it has various advantages:'],
		['http://www.gadberry.com/aaron/2006/01/13/merge_sort/', '1/12/2006', 'Sorting: Merge Sort', 'Conceptually, merge sort works as follows:  1. Divide the unsorted list into two sublists of about half the size  2. Sort each of the two sublists  3. Merge the two sorted sublists back into one sorted list.'],
		['http://www.gadberry.com/aaron/2006/01/13/quick_sort/', '1/12/2006', 'Sorting: Quick Sort', 'Quicksort is a well-known sorting algorithm developed by C. A. R. Hoare that, on average, makes O(n log n) comparisons to sort n items. However, in the worst case, it makes O(n^2) comparisons. Typically, quicksort is significantly faster in practice than other O(n log n) algorithms, because its inner loop can be efficiently implemented on most architectures, and in most real-world data it is possible to make design choices which minimize the possibility of requiring quadratic time. Quicksort is a comparison sort.'],
		['http://www.gadberry.com/aaron/2006/01/13/selection_sort/', '1/12/2006', 'Sorting: Selection Sort', 'Selection sort is a sort algorithm, a comparison sort that works as follows:  1. find the minimum value in the list  2. swap it with the value in the first position  3. sort the remainder of the list (excluding the first value)'],
		['http://www.ford-trucks.com/article/idx/15/179/article/How_to_Make_Woodgrain_Doorpanels_for_19671972_', '12/16/2004', 'How to Make Woodgrain Doorpanels', ' Let me start by saying I have no idea what I\'m doing. I take on projects and figure them out as I go, hoping to learn from my mistakes and help others. However, this is an easy project, doable in a weekend. First what you have to do is remove the old door panels, which requires a (preferably deep) socket set, a philips screwdriver, and a long flathead screwdriver. Take off the window handle, followed by the 3 screws holding on the armrest. ']
	]
});

for(var i=0; i<ArticlesStore.getCount(); i++) {
	ArticlesStore.getAt(i).set('shortUrl', shorten(ArticlesStore.getAt(i).get('url'), 80));
}

var Articles = new Ext.grid.GridPanel({
	id:					'articles-panel',
	cls:				'main-section articles-panel',
	plugins:			ArticlesExpander,
	stripeRows:			true,
	enableColumnMove:	false,
	viewConfig:			{forceFit: true},
	ds:					ArticlesStore,
	cm:					new Ext.grid.ColumnModel([
							ArticlesExpander,
							{header:'Title', dataIndex: 'title', sortable: true, resizable: false, hideable: false}
						])
});

/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/

var renderDepartmentNumber = function(value, p, record) {
	return record.get('department') + '-' +  record.get('number');
};

var ClassesExpander = new Ext.grid.RowExpander({
	tpl : new Ext.Template(
		'<table class="expanded-table">',
		'<tr><td class="expanded-table-firstTD">Semester:</b></td><td class="expanded-table-secondTD">{semester}</td></tr>',
		'<tr><td class="expanded-table-firstTD">Professor:</b></td><td class="expanded-table-secondTD">{professor}</td></tr>',
		'<tr><td class="expanded-table-firstTD">Hours:</b></td><td class="expanded-table-secondTD">{hours}</td></tr>',
		'<tr><td class="expanded-table-firstTD">Prerequisites:</b></td><td class="expanded-table-secondTD">{prerequisites}</td></tr>',
		'<tr class="{cls}"><td class="expanded-table-firstTD">Link:</b></td><td class="expanded-table-secondTD"><a class="link" target="_blank" href="{url}">Zip of selected work</a></td></tr>',
		'<tr><td class="expanded-table-firstTD">Summary:</b></td><td class="expanded-table-secondTD">{summary}</td></tr>',
		'</table>')
});

var Classes = new Ext.grid.GridPanel({
	id:					'classes-grid',
	cls:				'main-section classes-grid',
	plugins:			ClassesExpander,
	stripeRows:			true,
	enableColumnMove:	false,
	viewConfig:			{forceFit: true},
	cm:					new Ext.grid.ColumnModel([
							ClassesExpander,
							{header:'Course', dataIndex: 'department', width: 80, fixed: true, sortable: true, hideable: false, renderer: renderDepartmentNumber},
							{header:'Title', dataIndex: 'title', sortable: true, resizable: false, hideable: false},
							{header:'Grade', dataIndex: 'grade', width: 50, fixed: true, sortable: true, hideable: false}
						]),
	ds:					new Ext.data.SimpleStore({
							fields: ['department', 'number', 'title', 'graduate', 'summary', 'prerequisites', 'professor', 'semester', 'grade', 'url', 'hours', 'cls'],
							data: [
								['CPSC', '111', 'Intro to CS Concepts and Programming', '0', 'Basic concepts, nomenclature, and historical perspective of computers and computing; problem solving and software design principles, including abstraction, modularity, data representation, documentation, portability, structured and object oriented programming; software engineering concepts including requirements definition, testing, and maintenance considerations; development and execution of student written programs.', 'Course in Pascal or C (high school or college) or approval of instructor.', 'Dr. Lawrence Peterson', 'Fall 2002', 'A', 'classfiles/cpsc111.zip', '4', ''],
								['CPSC', '211', 'Data Structures and Implementations', '0', 'Specification and implementation of basic data structures and abstract data types - linked lists, stacks, queues, trees and tables; performance tradeoffs of different implementations; asymptotic analysis of running time and memory usage; compares and contrasts object-oriented language (typically, Java) and non-object-oriented languages (typically, C); emphasis on adherence to good software engineering principles.', 'CPSC 111 or approval of instructor.', 'Dr. Teresa Leyk', 'Spring 2003', 'A', 'classfiles/cpsc211.zip', '4', ''],
								['CPSC', '310', 'Database Systems', '0', 'File structures and access methods; database modelling, design and user interface; components of database management systems; information storage and retrieval, query languages, high-level language interface with database systems.', 'CPSC 210 or 211', 'Du Li', 'Spring 2004', 'A', 'classfiles/cpsc310.zip', '3', ''],
								['CPSC', '311', 'Analysis of Algorithms', '0', 'Fundamental concepts and techniques of intelligent systems; representation and interpretation of knowledge on a computer; search strategies and control; active research areas and applications such as notational systems, natural language understanding, vision systems, planning algorithms, intelligent agents and expert systems.', 'CPSC 311', 'Dr. Teresa Leyk', 'Spring 2005', 'B', 'classfiles/cpsc311.zip', '3', ''],
								['CPSC', '321', 'Computer Architecture', '0', 'Basic hardware/software components, assembly language, and functional architecture design of computers; syntax and semantics of a typical microprocessor assembly language; instruction sets, construction and execution of an assembly program; the design of I/O modules, memory, control unit and arithmetic unit.', 'ELEN 220 or 248', 'Dr. Hank Walker', 'Fall 2004', 'C', 'classfiles/cpsc321.zip', '4', ''],
								['CPSC', '332', 'Programming Language Design', '0', 'Design of high-level languages; criteria for language selection; specification techniques for syntax and semantics; trends in high-level language design and introduction to programming in LISP.', 'CPSC 211', 'Dr. Salih Yurttas', 'Fall 2004', 'A', 'classfiles/cpsc332.zip', '3', ''],
								['CPSC', '410', 'Operating Systems', '0', 'Hardware/software evolution leading to contemporary operating systems; basic operating systems concepts; methods of operating systems design and construction; algorithms for CPU scheduling, memory and general resource allocation; process coordination and management; case studies of several operating systems.', 'CPSC 321', 'Dr. Zbigniew Leyk', 'Summer 2005', 'A', 'classfiles/cpsc410.zip', '3', ''],
								['CPSC', '420', 'Artificial Intelligence', '0', 'Fundamental concepts and techniques of intelligent systems; representation and interpretation of knowledge on a computer; search strategies and control; active research areas and applications such as notational systems, natural language understanding, vision systems, planning algorithms, intelligent agents and expert systems.', 'CPSC 311', 'Dr. Walter Daugherity', 'Summer 2005', 'A', 'classfiles/cpsc420.zip', '3', ''],
								['CPSC', '441', 'Computer Graphics', '0', 'Principles of interactive computer graphics; systems organization and device technologies for raster and vector displays; 2-D and 3-D viewing, clipping, segmentation and interaction handling; 3-D geometrical transformations, projections and hierarchical data structures for graphics modeling.', 'CPSC 210; junior classification', 'Dr. John Keyser', 'Spring 2005', 'A', '', '3', 'hidden'],
								['CPSC', '641', 'Advanced Computer Graphics', '0', 'Representations of 3-dimensional objects, including polyhedral objects, curved surfaces, volumetric representations and CSG models; techniques for hidden surface/edge removal and volume rendering; illumination and shading; anti-aliasing; ray tracing; radiosity; animation; practical experience with state-of-the-art graphics hardware and software.', 'CPSC 441. Cross-listed with VIZA 671', 'Dr. John Keyser', 'Fall 2005 (Graduate Level)', 'A', 'classfiles/cpsc641.zip', '3', ''],
								['CPSC', '431', 'Software Engineering', '0', 'Application of engineering approach to computer software design and development; life cycle models, software requirements and specification; conceptual model design; detailed design; validation and verification; design quality assurance; software design/development environments and project management.', 'CPSC 311', 'Dick Simmons', 'Fall 2005', 'A', '', '3', 'hidden'],
								['MATH', '151', 'Engineering Math 1', '0', 'Rectangular coordinates, vectors, analytic geometry, functions, limits, derivatives of functions, applications, integration, computer algebra (Maple).', 'High school algebra I and II, trigonometry and geometry; MATH150', 'Joe Kahlig', 'Fall 2002', 'B', '', '4', 'hidden'],
								['MATH', '152', 'Engineering Math 2', '0', 'Differentiation and integration techniques and their applications (area, volumes, work), improper integrals, approximate integration, analytic geometry, vectors, infinite series, power series, Taylor series, computer algebra (Maple).', 'MATH 151 or equivalent', 'Lei Zhang', 'Fall 2003', 'C', '', '4', 'hidden'],
								['MATH', '302', 'Discrete Math', '0', 'Formal structures for describing data, algorithms and computing devices; theory and applications of sets, graphs and algebraic structures.', 'MATH 152', 'Maurice Rojas', 'Fall 2004', 'C', '', '3', 'hidden'],
								['MATH', '308', 'Differential Equations', '0', 'Linear ordinary differential equations, solutions in series, solutions using Laplace transforms, systems of differential equations.', 'MATH 251 or equivalent; knowledge of computer algebra system (Maple).', 'Changbing Hu', 'Spring 2005', 'C', '', '3', 'hidden'],
								['HIST', '105', 'History of the United States', '0', 'Colonial heritage; Revolution; adoption of Constitution; growth of nationalism and sectionalism; Civil War; Reconstruction.', '', 'Woodfin', 'Fall 2002', 'B', '', '3', 'hidden'],
								['HIST', '106', 'History of the United States', '0', 'Since reconstruction; new social and industrial problems; rise of progressivism; U.S. emergence as world power; World War I; reaction and New Deal; World War II; contemporary America.', '', 'Larry Smith', 'Spring 2003', 'B', '', '3', 'hidden'],
								['GEOL', '101', 'Principles of Geology', '0', 'Physical and chemical nature of the Earth and dynamic processes that shape it; plate tectonics, Earth\'s interior, materials it is made of, age and evolution, earthquakes, volcanism, erosion and deposition; introduces physical and chemical principles applied to the Earth.', 'Not open to students who have taken GEOL 103 or 104.', 'Dr. Thomas W. C. Hilde', 'Fall 2002', 'B', '', '4', 'hidden'],
								['GEOL', '106', 'Historical Geology', '0', 'Hypotheses of Earth\'s origin; age dating of geologic materials; development and history of life; plate tectonic reconstructions, geologic history, and paleogeography, with emphasis on the North American plate.', 'GEOL 101 or equivalent', 'Dr. Tom Yancey', 'Spring 2003', 'A', '', '4', 'hidden'],
								['KINE', '198', 'Health and Fitness Activity', '0', 'Half lecture; half activity; student choice of designated fitness or strength related activities; lecture portion covers current health topics. <br> I chose Self Defense. Woohoo.', '', 'none', 'Fall 2002', 'B', '', '1', 'hidden'],
								['KINE', '199', 'Required Physical Activity', '0', 'Selection from a wide variety of activities designed to increase fitness and/or encourage the pursuit of lifetime activity.<br> I chose Aerobic Walking. Woohoo.', '', 'Denise Chapman', 'Fall 2003', 'S', '', '1', 'hidden'],
								['POLS', '206', 'American National Government', '0', 'Survey of American national government, politics, and constitutional development.', '', '', 'Spring 2003', 'B', '', '3', 'hidden'],
								['POLS', '207', 'State and Local Government', '0', 'Survey of state and local government and politics with special reference to the constitution and politics of Texas.', '', 'Nikki R. Van Hightower', 'Fall 2003', 'B', '', '3', 'hidden'],
								['PHIL', '482', 'Ethics and Engineering', '0', 'Development of techniques of moral analysis and their application to ethical problems encountered by engineers, such as professional employee rights and whistle blowing; environmental issues; ethical aspects of safety, risk and liability; conflicts of interest; emphasis on developing the capacity for independent ethical analysis of real and hypothetical cases.', 'Junior classification. Cross-listed with ENGR 482', 'James, Harris, and Heffington', 'Fall 2003', 'B', '', '3', 'hidden'],
								['PHYS', '218', 'Mechanics', '0', 'Mechanics for students in science and engineering.3 Laboratory hours per week Offered each Fall, Spring and 10 week Summer. Credit Hours:4 Lab Hours:0', 'MATH 151 or 171 or registration therein', 'Carl Gagliardi', 'Fall 2003', 'B', '', '4', 'hidden'],
								['ELEN', '248', 'Introduction to Digital System Design', '0', 'Combinational and sequential digital system design techniques; design of practical digital systems.', 'ELEN 214 or equivalent, or registration therein', 'Dr. Karen Butler-Purry', 'Spring 2004', 'C', 'classfiles/elen248.zip', '4', ''],
								['STAT', '211', 'Principles of Statistics I', '0', 'Introduction to probability and probability distributions. Sampling and descriptive measures. Inference and hypothesis testing. Linear regression, analysis of variance.', 'MATH 152 or 172', 'Derya Akleman', 'Fall 2004', 'C', '', '3', 'hidden'],
								['MGMT', '209', 'Business, Government and Society', '0', 'Impact of the external environment--legal, political, economic and international--on business behavior; market and non-market solutions to contemporary public policies confronting business persons examined including antitrust law, employment and discrimination law, product safety regulation, consumer protection and ethics. May not be used to satisfy degree requirements for majors in business.', 'Sophomore classification; for students other than business and agribusiness majors.', 'Keith Swim, Jr.', 'Spring 2005', 'C', '', '3', 'hidden'],
								['ACCT', '209', 'Survey of Accounting Principles', '0', 'Accounting survey for non-business majors; non-technical accounting procedures, preparation and interpretation of financial statements and internal control. May not be used to satisfy degree requirements for majors in business. Business majors who choose to take this course must do so on a satisfactory/unsatisfactory basis.', '', 'Robert H. Strawser', 'Spring 2005', 'B', '', '3', 'hidden'],
								['POLS', '331', 'Introduction to World Politics', '0', 'Analysis of contemporary world from point of view of nation-state; political problems, factors involved in foreign policies and relations of nations.', 'POLS 206 or approval of department head.', 'Belinda Bragg', 'Summer 2005', 'A', '', '3', 'hidden'],
								['MKTG', '309', 'Introduction to Marketing Credits', '0', 'A survey course of the basic principles of marketing and key decision areas; product, promotion, distribution and pricing.', 'Junior classification; for students other than business and agribusiness majors', 'Duane Dewald', 'Summer 2005', 'A', '', '3', 'hidden'],
								['FINC', '309', 'Survey of Finance Principles', '0', 'Finance survey for non-business majors; financial markets, the investment banking process, interest rates, financial intermediaries and the banking system, financial instruments, time value of money concepts, and security valuation and selection. May not be used to satisfy degree requirements for majors in business.', 'ACCT 209 or 229; junior classification', 'Sally Guyton', 'Fall 2005', 'B', 'classfiles/finc309.zip', '3', ''],
								['ENGL', '301', 'Technical Writing', '0', 'Process of developing field-specific technical information related to the major, including researching, drafting, editing, revising, and designing technical reports, proposals, manuals, resumes and professional correspondence for specific audiences. Special topics, computer and distance sections available.', 'ENGL 104; Junior, Senior, and Post-Baccalaureate Classification Only.', 'Cindy Raisor', 'Fall 2005', 'B', 'classfiles/engl301.zip', '3', ''],
								['MUSC', '324', 'Music in World Cultures', '0', 'Examines music from an ethnomusicological perspective focusing on musical performance and the complex interrelationship of music to culture, society, and daily life; surveys music from a variety of cultures through a series of case studies.', 'MUSC 102 or approval of instructor. Cross-listed with ANTH 324.', 'Al. Madrid', 'Fall 2005', 'B', '', '3', 'hidden'],
								['MATH', '253', 'Engineering Math 3', '0', 'Vector calculus; calculus of functions of several variables, partial derivatives, directional derivatives, gradient, multiple integration, Green\'s and Stokes\' theorems, computer algebra (Maple).', 'MATH152 or equivalent', 'Art Belmonte', 'Spring 2004', 'B', '', '3', 'hidden'],
								['PHYS', '208', 'Electricity and Optics', '0', 'Continuation of PHYS 218. Electricity, magnetism and optics. Primarily for engineering students. Offered each Fall, Spring and 10 week Summer Credit Hours:4 Lab Hours:3', 'MATH 152, 161 or 172 and PHYS 218', 'Dr. John Hardy', 'Spring 2006', 'C', '', '4', 'hidden'],
								['MGMT', '309', 'Survey of Management', '0', 'Survey of the basic functions and responsibilities of managers; includes the environmental context of management, planning and decision making, organization structure and design, leading and managing people, and the controlling process; issues of globalization, ethics, quality and diversity integrated throughout the course. May not be used to satisfy degree requirements for majors in business.<br> Prerequisite(s): Prerequisites: Junior classification; for students other than business and agribusiness majors.', 'Junior classification; for students other than business and agribusiness majors.', 'Liesel Wesson', 'Spring 2006', 'B', '', '3', 'hidden'],
								['COMM', '203', 'Public Speaking', '0', 'Training in speeches of social and technical interest designed to teach students to develop and illustrate ideas and information and to inform, stimulate, and persuade their audiences.', '', 'Rebekah Carter', 'Fall 2004', 'B', '', '3', 'hidden'],
								['CPSC', '481', 'Seminar', '0', 'Investigation and report by students on topics of current interest in computer science.', 'Senior classification.', 'Dr. Nancy Amato', 'Fall 2005', 'A', '', '1', 'hidden'],
								['CPSC', '433', 'Formal Languages and Automata', '0', 'Basic types of abstract languages and their acceptors; the Chomsky hierarchy; solvability and recursive function theory; application of theoretical results to practical problems.', 'CPSC 311', 'Dr. Jennifer Welch', 'Spring 2006', 'A', 'classfiles/cpsc433.zip', '3', ''],
								['CPSC', '438', 'Distributed Objects Programming', '0', 'Principles of distributed computing and programming with current paradigms, protocols, and application programming interfaces including Sockets, RMI, CORBA, IDL, Servlets, Web Services; security issues with public/private keys, digital signatures, forms and GUI based applications with multi-tier components, database connectivity and storing/streaming data structured using XML.', 'CPSC 332 or approval of instructor; junior or senior classification.', 'Dr. Salih Yurttas', 'Spring 2006', 'A', '', '3', 'hidden'],
								['CPSC', '645', 'Geometric Modeling', '1', 'Geometric and solid modeling concepts. Freeform curves and surfaces (splines and Bezier) with their relational, intersectional and global mathematical properties. Parametric representation of solids, topology of closed curved surfaces, boundary concepts and Boolean/Euler operators. Construction and display of curves and surfaces, and solid models.', 'CPSC 441 and 442 or equivalent', 'Dr. John Keyser', 'Fall 2006 (Graduate)', 'B', 'classfiles/cpsc645.zip', '3', ''],
								['CPSC', '613', 'Operating Systems', '1', 'Analysis of algorithms in computer operating systems; sequencing and control algorithms supporting concurrent processes; scheduling algorithms to minimize execution times and mean flow times; algorithms for allocating tasks to processors; allocation of memory (virtual and real); direct access device schedules; auxiliary and buffer storage models.', 'CPSC 410', 'Dr. Udo Pooch', 'Fall 2006 (Graduate)', 'B', 'classfiles/cpsc613.zip', '3', ''],
								['CPSC', '629', 'Analysis of Algorithms', '1', 'Concrete algorithm design and analysis; abstract models to analyze the complexity of problems; NP-Completeness; approximation and probabilistic algorithms.', 'CPSC 311', 'Dr. Don Friesen', 'Fall 2006 (Graduate)', 'A', 'http://www.gadberry.com/travis/classfiles/cpsc629.zip', '3', ''],
								['CPSC', '436', 'Computer Human Interaction', '1', 'Comprehensive study of the Computer-Human Interaction (CHI) area; includes history and importance of CHI; CHI design theories; modeling of computer users and interfaces; empirical techniques for task analysis and interface design; styles of interaction and future directions of CHI including hypermedia and computer-supported collaborative work.', 'CPSC 310, 320, and 321', 'Dr. Frank Shipman', 'Fall 2006 (Graduate)', 'A', 'classfiles/cpsc436.zip', '3', '']
							]
						})
});

// 641
// 645
// 613
// 629
// 436


/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/


var ProjectsExpander = new Ext.grid.RowExpander({
	tpl : new Ext.Template(
		'<table class="expanded-table">',
		'<tr><td class="expanded-table-firstTD">Class:</b></td><td class="expanded-table-secondTD">{class}</td></tr>',
		'<tr><td class="expanded-table-firstTD">Link:</b></td><td class="expanded-table-secondTD"><a class="link" target="_blank" href="{url}">Zip of selected work</a></td></tr>',
		'<tr><td class="expanded-table-firstTD">Description:</b></td><td class="expanded-table-secondTD">{description}</td></tr>',
		'</table>')
});

var Projects = new Ext.grid.GridPanel({
	id:					'projects-panel',
	cls:				'main-section projects-panel',
	plugins:			ProjectsExpander,
	stripeRows:			true,
	enableColumnMove:	false,
	viewConfig:			{forceFit: true},
	cm:					new Ext.grid.ColumnModel([
							ProjectsExpander,
							{header:'Title', dataIndex: 'title', sortable: true, resizable: false, hideable: false}
						]),
	ds:					new Ext.data.SimpleStore({
							fields: ['class', 'url', 'title', 'description'],
							data: [
								['Cpsc 311', 'http://www.gadberry.com/travis/classfiles/cpsc311/Sorting.zip', 'Sorting Algorithms', 'A collection of basic sorting algorithms, including report and code.'],
								['Cpsc 311', 'http://www.gadberry.com/travis/classfiles/cpsc311/Searching.zip', 'Searching Algorithms', 'A collection of basic searching algorithms, including report and code.'],
								['Cpsc 311', 'http://www.gadberry.com/travis/classfiles/cpsc311/GraphSP.zip', 'Graph Project (SP)', 'Code which performs certain operations on graphs.'],
								['Cpsc 332', 'http://www.gadberry.com/travis/classfiles/cpsc332/psFlags.zip', 'Postscript Flags', 'A few flag images made in PS by hand.'],
								['Personal', 'http://www.gadberry.com/travis/classfiles/cpsc420/TicTacToe.zip', 'TicTacToe', 'An unbeatable gui of TTT. Difficulty levels and options.'],
								['Cpsc 420', 'http://www.gadberry.com/travis/classfiles/cpsc420/Cryptarithmatic.zip', 'Cryptarithmatic', 'Command line program solves cryptarithmatic problems efficiently.'],
								['Cpsc 420', 'http://www.gadberry.com/travis/classfiles/cpsc420/8PuzzleSolver.zip', '8Puzzle Solver', 'Command line program solves 8 puzzles extremely efficiently.'],
								['Cpsc 420', 'http://www.gadberry.com/travis/classfiles/cpsc420/InferenceEngine.zip', 'Inference Engine', 'A basic inference engine. Input rules and it determines values based on rules.'],
								['Cpsc 433', 'http://www.gadberry.com/travis/classfiles/cpsc433/NFASimulator.zip', 'NFA Simulator', 'Simulates a Nondeterministic Finite Automaton'],
								['Cpsc 441', 'http://www.gadberry.com/travis/classfiles/cpsc441/RoboticArm.zip', 'Robotic Arm', 'An OpenGL robotic arm simulation with keyboard controls'],
								['Cpsc 441', 'http://www.gadberry.com/travis/classfiles/cpsc441/LightingCalcs.zip', 'Lighting Calcs', 'OpenGL code which calculates the lighting on objects'],
								['Cpsc 441', 'http://www.gadberry.com/travis/classfiles/cpsc441/Flythrough.zip', 'Flythrough', 'OpenGL flythrough with keyboard controls.'],
								['Cpsc 441', 'http://www.gadberry.com/travis/classfiles/cpsc441/MultiView.zip', 'MultiViewport', 'OpenGL sample with several viewports and context menu options.']
							]
						})
});

/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/

var artDir = './graphics/thumbs/';

var ArtDesign = new Ext.Panel({
	id:			'artdesign-panel',
	cls:		'main-section artdesign-panel',
	layout:		'fit',
	items: [

		new Ext.DataView({
			cls:			'img-chooser-view',
			singleSelect:	true,
			overClass:		'x-view-over',
			itemSelector:	'div.thumb-wrap',
			listeners:		{'dblclick' : showImage},
			tpl:			new Ext.XTemplate(
								'<tpl for=".">',
									'<div class="thumb-wrap" id="{title}"><center>',
									'<div class="thumb"><img src="{thumbUrl}"></div>',
									'<span class="x-editable">{title}</span></center></div>',
								'</tpl>',
								'<div class="x-clear"></div>'),
			store:			new Ext.data.Store({
								autoLoad:	true,
								fields:		['url', 'thumbUrl', 'title'],
								sortInfo:	{field: 'title', direction: "ASC"},
								proxy:		new Ext.data.HttpProxy({url: 'getFileList.php?dir=' + artDir}),
								reader:		new Ext.data.JsonReader({root: 'fileList'}, ['url', 'title']),
								listeners:	{
												'load': function(store, records) {
													for(var i=0; i<records.length; i++) {
														var rec = records[i];
														rec.set('thumbUrl', rec.get('url'));
														rec.set('url', rec.get('url').replace('thumbs/', '') );
														var title = stripFileExtension(rec.get('title'));
														rec.set('title', shorten( title , 20));
													}
												}
											}
							})
		})
	]
});


/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/



var picturesDir = './pictures/thumbs/';

var Pictures = new Ext.Panel({
	id:			'pictures-panel',
	cls:		'main-section pictures-panel',
	layout:		'fit',
	items: [

		new Ext.DataView({
			cls:			'img-chooser-view',
			singleSelect:	true,
			overClass:		'x-view-over',
			itemSelector:	'div.thumb-wrap',
			listeners:		{'dblclick' : showImage},
			tpl:			new Ext.XTemplate(
								'<tpl for=".">',
									'<div class="thumb-wrap" id="{title}"><center>',
									'<div class="thumb"><img src="{thumbUrl}"></div>',
									'<span class="x-editable">{title}</span></center></div>',
								'</tpl>',
								'<div class="x-clear"></div>'),
			store:			new Ext.data.Store({
								autoLoad:	true,
								fields:		['url', 'thumbUrl', 'title'],
								sortInfo:	{field: 'title', direction: "ASC"},
								proxy:		new Ext.data.HttpProxy({url: 'getFileList.php?dir=' + picturesDir}),
								reader:		new Ext.data.JsonReader({root: 'fileList'}, ['url', 'title']),
								listeners:	{
												'load': function(store, records) {
													for(var i=0; i<records.length; i++) {
														var rec = records[i];
														rec.set('thumbUrl', rec.get('url'));
														rec.set('url', rec.get('url').replace('thumbs/', '') );
														var title = stripFileExtension(rec.get('title'));
														rec.set('title', shorten( title , 20));
													}
												}
											}
							})
		})
	]
});


/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/


/*
var gunsDir = './guns/thumbs/';

var Guns = new Ext.Panel({
	id:			'guns-panel',
	cls:		'main-section guns-panel',
	layout:		'fit',
	items: [

		new Ext.DataView({
			cls:			'img-chooser-view',
			singleSelect:	true,
			overClass:		'x-view-over',
			itemSelector:	'div.thumb-wrap',
			listeners:		{'dblclick' : showImage},
			tpl:			new Ext.XTemplate(
								'<tpl for=".">',
									'<div class="thumb-wrap" id="{title}"><center>',
									'<div class="thumb"><img src="{thumbUrl}"></div>',
									'<span class="x-editable">{title}</span></center></div>',
								'</tpl>',
								'<div class="x-clear"></div>'),
			store:			new Ext.data.Store({
								autoLoad:	true,
								fields:		['url', 'thumbUrl', 'title'],
								sortInfo:	{field: 'title', direction: "ASC"},
								proxy:		new Ext.data.HttpProxy({url: 'getFileList.php?dir=' + gunsDir}),
								reader:		new Ext.data.JsonReader({root: 'fileList'}, ['url', 'title']),
								listeners:	{
												'load': function(store, records) {
													for(var i=0; i<records.length; i++) {
														var rec = records[i];
														rec.set('thumbUrl', rec.get('url'));
														rec.set('url', rec.get('url').replace('thumbs/', '') );
														var title = stripFileExtension(rec.get('title'));
														rec.set('title', shorten( title , 20));
													}
												}
											}
							})
		})
	]
});
*/

/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/


var filesDir = './uploads/';

var Files = new Ext.Panel({
	id:			'files-panel',
	cls:		'main-section files-panel',
	layout:		'fit',
	items: [

		new Ext.DataView({
			cls:			'img-chooser-view',
			singleSelect:	true,
			overClass:		'x-view-over',
			itemSelector:	'div.thumb-wrap',
			listeners:		{'dblclick' : showImage},
			tpl:			new Ext.XTemplate(
								'<tpl for=".">',
									'<div class="thumb-wrap" id="{title}"><center>',
									'<div class="thumb"><img src="{thumbUrl}"></div>',
									'<span class="x-editable">{title}</span></center></div>',
								'</tpl>',
								'<div class="x-clear"></div>'),
			store:			new Ext.data.Store({
								autoLoad:	true,
								fields:		['url', 'thumbUrl', 'title', 'filetype'],
								sortInfo:	{field: 'title', direction: "ASC"},
								proxy:		new Ext.data.HttpProxy({url: 'getFileList.php?dir=' + filesDir}),
								reader:		new Ext.data.JsonReader({root: 'fileList'}, ['url', 'title']),
								listeners:	{
												'load': function(store, records) {
													var fileTypes = {
														'html':	'html',
														'htm':	'html',
														'php':	'html',
														'js':	'html',
														'gif':	'image',
														'jpg':	'image',
														'jpeg':	'image',
														'png':	'image',
														'pdf':	'pdf',
														'mp3':	'sound',
														'wma':	'sound',
														'wav':	'sound',
														'aif':	'sound',
														'avi':	'video',
														'mpg':	'video',
														'mpeg':	'video',
														'wmv':	'video',
														'zip':	'zip',
														'txt':	'txt',
														'doc':	'txt',
														'docx':	'txt',
														'xls':	'spreadsheet',
														'xlsx':	'spreadsheet'
													};

													for(var i=0; i<records.length; i++) {
														var rec = records[i];
														var title = rec.get('title');
														var fileType = title.substr( title.lastIndexOf('.') + 1 );
														var thumbUrl = rec.get('url');
														if(fileTypes[fileType] !== 'image') {
															thumbUrl = 'images/thumbs/' + (fileTypes[fileType] || 'unknown') + '.png';
														}
														rec.set('thumbUrl', thumbUrl);
														rec.set('title', shorten(title, 20));
													}
												}
											}
							})
		})
	]
});

/*********************************************************************************************************************************/
/*********************************************************************************************************************************/
/*********************************************************************************************************************************/


var AboutMe = new Ext.grid.GridPanel({
	id:						'aboutme-panel',
	cls:					'main-section aboutme-panel',
	stripeRows:				true,
	enableColumnMove:		false,
	viewConfig:				{forceFit: true},
	cm:						new Ext.grid.ColumnModel([
								{header:'Thing', dataIndex: 'thing', width: 100, fixed: true},
								{header:'Value', dataIndex: 'value', resizable: false}
							]),
	ds:						new Ext.data.SimpleStore({
								fields: ['thing', 'value'],
								data: [
									['Name:','Travis Gadberry'],
									['School:','Texas A&M University'],
									['Master\'s Degree:','Computer Science (Dec 2007)'],
									['Bachelor\'s Degree:','Computer Science / Business Minor (May 2006)'],
									['Current Job:','Software Developer at Microsoft'],
									['Current Location:','Redmond, WA'],
									['Hometown:','San Antonio, TX'],
									['Height / Weight:','6\'1" / 200 lbs'],
									['Interests:','Computers, hiking, engines, outdoors, movies, etc'],
									['Contact Info:','<a href="mailto:travis@gadberry.com" class="link">travis@gadberry.com </a> | (210) 685-2107'],
									['Portrait:','<a href="http://www.gadberry.com/travis/images/portrait2.jpg" target="_blank"><img class="grayed" src="http://www.gadberry.com/travis/images/portrait.jpg"></a>']
								]
							})
});



