function HideElement(obj) {
		obj.style.visibility="hidden";
		obj.style.display="none";
	}
function ShowElement(obj) {
		obj.style.visibility="visible";
		obj.style.display="block";
	}

function winopen(url,width,height) {
  var www = window.open(url, 'OzonInfo', 'resizable=yes,scrollbars=yes,menubar=yes,width='+width+',height='+height);
  www.focus();
};
function swapImages(img, fileSm, fileLg, widthSm, widthLg) {
  if (img.src.indexOf('/small/') > 0) {
    img.src = fileLg;
    img.width = widthLg;    
  } else {
    img.src = fileSm;
    img.width = widthSm;   
  };
  return false;
};
function getWindowWidth() {
  return (window.innerWidth)?window.innerWidth:((document.all)?document.body.clientWidth:800);
};
function swapPhotos(img, fileSm, fileLg) {
  if (img.src.indexOf('/small/') > 0) {
    img.src = fileLg;
  } else {
    img.src = fileSm;
  };
  return false; 
};
function showImage(name) {
  var inc_x = 12;
  var inc_y = 31;
  params = "top=50, left=200, width=600, height=500, Status=no, toolbar=no, menubar=no, location=no, directories=no, scrollbars=no";

  popupWin = window.open("", "OzonInfo", params);
  if (!popupWin.closed && popupWin.location!="about:blank") {
      popupWin = window.open("", "OzonInfoImage", params);  
  }

  popupWin.document.open();
  popupWin.status = "";
  popupWin.document.write("<html><head><title></title></head>");
  popupWin.document.write("<sc"+"ript language = JavaScript>");
  popupWin.document.write("function closeWindow(){");
  popupWin.document.write("parent.window.close() };");
  popupWin.document.write("</sc"+"ript>");
  popupWin.document.write("<body bgcolor='#C0C0C0' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' style='text-align: center;'><a href='' onClick='closeWindow()'><img src='"+name+"' alt='' border='0' onload='window.resizeTo(window.document.images[0].width+"+inc_x+",window.document.images[0].height+"+inc_y+");'></a></body></html>");
  popupWin.document.close();
  popupWin.focus();
};


function showInfo(id) {
    wi = window.open("/context/info/id/" + id + "/", "OzonInfo", "width=860,height=410,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,resizable=no")
    wi.focus();
  return false;
};
function showInfoA(id, anchor) {
  var url = "/context/info/id/"+id+"/";
  if (anchor.length > 0) {
    url = url + "#" + anchor;
  }
  wi = window.open(url,"OzonInfo","width=860,height=410,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,resizable=no")
  wi.focus();
  return false;
};
function getObj(name) {
  if (document.getElementById) {
    return document.getElementById(name);
  } else if (document.all) {
    return document.all[name];
  } else if (document.layers) {
    return document.layers[name];
  };
  return null;
};
function getWindowHeight() {
  if (document.compatMode && document.compatMode != 'BackCompat') {
    return document.documentElement.clientHeight;
  } else {
    return document.body.clientHeight;
  }
};
function getWindowScrollTop() {
  if (document.compatMode && document.compatMode != 'BackCompat') {
    return document.documentElement.scrollTop;
  } else {
    return document.body.scrollTop;
  }
};
function showListCode(listid) {
  var url = "/context/list_code/listid/"+listid+"/";
  wi = window.open(url,"OzonInfo","width=420,height=440,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,resizable=no")
  wi.focus();
  return false;
};
function showMovie(movie, name, width, height) {
  var inc_x = 12;
  var inc_y = 31;
  params = "top=50, left=200, width="+(parseInt(width)+inc_x)+", height="+(parseInt(height)+inc_y)+", status=no, toolbar=no, menubar=no, location=no, directories=no, scrollbars=no";
  www = window.open("","OzonInfo",params);
  www.document.open();
  www.document.write("<html><head>");
  www.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>");
  www.document.write("<link rel='Stylesheet' type='text/css' href='../styles/index.css' />");
  www.document.write("<title>"+name+"</title></head>");
  www.document.write("<body bgcolor='#C0C0C0' style='margin: 0px; text-align: center;'>"+
  "<embed src='"+movie+"' type='application/x-mplayer2' width='"+width+"' height='"+height+"'></embed><br />"+
  "<form class='vertpadd'><input type='button' value='Закрыть' onclick='window.close()' class='button'></form></body></html>");
  www.document.close();
  www.focus();
  return false;
};
function setCookie(cookieName, cookieContent, cookieExpireTime){
  if(cookieExpireTime > 0) {
    var expDate=new Date();
    expDate.setTime(expDate.getTime()+cookieExpireTime*3600000*24);
    var expires=expDate.toGMTString();
    document.cookie=cookieName+"="+escape(cookieContent)+"; path="+escape('/')+"; expires="+expires;
  } else {
    document.cookie=cookieName+"="+escape(cookieContent)+"; path="+escape('/')+"";
  };
};
function setCookieInHours(cookieName, cookieContent, cookieExpireTime) {
    if (cookieExpireTime > 0) {
        var expDate = new Date();
        expDate.setTime(expDate.getTime() + cookieExpireTime * 3600000);
        var expires = expDate.toGMTString();
        document.cookie = cookieName + "=" + escape(cookieContent) + "; path=" + escape('/') + "; expires=" + expires;
    } else {
        document.cookie = cookieName + "=" + escape(cookieContent) + "; path=" + escape('/') + "";
    };
};

