var g_stylename = "";
var g_color = "";
var g_fabric = "";
var g_path;
var g_className = ( document.all && !window.opera )? 'className' : 'class';

function MM_swapImage2() {
	var x,a=MM_swapImage2.arguments;
	if ((x=MM_findObj(a[0]))!=null) {
		x.src=a[2];
		x.setAttribute('title', "closeup");
		var fname = x.src.substr(x.src.lastIndexOf("/") + 1);
		if(! g_path) {
			g_path = x.src.substr(0, x.src.indexOf(fname));
		}
		setGlobalParam( fname);
		setText();
//		setThumb( fname);
		setPoplink( fname);
	}
}

function setText() {
	var obj = document.getElementById('imgtitle');
	obj.style.backgroundColor = "#ffffff";
	var p_name = document.getElementById('stylename');
	p_name.innerHTML = g_stylename;
//	p_name.innerHTML = g_stylename + " (COLOR:" + g_color + ")";
	var p_fabric = document.getElementById('fabric');
	p_fabric.innerHTML = "FABRIC : "+ g_fabric + "<br />COLOR : " + g_color;
//	p_fabric.innerHTML = "FABRIC : "+ g_fabric;
}

function setPoplink( imgName) {
	var pophtml = imgName.replace( "_mainimg", "");
//	pophtml = "pop/" + pophtml.replace( "jpg", "html");
	pophtml = "./" + pophtml.replace( "jpg", "html");
	var a_pop = document.getElementById('apop');
	a_pop.setAttribute('href', pophtml);
	a_pop.style.backgroundColor = "#000000";
	a_pop.style.display = "block";
	a_pop.onclick = function() {
		openWindow( pophtml, null, 740, 660);
		return false;
	}
}

function setGlobalParam( imgName) {
	switch( imgName){
		//jacket
		case "1185-ct2_mainimg_01.jpg":
			g_stylename = "#1185-CT2 CRUZER";
			g_color = "Khaki, Stone, Olive, Navy";
			g_fabric = "US Cotton Twill";
			break;
		case "2102x-ct5_mainimg_01.jpg":
			g_stylename = "#2102X-CT5 ENGINEER'S JACKET2-X";
			g_color = "Red, Stone, Navy";
			g_fabric = "US Cotton Twill";
			break;
		case "1192-ct4_mainimg_01.jpg":
			g_stylename = "#1192-CT4 SEA-CRUZ PARKA";
			g_color = "Navy, Stone, Khaki, Olive, Red";
			g_fabric = "US Cotton Twill";
			break;
		case "1151-gc1_mainimg_01.jpg":
			g_stylename = "#1151-GC1 MATTALINI2";
			g_color = "Dark grey, Light grey";
			g_fabric = "Japanese Covert";
			break;
		case "1151-bc2_mainimg_01.jpg":
			g_stylename = "#1151-BC2 MATTALINI2";
			g_color = "Khaki, Stone, Olive";
			g_fabric = "US Cotton Twill";
			break;
		//vest
		case "1504-ct2_mainimg_01.jpg":
			g_stylename = "#1504-CT2 CRUZER VEST";
			g_color = "Khaki, Olive, Red";
			g_fabric = "US Cotton Twill";
			break;
		case "1504-hp2_mainimg_01.jpg":
			g_stylename = "#1504-HP2 CRUZER VEST";
			g_color = "Olive, Khaki";
			g_fabric = "US Heavyweight Cotton Poplin";
			break;
		case "1512-ct5_mainimg_01.jpg":
			g_stylename = "#1512-CT5 ROYAL TRAVELER";
			g_color = "Red, Khaki, Olive";
			g_fabric = "US Cotton Twill";
			break;
		case "1512-gc_mainimg_01.jpg":
			g_stylename = "#1512-GC ROYAL TRAVELER";
			g_color = "Dark grey, Light grey";
			g_fabric = "Japanese Covert";
			break;
		case "1513-ct3_mainimg_01.jpg":
			g_stylename = "#1513-CT3 ROYAL CRUZ";
			g_color = "Olive, Khaki, Red";
			g_fabric = "US Cotton Twill";
			break;
		case "1513-hp1_mainimg_01.jpg":
			g_stylename = "#1513-HP1 ROYAL CRUZ";
			g_color = "Khaki, Olive";
			g_fabric = "Heavyweight Cotton Poplin";
			break;
		//pants
		case "2309-ct4_mainimg_01.jpg":
			g_stylename = "#2309-CT4 CRUZER JEAN";
			g_color = "Navy, Stone, Khaki";
			g_fabric = "US Cotton Twill";
			break;
		case "1311r-cc1_mainimg_01.jpg":
			g_stylename = "#1311R-CC1 NW PANTS-R";
			g_color = "Stone, Khaki, Olilve";
			g_fabric = "US 10oz. Cotton Canvas";
			break;
		case "2307-cc3_mainimg_01.jpg":
			g_stylename = "#2307-CC3 DELAWARE";
			g_color = "Olive, Stone, Khaki";
			g_fabric = "US 10oz. Cotton Canvas";
			break;
		case "2311-hp1_mainimg_01.jpg":
			g_stylename = "#2311-HP1 LOGGER CHINO2";
			g_color = "Khaki, Olive";
			g_fabric = "Heavyweight Cotton Poplin";
			break;
		default:
			break;
	}
	
}
