var divs;
var showDivs=new Array();


function DoFindClocks()
{
	var obj=$("#w_find");
	var z_form=$("#findclocks");
 	if (obj.val()!="")
	{
	z_form.submit();
	}
}

function setCheckboxValue(id)
{
 
	var obj=$("#checkchar_"+id);
 
	if (obj.val()==0)
	{
		obj.val(1);
	} else if (obj.val()==1)
	{
		obj.val(0);
	}
}


function compareSubmit()
{
	
	var c_form=$("#compare_form");
	c_form.submit();
	
}


function switchPanel(mode)
{
	
	if (mode=='simple')
	{
		var extended_flag=$("#extended");
		var sw_hide=$("#tomini");
		var sw_show=$("#tofull");
		var title_show=$("#title_simple");
		var title_hide=$("#title_ext");
		var fullpanel_show=$("#fullsearch");
		fullpanel_show.hide();
         sw_show.show();
		 sw_hide.hide();
		 title_show.show();
		 title_hide.hide();
		 extended_flag.val(1);
		
	} else if (mode=='full')
	{
		var extended_flag=$("#extended");
		var sw_hide=$("#tofull");
		var sw_show=$("#tomini");
		var fullpanel_show=$("#fullsearch");
			var title_show=$("#title_ext");
		var title_hide=$("#title_simple");
		fullpanel_show.show();
	  sw_show.show();
		 sw_hide.hide();
		  title_show.show();
		 title_hide.hide();
		  extended_flag.val(2);
		
	}
	
}
function changeWarePic(pic2,pic3,idpic)
{
	var obj=$("#warebigpic");
	 obj.attr("src", pic2);
	 var aobj=$("#awarebigpic");
	 aobj.attr("href", pic3);
	 $(".wimg").css("border","1px solid #DAE4F3");
	 var setobj=$("#"+idpic);
	 setobj.css("border","1px solid #1D249F");

}

function setParameterCompDel(id)
{
 
	var obj=$("#delid");
  
	 
		obj.val(id);
	var c_form=$("#compare_form");
	c_form.submit();
	 
}

function setParameterComp(id)
{
 
	
  
	$.post('/doajax',
			  {
			    type: "selected",
			    id: id
			  },
			  setParameterResponse
			);
			
	
	 
	 
	 
}


function setParameterResponse(xml)
{
	 
	 $(xml).find("compareadd").each(function()
			  {
		 	var id_text = $(this).attr('id'); 
		 	var count = $(this).attr('count'); 
		 	var numcomp=$("#numcomp");
		 	if (count>0)
		 	{
		 	numcomp.text(count+' шт.');
		 	}
		 	else
		 	{
		 	numcomp.text('');
		 	}	
		 	var div=$("#div_"+id_text);
		 	div.attr('title','удалить из списка сравнения');
		 	div.addClass('F_checkbox_act');
		 	var obj=$("#comp_"+id_text);
	        obj.val('sel');
	 
			  });
	 $(xml).find("comparedelete").each(function()
			  {
		 	var id_text = $(this).attr('id'); 
		 	var count = $(this).attr('count'); 
		 	var numcomp=$("#numcomp");
		 	if (count>0)
		 	{
		 	numcomp.text(count+' шт.');
		 	}
		 	else
		 	{
		 	numcomp.text('');
		 	}	
		 	
		 	var div=$("#div_"+id_text);
		 	div.removeClass('F_checkbox_act');
		 	div.attr('title','добавить в список сравнения');
		 	var obj=$("#comp_"+id_text);
	        obj.val('');
	 
			  });
 
	 
 
}

function setParameter(elem,val,doaction)
{
 
	var obj=$("#ol"+elem);
 
	obj.val(val);
	if (doaction)
	{
		var z_form=$("#z_form");
	z_form.submit();
	}
}

function setOrder(val)
{
 
	var obj=$("#byvalue");
 	obj.val(val);
	var z_form=$("#z_form");
	z_form.submit();
}
function changeVM(val)
{
 
	var obj=$("#vm");
 	obj.val(val);
	var z_form=$("#z_form");
	z_form.submit();
}
function ContentLeft(d) 
			{
			var obj = document.getElementById(d);
			var currentPosition = parseInt(obj.style.left)
			var amountToMove = 30
			obj.style.left = currentPosition-amountToMove+"pt";
			}
		
			function ContentRight(d) 
			{
			var obj = document.getElementById(d);
	     	var currentPosition = parseInt(obj.style.left)
			var amountToMove = 30
			obj.style.left = currentPosition+amountToMove+"pt";
			}

