var Search = {
	moreoptions: null,
	querystring: new Array(),
	
	init: function()
	{
		Search.getquerystring();
		var searchoptions = document.getElementById('searchoptions');
		moreoptions = document.getElementById('changeSearch_moreoptions');

		if (Search.querystring["moreoptions"] == 'True')
			moreoptions.style.visibility = 'visible';
		
		//Event.addEvent(searchoptions, 'click', Search.showmoreoptions, true);
		
		// Hide the filter 'Go' btn
		if (document.getElementById('filter'))
		{
			var filterbutton = document.getElementById('filter').getElementsByTagName('input')[0];
		
			if (filterbutton != undefined)
				filterbutton.style.display = 'none';
		}
			
		var hotpickbutton = document.getElementById('filterHotPicks');

		if (hotpickbutton != undefined)
			hotpickbutton.style.display = 'none';
		
		
	},
	
	getquerystring: function()
	{
		//this loads the portion of the url containing the querystring, and also
		//decodes any special character codes  
		var que = unescape(location.search);

		//remove the ? from the beginning of the string
		var que = que.substring(1, que.length);

		//detects multiple values and splits them into an array que[0], que[1] etc
		var que = que.split("&");

		//(for some strange reason the "for/next" loop wasn't working)
		var loop = 0;

		//This loop takes each value in the que array then seperates the "names" 
		//from the "values" by splitting it into "inter" arrays. the name becomes
		// "inter3" and the value becomes "inter2". querystring then loads the 
		// "inter2" value into a slot called "inter3"
		while (loop < que.length)
		{
			var inter = que[loop].split("=");
			var inter2 = inter[1];
			var inter3 = inter[0]
			que[loop] = inter2;
			Search.querystring[inter3] = inter2
			loop = loop + 1;
		} ;
	}, 
	
	showmoreoptions: function()
	{
		moreoptions.style.visibility = 'visible';
		document.getElementById('changeSearch_showMoreOptions').value = 'True';
	}
}

if (/WebKit/i.test(navigator.userAgent)) { // sniff
    var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
            clearInterval(_timer);
           Search.init(); // call the onload handler
        }
    }, 10);
}
if (document.addEventListener)
    document.addEventListener("DOMContentLoaded", Search.init, false);
else
	Event.addEvent(this, 'load', Search.init, true);


