function openw(str,x,y)
  {
  str3="scrollbars=yes,status=no,resizable=yes,width="+x+",height="+y+",left="+(screen.availWidth-x)/2+",top="
  +(screen.availHeight-y)/2;
  open(str, "_blank", str3, true);
  }

function window_big(str,x,y)
  {
  if(y < (screen.availHeight - 20) )str3="scrollbars=no,status=no,resizable=yes,width="+x+",height="+y+",left="+(screen.availWidth-x)/2+",top="+(screen.availHeight-y)/2;
  else str3="scrollbars= yes,width="+ (x + 20) +",height="+ (screen.availHeight - 50)  +",left="+(screen.availWidth-x)/2+",top= 10";
  newWindow = window.open("","newWindow",str3);
  newWindow.document.open();
  newWindow.document.write('<html><title>Èçîáðàæåíèå.</title> <body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"  onBlur="self.close()" onClick="self.close()">');
  newWindow.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="100%"><tr><td>');
  newWindow.document.write('<img src="'+str+'" width="'+x+'" height="'+y+'" alt="ÇÀÊÐÛÒÜ" >'); 
  newWindow.document.write('</td></tr></table></body></html>');
  newWindow.document.close();
  newWindow.focus();
  }

function dynamicSelect(id1, id2) {
 if (document.getElementById && document.getElementsByTagName) {
  var sel1 = document.getElementById(id1);
  var sel2 = document.getElementById(id2);
  var clone = sel2.cloneNode(true);
  var clonedOptions = clone.getElementsByTagName("option");
  refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
  sel1.onchange = function() {
  refreshDynamicSelectOptions(sel1, sel2, clonedOptions);
  }
 }
}

function refreshDynamicSelectOptions(sel1, sel2, clonedOptions) {
 while (sel2.options.length) {
  sel2.remove(0);
 }
 var pattern1 = /( |^)(select)( |$)/;
 var pattern2 = new RegExp("( |^)(" + sel1.options[sel1.selectedIndex].value + ")( |$)");
 for (var i = 0; i < clonedOptions.length; i++) {
  if (clonedOptions[i].className.match(pattern1) ||
  clonedOptions[i].className.match(pattern2)) {
   sel2.appendChild(clonedOptions[i].cloneNode(true));
  }
 }
}