function changecss(theClass,element,value) {
     var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 var added = false;
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    if(document.styleSheets[S][cssRules][R].style[element]){
	    document.styleSheets[S][cssRules][R].style[element] = value;
	    added=true;
		break;
	    }
	   }
	  }
}
}

function getCompareLogic(theElement) {
	 
	var num=0;
    var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox'){
	//  theForm[z].checked = theElement.checked;
	if (theForm[z].checked==true)
	{
	//	alert('ok'+ theForm[z].value);
		num++;
	}
	  
	  }
	  
	  }
	  if (num>1)
	  {
	  	changecss('.hiddencompare','visibility','visible');
		changecss('.hiddencompare','display','block');
		changecss('.displaycomparehref','visibility','hidden');
		changecss('.displaycomparehref','display','none');
		
		
	  }
	  else
	  {
	  	changecss('.hiddencompare','visibility','hidden');
		changecss('.hiddencompare','display','none');
			changecss('.displaycomparehref','visibility','visible');
		changecss('.displaycomparehref','display','block');
	  }
	 
}
function changeMapArea(mysrc)
{
//alert(mysrc);
document.getElementById("imgmap").src=mysrc;

 return true;
} 

function changeMainPic(mysrc)
{
//alert(mysrc);

 whichButton='mainpic';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
{
      elem = document.all[whichButton];
}
elem.src=mysrc;
 return true;
} 

function changeMainPicA(mysrc,myhref)
{

var elem,alink
 whichButton='mainpic';
  whichLink='amainpic';
  if( document.getElementById )  
  {
    elem = document.getElementById(whichButton);
	alink = document.getElementById(whichLink);
  }
  else if( document.all ) 
{
      elem = document.all[whichButton];
	  alink = document.all[whichLink];
}
 
elem.src=mysrc;
alink.href=myhref;
 
 return true;
} 



function doMapInit()
{

	MM_preloadImages('/img/maps/mapdvfo.jpg','/img/maps/mapsfo.jpg','/img/maps/mapyfo.jpg','/img/maps/mappfo.jpg','/img/maps/mapugfo.jpg','/img/maps/mapcfo.jpg','/img/maps/mapszfo.jpg');
}

