/* Accessories Pages Functions */
	function MultiDimensionalArray(iRows,iCols)
	{
	var i;
	var j;
	   var a = new Array(iRows);
	   for (i=0; i < iRows; i++)
	   {
		   a[i] = new Array(iCols);
		   for (j=0; j < iCols; j++)
		   {
			   a[i][j] = "";
		   }
	   }
	   return(a);
	}
	
	var colorCount;
	var currentColor = 0;
	function selectColor(colorIndex) {
		currentColor = colorIndex;
		document.getElementById('clr_sl_txt').innerHTML = colorOptions[colorIndex][0];
		document.getElementById('stone_color').style.backgroundImage = "url("+colorOptions[colorIndex][1]+")";
		document.getElementById('add_acc').href = "fav_addacc.asp?id=" + colorOptions[colorIndex][2];
		for (i=0; i<colorCount; i++) {
			document.getElementById("color_" + i).className = "ia";
		}
		document.getElementById("color_" + colorIndex).className = "a"
	}
	
	function colorPrev() {
		if (currentColor == 0) {
			prevColor = colorCount-1;
		} else {
			prevColor = currentColor-1;
		}
		selectColor(prevColor)
	}
	
	function colorNext() {
		if (currentColor == colorCount-1) {
			nextColor = 0;
		} else {
			nextColor = currentColor+1;
		}
		selectColor(nextColor)
	}


/*   Technical Page Flash   */
	var flash;
	
	function setHigh(){
		flash.setHighlight();
	}
	
	function setFlashObj(swfID){
		if (navigator.appName.indexOf("Microsoft") > -1) {
			flash = window[swfID];
			alert("asdfkljasdf");
		} else {
			flash = document[swfID];
		}
	}
/*  END  Technical Page Flash   */


/*Temporary script to show login button and logged in users*/
function logIn(i) {
	document.getElementById('pre_login').style.display = "none";
	document.getElementById('post_login').style.display = "none";
	
	document.getElementById(i).style.display = "block";
}



/*END Temporary script to show login button and logged in users*/

/*Script to show or hide side bar*/
function showSideBar() {
	var obj = document.getElementById('right');
	
	if (obj.style.display == 'none') {
		obj.style.display = 'block';
		document.cookie = "sideBar=block; path=/";
	} else {
		obj.style.display = 'none';
		document.cookie = "sideBar=none; path=/";
	}
}
/*END Script to show or hide side bar*/

/*Products Pages*/	
function stoneSwap(id, image, title, type){
	//alert(id+":::::"+image+"::::"+title+"::::"+type);
	var prodTitle = document.getElementById('prod_title');
	var prodImage = document.getElementById('prod_image');
	var prodSecTitle = document.getElementById('prod_sectitle');
	
	document.getElementById("fav").href = "fav_addstone.asp?id="+id;
	document.getElementById("color").value = id;
	prodTitle.src = "images/products/thumbs/"+type;
	prodImage.src = "img_crop.asp?i="+image+"&w=165&h=154";
	prodSecTitle.src = "uploads/"+title;
}
function productSwap(image, type, color){
	//alert(image);
	var prodImage = document.getElementById('prod_image');
	var prodTitle = document.getElementById('prod_title');
	var colorTitle = document.getElementById('prod_sectitle');

	document.getElementById("fav").href = "fav_addstone.asp?id="+color;
	document.getElementById("color").value = color;
	prodImage.src = "img_crop.asp?i="+image+".jpg&w=165&h=154";
	prodTitle.src = "uploads/ptitle_"+type+".gif";
	colorTitle.src = "uploads/pcolor_"+color+".gif";
}
/*END Products Pages*/

/*Technical DWG DXF Download swaps*/
function dwgSwap1(title, image, list, file) {
	
	var dwgTitle = document.getElementById('trr_title');
	var dwgImg = document.getElementById('trr_image');
	var downDwg = document.getElementById('down_dxf');
	var downDxf = document.getElementById('down_dxf');
	
	dwgTitle.src = "uploads/" + title;
	dwgImg.src = "img_thumb.asp?i=" + image + "&w=230&h=175";
	
	//for (i=0; i<23; i++) {
	//	document.getElementById('dwg'+i).className = "ia";
	//}
	
	//document.getElementById(list).className = "a";
	
	downDwg.href = "uploads/"+file;
	downDxf.href = "uploads/"+file;
}
/*END DWG DXF Technical Download swaps*/

