<!-- Hide script from old browsers
//Functions.js
//Standard functions used by MBX/HSK Web-Site Pages

// writeBBBanner uses bannerType to write the banner
function writeBBBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD>'
	bannerHtml += '<A Href=BBindex.html><IMG SRC=Benbros/BBBanner.jpg height=100 border=0 Alt="[Home]"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
// writeBDGBanner uses bannerType to write the banner
function writeBDGBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD>'
	bannerHtml += '<A Href=BDGindex.html><IMG SRC=BDG/BDGBanner.jpg width=292 height=101 border=1 Alt="[Home]"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
// writeHSKBanner uses bannerType to write the banner// 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=1 Alt="[Home]"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
function writeJLBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD>'
	bannerHtml += '<A Href=JLindex.html><IMG SRC=JL/JLLogo.jpg border=0 Alt="[Home]"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
function writeLSBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD><BR>'
	bannerHtml += '<A Href=LSindex.html><IMG SRC=LoneStarLogo.gif border=0 Alt="[Home]"></A>'
	bannerHtml += '</TD><TD>'
	bannerHtml += '</TD></TR></TABLE>'
	return(bannerHtml)
}
function writeNVBanner(bannerType){
	bannerHtml = ''
	bannerHtml += '<TABLE Cellspacing=0 Cellpadding=0 Border=0><TR Valign=Top><TD><BR>'
	bannerHtml += '<A Href=NVindex.html><IMG SRC=NorevBanner.gif 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)
}

// popupImg(ImgPathNum,ImgName,Width,Height,Title,Code) 
// 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 popupImg(ImgPathNum,ImgName,ImgWidth,ImgHeight,ImgTitle,ImgCode){
	ImgPath = setImgPath(ImgPathNum)
	ImgUrl = ImgPath + ImgName + '.jpg'

	options = ''
	if (ImgWidth == 0) {
		ImgWidth  = 300
		ImgHeight = 200
	} 
	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();
	}
} 

//buildTable()
//build table html for model#, filename of the table
function buildTable(ImgPathNum,ImgName,ImgWidth,ImgHeight,ImgTitle) {
	ImgPath=setImgPath(ImgPathNum)
	ImgUrl = ImgPath + 'THUMBS/' + ImgName + '.jpg'


	ThmWidth  = 96; ThmHeight = 72
	if (ImgWidth == 1) {ImgWidth  = 320; ImgHeight = 240} 
	if (ImgWidth == 2) {ImgWidth  = 440; ImgHeight = 330}
	if (ImgWidth == 3) {ImgWidth  = 330; ImgHeight = 440; ThmWidth  = 72; ThmHeight = 96}
	if (ImgWidth == 4) {ImgWidth  = 500; ImgHeight = 300; ThmWidth  = 96; ThmHeight = 58}
	if (ImgWidth == 5) {ImgWidth  = 640; ImgHeight = 480}
   if (ImgWidth == 6) {ImgWidth  = 600; ImgHeight = 682; ThmWidth  = 84; ThmHeight = 96}
	if (ImgHeight == 101) {ThmHeight = 33}
	if (ImgHeight == 253) {ThmHeight = 40}
	if (ImgHeight == 308) {ThmHeight = 57}
	if (ImgHeight == 327) {ThmHeight = 62}

	tableHtml = ''
	if ((indexCount >= begIndex) && (indexCount <= endIndex)){
		if (columnCount==1) {
			tableHtml += '<TR align=Left valign=Top>'
		}
		if (ImgTitle.charAt(3) == "-") {
			modelNumLength = 6
		} else {
			modelNumLength = 4
		}
		tableHtml += '<TD><FONT size=2>'
		tableHtml += '<A HREF="javascript:popupImg(' +ImgPathNum+ ",'" +ImgName + "'," 
		tableHtml += ImgWidth + "," +  ImgHeight + ",'" +ImgTitle+ "')"
		tableHtml += '">'
		tableHtml += '<IMG src=' +ImgUrl+ ' alt = "[Thumbnail Photo]" width=' +ThmWidth+ ' height=' +ThmHeight+ ' border=1></A>'
		tableHtml += setExtraHtml('rw',ImgName.substring(0,3))
		tableHtml += '<BR><B>' + ImgTitle.substring(0,modelNumLength) + '</B><BR>' + ImgTitle.substring(modelNumLength,ImgTitle.length)
		tableHtml += '</FONT></TD>'
		if (columnCount==4) {
			tableHtml += '</TR>'
			columnCount = 0
		}
		columnCount++
	}
	if (htmlPageBox.indexOf('SlideShow') > 0){
		tableHtml =  '<SCRIPT>'
		tableHtml += 'slides['      + indexCount + '] = "' + ImgPath + ImgName + '.jpg";';
		tableHtml += 'slideTitles[' + indexCount + '] = "' +ImgTitle+ '"';
 	   tableHtml += '</SCRIPT>';
	}	
	indexCount++

	return (tableHtml)
}