function doInit()
{
	MM_preloadImages('/img/menuselect.jpg','/img/rightmenudelim.gif','/img/rightmenudelim.gif','/img/partner1.gif','/img/partner2.gif','/img/partner3.gif','/img/partner4.gif');
}
function toSubmitSelect()
{
	var   s_form,s_formid ;
 
	  s_formid='s_form';
  if( document.getElementById ) // this is the way the standards work
  {
   s_form= document.getElementById(s_formid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
    s_form = document.all[s_formid];
	}
	
	if (s_form)
	{
		 
		s_form.submit();
	}
}


function toSubmitCompare()
{
	var   s_form,s_formid ;
 
	  s_formid='compare_form';
  if( document.getElementById ) // this is the way the standards work
  {
   s_form= document.getElementById(s_formid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
    s_form = document.all[s_formid];
	}
	
	if (s_form)
	{
		 
		s_form.submit();
	}
}
function sendToBy()
{
	var  w_form,w_formid;
	
  
	  w_formid='onewareform';
  if( document.getElementById ) // this is the way the standards work
  {
    w_form= document.getElementById(w_formid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
    w_form = document.all[w_formid];
	}
	
	if (w_form)
	{
		 
		w_form.submit();
	}
}


function sendToBasket(wid)
{
	var w_value,w_valueid, w_form,w_formid;
	
	 w_valueid='m_ware_id';
  if( document.getElementById ) // this is the way the standards work
  {
    w_value = document.getElementById(w_valueid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
     w_value = document.all[w_valueid];
	}
	
	if (w_value)
	{
		w_value.value=wid;
	}
	
	 
	  w_formid='m_basket_form';
  if( document.getElementById ) // this is the way the standards work
  {
    w_form= document.getElementById(w_formid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
    w_form = document.all[w_formid];
	}
	
	if (w_form)
	{
		 
		w_form.submit();
	}
}

function setNumberOnPage(id)
{
	var inputvalue,inputvalueid, searchform,searchformid;

  inputvalueid='onpagesinput';
  if( document.getElementById ) // this is the way the standards work
  {
    inputvalue = document.getElementById(inputvalueid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
     inputvalue = document.all[inputvalueid];
	}
	
	if (inputvalue)
	{
		inputvalue.value=id;
	}
	  searchformid='s_form';
  if( document.getElementById ) // this is the way the standards work
  {
    searchform = document.getElementById(searchformid);
  }
  else if( document.all ) // this is the way old msie versions work
  {
    searchform = document.all[searchformid];
	}
	
	if (searchform)
	{
		 
		searchform.submit();
	}
	
}
function pushItem( number,islast)
{
  var elem, vis,whichButton,delim;

  whichButton='div'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
//alert(whichButton);

//alert(elem.style.background);
elem.style.background = ' url(/img/itembg.gif) repeat-x   bottom #188dd7';
elem.style. cursor='pointer';

if (islast==1)
{
elem.style.background = '#188dd7';
}
else
{
elem.style.background = ' url(/img/itembg.gif) repeat-x   bottom #188dd7';
}

}

function outItem( number,islast)
{
  var elem, vis,whichButton,delim;

  whichButton='div'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
//alert(whichButton);

//alert(elem.style.background);
if (islast==1)
{
elem.style.background = '  #42a2de';
}
else
{
elem.style.background = ' url(/img/itembg.gif) repeat-x bottom #42a2de';
}

}





function pushButton( number)
{
  var elem, vis,whichButton,delim;
  clearAllBg();
  whichButton='but'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];

vis = elem.style;
elem.style.background='url("/img/menuselect.jpg")';
var objtext='lm'+number;
setColorMenu(objtext,"#FFFFFF");
if (parseInt(number)>1)
{
setLeftDelim(parseInt(number)-1);
setRightDelim(parseInt(number));		
delim = 'mi'+(number-1);
var pos=findPos(delim);
showMenu(number,pos);
}
else
{
setRightDelim('1');
delim = 'menu2';
var pos=findPos(delim);
showMenu(number,pos);
}

}

function clearBg(number)
{
var elem, vis,whichButton;

  whichButton='but'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];

vis = elem.style;
elem.style.background='none';
var objtext='lm'+number;
setColorMenu(objtext,"#4C5B7E");
if (parseInt(number)>1)
{
clearDelim(parseInt(number)-1);
clearDelim(parseInt(number));		
}
else
{
clearDelim('1');
}
hideMenu(number);
}
function clearAllBg()
{
clearBg('1');	
clearBg('2');	
clearBg('3');	
clearBg('4');	
clearBg('5');	
clearBg('6');	
clearBg('7');
clearBg('8');
		
}

function setLeftDelim(number)
{
  var elem, vis,whichImage;
   whichImage='mi'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichImage);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichImage];

elem.src='/img/leftmenudelim.gif';	
}
function setRightDelim(number)
{

  var elem, vis,whichImage;
  whichImage='mi'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichImage);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichImage];

elem.src='/img/rightmenudelim.gif';	
}

function clearDelim(number)
{

  var elem, vis,whichImage;
   whichImage='mi'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichImage);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichImage];

elem.src='/img/menudelim1.jpg';	
}
function findPos(id) {
	  if( document.getElementById ) // this is the way the standards work
  {
    obj = document.getElementById(id);
  }
  else if( document.all ) // this is the way old msie versions work
      obj = document.all[id];
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	
	return [curleft,curtop];
}
function MM_preloadImages() 
{ var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image(); d.MM_p[j].src=a[i];j++;}} } 




