function highlight(aa, bb){aa.style.backgroundColor=bb;aa.style.color='#000000';}function unhighlight(aa, bb){aa.style.backgroundColor=bb;aa.style.color='#000000';}
function submit_form(val){val.submit();}

function resizeFoto2(id){
 width_arr = new Array('80', '550');
  srcarr = document.getElementById(id).src.split('\.');
  srcsm=srcarr[srcarr.length-2].split('_sm');
  if (srcsm[1]=='80'){srcsm[1]='550';document.getElementById(id).title="уменьшить";}else{srcsm[1]='80';document.getElementById(id).title="увеличить";}
  srcarr[srcarr.length-2]=srcsm.join('_sm');
  src=srcarr.join('\.');document.getElementById(id).src=src;
}
function resizeFoto3(id){
 width_arr = new Array('80', '350');
  srcarr = document.getElementById(id).src.split('\.');
  srcsm=srcarr[srcarr.length-2].split('_sm');
  if (srcsm[1]=='80'){srcsm[1]='350';document.getElementById(id).title="уменьшить";}else{srcsm[1]='80';document.getElementById(id).title="увеличить";}
  srcarr[srcarr.length-2]=srcsm.join('_sm');
  src=srcarr.join('\.');document.getElementById(id).src=src;
}

function Menu(by){by_array = new Array('by_room', 'by_item', 'by_collection', '', '');array_by = new Array('room_by', 'item_by', 'collection_by', '', '');document.getElementById(by_array[by]).style.display = '';document.getElementById(array_by[by]).style.width = '140px';document.getElementById(array_by[by]).style.backgroundColor='#ffffff';i=0;while(i!=by_array.length){if (i!=by && by_array[i]!=''){document.getElementById(by_array[i]).style.display = 'none';document.getElementById(array_by[i]).style.width = '150px';document.getElementById(array_by[i]).style.backgroundColor='#E0E0E0';}i++;}reposdivs();}
function Showinfo(id, show_id){document.getElementById(id).style.display=''; document.getElementById(show_id).style.display='none'; reposdivs(); return false;}
function PutProgramFoto(pr_id){document.getElementById('pr_foto_'+pr_id).innerHTML='&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<font color=green>Подождите, идет загрузка фотографий...</font><br><br>';var myConn = new XHConn();var fnWhenDone = function(oXML) {document.getElementById('pr_foto_'+pr_id).innerHTML = oXML.responseText;reposdivs();};myConn.connect("/inc/program_review_foto.php", "POST", "pr_id="+pr_id, fnWhenDone);return false;}
function PutGoodsVideo(video_id){document.getElementById('goods_video_'+video_id).innerHTML='&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<font color=green>Подождите, идет загрузка видео...</font><br><br>';var myConn = new XHConn();var fnWhenDone = function(oXML) {document.getElementById('goods_video_'+video_id).innerHTML = oXML.responseText;reposdivs()};myConn.connect("/inc/see_goods_video.php", "POST", "id="+video_id, fnWhenDone);return false;}
function reposdivs() {
  
  document.getElementById("Colleft").style.top = document.getElementById("Shapka").offsetHeight;
  document.getElementById("Hormenu").style.top = document.getElementById("Shapka").offsetHeight;
  document.getElementById("Colcenter").style.top = document.getElementById("Shapka").offsetHeight+document.getElementById("Hormenu").offsetHeight;
  document.getElementById("Colleftad").style.top = document.getElementById("Shapka").offsetHeight+document.getElementById("Colleft").offsetHeight;
 
    document.getElementById("Leftfiller").style.top = document.getElementById("Shapka").offsetHeight+document.getElementById("Colleft").offsetHeight+document.getElementById("Colleftad").offsetHeight;
    
     document.getElementById("Fillertable").style.height = Math.max(document.getElementById("Shapka").offsetHeight+document.getElementById("Colleft").offsetHeight+document.getElementById("Colleftad").offsetHeight, document.getElementById("Shapka").offsetHeight+document.getElementById("Hormenu").offsetHeight+document.getElementById("Colcenter").offsetHeight)-(document.getElementById("Shapka").offsetHeight+document.getElementById("Colleft").offsetHeight+document.getElementById("Colleftad").offsetHeight);
    
    document.getElementById("Footer").style.top = Math.max(document.getElementById("Shapka").offsetHeight+document.getElementById("Colleft").offsetHeight+document.getElementById("Colleftad").offsetHeight, document.getElementById("Shapka").offsetHeight+document.getElementById("Hormenu").offsetHeight+document.getElementById("Colcenter").offsetHeight);
}

