/* JavaScript Document 2007 BistroAvto.ru. All Right Reserved | Professional Web Site Design By http://mediadoors.ru */

var img_cache = new Object();

function parse_images() {
	if (document.getElementById) {
		var ar = document.getElementsByTagName('img');
		for( var x = 0; ar[x]; x++ ) {
			var im = ar[x];
			if(im.getAttribute) { 
				im.hover_src = im.getAttribute('hover_src');
			}
			if(im.hover_src) {
				im.rootsrc = im.src;				
				im.onmouseout = function () {
					this.src = this.rootsrc;
				}
				
				if(!img_cache[im.hover_src]) {
					img_cache[im.hover_src] = new Image();
					img_cache[im.hover_src].src = im.hover_src;
				}

				im.onmouseover = function () {			
					this.src = this.hover_src;								
				}
			}
		}
	}
}

function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
	return true;
	}
}


function SubmitItem(pid) {
	document.getElementById(pid).submit();
}

function SubmitForm(id) {
	document.getElementById(id).submit();
}

function SelectColor(id) {
	document.getElementById(id).className = 'tr_skyblue';
}
function ReturnColor(id) {
	document.getElementById(id).className = '';
}


/*

var isIE = (document.all) ? 1 : 0;

function keyFilter(e, strPattern)
{
   var chr = (isIE) ? e.keyCode : e.which;
   var ch = String.fromCharCode(chr);

   if (chr != 13 && chr != 8 && chr != 0)
   {
      var re = new RegExp(strPattern);

      if (ch.search(re) == -1)
      {
         if(isIE)
          e.returnValue = false;
         else
          e.preventDefault();
      }
   }
}

*/