var IsIE = (window.navigator.appName.toLowerCase().indexOf('microsoft')!=-1)?true:false;
var IE_Ver = (window.navigator.appVersion.toLowerCase().indexOf('msie 7')!=-1)?7:6;
var RND=parseInt(Math.random()*100000);
var cat_cur_color="#CC0000";
var cat_cur_bgcolor="";

var pathID = new Array();


function keypress(event, obj)
{
	if((event.ctrlKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD)))
    {
		var str = getSelectionText();
		if (fr_bask!=null && str!='')
		{
			fr_bask.document.location="/error_send.aspx?url="+document.location+"&text="+str;
			document.getElementById("fr_bask_id").style.height="300px";
			document.getElementById("fr_bask_id").style.display="block";
		}
    }
}

function getSelectionText() {
	var str = "";
	if (document.getSelection) 
	{
		str = document.getSelection();
	} 
	else if (document.selection && document.selection.createRange) 
	{
		range = document.selection.createRange();
		str = range.text;
	} 
	return str;
}

/*
function set_radio(str,V){
var rez;
rez = str.substring(1,V);
	return rez;
	}
*/

function show_img(width,height,s_url){
	var imgnwin=window.open(s_url,"imgswin","resizable=yes,scrollbars=yes,toolbar=yes,location=no,directoties=no,status=no,menubar=no,width="+width+",height="+height);
}