function resizeFoto85(id, type, goods_id){
 width_arr = new Array('175', 350, 550, 900);
  srcext = document.getElementById('g_img_'+id).src.split('\.');
  x=0;
while(x!=4){
  if (document.getElementById('zoom_'+id+'_'+x).checked==true){
     if (type==1){
    document.getElementById('zoom_'+id+'_'+x).checked=false;
    if(x>=2){x=0;}
    else{x++;}
    document.getElementById('zoom_'+id+'_'+x).checked=true;
  }
    src = document.getElementById('g_img_'+id).src.split('_sm');
    src[src.length-1] = width_arr[x]+'.'+srcext[srcext.length-1];
    src = src.join('_sm');document.getElementById('g_img_'+id).src=src;
    if (width_arr[x]=='175'){document.getElementById('sp0'+id).innerHTML='';document.getElementById('sp1'+id).innerHTML='';}else{document.getElementById('sp0'+id).innerHTML='<br clear=all>';document.getElementById('sp1'+id).innerHTML='<br clear=all>';}
    break;
}
  x++;
}
if (goods_id != "0"){
  document.getElementById('good'+goods_id).src='/inc/popular_stat.php?goods_id='+goods_id;
  document.getElementById('goodd'+goods_id).src='/inc/popular_stat1.php?rand='+Math.random()+'&goods_id='+goods_id;
  }
}

function PutGoods(g_i, pcount, id, clr){
imgload=1;
var p_src='/inc/imgicon.php?rand='+Math.random()+
'&func=buy&buy_id='+id;
 i=0;
 i1=1;
  while (i!=pcount){
    if (document.getElementById('quantity_'+g_i+'_'+i)){
    p_src=p_src+'&quant'+i1+'='+document.getElementById('quantity_'+g_i+'_'+i).value;
    document.getElementById('quantity_'+g_i+'_'+i).disabled=true;
    if(document.getElementById('check_'+g_i+'_'+i).checked){
	  p_src=p_src+'&opt'+i1+'=1';
	}
	document.getElementById('check_'+g_i+'_'+i).disabled=true;}
	else {pcount++;}
   i++;
    i1++;
}
if (clr!='' && clr>0){
  i=0;
  while (i!=clr){
    if (document.getElementById('color_'+g_i+'_'+i)){
      if (document.getElementById('color_'+g_i+'_'+i).checked==true){
      p_src=p_src+'&calor='+document.getElementById('color_'+g_i+'_'+i).value;}
    document.getElementById('color_'+g_i+'_'+i).disabled=true;}
	else {clr++;}
    i++;
}
}
document.getElementById('put_'+g_i).src=p_src;
document.getElementById('submit_'+g_i).value='Помещено в корзину';
document.getElementById('submit_'+g_i).disabled=true;
document.getElementById('submit_out_'+g_i).disabled=false;
alert('Товар "'+g_n[g_i]+'" помещен в корзину! Состояние Вашей корзины вы можете узнать в верхней левой части сайта. В случае, если Ваша корзина остается пустой, это означает, что у Вас отключены cookies.');
//document.getElementById('good'+id).src='/inc/popular_stat.php?rand='+Math.random()+'&goods_id='+id;
  return false;
}
function AwayGoods(g_i, pcount, id, clr){
imgload=1;
var a_src='/inc/imgicon.php?rand='+Math.random()+
'&func=kor&kor_id='+id+'&kor_act=Убрать';
document.getElementById('put_'+g_i).src=a_src;
document.getElementById('submit_'+g_i).value='Поместить отмеченное в корзину';
document.getElementById('submit_'+g_i).disabled=false;
document.getElementById('submit_out_'+g_i).disabled=true;
i=0;
  while (i!=pcount){
    if (document.getElementById('quantity_'+g_i+'_'+i)){
    document.getElementById('quantity_'+g_i+'_'+i).disabled=false;
	document.getElementById('check_'+g_i+'_'+i).disabled=false;}
	else {pcount++;}
    i++;
}
alert('Товар "'+g_n[g_i]+'" убран из корзины! Состояние Вашей корзины вы можете узнать в верхней левой части сайта. В случае, если Ваша корзина остается пустой, это означает, что у Вас отключены cookies.');
if (clr!='' && clr>0){
  i=0;
  while (i!=clr){
    if (document.getElementById('color_'+g_i+'_'+i)){
    document.getElementById('color_'+g_i+'_'+i).disabled=false;}
	else {clr++;}
    i++;
}
}
  return false;
}
function RefreshKor(){
  if (imgload==1){
 document.getElementById('kor_state').innerHTML='<font color="565656">Данные обновляются...</font><br><br>';var myConn = new XHConn();var fnWhenDone = function(oXML) {document.getElementById('kor_state').innerHTML = oXML.responseText;reposdivs(); return false;};myConn.connect("/inc/kor_left_refresh.php", "POST", "", fnWhenDone);}
}