function lily3_wheel(place)
{
// ritentinsh gaidishanas rezhiimaa
updatepage(place,'<img src="/wheel1.gif"/>');
}

function updateimg(img,val){
var ima_Element = document.getElementById(img);
if (ima_Element)
    ima_Element.src = val;
}

function updatepage(div_name,val){
var productElement = document.getElementById(div_name);
if (productElement)
    productElement.innerHTML = val;
}

function get_url_parm()
{
var strHref = window.location.href;

if ( strHref.indexOf("?") > -1 ){
	//dabonam visu kas ir pec jautajumziimes
  var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
  if(strQueryString.indexOf("#")>-1) 
  		new_return=strQueryString.substr(0,strQueryString.length-1);
	else new_return=strQueryString;
  }

else new_return='?';
return new_return;
}

function load_pub(param){
lily3_wheel('center_div');
new Ajax.Request(
'/ajax_mod/ret_center_text.php',
  {
	method: 'post',
	postBody: 'HORDE='+param+'',
	evalScripts: true,
    onSuccess: function(req) { updatepage('center_div',req.responseText); }
  }
);
}

function head_img(param){
new Ajax.Request(
'/ajax_mod/head_pic.php',
  {
	method: 'post',
	postBody: 'HORDE='+param+'',
	evalScripts: true,
    onSuccess: function(req) { updateimg('head_pic',req.responseText); }
  }
);
}


function load_thumbs(gal_id)
{
var randomnumber=Math.floor(Math.random()*1000000);
//updatepage('publ','<img src="/wheel1.gif"/>');	
new Ajax.Request(
'/modules/gallery_cli/list_thumbs.php',
  {
	method: 'post',
	postBody: gal_id+'&q='+randomnumber,
	evalScripts: true,
    onSuccess: function(req) { updatepage('center_div',req.responseText);}
  }
);
//add_history(gal_id+'q'+randomnumber,'reg');
}

function load_gal_img(param)
{
var randomnumber=Math.floor(Math.random()*1000000);
//updatepage('publ','<img src="/wheel1.gif"/>');	
new Ajax.Request(
'/modules/gallery_cli/list_images.php',
  {
	method: 'post',
	postBody: param+'&q='+randomnumber,
	evalScripts: true,
    onSuccess: function(req) { updatepage('center_div',req.responseText);}
  }
);
//add_history(gal_id+'q'+randomnumber,'reg');
}

function load_banners()
{
new Ajax.PeriodicalUpdater('bannerrs', '/ajax_mod/get_banners_right.php',
		{asynchronous:true,
		frequency:30,
		onSuccess: function(){new Element.show('bannerrs');},
		onFailure: {},	onException: {}, on404:{}
		});		
}