function showMenu(number,pos)
{

  var elem, vis;
   var whichMenu='floatmenu'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.visibility='visible';
elem.style.display='block';
if (parseInt(number)>1)
{
elem.style.left=pos[0]+2+'px';
}
else
{
elem.style.left=pos[0]+'px';	
}
	}	
	
}
function hideMenu(number)
{

  var elem, vis;
   var whichMenu='floatmenu'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.visibility='hidden';
elem.style.display='none';

	}	
}

function setColorMenu(objtext,color)
{

  
  var whichMenu=objtext;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.color=color;


	}	
}



function pushPartner( number)
{
  var elem, whichButton;

  whichButton='pimg'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
//alert(whichButton);



elem.src='/img/partner'+number+'.gif';

}

function releasePartner( number)
{
  var elem, whichButton;

  whichButton='pimg'+number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
//alert(whichButton);



elem.src='/img/partner'+number+'hid.gif';

}


function showPerson()
{
  var elem, whichButton;
hideOrg();
  whichButton='regperson';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
elem.style.visibility='visible';
elem.style.display='block';
}
function showOrg()
{
  var elem, whichButton;
hidePerson();
  whichButton='regorg';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
elem.style.visibility='visible';
elem.style.display='block';
}

function hidePerson()
{
  var elem, whichButton;

  whichButton='regperson';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
elem.style.visibility='hidden';
elem.style.display='none';
}
function hideOrg()
{
  var elem, whichButton;

  whichButton='regorg';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichButton);
  }
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichButton];
elem.style.visibility='hidden';
elem.style.display='none';
}


function hideCat(number)
{

  var elem, vis;
   var whichMenu=number;
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{

elem.style.visibility='hidden';
elem.style.display='none';

	}	
	
}
function showCat(number)
{

  var elem, vis;
   var whichMenu=number;

  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}

	if (elem)
	{


elem.style.visibility='visible';
elem.style.display='block';	

	}	
}

function elemShow(elem)
{
hideAllElem(divs);
hideAllCatElem(divcat);
setTimeout('showCat(\''+elem+'\')',100);

}
function hideAllElem(divs)
{

var dv =divs.split(',');
var curDiv;
for(i = 0; i < dv.length; i++){
curDiv='mcat'+dv[i];
elemHide(curDiv);
}
}
function hideAllCatElem(divs)
{

var dv =divs.split(',');
var curDiv;
for(i = 0; i < dv.length; i++){
curDiv='scat'+dv[i];
 if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(curDiv);
  }
  else if( document.all ) 
  {
      elem = document.all[curDiv];
	}
if (elem)
{
elemHide(curDiv);
}
}

}
function elemHide(elem)
{

setTimeout('hideCat(\''+elem+'\')',100);	
}



function changeSRC(elem,src)
{

elem.src=src;
}

function changeBG(id,src)
{
//alert(src);
var td;
var tdtxt='quick'+id;
 if( document.getElementById ) 
  {
    td = document.getElementById(tdtxt);
  }
  else if( document.all ) 
  {
      td = document.all[tdtxt];
	}
 
	if (td)
	{

td.style.backgroundImage = 'url('+src+')';
	}	

}
 


/*
 *  move lent layer 
 */

 function showBig(obj,artname)
{

var pos=getPos(obj);
var pos_x=pos.x;
var pos_y=pos.y;
var divnumber=showDivs.length+1;
showDivs[divnumber]=divnumber;

var thisdiv=createbigDiv(divnumber,pos_x,pos_y);
var divImg='bigimg'+divnumber;
var tblName='tablebig'+divnumber;
var tbltitle='bigtitle'+divnumber;
thisimg = document.getElementById(divImg);
thistable = document.getElementById(tblName);
thistitle = document.getElementById(tbltitle);
thisimg.src=obj.href;
///var thisimg=createImg(thisdiv,divImg,obj.href);
//alert(thisimg);
//	setTimeout(function(){IncreaseSize2(thisimg,10)},10);
//IncreaseSize2(thisimg,10);
 
thistable.style.background = '#000';
 thistitle.innerHTML ='&#160;&#160;&#160;'+artname;
//alert('ok');
return false;
}

