function fixPNG(element)
{
  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
  {
    var src;
	
    if (element.tagName=='IMG')
    {
      if (/\.png$/.test(element.src))
      {
        src = element.src;
        element.src = path+"/images/blank.gif";
      }
    }
    else
    {
      src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      if (src)
      {
        src = src[1];
        element.runtimeStyle.backgroundImage="none";
      }
    }
    if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
  }
}
function openw(res,title) {
   //rand=Math.random().toString().substring(2,15);
   //window.open(path + "/lib/show_pic.php?src="+res+"&title="+title, 'new_'+rand, "top=50, left=50, width=50, height=50, channelmode=no, toolbar=no, location=no, status=no, directories=no, menubar=no, resizable=yes, scroll=yes");
   window.open(path + "/lib/show_pic.php?src="+res+"&title="+title, 'picture', "top=50, left=50, width=720, height=590, channelmode=no, toolbar=no, location=no, status=no, directories=no, menubar=no, resizable=yes, scroll=yes");
}
function open_pic(res,title) {
   rand=Math.random().toString().substring(2,15);
   window.open(path + "/lib/show_pic.php?src="+res+"&title="+title, 'new_'+rand, "top=50, left=50, width=50, height=50, channelmode=no, toolbar=no, location=no, status=no, directories=no, menubar=no, resizable=yes, scrollbars=yes");
}
function gggg()
{
        var req = new JsHttpRequest();
        req.onreadystatechange = function() 
        {
           if (req.readyState == 4) {
        	  document.getElementById('order_div').innerHTML=req.responseText;
        	  if (req.responseJS.err != 1)
        	  {
        	  	  fio.value="";
        	  	  company.value="";
        	  	  phone.value="";
        	  	  email.value="";
        	  	  text.value="";
        	  }
           }
        }
        req.open(null, path+'/add_order.html', true);
        req.send( { fio: fio.value, company: company.value, phone: phone.value, email: email.value, text: text.value } );
}
function rand( min, max ) {
    if( max ) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    } else {
        return Math.floor(Math.random() * (min + 1));
    }
}
var quote_old = -1;
function QuoteChange(n) 
{
    QuoteIndex = rand(0,n-1);
    while (QuoteIndex == quote_old)
    {
    	QuoteIndex = rand(0,n-1);
    }
    quote_old = QuoteIndex;
    //document.getElementById('quotes').innerHTML="123";
    
    var req = new JsHttpRequest();
    req.onreadystatechange = function() 
    {
       if (req.readyState == 4) {
    	  if (req.responseJS.err != 1)
    	  {
    	  	  if (document.getElementById('quotes').style.display == "none")
    	  	  {
    	  	      document.getElementById('quotes').innerHTML=req.responseText;
    	  	      document.getElementById('quotes_extra').style.display="none";
    	  	      $("#quotes").fadeIn(1000);
    	  	  }
    	  	  else
    	  	  {
    	  	      document.getElementById('quotes_extra').innerHTML=req.responseText;
    	  	      document.getElementById('quotes').style.display="none";
    	  	      $("#quotes_extra").fadeIn(1000);
    	  	  }
    	  }
       }
    }
    req.open(null, path+'/change_quote.html', true);
    req.send( { num: QuoteIndex } );
    
    //document.getElementById("div_banners_"+type).innerHTML = document.getElementById(banners_index[BannerIndex]).innerHTML;
}

