function checkIsCode(){
 var txt=document.getElementById('search').value;
  if(txt=='Введите искомый товар'){
    alert('Не указано выражение для поиска');
    return false;
  }
  if(txt==parseInt(txt)){
   if (!confirm("Для поиска по названию введено число. \n\nОК - Выполнить поиск по коду товара\n\nОтмена - поиск по названию")) { 
     return true;
   }
   document.location='/catalog/?search2='+txt;
   return false;
 }
 return true;
}

function ShortWindow(x,ww,wh){
  var sc="yes";
  if(x.substr(1,5)=="photo") sc="no";
  var l=(screen.width-ww)/2;
  var h=(screen.height-wh)/2;
  var a=window.open(x,"smallwindow","left="+l+",width="+ww+", height="+wh+",top="+h+", status=no, toolbar=no, menubar=no, resizable=yes, scrollbars="+sc);
  a.focus();
  return false;
}

function ChangeForPage(x){
 var p=x.value;
 var expiresDate = new Date(); 
 expiresDate.setTime(expiresDate.getTime() + 365 * 24 * 60 * 60 * 1000); // срок - 1 год, но его можно изменить 
 var expires = expiresDate.toGMTString();

 document.cookie="forPageCount="+p+";path=/; expires=" + expires;
 var loc=document.location.href;
 var re=/page\d+.htm/;
 var loc2=loc.replace(re,"page1.htm");
 var re2=/page=\d+$/;
 loc2=loc2.replace(re2,"page=1");

 setTimeout("document.location.href='"+loc2+"'",500);

 return false;
}

function hideshow(num) {
  var el = document.all['menu' + num];
  if (el.style.display == 'none') {
    el.style.display = '';
  } else {
    el.style.display = 'none';
  }
}

function fixPNG(myImage) {
if ((version >= 5.5) && (version < 7) && (document.body.filters)) {
var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' "
var imgStyle = "display:inline-block;" + myImage.style.cssText
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
myImage.outerHTML = strNewHTML	}
}

function AddCompare(x,y){
 $("#cmpr"+x).html("<img src='/images/ajax-loader.gif' width=19 height=19>");
 $("#cmpr"+x).load("/cmpradd.php?add="+x+"&s="+y);
}
