function ge()
{
  var ea;
  for( var i = 0; i < arguments.length; i++ ) {
    var e = arguments[i];
    if( typeof e == 'string' )
      e = document.getElementById(e);
    if( arguments.length == 1 )
      return e;
    if( !ea )
      ea = new Array();
    ea[ea.length] = e;
  }
  return ea;
}

function photoloaded(im){
   var obj = document.getElementById('photo_img');
   im.onmousemove = overphotomove;
   if (im.width < 724 && im.width > 10){   	  var k16 = im.width + 16;
   	  var k32 = im.width + 32;
      document.getElementById('photo_img_outer').style.width = '' + k16 + 'px';
      document.getElementById('photo_img_outer_outer').style.width = '' + k32 + 'px';
   	  }
   obj.style.width = '' + im.width + 'px';
}

function overphotomove(e){	e = (e) ? e : ((window.event) ? event : null );
	w = (e.target) ? e.target.width : e.srcElement.width;
	x = (e.layerX) ? e.layerX : e.x;
	x = x * 100 / w;
	if (x>30 && gomode != 1 && nextHREF != ''){		gomode = 1;
		showObj('go_next');
		hideObj('go_prev');
		document.getElementById('photolink').href=nextHREF;		}
	if (x<=30 && gomode != 2 && prevHREF != ''){
		gomode = 2;
		showObj('go_prev');
		hideObj('go_next');
		document.getElementById('photolink').href=prevHREF;
		}
}

function toggle(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   if (visible) {
     obj.style.display="none";
   } else {
     obj.style.display="block";
   }
}

function hideObj(item) {
    document.getElementById(item).style.display="none";
}

function showObj(item) {
    document.getElementById(item).style.display="block";
}

function fixPNG(element)
{
  //Если IE версии 5.5-6
  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 = "/i/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 dateboxchange(box_prefix)
{    var weekdaybox = document.getElementById('weekdaybox');
	d = document.getElementById(box_prefix + 'day').value;
	m = document.getElementById(box_prefix + 'month').value;
	y = document.getElementById(box_prefix + 'year').value;

	var curdate = new Date(y,m,d);
	weekdaybox.innerHTML = '' + curdate.getFullDay();
}

Date.prototype.DAYNAMES = ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"];
Date.prototype.getFullDay = function() {
  return this.DAYNAMES[this.getDay()];
};
Date.prototype.lastday = function() {
  var d = new Date(this.getFullYear(), this.getMonth() + 1, 0);
  return d.getDate();
};
