function varDump(variable, maxDeep) {
	var deep = 0;
	var maxDeep = maxDeep || 5;

	function fetch(object, parent)
	{
		var buffer = '';
		deep++;

		for (var i in object) {
			if (parent) {
				objectPath = parent + '.' + i;
			} else {
				objectPath = i;
			}

			buffer += objectPath + ' (' + typeof object[i] + ')';

			if (typeof object[i] == 'object') {
				buffer += "\n";
				if (deep < maxDeep) {
					buffer += fetch(object[i], objectPath);
				}
			} else if (typeof object[i] == 'function') {
				buffer += "\n";
			} else if (typeof object[i] == 'string') {
				buffer += ': "' + object[i] + "\"\n";
			} else {
				buffer += ': ' + object[i] + "\n";
			}
		}

		deep--;
		return buffer;
	}

	if (typeof variable == 'object') {
		return fetch(variable);
	}

	return '(' + typeof variable + '): ' + variable + "\n";
}

function displaySuggests(arg1) {
	//alert(arg1);
	var data = arg1.evalJSON(true);
	var sr = $('intelliSearchResult');
	sr.update('');
	sr.setStyle({display: 'block'});
	sr.setStyle({visibility: 'visible'});
	
	// outer loop - sections
	for (var i = 0; i < data.length; i++) {

		if(data[i].links.length > 0) {
			sr = sr.update(sr.innerHTML + data[i].heading);
			// inner loop for all links
			for (n=0; n<data[i].links.length; n++) {
				var linkEntry = data[i].links[n];
				linkEntry.linkName = linkEntry.linkName.replace(/\+\+\+\+/g, '<span class="suggestHighlight">');
				linkEntry.linkName = linkEntry.linkName.replace(/----/g, '</span>');
				var el = new Element('a', { href: linkEntry.linkHref}).update(linkEntry.linkName);
				if(linkEntry.pid > 0) {
					el.setAttribute('class', 'suggestSelector');
					el.setAttribute('id', linkEntry.name);
					el.setAttribute('name', 'tooltipDetail_' + linkEntry.pid);
					// IE Fix - since it does not recognize for some fu reason the name attribute, it
					// works to set a dummy attribute
					el.setAttribute('pid', linkEntry.pid);    
				}
				sr.insert(el);
			}
		}
	}


	$$('.suggestSelector').each(function(element) {
			//var base = "<?php echo  DIR_WS_CATALOG;  ?>";
			var base = '/';
			if (shop_base_path) {
				base = shop_base_path;
			}
			var pid = element.name.replace(/tooltipDetail_/g, "");
			// IE Fix
			if(pid == '') {
				pid = element.pid;
			}
			// IE Fix END
			
	    	new Tip(
				    element, 
				    element.id, 
				    { 
					    width: '280px;', 
					    border: 1, 
					    radius: 2,
					    borderColor: '#9C9C9C',
					    className: 'ajax_tooltip_response',
					    offset: { x: 358, y: -20 },
					    hook: { target: 'intelliSearchResult', tip: 'topLeft' },
						ajax: {
							url: base + 'ajax_tooltip_response.php?pid=' + pid						    
					  	}
					}
		    );
	});			
}

function hideSuggests() {
/*
	var sr = $('intelliSearchResult');
	sr.update('');
	sr.setStyle({display: 'none'});
	sr.setStyle({visibility: 'hidden'});
*/
}
function removeTipps() {
	$$('.suggestSelector').each(function(element) {
    	Tips.remove(element);
	});	
}

/*
document.observe("dom:loaded", function() {
	var instanceOne = new ImageFlow();
	instanceOne.init(
			{ImageFlowID:'myImageFlow',
				reflectionGET: '&bgc=ffffff',
				xStep: 120,
				imageFocusM : 0.9,
				startID : 2,
				imageCursor : 'pointer'
			});
	});
*/	

function shoppingCartTip(id, tipp) {
	new Tip(id, tipp, { width: '250px;', border: 1, radius: 2, borderColor: '#9C9C9C', className: 'shoppingcart' });
}