/*Technical Hatch Patterns Download swaps*/
function hatchSwap1(title, image, list, file) {
	
	var hatchTitle = document.getElementById('trr_title2');
	var hatchImg = document.getElementById('trr_image2');
	var downHatch = document.getElementById('down_hatch');
	
	hatchTitle.src = "uploads/" + title;
	hatchImg.src = "img_thumb.asp?i=" + image + "&w=230&h=175";
	
	//for (i=0; i<12; i++) {
	//	document.getElementById('hatch'+i).className = "ia";
	//}
	
	//document.getElementById(list).className = "a";
	
	downHatch.href = "uploads/"+file;
	
}
/*END Hatch Patterns Technical Download swaps*/

/*Technical Color Download swaps*/
function colorSwap(ul, type, subNav, image, title, href) {
	
	var colorTitle = document.getElementById('trr_title3');
	var colorImg = document.getElementById('trr_image3');
	var downColor = document.getElementById('down_color');	
	
	for (i=0; i<12; i++) {
	document.getElementById('clr'+i).style.display = "none";
		document.getElementById('hatch'+i).className = "ia";
	}
	
	//for (i=1; i<57; i++) {
	//	document.getElementById('color'+i).className = "ia";
	//}
	
	document.getElementById(ul).style.display = "block";
	//document.getElementById(type).className = "a";
	//document.getElementById(subNav).className = "a";
	
	colorTitle.src = "uploads/" + title;
	colorImg.src = "img_thumb.asp?i=" + image + "&w=230&h=175";
	
	downColor.href = "uploads/"+href;
	
}
/*END Technical Color Download swaps*/

/*Technical PDF Download swaps*/
function pdfSwap(obj, title, img, file) {
	
	var pdfTitle = document.getElementById('trr_title4');
	var pdfImg = document.getElementById('trr_image4');
	var downPdf = document.getElementById('down_pdf');
	
	for (i=1; i<12; i++) {
		document.getElementById('pdf'+i).className = "ia";	
	}
	
	document.getElementById(obj).className = "a";
	
	pdfTitle.src = "uploads/"+title;
	pdfImg.src = "uploads/"+img;
	downPdf.href = "uploads/"+file;
}	
/*END Technical PDF Download swaps*/

/*Accessories swaps*/
num = 0;
num2 = 0;

function accSwap(menuItem, stone) {
	var bg = document.getElementById('stone_color');
	var txt = document.getElementById('clr_sl_txt');

	color=eval(menuItem);
	for(i=0; i<6; i++) {
			document.getElementById('color_'+i).className = "ia";	
		}
	switch(color) {
		case 0:
			document.getElementById('color_0').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_chocolate.gif)";
			txt.innerHTML ="Chocolate";
			num = 0;
			break;
		case 1:
			document.getElementById('color_1').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_cream.gif)";
			txt.innerHTML ="Cream";
			num = 1;
			break;
		case 2:
			document.getElementById('color_2').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_grey.gif)";
			txt.innerHTML ="Grey";
			num = 2;
			break;
		case 3:
			document.getElementById('color_3').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_red.gif)";
			txt.innerHTML ="Red";
			num = 3;
			break;
		case 4:
			document.getElementById('color_4').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_tan.gif)";
			txt.innerHTML ="Tan";
			num = 4;
			break;
		case 5:
			document.getElementById('color_5').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_taupe.gif)";
			txt.innerHTML ="Taupe";
			num = 5;
			break;
	}
};

function nextAccSwap(menuAmount, stone) {
	num++;
	if (num > menuAmount) {
		num = 0;	
	}
	accSwap(num, stone);
};

function prevAccSwap(menuAmount, stone) {
	num--;
	if (num < 0) {
		num = menuAmount;	
	}
	accSwap(num, stone);
};

