function search_in_shop(art_id, color_id, size, container_id, region){
var obj = document.getElementById(container_id);
	if (document.getElementById('loading')) document.getElementById('loading').style.display = 'block';
	aj_shop = new sack();
	aj_shop.setVar('art_id',art_id);
	aj_shop.setVar('color_id',color_id);
	aj_shop.setVar('size',size);
	aj_shop.setVar('cmd','get_shops');
	aj_shop.setVar('region',region);
 aj_shop.method = 'POST';
 aj_shop.requestFile = '/ajax/search_in_shops.php';
 aj_shop.onCompletion = function(){
 if (document.getElementById('loading')) document.getElementById('loading').style.display = 'none';
  obj.style.display = "block";
	obj.innerHTML = this.response;
	combo_shops = new ac_combo_box();
    combo_shops.init('shops_c');
	if (combo_shops) combo_shops.onSelect = function(){if (combo_shops) search_in_shop(art_id, color_id, size, container_id,combo_shops.getSelectedValue());}
	reset_bg_height();
	align_center();
	}
    aj_shop.runAJAX();
}//function

function hide_shop_detail(container_id){
var obj = document.getElementById(container_id);
	obj.style.display = "none";
	obj.innerHTML = "";
	combo_shops = null;
	document.getElementById("content").style.height = "100%";
}//function

function  show_detail_shop(shop_id, art_id, color_id, size, region, container_id){
var obj = document.getElementById(container_id);
	aj_shop = new sack();
	$("#_pane_div").hide();
	$("#preloader").show();
	align_preloader();
	aj_shop.setVar('shop_id',shop_id);
	aj_shop.setVar('art_id',art_id);
	aj_shop.setVar('color_id',color_id);
	aj_shop.setVar('size',size);
	aj_shop.setVar('region',region);
	aj_shop.setVar('cmd','show_detail_shop');
	aj_shop.method = 'POST';
	aj_shop.requestFile = '/ajax/search_in_shops.php';
	aj_shop.onCompletion = function(){
	obj.style.display = "block";
	
	obj.innerHTML = this.response;
	document.getElementById('pane_').style.visibility ='hidden';
  reset_bg_height();
	//align_center();
	document.getElementById('_photo_shop_img').onload = function()
		{
			align_center();
			document.getElementById('pane_').style.visibility ='visible';
	
		} // function
	} //function
    aj_shop.runAJAX();
}//function


function reset_bg_height(){
	new_h = parseInt(document.getElementById("_pane_div").clientHeight) + parseInt(document.getElementById("_pane_div").offsetTop);
    if ( document.getElementById("content").clientHeight < new_h ){
      document.getElementById("content").style.height = new_h+'px';
      document.getElementById("page_all").style.height = document.getElementById("container").clientHeight+"px";
    }//if
    else {
    document.getElementById("page_all").style.height = document.getElementById("container").clientHeight+"px";
    }//else
  }//function


function align_center(){

new_top = parseInt((parseInt(getClientHeight()) - parseInt(document.getElementById("_pane_div").clientHeight))/2);
if (new_top<40){
  new_top = 40;
}
var temp= new_top;
scroll_top = parseInt(getBodyScrollTop());
new_top = parseInt(new_top+scroll_top);

new_height = parseInt(document.getElementById("_pane_div").offsetHeight) + new_top + 90;
document.getElementById("_pane_div").style.marginTop = new_top+'px';

//alert(document.getElementById("page_all").offsetHeight +" - "+ new_height);


if(document.getElementById("pane_container"))
	if(document.getElementById("page_all").offsetHeight < new_height)
		document.getElementById("page_all").style.height = new_height+'px';

if(document.getElementById("pane_"))
	if(document.getElementById("page_all").offsetHeight < new_height)
		document.getElementById("page_all").style.height = new_height+'px';


}//function

function getBodyScrollTop(){
  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}//func

  function getClientHeight(){
  //return document.compatMode=='CSS1Compat' && !window.opera ? document.documentElement.clientHeight:document.body.clientHeight;
  return document.compatMode=='CSS1Compat' ? document.documentElement.clientHeight:document.body.clientHeight;
  //return document.documentElement.clientHeight;
}//func

//--------------
function show_on_metroMap(shop_id,container_id,art_id,color_id,size,region){

	var params = new Object;
	params.shop_id = shop_id;
	params.art_id = art_id; 
	params.color_id = color_id; 
	params.size = size; 
	params.region = region;
	params.search = 1;
	//params.tpl_file = '<!--[tpl_file]-->';
	params.cmd = 'select_onmap';
	$.post('/ajax/shop_selector.php',params,function(txtresponse){
	$("#"+container_id).css("display: block;");
	$("#_pane_div").hide();
	$("#preloader").show();
	$("#"+container_id).html(txtresponse);
	commitFlashObject(NmyFlashObject, "new_flash_screen");
		reset_bg_height();
		align_center();
	});
}//function
//--------------
function show_on_CityMap(shop_id,container_id,art_id,color_id,size,region){

	var params = new Object;
	params.shop_id = shop_id;
	params.art_id = art_id; 
	params.color_id = color_id; 
	params.size = size; 
	params.region = region;
	params.search = 1;
	//params.tpl_file = '<!--[tpl_file]-->';
	params.cmd = 'select_on_city_map';
	$.post('/ajax/shop_selector.php',params,function(txtresponse){
	$("#"+container_id).css("display: block;");
	$("#_pane_div").hide();
	$("#preloader").show();
	$("#"+container_id).html(txtresponse);
	reset_bg_height();
	align_center();
	});
}//function

function align_preloader(){
new_top = parseInt(parseInt(getClientHeight())/2);
if (new_top<40){
  new_top = 40;
}
scroll_top = parseInt(getBodyScrollTop());
new_top = parseInt(new_top+scroll_top);
document.getElementById("preloader").style.marginTop = new_top+'px';

}// function

