/* $Header: /cvs/evision/src/www/b2b/lite/js/shopITTreeNL.js,v 1.4 2009/08/31 14:49:50 aeg Exp $ */

var arrVendors;
var arrPT2V;

var loaded = false;

function doBodyOnLoad() {
	try {
		var e = window.parent.window;
		if (e.loaded) {
			initArrays();
		}
	}
	catch(e) {}
	loaded = true;
}

function doS(rnig, mnf) {
	if (window.parent) {
		if (typeof(window.parent.window.doTreeSearch) == 'function') window.parent.window.doTreeSearch(rnig, mnf);
	}
}

function initArrays() {
/*
	arrVendors = window.parent.window.arrVendors;
	arrPT2V = window.parent.window.arrPT2V;

	for (var i = 0; i < arrProdTypes.length; i++) {
		arrProdTypes[i][2] = new Array();
		for (var j = 0; j < arrPT2V.length; j++) {
			if (arrProdTypes[i][0] == arrPT2V[j][0]) {
				for (var k = 0; k < arrVendors.length; k++) {
					if (arrPT2V[j][1] == arrVendors[k][0]) {
						arrProdTypes[i][2][arrProdTypes[i][2].length] = k;
					}
				}
			}
		}
	}
	for (var i = 0; i < arrVendors.length; i++) {
		arrVendors[i][2] = new Array();
		for (var j = 0; j < arrPT2V.length; j++) {
			if (arrVendors[i][0] == arrPT2V[j][1]) {
				for (var k = 0; k < arrProdTypes.length; k++) {
					if (arrPT2V[j][0] == arrProdTypes[k][0]) {
						arrVendors[i][2][arrVendors[i][2].length] = k;
					}
				}
			}
		}
	}
*/
	/*if ((window.parent) && (arrProdTypes.length != 0)) {
		if (typeof(window.parent.window.doShowTree) == 'function') window.parent.window.doShowTree();
	}*/
	/*window.parent.window.doShowTree();*/
	if (window.parent && typeof(window.parent.window.doShowTree) == 'function') window.parent.window.doShowTree();
}

function doEClk(ind, PTId) {
	doExp(ind);
	/*doS(arrProdTypes[ind][0], '');*/
	doS(PTId,'');
}

function doPClk(sender) {
	var ind = sender.getAttribute('pind');
	doExp(ind);
}

function doMClk(sender) {
	var ind = sender.getAttribute('pind');
	doCol(ind);
}

function doExp(ind) {
	var body = document.getElementById('pt_' + ind);
	/*
	if (body.innerHTML.length == 0) {
		buildMnf(body, ind);
	}
	*/
	body.style.display = '';
	document.getElementById('pimg' + ind).className = 'h img';
	document.getElementById('mimg' + ind).className = 'img';
}

function doCol(ind) {
	var body = document.getElementById('pt_' + ind);
	document.getElementById('mimg' + ind).className = 'h img';
	document.getElementById('pimg' + ind).className = 'img';
	body.style.display = 'none';
}

/*
function buildMnf(body, ind) {

	var row = body.insertRow(0);
	var td = row.insertCell(-1);
	td = row.insertCell(-1);

	var tab = document.createElement('TABLE');
	tab.width = '100%';
	tab.className = 'small_text searchBackground_ex';
	td.appendChild(tab);

	for (var j = arrProdTypes[ind][2].length - 1; j >= 0 ; j--) {
		var row = tab.insertRow(0);
		var td = row.insertCell(-1);
		td.width = '5px';
		td.noWrap = 'true';
		td = row.insertCell(-1);
		var a = document.createElement('A');
		a.href = 'javascript:doS(\'' + arrProdTypes[ind][0] + '\', \'' + arrVendors[arrProdTypes[ind][2][j]][0] + '\')';
		a.innerHTML = arrVendors[arrProdTypes[ind][2][j]][1];
		td.appendChild(a);
	}
}
*/
function doCPClk(sender) {
	var ind = sender.getAttribute('pind');
	doExpC(ind);
}

function doCPClkT(sender) {
	var ind = sender.getAttribute('pind');
   if (document.getElementById('ct_' + ind).style.display == 'none')
   	doExpC(ind);
   else 
      doColC(ind);
}
function doCMClk(sender) {
	var ind = sender.getAttribute('pind');
	doColC(ind);
}
function doExpC(ind) {
	var body = document.getElementById('ct_' + ind);
	body.style.display = '';
	document.getElementById('cpimg' + ind).className = 'h img';
	document.getElementById('cmimg' + ind).className = 'img';
}

function doColC(ind) {
	var body = document.getElementById('ct_' + ind);
	document.getElementById('cmimg' + ind).className = 'h img';
	document.getElementById('cpimg' + ind).className = 'img';
	body.style.display = 'none';
}