function accSwap2(menuItem, stone) {
	var bg = document.getElementById('stone_color');
	var txt = document.getElementById('clr_sl_txt');
	
	color=eval(menuItem);
	for(i=0; i<3; i++) {
			document.getElementById('color_'+i).className = "ia";	
		}
	switch(color) {
		case 0:
			document.getElementById('color_0').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_grey.gif)";
			txt.innerHTML ="Grey";
			num2 = 0;
			break;
		case 1:
			document.getElementById('color_1').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_tan.gif)";
			txt.innerHTML ="Tan";
			num2 = 1;
			break;
		case 2:
			document.getElementById('color_2').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_taupe.gif)";
			txt.innerHTML ="Taupe";
			num2 = 2;
			break;
	}
};

function nextAccSwap2(menuAmount, stone) {
	num2++;
	if (num2 > menuAmount) {
		num2 = 0;	
	}
	accSwap2(num2, stone);
};

function prevAccSwap2(menuAmount, stone) {
	num2--;
	if (num2 < 0) {
		num2 = menuAmount;	
	}
	accSwap2(num2, stone);
};

function accSwap3(menuItem, stone) {
	var bg = document.getElementById('stone_color');
	var txt = document.getElementById('clr_sl_txt');

	color=eval(menuItem);
	for(i=0; i<5; i++) {
			document.getElementById('color_'+i).className = "ia";	
		}
	switch(color) {
		case 0:
			document.getElementById('color_0').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_chocolate.gif)";
			txt.innerHTML ="Chocolate";
			num = 0;
			break;
		case 1:
			document.getElementById('color_1').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_cream.gif)";
			txt.innerHTML ="Cream";
			num = 1;
			break;
		case 2:
			document.getElementById('color_2').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_grey.gif)";
			txt.innerHTML ="Grey";
			num = 2;
			break;
		case 3:
			document.getElementById('color_3').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_tan.gif)";
			txt.innerHTML ="Tan";
			num = 3;
			break;
		case 4:
			document.getElementById('color_4').className = "a";
			bg.style.backgroundImage = "url(images/products/acc_colors/"+stone+"_taupe.gif)";
			txt.innerHTML ="Taupe";
			num = 4;
			break;
	}
};

function nextAccSwap3(menuAmount, stone) {
	num++;
	if (num > menuAmount) {
		num = 0;	
	}
	accSwap3(num, stone);
};

function prevAccSwap3(menuAmount, stone) {
	num--;
	if (num < 0) {
		num = menuAmount;	
	}
	accSwap3(num, stone);
};

/*END Accessories swaps*/

function imgSwap(img, imgSrc) {
	img.src = imgSrc;
}

/*Tech Flash Highlights*/
function techHigh(obj) {
	var par = document.getElementById(obj);
	if(par) {
		par.style.fontWeight = "bold";
	} else {
		alert(par);	
	}
}
function techUnHigh(obj) {
	var par = document.getElementById(obj);
	//alert(par);
	if(par) {
		par.style.fontWeight = "normal";
	}
}
/*END Tech Flash Highlights*/

/*Mortar Color Select*//*
function mortarSelect(clr,mx) {
	var title = document.getElementById('color_title');
	var obj = document.getElementById('mortar_color');
	var mix = document.getElementById('color_amount');
	obj.style.backgroundColor = "#"+clr;
	title.src = "images/titles/"+clr+".gif";
	mix.src = "images/titles/mix_"+mx+".gif";
	//alert(mix.src);
}
*//*END Mortar Color Select*/

/* Company Logo Image Preview */
function imagePrev(url) {
	var prev = document.getElementById('preview');
	var urlClean = url.replace('\\','/','g');
	var urlComp = "file:///"+urlClean;
	if(navigator.appName == "Netscape") {
		prev.src = "images/register/not_available.gif";
	} else {
		prev.src = urlComp;
	}
}
/* End Company Logo Image Preview */

/* 
Add Shipping Address 
var addNum = 0;
function addAddress(num) {
	addNum++;
	var table = document.getElementById("reg3Table_"+addNum);
	if(table) {
		table.style.display = "block";	
	}
	var pgHeight = document.body.scrollHeight;
	if(pgHeight) {
		window.scrollTo(0,pgHeight);
	}
}
function removeAddress(obj) {
	addNum--;
	var table = document.getElementById("reg3Table_"+addNum);
	if(table) {
		table.style.display = "block";	
	}
	var pgHeight = document.body.scrollHeight;
	if(pgHeight) {
		window.scrollTo(0,pgHeight);
	}
}
 END Add Shipping Address */
