window.gsearch = function(hash, skip, paging)
{
	
	if(window.location.hash.replace("#","")=="")
	{

		bookmarks.sethash("#home=1");
	}



	if(paging==null)
	{
	
		ge('content').innerHTML='<div class="blockCaption"><div id="editor" class="profileEditor">&nbsp;</div><div id="search_progress"><img src="/images/progress7.gif"></div></div>';
	}


	if(hash==null)
	{

		params = {};
	}
	else {

		params=q2o(hash.replace('#',''));
	}

	


	if(params.page=="bestsellers")
	{

		Ajax.Send('/bestsellers.php', params, function(o,t) {
			show('content');
			ge('content').innerHTML=t;
		});

	}
	else if(params.id)
	{

		Ajax.Send('/auto.php', {'id':params.id}, function(o,t) {
			show('content');
			ge('content').innerHTML=t;

			  Ajax.Send('/actions.php', {act:'descrip',url_id:params.id}, function(o,t){
				ge('descrip').innerHTML=t;
			  });
		
		
		});
	}
	else if(params.text)
	{

		Ajax.Send('/search.php', params, function(o,t) {
			show('content');
			ge('content').innerHTML=t;
		});
	
	}
	else {

		Ajax.Send('/home.php', {}, function(o,t) {
			show('content');
			ge('content').innerHTML=t;
		});
	}


	if(skip==null)
	{

		bookmarks.sethash(hash);
	}

	window.scrollTo(0, 0);
}





function show_paging(pid)
{

	ge('paging_progress').style.visibility='';
	ge('paging_progress_bottom').style.visibility='';

	params={};

	if(h=window.location.hash.replace('#',''))
	{

		params=q2o(h);
	}

	params.pid = pid;

	hash='#'+ajx2q(params);	

	gsearch(hash,null,1);
}



onDomReady(function() {
	bookmarks.initialize();
});