function GetBrowserVer() {
	var ver = "";

    if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 3) 
		ver = "nn3"
	else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4) 
		ver = "nn4"
	else if (navigator.appName == "Microsoft Internet Explorer" 
				&& navigator.appVersion.substring(0,4) == 2.0)  
		ver = "ie3"	
	else if( (navigator.appName == "Microsoft Internet Explorer" 
				&& parseInt(navigator.appVersion) == 4)||((navigator.appName == "Opera")&&(parseInt(navigator.appVersion.substring(0,navigator.appVersion.indexOf(".")))>=8))) 
		ver = "ie4";
	return ver;
}

function AddQty(objId){
  var bv = GetBrowserVer();
		if (bv=="ie4"){
			var currQty = eval ( objId ).innerHTML;
			currQty++;
			eval ( objId ).innerHTML = currQty.toString();
		}

		if (bv=="nn4") {
			var clayer = eval( "document." + objId + ".document" );
			var currQty = clayer.read
			currQty++;
			clayer.write(currQty);
			clayer.close();
		}
}
function toCompare(id) {
	OzonCompare = window.open("/?context=compare&id="+id, "OzonCompare", "width=800,height=600,resizable=yes,directories=no,status=no,toolbar=no,menubar=0,location=no,scrollbars=yes");
	OzonCompare.focus()
	return false;
};
function setCookieForOmniture(cookieName, cookieValue) {
  setCookie(cookieName,cookieValue,-1);
};
function setMCH(value) {
  setCookie('oz_mch',value,-1);
};
function DisableTextBox(elemTextBoxId, idRadioButtonList, indexRadioButton,
	idValidatorLogin, idValidatorLoginList)
{	
	var idSingleRadioButton = idRadioButtonList +"_"+indexRadioButton;
	var elemRadio = document.getElementById(idSingleRadioButton);
	var elemTextBox = document.getElementById(elemTextBoxId);
	var validatorLogin = document.getElementById(idValidatorLogin);	
	var validatorLoginList = document.getElementById(idValidatorLoginList);
	if (elemRadio!=null && elemTextBox!=null && validatorLogin!=null && validatorLoginList !=null)
	{		
		if (elemRadio.checked)
		{
			elemTextBox.disabled = false;
			validatorLogin.enabled = true;
			validatorLoginList.enabled = true;
		}
		else
		{
			elemTextBox.disabled = true;
			validatorLogin.enabled = false;
			validatorLoginList.enabled = true;
		}
	}
};
function ValidateBirthday(source, args)
{
	args.IsValid=false;	
	if (dateElem!=null && monthElem!=null && yearElem!=null)
	{
		if ((dateElem.value==null || dateElem.value.length==0)
		&& (monthElem.value==null || monthElem.value=='0')
		&& (yearElem.value==null || yearElem.value.length==0))
		{
			args.IsValid=true;
			return;
		}
		if (dateElem.value!=null && dateElem.value.length>0
			&& monthElem.value!=null
			&& yearElem.value!=null && yearElem.value.length>0)
		{
			var day = parseInt(dateElem.value);
			var month = parseInt(monthElem.value);
			var year = parseInt(yearElem.value);
			if (day>0 && month>0 && year>minYear)
			{
				var dateBD = new Date(year, month-1, day);
				if (dateBD.getDate() == day && dateBD.getMonth() == (month-1) && dateBD.getFullYear() == year)
				{
					args.IsValid=true;
				}
			}
		}
	}
	else
	{
		args.IsValid=true;
	}
};
function SetTextIntoElem(elem, text)
{
	if (elem != null) 
	{
		var pText = parseFloat(text);
		if (!isNaN(pText) && pText != 0) 
		{
			text = pText.toFixed(2).replace(".", ",");
			var rExp00 = /,00/, rExp0 = /,\d0/;
			if (rExp00.test(text)) 
			{
				text = text.replace(",00", "");
			}
			if (rExp0.test(text)) 
			{
				text = text.substr(0, text.length - 1);
			}
		}
		if (elem.innerText != null) 
		{
			elem.innerText = text;
		}
		else if (elem.innerHTML != null) 
		{
			elem.innerHTML = text;
		}
	}
};
function ClickButton(buttonCLientID, buttonUniqueID)
{
	var buttonParam = document.getElementById(buttonCLientID);
	if (buttonParam!=null)
	{
		__doPostBack(buttonUniqueID,'');		
		buttonParam.className = "HiddenButton";
	}
}
function changeSelectionRadio(nameRadio, idText)
{
	var radioList = document.getElementsByName(nameRadio);
	var textBox = document.getElementById(idText);
	if (textBox!=null && radioList!=null && radioList.length>0)
	{
		var i =0;
		for (i=0; i<radioList.length;i++)
		{
			if (radioList[i].checked)
			{
				var value = parseInt(radioList[i].value);
				if (!isNaN(value))
				{
					if (value == 0)
					{
						textBox.readOnly = false;
						textBox.style.color = '';
					}
					else
					{
						textBox.readOnly = true;
						textBox.style.color = 'silver';
					}
				}
			}
		}
	}
}
function SetOmnitureCode (pageName, channel, prop1, hier2, events, products, eVar6, eVar14, eVar20, eVar2)
{	
	vars = new Object(); 
	if (pageName!=null)
	{
		vars.pageName = pageName;
	}   
	if (channel!=null)
	{
		vars.channel = channel;
	}
	if (prop1!=null)
	{
		vars.prop1 = prop1;
	}
	if (hier2!=null)
	{
		vars.hier2 = hier2;
	}
	if (events!=null)
	{
		vars.events = events;
	}
	if (products!=null)
	{
		vars.products = products;
	}
	if (eVar6!=null)
	{
		vars.eVar6=eVar6;    	
	}	
	if (eVar14!=null)
	{
		vars.eVar14=eVar14;    	
	}
	if (eVar20!=null)
	{
		vars.eVar20=eVar20;    	
	}
	if (eVar2!=null)
	{
		vars.eVar2=eVar2;    	
	}
	s.t(vars);
}