function createbigDiv(divnumber,left,top)
{
var divName='showbig'+divnumber;
var tblName='tablebig'+divnumber;
var divImg='bigimg'+divnumber;
var tbltitle='bigtitle'+divnumber;
var newdiv = document.createElement('div'); 
newdiv.setAttribute('id',divName); 

newdiv.setAttribute('style','z-index: 1'); 
newdiv.style.width = "550px"; 
newdiv.style.height = "750px"; 
newdiv.style.left = left-200+'px'; 
newdiv.style.top = top-450+'px';  
newdiv.style.position = "absolute"; 
//newdiv.style.background = "#00C"; 
 
newdiv.innerHTML = '<table width="550" height="750" border="0" id="'+tblName+'"><tr><td width="550" height="20" id="'+tbltitle+'" class="medtitle"></td><td width="50"><a class="medlink" href="javascript:closeBig(\''+divName+'\');" >пїЅпїЅпїЅпїЅпїЅпїЅпїЅ</a> </td></tr><tr><td align="center" valign="top" colspan="2"><img id="'+divImg+'"  onmousedown="dragStart(event,\''+divName+'\')"  ondblclick="closeBig(\''+divName+'\');" /></td></tr></table>'; 
document.body.appendChild(newdiv);
return newdiv;
}



 function showMedium2(obj,artname)
{

var pos=getPos(obj);
var pos_x=pos.x;
var pos_y=pos.y;

return false;
}
function closeMedium(objname)
{

thisdiv = document.getElementById(objname);
 thisdiv.style.visibility = 'hidden';  
  thisdiv.style.display = 'none';  

}

function closeBig(objname)
{

  
thisdiv = document.getElementById(objname);
 thisdiv.style.visibility = 'hidden';  
  thisdiv.style.display = 'none';  

}

function showMedium(obj,artname)
{

var pos=getPos(obj);
var pos_x=pos.x;
var pos_y=pos.y;
var divnumber=showDivs.length+1;
showDivs[divnumber]=divnumber;

var thisdiv=createmediumDiv(divnumber,pos_x,pos_y);
var divImg='medimg'+divnumber;
var tblName='tablemed'+divnumber;
var tbltitle='medtitle'+divnumber;
thisimg = document.getElementById(divImg);
thistable = document.getElementById(tblName);
thistitle = document.getElementById(tbltitle);
thisimg.src=obj.href;
///var thisimg=createImg(thisdiv,divImg,obj.href);
//alert(thisimg);
	setTimeout(function(){IncreaseSize2(thisimg,10)},10);
//IncreaseSize2(thisimg,10);
 
setTimeout("thistable.style.background = '#000' ", 300);
 thistitle.innerHTML ='&#160;&#160;&#160;'+artname;
//alert('ok');
return false;
}

 
 function IncreaseSize2(thisimg,value){
	value=value+100;
	//alert(value);
	thisimg.style.width=value+"px";
	if(value<310){
		setTimeout(function(){IncreaseSize2(thisimg,value)},50);
		// IncreaseSize2(thisimg,value);
	}
	else
	{
		return false;
	}
}
 

function createmediumDiv(divnumber,left,top)
{
var divName='showmed'+divnumber;
var tblName='tablemed'+divnumber;
var divImg='medimg'+divnumber;
var tbltitle='medtitle'+divnumber;
var newdiv = document.createElement('div'); 
newdiv.setAttribute('id',divName); 

newdiv.setAttribute('style','z-index: 1'); 
newdiv.style.width = "330px"; 
newdiv.style.height = "450px"; 
newdiv.style.left = left+'px'; 
newdiv.style.top = top-80+'px';  
newdiv.style.position = "absolute"; 
//newdiv.style.background = "#00C"; 
 
newdiv.innerHTML = '<table width="330" height="450" border="0" id="'+tblName+'"><tr><td width="280" height="20" id="'+tbltitle+'" class="medtitle"></td><td width="50"><a class="medlink" href="javascript:closeMedium(\''+divName+'\');" >пїЅпїЅпїЅпїЅпїЅпїЅпїЅ</a> </td></tr><tr><td align="center" valign="top" colspan="2"><img id="'+divImg+'"  onmousedown="dragStart(event,\''+divName+'\')" onmouseup="dragStop(event,\''+divName+'\')"  ondblclick="closeMedium(\''+divName+'\');" width="10"/></td></tr></table>'; 
document.body.appendChild(newdiv);
return newdiv;
}

