<!-- Hide script from old browsers
//mbxFunctions.js
//050401.sdb
//Standard functions used by Matchbox Web-Site Pages

// writeHSKBanner uses bannerType to write the banner
function writeHSKBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD>'
	bannerHtml += '<A Href=HSKindex.html><IMG SRC=HSK/HSKBanner.jpg width=500 height=70 border=0 Alt="Home"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
// writeMBXBanner uses bannerType to decide to write the long or short banner
function writeMBXBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD>'
	bannerHtml += '<A Href=index.html><IMG SRC=MBXBannerFNew.gif width=305 height=74 border=0 Alt="Home"></A>'
	bannerHtml += '</TD><TD>'
	if (bannerType == 'SHORT') {	
		bannerHtml += '<IMG SRC=07A-1.jpg  height=70 alt="[07A-1]">'
	} else if (bannerType == 'MBX') {
		bannerHtml += '<IMG SRC=MBXNoTreasureHunts.jpg height=70 alt="[No Treasure Hunts!!]">'
	} else if (bannerType == 'LONG') {
		bannerHtml += '<IMG SRC=06B-2.jpg  height=70 alt="[06B-2]">'
		bannerHtml += '</TD><TD>'
		bannerHtml += '<IMG SRC=20A-1.jpg  height=70 alt="[20A-1]">'
		bannerHtml += '</TD><TD>'										  
		bannerHtml += '<IMG SRC=34A-2.jpg  height=70 alt="[34A-2]">'
	}
		bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}

// intToHex returns Hexidecimal equivalent
function intToHex(intNum){
	hexDigits='0123456789abcdef0'
	if (intNum > 255) {
		tmpNum1 = (intNum - (intNum%256)) / 256
		hexNum = hexDigits.charAt(tmpNum1)
	} else {
		tmpNum1 = 0
		hexNum = ''
	}
	if (intNum >15) {
		tmpNum2 = (intNum - (tmpNum1 * 256) - (intNum%16)) / 16
		hexNum += hexDigits.charAt(tmpNum2)
	} else {
		tmpNum2 = 0
	}
	tmpNum3 = (intNum - (tmpNum1 * 256) - (tmpNum2 * 16))
	hexNum += hexDigits.charAt(tmpNum3)
	return (hexNum)
}

// popupImg1(ImgPathNum,ImgName,Width,Height,Title) 
// Pops up a new window to display an image centered and anchored to the right edge of the window
// ImgPathNum = # pathname to picture
// ImgName = filename of picture
// Width  = pixel width of image
// Height = pixel height of image
// Title = Title bar for picture
 
function popupImg1(ImgPathNum,ImgName,ImgWidth,ImgHeight,ImgTitle){
	if (ImgPathNum == 1) {
		ImgPath = 'HSK/HSKBPs/'
	} else if (ImgPathNum == 2) {
		ImgPath = 'HSK/HSKCats/'
	} else if (ImgPathNum == 3) {
		ImgPath = 'HSK/HSKMisc/'
	} else if (ImgPathNum == 4) {
		ImgPath = 'HSK/HSKModels/'
	} else {
		ImgPath = ''
	}
	ImgUrl = ImgPath + ImgName + '.jpg'

	options = ''
	if (ImgWidth == 1) {
		ImgWidth  = 320
		ImgHeight = 240
	} 
	if (ImgWidth == 2) {
		ImgWidth  = 440
		ImgHeight = 330
	}
	if ((parseInt(ImgWidth)+40) > parseInt(screen.width)){
		ImgWidth = (parseInt(screen.width) - 60)
		options = 'scrollbars=yes,'
	}
	if (ImgHeight > screen.height) {
		ImgHeight = screen.height
		options = 'scrollbars=yes,'
	}
	options += 'WIDTH='	+ (parseInt(ImgWidth))
	options += ',HEIGHT='+ (parseInt(ImgHeight))
	options += ',LEFT='	+ (screen.width - ImgWidth - 22)
	options += ',TOP='	+ (screen.height - ImgHeight - 40)

	popupImage = window.open('','',options)
	with (popupImage.document) {
		open();
		write('<HTML><HEAD><TITLE>' + ImgTitle + '</TITLE></HEAD>');
		write('<BODY rightmargin=0 bottommargin=0 leftmargin=0 topmargin=0 onClick=window.close();>');
		write('<TABLE cellpadding=0 cellspacing=0>');
		write('<TR>');
		write('<TD><IMG src=' + ImgUrl + ' width=' + ImgWidth + ' height= ' + ImgHeight +' alt="[Click here to close window]"></TD>');
		write('</TR>');
		write('</TABLE></BODY></HTML>');
		close();
	}
} 