//buildBiggerTable()
//build table html for model#, filename of the table
function buildBiggerTable(ImgPathNum,ImgName,ImgWidth,ImgHeight,ImgTitle) {
	ImgPath=setImgPath(ImgPathNum)
	ImgUrl = ImgPath + 'THUMBS/' + ImgName + '.jpg'


	ThmWidth  = 164; ThmHeight = 128
	if (ImgWidth == 1) {ImgWidth  = 320; ImgHeight = 240} 
	if (ImgWidth == 2) {ImgWidth  = 440; ImgHeight = 330}
	if (ImgWidth == 3) {ImgWidth  = 330; ImgHeight = 440; ThmWidth  = 72; ThmHeight = 96}
	if (ImgWidth == 4) {ImgWidth  = 500; ImgHeight = 300; ThmWidth  = 96; ThmHeight = 58}
	if (ImgWidth == 5) {ImgWidth  = 640; ImgHeight = 480}
    if (ImgWidth == 6) {ImgWidth  = 600; ImgHeight = 682; ThmWidth  = 84; ThmHeight = 96}
	if (ImgHeight == 101) {ThmHeight = 33}
	if (ImgHeight == 253) {ThmHeight = 40}
	if (ImgHeight == 308) {ThmHeight = 57}
	if (ImgHeight == 327) {ThmHeight = 62}

	tableHtml = ''
	if ((indexCount >= begIndex) && (indexCount <= endIndex)){
		if (columnCount==1) {
			tableHtml += '<TR align=Left valign=Top>'
		}
		if (ImgTitle.charAt(3) == "-") {
			modelNumLength = 6
		} else {
			modelNumLength = 4
		}
		tableHtml += '<TD><DIV style="position: relative;">'
		if (ImgWidth != 'HTML') {
            tableHtml += '<A HREF="javascript:popupImg(' +ImgPathNum+ ",'" +ImgName + "'," 
		    tableHtml += ImgWidth + "," +  ImgHeight + ",'" +ImgTitle+ "')"
		    tableHtml += '">'
        } else {
            tableHtml += '<A HREF=' + ImgHeight + '.html>'
        }            
		tableHtml += '<IMG src=' +ImgUrl
		tableHtml += ' alt = "[' + ImgTitle.substring(0,modelNumLength) + ImgTitle.substring(modelNumLength,ImgTitle.length) + ']" '
		tableHtml += ' width=' +ThmWidth+ ' height=' +ThmHeight+ ' border=1></A>'
		tableHtml += setExtraHtmlLayer('rw',ImgName)
		if (ImgName.substring(0,2)=='SF'){tableHtml += setExtraHtmlLayer('SF',ImgName.substring(2,5))}
		if (ImgName.substring(0,1)=='A' ){tableHtml += setExtraHtmlLayer('A' ,ImgName.substring(1,4))}
		tableHtml += '</DIV></TD>'
		if (columnCount==4) {
			tableHtml += '</TR>'
			columnCount = 0
		}
		columnCount++
	}
	if (htmlPageBox.indexOf('SlideShow') > 0){
		tableHtml =  '<SCRIPT>'
		tableHtml += 'slides['      + indexCount + '] = "' + ImgPath + ImgName + '.jpg";';
		tableHtml += 'slideTitles[' + indexCount + '] = "' +ImgTitle+ '"';
 	   tableHtml += '</SCRIPT>';
	}	
	indexCount++

	return (tableHtml)
}
//set Path for Image
function setImgPath(ImgPathNum){
	switch (ImgPathNum) {
		case  1 : ImgPath = 'HSK/HSKBPs/';	break;
		case  2 : ImgPath = 'HSK/HSKCats/';	break;
		case  3 : ImgPath = 'HSK/HSKMisc/';	break;
		case  4 : ImgPath = 'HSK/HSKModels/';break;
		case  5 : ImgPath = 'MBX/YY/';		break;
		case  6 : ImgPath = 'MBX/Cats/';	break;
		case  7 : ImgPath = 'MBX/Pics/';	break;
		case  8 : ImgPath = 'MBX/Displays/';break;
		case 11 : ImgPath = 'MBX/Misc/';	break;
		case 12 : ImgPath = 'MBX/Models/';	break;
		case 13 : ImgPath = 'MBX/Loose/';	break;
		case 21 : ImgPath = 'MBX/BoxA/';	break;
		case 22 : ImgPath = 'MBX/BoxB/';	break;                      
		case 23 : ImgPath = 'MBX/BoxC/';	break;
		case 24 : ImgPath = 'MBX/BoxD/';	break;
		case 25 : ImgPath = 'MBX/BoxE/';	break;
		case 26 : ImgPath = 'MBX/BoxF/';	break;
		case 27 : ImgPath = 'MBX/BoxG/';	break;
		case 28 : ImgPath = 'MBX/SF35/';	break;
		case 51 : ImgPath = 'BDG/BDGBPs/';	break;
		case 52 : ImgPath = 'BDG/BDGCats/';	break;
		case 53 : ImgPath = 'BDG/BDGMisc/';	break;
		case 54 : ImgPath = 'BDG/BDGModels/';break;
		case 55 : ImgPath = 'BDG/BDGEE/';   break;
		case 56 : ImgPath = 'BDG/BDGLarge/';break;
		case 61 : ImgPath = 'JL/';			break;
		case 71 : ImgPath = 'LS/LSModels/';	break;
		case 72 : ImgPath = 'LS/LSCats/';	break;
		case 73 : ImgPath = 'LS/LSMisc/';	break;
		case 74 : ImgPath = 'LS/??/';       break;
        case 81 : ImgPath = 'Benbros/';     break;
		case 90 : ImgPath = 'ForSale/';     break;
		default : ImgPath = '';
	}
	return(ImgPath)
}

