<!--

var topicsFound=0;
var topicName="Catalog";

function showVideo(title)
{
window.open(title,'_video_window','width=970,height=565,status=no,scrollbars=no,resizable=yes,toolbar=no,left=20,screenX=20,top=10,screenY=10'); 
}


function topicsDB(val,topic_text,topic_url)
{
		this.val = val;
		this.topic_text = topic_text;
		this.topic_url = topic_url;
}

function getTopicType(topicStr)
{
	for(k=0; k<MAX_TOPICS; k++) {
		if(topics[k].topic_text == topicStr)  {
			return topics[k].val;
		}
	}
}

function getTopics(dbEntry)
{
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic1 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic2 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic3 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic4 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic5 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
	for(k=0; k<MAX_TOPICS; k++) {
		if(dbEntry.topic6 == topics[k].val) 
			document.write('<li><a href="'+topics[k].topic_url+'">'+topics[k].topic_text+'</a></li>');
	}
}

function dbData(hbsp_id,author_first,author_last,affiliation,title,short_bio,marketing_text,short_text,preview_url,topic1,topic2,topic3,topic4,topic5,topic6)
{
        this.hbsp_id = hbsp_id;
        this.author_first = author_first;
        this.author_last = author_last;
        this.affiliation = affiliation;
        this.title = title;
        this.short_bio = short_bio;
        this.marketing_text = marketing_text;
        this.short_text = short_text;
		this.preview_url = preview_url;
        this.topic1 = topic1;
        this.topic2 = topic2;
        this.topic3 = topic3;
        this.topic4 = topic4;
        this.topic5 = topic5;
        this.topic6 = topic6;
}

function copyDB(sourceDB)
{
	var targetDB=new Array();
	for(i=0; i<MAX_DB_ENTRIES;i++) {
		targetDB[i]=new dbData(
			sourceDB[i].hbsp_id,
			sourceDB[i].author_first,
			sourceDB[i].author_last,
			sourceDB[i].affiliation,
			sourceDB[i].title,
			sourceDB[i].short_bio,
			sourceDB[i].marketing_text,
			sourceDB[i].short_text,
			sourceDB[i].preview_url,
			sourceDB[i].topic1,
			sourceDB[i].topic2,
			sourceDB[i].topic3,
			sourceDB[i].topic4,
			sourceDB[i].topic5,
			sourceDB[i].topic6);
	}
	return targetDB;
}

function copyRecord(sourceRecord)
{
	var targetRecord=new dbData(
			sourceRecord.hbsp_id,
			sourceRecord.author_first,
			sourceRecord.author_last,
			sourceRecord.affiliation,
			sourceRecord.title,
			sourceRecord.short_bio,
			sourceRecord.marketing_text,
			sourceRecord.short_text,
			sourceRecord.preview_url,
			sourceRecord.topic1,
			sourceRecord.topic2,
			sourceRecord.topic3,
			sourceRecord.topic4,
			sourceRecord.topic5,
			sourceRecord.topic6);
	
	return targetRecord;
}

function sortByAuthorsLastname()
{
	var tmpDB=copyDB(db);

    for (var i=0; i<(MAX_DB_ENTRIES-1); i++)
        for (var j=i+1; j<MAX_DB_ENTRIES; j++)
            if (tmpDB[j].author_last < tmpDB[i].author_last) {
                var dummy = tmpDB[i];
                tmpDB[i] = tmpDB[j];
                tmpDB[j] = dummy;
            }

	return tmpDB;
}

