
function GoTab(div) {
  for (var i = 1; (DivObject = document.getElementsByTagName("div").item(i-1)); i++) { 
    if (DivObject.id == 'Panel'+i) {
      if (i == div) {
        getobject('Panel'+div).style.display = 'block';
        getobject('Tab'+i).className = 'Active';
      } else {
        DivObject.style.display = 'none';
        getobject('Tab'+i).className = 'NotActive';
      }
    }
  } 
}

function getobject(obj){
  if (document.getElementById)
    return document.getElementById(obj)
  else if (document.all)
    return document.all[obj]
}


function alertPopUp (title, content, hebrew) {
var buttonTitle = (hebrew == 1) ? 'свеш' : 'Закрыть'; 
alertpu = $('<div id="alertPopUp"><div id="popTop"><table cellspacing="2" cellpadding="4" class="alertTable"><tr><td class="category"><table cellspacing="0" cellpadding="0" width="100%"><tr><td id="alertTitle" class="category0">' + title + '</td></tr></table></td></tr><tr><td class="alertMainTd">' + content + '<br/><br/><input value="' + buttonTitle + '" class="search close" type="button"/></td></tr></table></div><div id="popBottom"></div></div>').appendTo('body');
$("#alertPopUp").css("top", document.body.scrollTop + (window.size().height / 2 - $("#alertPopUp").height()/2));
$("#alertPopUp").css("left", window.size().width / 2 - $("#alertPopUp").width()/2);
$(window).resize(function() {alertPos();});
$(window).scroll(function() {alertPos();});
$(".close").click(function(){ $("#alertPopUp").remove(); });
}

window.size = function() {
	var w = 0;
	var h = 0;
	if(!window.innerWidth) {
		if(!(document.documentElement.clientWidth == 0)) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		} else {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	} else {
		w = window.innerWidth;
		h = window.innerHeight;
	}
	return {width:w, height:h};
}

function alertPos() {
$("#alertPopUp").css("top", document.body.scrollTop + (window.size().height / 2 - $("#alertPopUp").height()/2));
$("#alertPopUp").css("left", window.size().width / 2 - $("#alertPopUp").width()/2);
}

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 = "/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='crop')";
  }
}