//setDesc(prefix,modelNumAndCode)
//return modelNumAndCode + modelDesc given the model type prefix, model# and code
function setDesc(prefix, modelNumAndCode){
	if (modelNumAndCode.substring(0,2) == "MB"){
		temp = prefix + modelNumAndCode.substring(0,5)
	} else {
		if (modelNumAndCode.substring(0,2) == "SF"){
			temp = prefix + modelNumAndCode.substring(2,5)
		} else {
		temp = prefix + modelNumAndCode.substring(0,3)
		}
	}
	desc = modelNumAndCode + ' '
	try {
		desc += eval(temp + '.desc')
		if (eval(temp + '.sf') == 'Y'){
			desc += ', Superfast'
		}
		desc += ', ' + eval(temp + '.year')
	}
	catch(err) {
		desc += 'Undefined'
	}
	return (desc)
}

//setExtraHtml(prefix,modelNumAndCode)
//return Extra Html Page URL for model# and code
function setExtraHtml(prefix, modelNumAndCode){
	extraHtml=''
	temp = prefix + modelNumAndCode.substring(0,3)
	try {
		if (eval(temp + '.extra') != ''){
			extraHtml = ' <A href=' + eval(temp + '.extra') + '.html><IMG src=Extra.gif alt=[See_extra_information] border=0></A> '
		}
	}
	catch(err) {
	}
	return (extraHtml)
}
 
//setExtraHtmlLayer(prefix,modelNumAndCode)
//return Extra Html Page URL for model# and code
function setExtraHtmlLayer(prefix, modelNumAndCode){
	extraHtml=''
	if (modelNumAndCode.substring(0,2) == "MB"){
		temp = prefix + modelNumAndCode.substring(0,5)
	} else {
		temp = prefix + modelNumAndCode.substring(0,3)
	}
	try {
		if (eval(temp + '.extra') != ''){
			extraHtml  = '<DIV style="position:absolute; right: 0px; top: 0px;">'
			extraHtml += '<A href=' + eval(temp + '.extra') + '.html>'
			extraHtml += '<IMG src=Extra.gif alt=[See_extra_information] border=0></A></DIV>'
		}
	}
	catch(err) {
	}
	return (extraHtml)
} 

// End hiding script from old browsers -->