function topicSortByAuthorsLastname(topicStr)
{
	var tmpDB=new Array();

	topicType=getTopicType(topicStr);
	topicName='Topic: '+topicStr;	
	
	j=0;
	for(i=0; i<MAX_DB_ENTRIES; i++) {
		if(db[i].topic1==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
		else if(db[i].topic2==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
		else if(db[i].topic3==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
		else if(db[i].topic4==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
		else if(db[i].topic5==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
		else if(db[i].topic6==topicType) {
			tmpDB[j++]=copyRecord(db[i]);
		}
	}
	topicsFound=j;
// sort by author_last
    for (var i=0; i<(topicsFound-1); i++)
        for (var j=i+1; j<topicsFound; j++)
            if (tmpDB[j].author_last < tmpDB[i].author_last) {
                var dummy = tmpDB[i];
                tmpDB[i] = tmpDB[j];
                tmpDB[j] = dummy;
            }

	return tmpDB;
}

function sortByAuthorsFirstname()
{
	var tmpDB=copyDB(db);

    for (var i=0; i<(MAX_DB_ENTRIES-1); i++)
        for (var j=i+1; j<MAX_DB_ENTRIES; j++)
            if (tmpDB[j].author_first < tmpDB[i].author_first) {
                var dummy = tmpDB[i];
                tmpDB[i] = tmpDB[j];
                tmpDB[j] = dummy;
            }

	return tmpDB;
}

function sortByTitle()
{
	var tmpDB=copyDB(db);

    for (var i=0; i<(MAX_DB_ENTRIES-1); i++)
        for (var j=i+1; j<MAX_DB_ENTRIES; j++)
            if (tmpDB[j].title < tmpDB[i].title) {
                var dummy = tmpDB[i];
                tmpDB[i] = tmpDB[j];
                tmpDB[j] = dummy;
            }

	return tmpDB;
}

function sortByHBSPid()
{
	var tmpDB=copyDB(db);

    for (var i=0; i<(MAX_DB_ENTRIES-1); i++)
        for (var j=i+1; j<MAX_DB_ENTRIES; j++)
            if (tmpDB[j].hbsp_id < tmpDB[i].hbsp_id) {
                var dummy = tmpDB[i];
                tmpDB[i] = tmpDB[j];
                tmpDB[j] = dummy;
            }

	return tmpDB;
}

//////////// rollover
var imgPath = '';

function imgToggle(imgObjectName, imgObjectState) {
    imgObject = new Object();
    imgObject = imgObjectName;
    imgObject.src = imgPath + imgObjectState;
}
//////////////

function showList(showDB)
{
	showSubList(showDB, MAX_DB_ENTRIES);
}

function showSubList(showDB, dbSize)
{
	if(showDB==null) showDB=db;
	for(i=0;i<dbSize;i++) {
	
		document.write();
	
		document.write('<tr valign="top"><td>');
		document.write('<a href="title.html?'+showDB[i].hbsp_id+'"><img border="0" src="titles/'+showDB[i].hbsp_id+'/titleico.gif" alt="'+showDB[i].author_last+'" width="91" height="31" ></a><br>');
		document.write('<a href="title.html?'+showDB[i].hbsp_id+'" onmouseover="imgToggle(mr,\'images/more-info-over.gif\');" onmouseout="imgToggle(mr,\'images/more-info.gif\');"><img name="mr" border="0" src="images/more-info.gif" alt="More information" width="69" height="10" vspace="5"></a></td>');
//document.write('<a href="title.html?'+featured_title_id+'" onmouseover="imgToggle(m,\'images/more-info-over.gif\');" onmouseout="imgToggle(m,\'images/more-info.gif\');"><img name="m" border="0" src="images/more-info.gif" alt="More information" width="69" height="10"></a>');
		document.write('<td class="title" valign="top"><a href="title.html?'+showDB[i].hbsp_id+'">'+showDB[i].title+'</a></td>');
		document.write('<td class="prof" valign="top"><a href="title.html?'+showDB[i].hbsp_id+'">'+showDB[i].author_first+' '+showDB[i].author_last+'</a><br><font size="1">'+showDB[i].affiliation+'</font></td><td id="topiclist" class="topic" valign="top"><ul>');
		getTopics(showDB[i]);
		document.write('</ul></td></tr>');
	
	}

}
function showSortedList(sortType)
{
	if(sortType=='ByAuthorsLastname') {
		topicName="Alphabetical Listing by Faculty Name";
		showList(sortByAuthorsLastname());
	}
	else if(sortType=='ByAuthorsFirstname') {
		topicName="Full List by Faculty First Name";
		showList(sortByAuthorsFirstname());
	}
	else if(sortType=='ByTitle') {
		topicName="Alphabetical Listing by Seminar Title";
		showList(sortByTitle());
	}
	else if(sortType=='ByHBSPid') {
		showList(sortByHBSPid());
	}
	else if(sortType=='ByTopicCaseMethod') {
		showSubList(topicSortByAuthorsLastname('Case Method'), topicsFound);
	}
	else if(sortType=='ByTopicChange') {
		showSubList(topicSortByAuthorsLastname('Change'), topicsFound);
	}
	else if(sortType=='ByTopicCommunications') {
		showSubList(topicSortByAuthorsLastname('Communications'), topicsFound);
	}
	else if(sortType=='ByTopicEthics') {
		showSubList(topicSortByAuthorsLastname('Ethics'), topicsFound);
	}
	else if(sortType=='ByTopicFinanceandAccounting') {
		showSubList(topicSortByAuthorsLastname('Finance and Accounting'), topicsFound);
	}
	else if(sortType=='ByTopicGlobalBusiness') {
		showSubList(topicSortByAuthorsLastname('Global Business'), topicsFound);
	}
	else if(sortType=='ByTopicGovernance') {
		showSubList(topicSortByAuthorsLastname('Governance'), topicsFound);
	}
	else if(sortType=='ByTopicInnovationandEntrepreneurship') {
		showSubList(topicSortByAuthorsLastname('Innovation and Entrepreneurship'), topicsFound);
	}
	else if(sortType=='ByTopicLeadership') {
		showSubList(topicSortByAuthorsLastname('Leadership'), topicsFound);
	}
	else if(sortType=='ByTopicManagement') {
		showSubList(topicSortByAuthorsLastname('Management'), topicsFound);
	}
	else if(sortType=='ByTopicOrganizationalBehavior') {
		showSubList(topicSortByAuthorsLastname('Organizational Behavior'), topicsFound);
	}
	else if(sortType=='ByTopicOrganizationalDevelopment') {
		showSubList(topicSortByAuthorsLastname('Organizational Development'), topicsFound);
	}
	else if(sortType=='ByTopicSalesandMarketing') {
		showSubList(topicSortByAuthorsLastname('Sales and Marketing'), topicsFound);
	}
	else if(sortType=='ByTopicStrategy') {
		showSubList(topicSortByAuthorsLastname('Strategy'), topicsFound);
	}
	else if(sortType=='ByTopicTechnologyandOperations') {
		showSubList(topicSortByAuthorsLastname('Technology and Operations'), topicsFound);
	}
	else if(sortType=='ByTopicSocialEnterprise') {
		showSubList(topicSortByAuthorsLastname('Social Enterprise'), topicsFound);
	}
	else {
	// show unsorted list
		showList(db);
	}

}

function getRecord(hbsp_id)
{
	var dbEntry=new dbData;
	for(i=0; i<MAX_DB_ENTRIES; i++) {
		if(db[i].hbsp_id==hbsp_id) {
			dbEntry=db[i];
			break;
		}
	}
	return dbEntry;
}





//-->