// popupImg(file#,picture#,Width,Height,Title) 
// Pops up a new window to display an image centered and anchored to the right edge of the window
// file# = # of MSN file to access for picture
// picture# = # of MSN picture in the file
// Width  = pixel width of image
// Height = pixel height of image
// Title = Title bar for picture
 
function popupImg(IDTopic,IDMessage,gifWidth,gifHeight,msg){
	gifUrl  = 'http://content.communities.msn.com/isapi/fetch.dll?action=view_photo&ID_Community=MyMatchboxPhotos&ID_Topic='
	if (IDTopic > 1000) {
		gifUrl  = 'http://content.communities.msn.com/isapi/fetch.dll?action=view_photo&ID_Community=MBXPhotos&ID_Topic=';
		IDTopic = IDTopic - 1000;
	}
	gifUrl += IDTopic + '&ID_Message=' + IDMessage
	options = ''
	if ((parseInt(gifWidth)+40) > parseInt(screen.width)){
		gifWidth = (parseInt(screen.width) - 60)
		options = 'scrollbars=yes,'
	}
	if (gifHeight > screen.height) {
		gifHeight = screen.height
		options = 'scrollbars=yes,'
	}
	options += 'WIDTH='	+ (parseInt(gifWidth))
	options += ',HEIGHT='+ (parseInt(gifHeight))
	options += ',LEFT='	+ (screen.width - gifWidth - 22)
	options += ',TOP='	+ (screen.height - gifHeight - 40)
	popupImage = window.open('','',options)
	with (popupImage.document) {
		open();
		write('<HTML><HEAD><TITLE>' + msg + '</TITLE></HEAD>');
		write('<BODY rightmargin=0 bottommargin=0 leftmargin=0 topmargin=0 onClick=window.close();>');
		write('<TABLE cellpadding=0 cellspacing=0>');
		write('<TR>');
		write('<TD><IMG src=' + gifUrl + ' width=' + gifWidth + ' height= ' + gifHeight +' alt="[Click here to close window]"></TD>');
		write('</TR>');
		write('</TABLE></BODY></HTML>');
		close();
	}
} 

// popupWin(gifUrl,gifFolder,gifName,gifWidth,gifHeight) 
// Pops up a new window to display an image anchored to the right lower corner of the window
// gifUrl = full pathname for gif, including gif's folder and filename
// gifFolder = gif's folder to be used w/o full pathname
// gifName   = gif's filename to be used w/o full pathname
// gifWidth  = pixel width of image
// gifHeight = pixel height of image
function popupWin(gifUrl,gifFolder,gifName,gifWidth,gifHeight,msg){
	if (gifUrl == ""){
		gifUrl = gifFolder + '\\' + gifName
	}else{
		gifUrl = unescape(gifUrl)
	}
	options = ''
	if ((parseInt(gifWidth)+40) > parseInt(screen.width)){
		gifWidth = (parseInt(screen.width) - 60)
		options = 'scrollbars=yes,'
	}
	if (gifHeight > screen.height) {
		gifHeight = screen.height
		options = 'scrollbars=yes,'
	}
	options += 'WIDTH='	+ parseInt(gifWidth)
	options += ',HEIGHT='+ parseInt(gifHeight)
	options += ',LEFT='	+ (screen.width - gifWidth - 22)
	options += ',TOP='	+ (screen.height - gifHeight - 40)
	popupWindow = window.open('','',options)
	with (popupWindow.document) {
		open();
		write('<HTML><HEAD><TITLE>' + msg + '</TITLE></HEAD>');
		write('<BODY rightmargin=0 bottommargin=0 leftmargin=0 topmargin=0 onClick=window.close();>');
		write('<TABLE cellpadding=0 cellspacing=0>');
		write('<TR>');
		write('<TD><IMG src=' + gifUrl + ' width=' + gifWidth + ' height= ' + gifHeight +' alt="[Click here to close window]"></TD>');
		write('</TR>');
		write('</TABLE></BODY></HTML>');
		close();
	}
}

