  toImage = null;
  function ShowImage(image_name)
  {
    removeImage();
    var href = document.createElement("a");
    href.setAttribute("href","javascript:removeImage();");

    var img = document.createElement("img");
    img.setAttribute("src","base/images/"+image_name+".jpg");
    img.setAttribute("style","vertical-align:middle;width:300px;height:300px;");
    img.setAttribute("border","0");
	  img.setAttribute('onclick', 'removeImage();');

    var text = document.createTextNode('"Клик" на картинке, чтобы закрыть это окно');
	  var elem = document.createElement('div');
	  elem.setAttribute("align","center");
	  elem.setAttribute('id', 'showimg');
	  elem.setAttribute('width', '300');
	  elem.setAttribute('height', '300');
	  elem.setAttribute('onclick', 'removeImage();');
	  elem.setAttribute("style","vertical-align:middle;width:320px;height:340px;");
	  elem.appendChild(href);
	  href.appendChild(img);
	  var brr = document.createElement("p");
	  elem.appendChild(brr);
	  elem.appendChild(text);
	  document.getElementsByTagName('body')[0].appendChild(elem);
	  toImage = elem;
  }

  function removeImage()
  {
	  if (toImage)
	  {
		  document.getElementsByTagName('body')[0].removeChild(toImage);
		  toImage = null;
	  }
  }

  function selectTovarSort(val){
    var objSelNum = document.forms["FormSelects"].elements["SNum"];
    var objSelSort = document.forms["FormSelects"].elements["SSort"];
    location.href='index.php?'+val+'&SNum='+objSelNum.selectedIndex+'&SSort='+objSelSort.selectedIndex;
  }
  
  function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }
  function doDefault(theText) { if (theText.value == "") { theText.value = theText.defaultValue } }

