function changeImage(imgId, imgSrc) {
	document.getElementById(imgId).src = imgSrc;
}


var oldXPos=0;
var oldYPos=0;
function fadeIn( elID, imgName ){
	var el = Ext.get(elID.id);
	el.syncFx();
	oldXPos = el.getX();
	oldYPos=el.getY();
	el.shift({
	    width: 120,
	    x: (oldXPos-20),
	    y: (oldYPos-10),
	    easing: 'easeOut',
	    duration: .25
	});
	el.setStyle('zIndex',1000);
	el.repaint();
}

function fadeOut( elID, imgName ){
	var el = Ext.get(elID.id);
	el.syncFx();
	el.shift({
	    width: 80,
	    x: oldXPos,
	    y: oldYPos,
	    easing: 'easeOut',
	    duration: .25
	});
		el.setStyle('zIndex',10);
	el.repaint();
}

function doSelect(el) {
	if(el.getValue()) {
		window.location.href = el.getValue();
	}
}

function convertSelect(id, callback, numId, baseUrl, width) {
	if(!width) {
		width = 190;
	}
	Ext.onReady(function(){
		var converted = new Ext.form.ComboBox({
			typeAhead: true,
			triggerAction: 'all',
			transform: id,
			width: width,
			editable: false,
			forceSelection: true, 
			baseUrl: baseUrl,
			numId: numId
		});
		converted.on('select', eval(callback), this);
	});	
}

function switchBrand(el, event) {
	url = el.baseUrl+el.getValue();
	window.location.href = url;
}

function switchBrandShopStart(el, event) {
	url = el.baseUrl;
	for(i = el.numId; i > 0; i--) {
		lel = Ext.get('level'+i);
		if(lel) {
			if(lel.getValue()) {
				url += '/'+lel.id+'/'+lel.getValue();
			}
		}
	}
	window.location.href = url;
}

function highlightArrow(id, onOff) {
	// td arrow change
	el = document.getElementById('tdarrow_' + id);
	el.className = 'arrow_' + onOff;
	// img change
	el = document.getElementById('arrow_' + id);
	if(onOff == 'on') {
		el.src = '/application/views/frontend/resources/img/arrow_right_redbg.gif';
	} else {
		el.src = '/application/views/frontend/resources/img/arrow_right.gif';
	}
	
}