function createImg(newdiv,imgName,src)
{
var newimg = document.createElement('img'); 
newimg.setAttribute('id',imgName); 
newimg.setAttribute('src',src); 
newimg.setAttribute('onmousedown','dragStart(event,\''+newdiv+'\')');

newimg.style.width = "10px"; 
//newimg.src('id',divIdName); 
//newdiv.style.background = "#00C"; 

newdiv.appendChild(newimg);
return newimg;
}


function getPos(element) {
     var left  = 0;
	   var top = 0;
	    if (element.offsetParent) {
        left = element.offsetLeft;
	    top = element.offsetTop;
	  
       while (element.offsetParent) {
           element = element.offsetParent;
		   if(element.offsetParent===document.body) break;
 	            left += element.offsetLeft;
             	top += element.offsetTop;
 	        }
 	    }
	
     return {'x': left, 'y': top};
 	};

function showBuyMessage(obj)
{
var pos=getPos(obj);
var pos_x=pos.x;
var pos_y=pos.y;

  var elem;
   var ThisId='buymessage';
  if( document.getElementById ) 
  {
    elem = document.getElementById(ThisId);
  }
  else if( document.all ) 
  {
      elem = document.all[ThisId];
	}
	if (elem)
	{
elem.style.left=pos_x+160+'px';
elem.style.top=pos_y-10+'px'; 		
elem.style.visibility='visible';
elem.style.display='block';
	}	
	
}
function hideBuyMessage()
{

   var ThisId='buymessage';
  if( document.getElementById ) 
  {
    elem = document.getElementById(ThisId);
  }
  else if( document.all ) 
  {
      elem = document.all[ThisId];
	}
 
	if (elem)
	{
elem.style.visibility='hidden';
elem.style.display='none';

	}	
}



function showZoomMessage(obj,id)
{
var pos=getPos(obj);
var pos_x=pos.x;
var pos_y=pos.y;

  var elem,div;
   var ThisId='zoommessage';
    var ThisDiv='small'+id;
  if( document.getElementById ) 
  {
    elem = document.getElementById(ThisId);
	 div = document.getElementById(ThisDiv);
  }
  else if( document.all ) 
  {
      elem = document.all[ThisId];
	  div = document.all[ThisDiv];
	}
	if (elem)
	{
elem.style.left=pos_x-50+'px';
elem.style.top=pos_y+10+'px'; 		
elem.style.visibility='visible';
elem.style.display='block';
	}	
	if (div)
	{
 
div.style.background='url("/ics/smallr.gif") top left no-repeat';
 
	}	
	/*'
 background-image:url("/ics/smallr.gif");
background-position:  top left;
background-repeat:no-repeat;
*/
}
function hideZoomMessage(id)
{
 var elem,div;
   var ThisId='zoommessage';
     var ThisDiv='small'+id;
  if( document.getElementById ) 
  {
    elem = document.getElementById(ThisId);
	 div = document.getElementById(ThisDiv);
  }
  else if( document.all ) 
  {
      elem = document.all[ThisId];
	  div = document.all[ThisDiv];
	}
 
	if (elem)
	{
elem.style.visibility='hidden';
elem.style.display='none';

	}	
	if (div)
	{

div.style.background='none	';
 
	}	
}



function ShowExtendedPanel()
{

  var elem, vis;
   var whichMenu='extpanel';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
HideHideButton();
elem.style.visibility='visible';
elem.style.display='block';
 
	}	
	
}
function HideExtendedPanel()
{

  var elem, vis;
      var whichMenu='extpanel';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.visibility='hidden';
elem.style.display='none';
ShowHideButton();
	}	
}

function ShowHideButton()
{

  var elem, vis;
   var whichMenu='butshow';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.visibility='visible';
elem.style.display='block';
 
	}	
	
}
function HideHideButton()
{

  var elem, vis;
      var whichMenu='butshow';
  if( document.getElementById ) // this is the way the standards work
  {
    elem = document.getElementById(whichMenu);
  }
  else if( document.all ) 
  {
      elem = document.all[whichMenu];
	}
	if (elem)
	{
elem.style.visibility='hidden';
elem.style.display='none';

	}	
}



