var preImgArr = new Array();
var preImgArrCount = 0;

try{
	for (i=0; i<imgArray.length; i++){
		for (j=0; j<imgArray[i].length; j++){
			var preImg = new Image();
			preImg.src = imgArray[i][j];
		}
	}
}
catch(e){
}
try{
	for (i=0; i<thmOnImgArray.length; i++){
		for (j=0; j<thmOnImgArray[i].length; j++){
			var preImg = new Image();
			preImg.src = thmOnImgArray[i][j];
		}
	}
}
catch(e){
}
try{
	for (i=0; i<thmOffImgArray.length; i++){
		for (j=0; j<thmOffImgArray[i].length; j++){
			var preImg = new Image();
			preImg.src = thmOffImgArray[i][j];
		}
	}
}
catch(e){
}
try{
	for (i=0; i<strBtnOnImgArray.length; i++){
		var preImg = new Image();
		preImg.src = strBtnOnImgArray[i];
	}
}
catch(e){
}
try{
	for (i=0; i<strBtnOffImgArray.length; i++){
		var preImg = new Image();
		preImg.src = strBtnOffImgArray[i];
	}
}
catch(e){
}


function chgImg(blockNum, imgNum){
	var imgObj = document.getElementById(blockArray[blockNum - 1]);
	imgObj.src = imgArray[blockNum - 1][imgNum - 1];
	imgObj.alt = altArray[blockNum - 1][imgNum - 1];
}

function chgThmImg(blockNum, imgNum){
	for (i=0; i<thmBlockArray[blockNum - 1].length; i++){
		var imgObj = document.getElementById(thmBlockArray[blockNum - 1][i]);
		if (i == imgNum - 1){
			imgObj.src = thmOnImgArray[blockNum - 1][i];
			imgObj.onmouseover = null;
			imgObj.onmouseout = null;
		}else{
			imgObj.src = thmOffImgArray[blockNum - 1][i];
			imgObj.onmouseover = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
			}
			imgObj.onmouseout = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
			}
		}
	}
}

function chgTxtBlk(blockNum, imgNum){
	for (i=0; i<txtBlockArray[blockNum - 1].length; i++){
		document.getElementById(txtBlockArray[blockNum - 1][i]).style.display = 'none';
	}
	document.getElementById(txtBlockArray[blockNum - 1][imgNum - 1]).style.display = 'block';
}

/* interior - storage */
function chgStrBtn(num){
	for (i=0; i<strBtnBlockArray.length; i++){
		var imgObj = document.getElementById(strBtnBlockArray[i]);
		if ((num == 1 && (i == 0 || i == 1)) ||
		    (num == 2 && (i == 2 || i == 3 || i == 4)) ||
		    (num == 3 && (i == 5 || i == 6 || i == 7))){
			imgObj.src = strBtnOnImgArray[i];
			imgObj.onmouseover = null;
			imgObj.onmouseout = null;
		}else{
			imgObj.src = strBtnOffImgArray[i];
			imgObj.onmouseover = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
			}
			imgObj.onmouseout = function() {
				this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
			}
		}
	}
}

