/* -------------------------------------------------------------- 
		Function: $get
		* This function provides access to the "get" variable scope + the element anchor
		
		Arguments:
		* key - string; optional; the parameter key to search for in the url's query string (can also be "#" for the element anchor)
		* url - url; optional; the url to check for "key" in, location.href is default

		Example:
		* $get("foo","http://example.com/?foo=bar"); //returns "bar"
		* $get("foo"); //returns the value of the "foo" variable if it's present in the current url(location.href)
		* $get("#","http://example.com/#moo"); //returns "moo"
		* $get("#"); //returns the element anchor if any, but from the current url (location.href)
		* $get(,"http://example.com/?foo=bar&bar=foo"); //returns {foo:'bar',bar:'foo'}
		* $get(,"http://example.com/?foo=bar&bar=foo#moo"); //returns {foo:'bar',bar:'foo',hash:'moo'}
		* $get(); //returns same as above, but from the current url (location.href)
		* $get("?"); //returns the query string (without ? and element anchor) from the current url (location.href)
		
		Returns:
		* Returns the value of the variable form the provided key, or an object with the current GET variables plus the element anchor (if any)
		* Returns "" if the variable is not present in the given query string
-------------------------------------------------------------- */
function $get(key,url)
{
	if(arguments.length < 2) url =location.href;
	if(arguments.length > 0 && key != "")
	{
		if(key == "#")
		{
			var regex = new RegExp("[#]([^$]*)");
		} 
		else if(key == "?")
		{
			var regex = new RegExp("[?]([^#$]*)");
		} 
		else 
		{
			var regex = new RegExp("[?&]"+key+"=([^&#]*)");
		}
		var results = regex.exec(url);
		return (results == null )? "" : results[1];
	} 
	else 
	{
		url = url.split("?");
		var results = {};
		if(url.length > 1)
		{
			url = url[1].split("#");
			if(url.length > 1) results["hash"] = url[1];
			var vars = url[0].split("&");
			for (var i=0;i<vars.length;i++)
			{
				var pair = vars[i].split("=");
				results[pair[0]] = pair[1];
			}
		}
		return results;
	}
}


document.observe('dom:loaded', function() {
	if (adobe.hostEnv.ieV == 6 || adobe.hostEnv.ieV == 7) {
		//var els = document.getElementsByClassName('link-more');
		Spry.$$('.link-more').each(function(item) {
			item.innerHTML += ' &rsaquo;';
		});
		
		Spry.$$('#depthpath li').each(function(item) {
			//item.innerHTML += '/';
			item.innerHTML += '/';
		});
	}
});

function showProduct(product) {
	productsAccordion.openPanel(product);
	
	var el = document.getElementById(product);
  el.scrollIntoView(true);
}