function show_win(width,height,s_url){
	var p_top=(window.screen.height-height)/2, p_left=(window.screen.width-width)/2;
	var win=window.open(s_url,"imgswin","resizable=yes,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+width+",height="+height+",top="+p_top+",left="+p_left);
	win.focus();
}

function show_winName(width,height,s_url,winname){
	var p_top=(window.screen.height-height)/2, p_left=(window.screen.width-width)/2;
	var win=window.open(s_url,winname,"resizable=yes,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+width+",height="+height+",top="+p_top+",left="+p_left);
	win.focus();
}

var win_imggoods=null;
function show_goods_img(goods_name){
	var height=520, width=520;
	if (win_imggoods!=null) win_imggoods.close();
	if (ImgGoodsBig!='') {
		var p_top=(window.screen.height-height)/2, p_left=(window.screen.width-width)/2;	
		win_imggoods=window.open(null,"win_imggoods","resizable=yes,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width="+width+",height="+height+",top="+p_top+",left="+p_left);
		win_imggoods.focus();
		win_imggoods.document.open();
		win_imggoods.document.write('<html><head><title>Изображение '+goods_name+'</title></head><body style="padding:0px;margin:0px;text-align:center;vertical-align:center;"><img src="'+ImgGoodsBig+'" width=500/></body></html>');
	}
}

function goods_img_load(obj_img, type){
	if (obj_img!=null && obj_img.src!=null && obj_img.src=="") 
	{
		goods_img_set(obj_img, type);
	}
}

function goods_img_error(obj_img, type){
	if (obj_img!=null) 
	{
		goods_img_set(obj_img, type);
	}
}

function goods_img_set(obj_img, type){
	var img_rubric = document.getElementById("img_rub");
	
	if (img_rubric!=null && img_rubric.src!="" && img_rubric.src.indexOf("i/0.gif")==-1
		&& type!=1) 
		obj_img.src = img_rubric.src;
	else 
		obj_img.src="/linkpics/i/null.gif";
}

var ImgGoodsBig = '';
function set_img(id_src,img_url_small,img_url_big){
	var obj = document.getElementById(id_src);
	if (obj!=null && obj.src!=null && img_url_small!='') {
		obj.src=img_url_small;
	}
	if (img_url_big!='') { ImgGoodsBig = img_url_big; }
	else ImgGoodsBig = img_url_small;
}

function show_print(s_url){
	var height=520, width=520;
	if (win_imggoods!=null) win_imggoods.close();
	var p_top=(window.screen.height-height)/2, p_left=(window.screen.width-width)/2;
	win_imggoods = window.open(s_url, "win_imggoods", "resizable=yes,scrollbars=yes,toolbar=yes,location=no,directoties=no,status=no,menubar=no,width=" + width + ",height=" + height + ",top=" + p_top + ",left=" + p_left);
	win_imggoods.focus();
}


function active_win(surl){
	window.opener.document.location=surl;
}


function show_call_send() {
    var _fr_div = document.getElementById("fr_bask_id");
    var height = 220;
    var width = 400;
    if (fr_bask != null && _fr_div != null) {

        var p_top = (window.screen.height - height - 200) / 2;
        var p_left = (window.screen.width - width) / 2;

        _fr_div.setAttribute("className", "fr_call_send");
        _fr_div.className = "fr_call_send";
        if (!IsIE) _fr_div.style.top = p_top + "px";
        _fr_div.style.left = p_left;

        fr_bask.document.location = "/call_send.aspx?url=" + document.location;
        _fr_div.style.width = width + "px";
        _fr_div.style.height = height + "px";
        _fr_div.style.display = "block";
    }
}


function setBaskStyle() {
    var _fr_div = document.getElementById("fr_bask_id");
    var height = 140;
    var width = 400;
    if (fr_bask != null && _fr_div != null) {

        var p_top = (window.screen.height - height - 200) / 2;
        var p_left = (window.screen.width - width) / 2;

        _fr_div.setAttribute("className", "fr_call_send");
        _fr_div.className = "fr_call_send";
        if (!IsIE) _fr_div.style.top = p_top + "px";
        _fr_div.style.left = p_left;

        fr_bask.document.location = "/call_send.aspx?url=" + document.location;
        _fr_div.style.width = width + "px";
        _fr_div.style.height = height + "px";
        _fr_div.style.display = "block";
    }
}

function add_bask_img(idcat,idgoods,url){
	str_url="";
	if (url!=null) str_url=url;

	document.write("<a href='javascript:void(0);' onclick='setBaskStyle();fr_bask.document.location=\"" + str_url + "/basket_add.aspx?idc=" + idcat + "&idg=" + idgoods + "&c=addbask&ctype=showbask&r=" + RND + "\";document.getElementById(\"fr_bask_id\").style.display=\"block\";'><img src='/i/basket.gif' width=17 height=17 border=0 alt='в корзину' align='absmiddle' class='g_bask_img'></a>");
}

function add_bask_img2(idcat,idgoods,url,status){
	var str_url="";
	if (url!=null) str_url=url;
	var img_bask = "/i/basket_goods.gif";
	if (status!=null && status>-20) img_bask = "/i/buy_analog.gif";
	document.write("<a href='javascript:void(0);' onclick='fr_bask.document.location=\""+str_url+"/basket_add.aspx?idc="+idcat+"&idg="+idgoods+"&c=addbask&ctype=showbask&r="+RND+"\";document.getElementById(\"fr_bask_id\").style.display=\"block\";'><img src='"+img_bask+"' width=146 height=48 border=0 alt='в корзину' align='absmiddle' class='g_bask_img'></a>");
}

function add_bask_img_text(idcat,idgoods,url){
	document.write("<a href='javascript:void(0);' onclick='fr_bask.document.location=\"/basket_add.aspx?idc="+idcat+"&idg="+idgoods+"&c=addbask&ctype=showbask&r="+RND+"\";document.getElementById(\"fr_bask_id\").style.display=\"block\";' class=bask_img_text><img src='/i/bask_goods.gif' width=21 height=17 border=0 alt='в корзину' align='absmiddle' class='g_bask_img'> в корзину</a>");
}

function add_bask_text(idcat,idgoods,url){
	document.write("<a href='javascript:void(0);' onclick='fr_bask.document.location=\"/basket_add.aspx?idc="+idcat+"&idg="+idgoods+"&c=addbask&ctype=showbask&r="+RND+"\";document.getElementById(\"fr_bask_id\").style.display=\"block\";' class=bask_img_text>выбрать в заказ</a>");
}

function add_bask_text2(idcat,idgoods,url){
	var str_url="";
	if (url!=null) str_url=url;
	document.write("<a href='javascript:void(0);' onclick='fr_bask.document.location=\""+str_url+"/basket_add.aspx?idc="+idcat+"&idg="+idgoods+"&c=addbask&ctype=showbask&r="+RND+"\";document.getElementById(\"fr_bask_id\").style.display=\"block\";' class=bask_img_text>");
}


function set_selected(p,v){
	for (i=0; i < p.options.length; i++) {
		if (p.options[i].value==v) { p.options[i].selected=true; break; }
	}
}

function set_radio(p,v){
	for (i=0; i < p.length; i++) {
		if (p[i].value==v) { p[i].checked=true; break; }
	}
}

function set_checked(p,v){
	if (p.value==v) p.checked=true; 
}

function set_cat_class(cat_id, cat_level) {
    var obj = document.getElementById(cat_id);
    if (obj != null) {
        var className = "cat_" + cat_level + "_cur";
        obj.setAttribute("className", className);
        obj.className = className;
    }
}

function ShowAsDeleted(div_par)
{
    MakeBgColor4TagName("TR", div_par, "#AAAAAA");
    var obj=document.getElementById(div_par);
    var col=null;
    if (obj!=null)
    {  
		if (IsIE) col=obj.children;
		else col = obj.childNodes;
		for(var i=0; i<col.length; i++)
		{
    		if (col[i].tagName=="A")
    		{
                changeText(col[i], "Отображать на сайте");
                break;
    		}
		}
    }
}

function MakeBgColor4TagName(TagName, div_par, bgcl)
{
    var i=0;
	var obj=null;
    var obj1=document.getElementById(div_par);
    while (obj1!=null && i<10)
    {
		obj=obj1;
		//alert("1="+obj.tagName);
		obj.style.backgroundColor=bgcl;
		if (obj.tagName==TagName)
		{
			break;
		}
	    i++;
		if (IsIE) obj1=eval("obj.parentElement");
		else obj1=eval("obj.parentNode");
	}
}


function show_div(id_cur){
	var div_set=null;
	div_set=document.getElementById(id_cur);
	if (div_set!=null) {
		if (div_set.style.display=="block") div_set.style.display="none";
		else div_set.style.display="block";
	}
}

function show_divMODE(id_cur, mode){
	var div_set=null;
	div_set=document.getElementById(id_cur);
	if (div_set!=null)
		div_set.style.display=mode;
}


function show_cat(id_cur){
	var div_set = document.getElementById(id_cur);
	var obj_link = document.getElementById(id_cur+"_a");
	var obj_ico = document.getElementById(id_cur+"_ico");
	if (div_set!=null) {
		if (div_set.style.display=="block") {
			div_set.style.display="none";
			/*
			if ( obj_link!=null )
			{
				obj_link.setAttribute("className","cat0_off");
				obj_link.className = "cat0_off";
			}
			*/
			if (obj_ico!=null && obj_ico.src!=null)
			{
				obj_ico.src = "/i/ic_plus.gif"
			}
		}
		else {	
			div_set.style.display="block";
			/*
			if ( obj_link!=null )
			{
				obj_link.setAttribute("className","cat0_on");
				obj_link.className = "cat0_on";
			}
			*/
			if (obj_ico!=null && obj_ico.src!=null)
			{
				obj_ico.src = "/i/ic_minus.gif"
			}
		}
	}
	return false;
}


function show_parent_div(div_par){
    var IDParentElement="", NextParentElement="";
		var obj=null; 
		var obj1=document.getElementById(div_par);


		if (obj1 != null)
    {
			for(var i=0; i<10; i++) {
				obj=obj1;

				if (obj!=null) {
					if (obj.id!="" && obj.style.display!="block") {
						obj.style.display="block";
					}
					//if ( obj.id.indexOf('cat')!=-1 && cat_cur_bgcolor!="" ) obj.style.backgroundColor = cat_cur_bgcolor;
					if ( cat_cur_color!="" && document.getElementById(obj.id+'_a')!=null ) 
						document.getElementById(obj.id+'_a').style.color = cat_cur_color;
					obj_ico = null;
					if ( (obj_ico=document.getElementById(obj.id+'_ico'))!=null && obj_ico.src!=null ) 
						obj_ico.src = "/i/ic_minus.gif";

				}
				else break;
				if (IsIE) obj1=eval("obj.parentElement");
				else obj1=eval("obj.parentNode");
				//parentNode 
			}// end for
		}
		else {
			obj1=document.getElementById(div_par+'_a');
			if ( cat_cur_color!="" && obj1!=null ) obj1.style.color = cat_cur_color;
		}
}

CurCurse='1.0';


function normalize(price)
{	var pr, str;
	pr=parseInt(Math.round(price*100));
	str = new String(pr);
	pr="";
	if (str.length>2)
		pr += str.substring(0, str.length-2);
	else
		pr += "0";
	pr += ".";
	if (str.length>2)
		pr += str.substring(str.length-2, str.length);
	else
	{	if (str.length==1)
			pr += "0";
		pr += str;
	}
	return pr;
}

function price_alt(in_price,in_usd,in_rur){
	if (in_price=='' || (in_usd=='' && in_rur=='')) return;
	var normal_price=parseFloat("0"+in_price);
	if (in_usd!='') { document.write( normalize(normal_price*CurCurse)+" руб." ); return; } // если цена товара в USD, то пересчитаем в рублях и отобразим альтернативную цену
	if (in_rur!='') { document.write( normalize(normal_price/CurCurse)+" $" ); return; } // если цена товара в USD, то пересчитаем в рублях и отобразим альтернативную цену
}

function price_alt2(in_price){
CurValuteFlag='2'; // 0 - не установлен, 1-доллары, 2-рубли.
	var normal_price=parseFloat("0"+in_price);
	if (CurValuteFlag=='1') { document.write( normalize(normal_price*CurCurse)+" руб." ); return; } // если цена товара в USD, то пересчитаем в рублях и отобразим альтернативную цену
	if (CurValuteFlag=='2') { document.write( normalize(normal_price/CurCurse)+" $" ); return; } // если цена товара в USD, то пересчитаем в рублях и отобразим альтернативную цену
}

function ico_img(graph)
{
	if (graph == '/i/null.gif') document.write('<img src="/i/ico_noimg.gif" width=30 height=30 border=0 alt="Изображение отсутствует">');
	else if (graph == '/i/noimage.gif') document.write('<img src="/i/ico_noimg.gif" width=30 height=30 border=0 alt="Изображение отсутствует">');
	else document.write('<img src="/i/ico_img.gif" width=30 height=30 border=0 alt="Описание с изображением">')
}

function CreateCookie(name,value,ex_date){
	var today=new Date();
	today.setDate(today.getDate()+ex_date);
	document.cookie=name+"="+value+"; expires="+today.toGMTString()+"; path=/;";
}

function CreateTmpCookie(name,value){
	document.cookie=name+"="+value+"; path=/;";
}

function RemoveCookie(name){
	CreateCookie(name,"",-1);
}

function ViewCompare(idcat, idgoods){
	document.write("<a href='javascript:void(0);' onclick='retval=SetCompare("+idcat+","+idgoods+"); fr_bask.document.location=\"/compare_set.aspx?idc="+idcat+"&idg="+idgoods+"&r="+RND+"\"; if (retval) document.getElementById(\"fr_bask_id\").style.display=\"block\";'>К сравнению</a>");
}

function ViewCompare2(idcat, idgoods){
	document.write("<a href='javascript:void(0);' onclick='retval=SetCompare("+idcat+","+idgoods+"); fr_bask.document.location=\"/compare_set.aspx?idc="+idcat+"&idg="+idgoods+"&r="+RND+"\"; if (retval) document.getElementById(\"fr_bask_id\").style.display=\"block\";'>");
}

function ViewCompareCheck(idcat,idgoods, IsChecked){
	document.write("<input id='compare"+idgoods+"' name='compare"+idgoods+"' type='checkbox' "+IsChecked+" onclick='fr_bask.document.location=\"/compare_set.aspx?idc="+idcat+"&idg="+idgoods+"&r="+RND+"\"; if (this.checked) document.getElementById(\"fr_bask_id\").style.display=\"block\";'/>");
}




function SetCompare(idc, idg){
	obj_check = document.getElementById("compare"+idg);
	retVal = false;
	if (obj_check != null)
	{
		if (!obj_check.checked) obj_check.checked = true;
		else obj_check.checked = false;
		retVal = obj_check.checked;
	}
	return retVal;
}

function ClearCompare(idg){
	obj_check = document.getElementById("compare"+idg);
	if (obj_check != null) obj_check.checked = false;
}

function SpellCompare(obj){
	var str="";
	var start_IDG=0;
	var end_IDG=-1;
	var break_point=0;
	var flag;
	while (start_IDG!=-1){
		start_IDG=document.cookie.indexOf("idg",start_IDG);
		end_IDG=document.cookie.indexOf("=",start_IDG);
		if (start_IDG==-1 || end_IDG==-1) break;
		idg=unescape(document.cookie.substring(start_IDG+3,end_IDG));
		start_IDG=end_IDG;
		flag=false;
		//alert("idg="+idg+" , obj.idg.length="+obj.idg.length);
		if (isNaN(obj.idg.length)) { 
			if (obj.idg.value==idg) { obj.idg.checked=true; flag=true; }
		}
		else {
			for (i=0;i<obj.idg.length;i++) {
				if (obj.idg[i].value==idg) { obj.idg[i].checked=true; flag=true; break; }
			}
		}
		//alert("flag="+flag);
		if (!flag) { 
			//alert("!!! idg="+idg);
			str+="<input type=hidden name=idg value="+idg+">"
		}
		break_point++; if (break_point>10) break;
	}
	return str;
}

function SearchScroll(FileAction,pgsize,numpage,stype,str_url){
	var s1=new RegExp("pgsize=.&|pgsize=..&|pgsize=...&", "gi");
	var s2=new RegExp("page=.&|page=..&|page=...&", "gi");
	var s3=new RegExp("stype=.&|stype=..&|stype=...&", "gi");
	str_url=str_url.replace(s1,''); str_url=str_url.replace(s2,''); str_url=str_url.replace(s3,'');
	document.location = FileAction + '?c=search&pgsize='+pgsize + '&page='+numpage +'&stype='+stype + '&'+str_url;
}

function logoff(file_templ,idc,stype,page,idr,idt,idn){
	RemoveCookie("login");
	RemoveCookie("pass");
	RemoveCookie("userid");
	document.location='/'+ file_templ +'?idc='+idc +'&stype='+stype +'&page='+page +'&idr='+idr +'&idt='+idt +'&idn='+idn +'&r='+RND;
	//location.reload();
}

function set_url(str_url){
    if (str_url.indexOf("?")>0)
        parent.document.location=str_url+'&r='+RND;
	else
	    parent.document.location=str_url+'?r='+RND;
	return false;
}

function GetMianForm() {
	var theForm = document.forms['aspnetForm'];
	if (!theForm) {
			theForm = document.aspnetForm;
	}
	if (!theForm.onsubmit || (theForm.onsubmit() != false)) return theForm;
	else return null;
}

function SetAction(url) {
	var theForm = GetMianForm();
	if (theForm != null) {
	    theForm.action = url;
	    if (theForm.IsPostForm != null) theForm.IsPostForm.value = 1;
	    if (theForm.__VIEWSTATE != null) theForm.__VIEWSTATE.value = '';
	}
}
function PostBack(command, command_type) {
	var theForm = GetMianForm();
	if (theForm != null) {
			if (theForm.c!=null) theForm.c.value = command;
			if (theForm.ctype!=null) theForm.ctype.value = command_type;
			if (theForm.IsPostForm!=null) theForm.IsPostForm.value = 1;
			theForm.submit();
	}
	return false;
}


function g_sort(s_name_sort){
	var theForm = GetMianForm();
	if (theForm != null) {
			if (theForm.GoodsSort!=null) theForm.GoodsSort.value = s_name_sort;
			if (theForm.IsPostForm!=null) theForm.IsPostForm.value = 1;
			theForm.submit();
	}
	return false;
}

function g_scroll(pgn,IsPostForm){
	var theForm = GetMianForm();
	if (theForm != null) {
			if (theForm.pgn!=null) theForm.pgn.value = pgn;
			theForm.submit();
	}
	return (IsPostForm=="1")?false:true;
}

function changeText(el,text) {
	//alert(el.firstChild.nodeValue);
  //if (IsIE && IE_Ver<7) el.innerText=text;
	//else {
		if (el.firstChild) el.firstChild.nodeValue=text;
		else el.appendChild(document.createTextNode(text));
	//}
}

function search_action(){
	var theForm = GetMianForm();
	var search_info = document.getElementById("search_info");
	
	if (theForm != null && theForm.s_Word!=null && theForm.s_Word.value!='') {
			if (theForm.c!=null) theForm.c.value = "search";
			if (theForm.IsPostForm!=null) theForm.IsPostForm.value = 1;
			if (theForm.__VIEWSTATE!=null) theForm.__VIEWSTATE.value = '';
			theForm.action='/search.aspx';
			if (search_info!=null) search_info.style.display="block";
			theForm.submit();
	}
	return false;
}

function search_keypress(event)
{
	if((event.keyCode == 0xA)||(event.keyCode == 0xD))
    {
		search_action();
    }
}


function set_message(id_div,text){
	var obj = document.getElementById(id_div);
	if (obj!=null) changeText(obj,text);
}

function CheckPayCondition(obj_Paymode, BasketSummUSD, BasketSumRUR){
	var PayConditionCreditPersonal = document.getElementById("PayConditionCreditPersonal");
	var PayConditionCreditOrg = document.getElementById("PayConditionCreditOrg");

	if (obj_Paymode!=null && PayConditionCreditPersonal!=null && PayConditionCreditOrg!=null) {
		PayConditionCreditOrg.style.display="none";
		PayConditionCreditPersonal.style.display="none";
		if (obj_Paymode.value==300 && BasketSummRUR<3000){
			PayConditionCreditPersonal.style.display="block";
		}
		else if (obj_Paymode.value==400 && BasketSummUSD<5000){
			PayConditionCreditOrg.style.display="block";
		}
	}
}

function mySelect(fileName, ObjectID2Paste, winName){
	var obj = document.getElementById(ObjectID2Paste);
	if (obj==null)
    {   
        alert("Не удается найти объект " + ObjectID2Paste);
        return false;
    }
    show_winName(800, 600, fileName + "?id=" + ObjectID2Paste, winName);
}

// функция для просмотра картинки в отдельном окне
function viewimageJS(myfile, mydirect, mypath)
{	var tmp, i;
	myfile = new String(myfile);
	if (myfile!="")
	{	if ((myfile.substring(0,7)!="http://") && (mydirect==0)) // относительная адресация
		{	tmp = new String(mypath);
			i = tmp.lastIndexOf("/");
			if (i>-1)
				tmp = tmp.substring(0, i-1);
			else
				tmp = "";
			if (tmp.substring(0, 1)=="/")
				myfile = "http://" + tmp.substring(0, tmp.lastIndexOf("/")-1) + myfile;
			else
				myfile = "http://" + tmp.substring(0, tmp.lastIndexOf("/")) + myfile;
		}
		alert(myfile);
		var iwin = window.open(myfile, "iwin", "resizable=yes,scrollbars=yes,toolbar=no,location=no,directoties=no,status=no,menubar=no,width=400,height=400");
		if (iwin!=null)
			iwin.focus();
	}
}

var row=1;
function s_tr(){if (row==1) { document.write("<tr bgcolor=#EDF1F6>"); row=2; } else { document.write("<tr>"); row=1; }}

var cols=1;
function s_cols_1(num_cols){//start
	if (cols > num_cols) cols=1;
	if (cols==1) { document.write("<tr><td width="+(100/num_cols)+"%  style='padding-right:10;'>"); } 
	else { document.write("<td style='padding-left:20;'>"); }
}
function s_cols_2(num_cols){//end
	if ( cols==num_cols ) { document.write("</td></tr>"); } 
	else { document.write("</td>"); }
	cols++;
}
function s_cols_final(num_cols){//end
	if (cols<=num_cols) {
		for (i=cols; i<=num_cols; i++) {
			document.write("<td width="+(100/num_cols)+"%>&nbsp;</td>");
		}// end for
		document.write("</tr>");
	}// end if
}


function spec_ico(SpecID, RubricID, GoodsID) {
    if (SpecID != 0)
        document.write("<div style=\"position:relative; float:left;\"><a href=\"/vcd-" + RubricID + "-1-" + GoodsID + "/goodsinfo.html\"><img src=\"/i/spec_" + SpecID + ".png\" width=\"156\" height=\"122\" alt=\"Лучшая цена\" style=\"position:absolute; top:30px; left:0px;\" class=\"iePNG\" onerror=\"this.src='/i/0.gif'\" border=\"0\"/></a></div>");
}

function fixPNG(element) {
    //Если браузер IE версии 5.5-6
    if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
        var src;

        if (element.tagName == 'IMG') //Если текущий элемент картинка (тэг IMG)
        {
            if (/\.png$/.test(element.src)) //Если файл картинки имеет расширение PNG
            {
                src = element.src;
                element.src = "/i/0.gif"; //заменяем изображение прозрачным gif-ом
            }
        }
        else //иначе, если это не картинка а другой элемент
        {
            //если у элемента задана фоновая картинка, то присваеваем значение свойства background-шmage переменной src
            src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
            if (src) {
                src = src[1]; //берем из значения свойства background-шmage только адрес картинки
                element.runtimeStyle.backgroundImage = "none"; //убираем фоновое изображение
            }
        }
        //если, src не пуст, то нужно загрузить изображение с помощью фильтра AlphaImageLoader
        if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
  }
}