//setModelDesc(modelNumAndCode)
//return modelNumAndCode + modelDesc given the model# and code
function setModelDesc(modelNumAndCode){
	firstIndex  = parseFloat(modelNumAndCode.substring(0,2))
	secondIndex = modelNumAndCode.substring(2,3)
	if (secondIndex == "A") {
		secondIndex = 0
	}
	if (secondIndex == "B") {
		secondIndex = 1
	}
	if (secondIndex == "C") {
		secondIndex = 2
	}
	if (secondIndex == "D") {
		secondIndex = 3
	} 
	if (secondIndex == "E") {
		secondIndex = 4
	} 
	if (secondIndex == "F") {
		secondIndex = 5
	}
	return (modelNumAndCode+ ' ' + modelDesc[firstIndex][secondIndex])
}

//buildThumbnail(picture#, file#)
//build thumbnail html for picture#, file# of the table
function buildThumbnail(IDTopic, IDMessage) {
	jpgUrl = 'http://sc.communities.msn.com/tn/F6/E0/MyMatchboxPhotos/'
	jpgUrl += intToHex(IDTopic) + '/' + intToHex(IDMessage) + '.jpg'
	
	return ('<IMG SRC=' + jpgUrl+ ' alt = "[Thumbnail Photo]" width=96 height=72 border=1>')
}

//buildTable(model, file)
//build table html for model#, filename of the table
function buildTable(model, IDTopic, IDMessage, IDWidth, IDHeight) {
	if (IDTopic < 1000){
		jpgUrlWindow = 'http:\/\/content.communities.msn.com\/isapi\/fetch.dll?action=view_photo&ID_Community=MyMatchboxPhotos&ID_Topic=';
		jpgUrl = 'http:\/\/sc.communities.msn.com\/tn\/F6\/E0\/MyMatchboxPhotos\/';
	} else {
		jpgUrlWindow = 'http:\/\/content.communities.msn.com\/isapi\/fetch.dll?action=view_photo&ID_Community=MBXPhotos&ID_Topic=';
		jpgUrl = 'http:\/\/sc.communities.msn.com\/tn\/07\/92\/MBXPhotos\/';
		IDTopic = IDTopic - 1000; 	   
	}
	jpgUrlWindow += IDTopic + '&ID_Message=' + IDMessage
	jpgUrl += intToHex(IDTopic) + '\/' + intToHex(IDMessage) + '.jpg'

	if (IDWidth == '') {
		IDWidth = 320
		IDHeight= 240
	}
	tableHtml = ''
	if ((indexCount >= begIndex) && (indexCount <= endIndex)){
		if (columnCount==1) {
			tableHtml += '<TR align=Left valign=Top>'
		}
		if (model.charAt(3) == "-") {
			modelNumLength = 6
		} else {
			modelNumLength = 4
		}
		tableHtml += '<TD><FONT size=2>'
		tableHtml += '<A HREF="javascript:popupWin(' + "'" +escape(jpgUrlWindow)+ "',"
		tableHtml += "'', ''," + IDWidth + " ," +  IDHeight + " ,'" + model + "')"
		tableHtml += '">'
		tableHtml += '<IMG SRC=' + jpgUrl+ ' alt = "[Thumbnail Photo]" width=96 height=72 border=1></A>'
		tableHtml += '<BR><B>' + model.substring(0,modelNumLength) + '</B><BR>' + model.substring(modelNumLength,model.length)
		tableHtml += '</FONT></TD>'
		if (columnCount==4) {
			tableHtml += '</TR>'
			columnCount = 0
		}
		columnCount++
	}
	if (htmlPageBox.indexOf('SlideShow') > 0){
		tableHtml =  '<SCRIPT>'
		tableHtml += 'slides['      + indexCount + '] = "&ID_Topic=' + IDTopic + '&ID_Message=' + IDMessage + '";';
		tableHtml += 'slideTitles[' + indexCount + '] = "' + model + '"';
 	   tableHtml += '</SCRIPT>';
	}	
	indexCount++

	return (tableHtml)
}

// End hiding script from old browsers -->