function toggle_help(key) {
	
	if (!document.getElementById) return;
	
	prefix = 'styling_help_';
	help = document.getElementById( prefix + key  );
	
	if (!help) return;
	
	if (help.style.display != '') {
		help.style.display = '';
	}
	else {
		help.style.display = 'block';	
	}
	
}

addLoadEvent(initShirtEditor);

function initShirtEditor() {
	applyStylingRollovers()	
}


function applyStylingRollovers() {
	
	if (!document.getElementById) return;
	
	list = document.getElementById('select_style');
	
	if (!list) return;
	items = list.getElementsByTagName('a');

	for(var i = 0; i < items.length; i++ ) {

		// Get the styling key
		type_link = items[i];
		url = type_link.href;
		url = url.split('#')[0];
		params = url.split('&');
		param = params.pop().split('=');
		key = param.pop();
		img = items[i].getElementsByTagName('img')[0];
		if (img) {
			applyStylingRollover(img, key);
		}
	}
}

function applyStylingRollover(img, key) {
	
	img.onmouseover = function () {
		toggle_help(key); 
		return false;
	}
	
	img.onmouseout = img.onmouseover;
}



function view_fabric(url) {

	newwindow = window.open('/shop/viewfabric/?img=' + url, '_fabrics','height=600,width=600');
	return false;
	
}

