function emptyFormElements(theForm, theFieldName)
  {
      var isEmpty  = 1;
      var theField = theForm.elements[theFieldName];
    	var isRegExp = (typeof(theField.value.replace) != 'undefined');
      if (!isRegExp) {
          isEmpty      = (theField.value == '') ? 1 : 0;
      } 
      else 
      {
          var space_re = new RegExp('\\s+');
          if(theField.value == '0')
          {
            isEmpty = 1;
          }
          else
            if(theField.value == '0,00')
              isEmpty = 1;
            else
              if(theField.value == '0,0')
                isEmpty = 1;
              else
                if(theField.value == '0.00')
                  isEmpty = 1;
                else
                  if(theField.value == '0.0')
                    isEmpty = 1;
                  else
                    if(theField.value.replace(space_re, '') == '')
                      isEmpty = 1;
                    else
                      isEmpty = 0;
      }
      if (isEmpty)
      {
        alert('Пожалуйста заполните обязательные поля!');
        theField.focus();
				return false;
      }

      return true;
  }

function poll_results(id,action)
{
	winWidth=400;
	winHeight=350;
	winName='Poll';
	theURL='poll.php';
	features='toolbar=no,scrollbars=yes';
	var w = (screen.width - winWidth)/2;
	var h = (screen.height - winHeight)/2 - 20;
	features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
	var poll_ident = self.document.forms["poll"+id].poll_ident.value;
	option_id = '';
	for (i=0; i<self.document.forms["poll"+id].option_id.length; i++)
	{
		if(self.document.forms["poll"+id].option_id[i].checked == true)
		{
			option_id = self.document.forms["poll"+id].option_id[i].value;
			break;
		}
	}
	option_id = (option_id != '') ? '&option_id='+option_id : '';
	if (action=='results' || (option_id != '' && action=='vote'))
	{
		theURL = theURL+'?action='+action+'&poll_id='+poll_ident+option_id;
		poll_popup = window.open(theURL,winName,features);
		poll_popup.focus();
	}
	return false;
}

function showimg(img)
{
	window.open("image.php?img=" + img , "photo", "top=0, left=0, width=840, height=640, toolbar=no, menubar=no, location=no, scrollbars=0, statusbar=0, resizable=1");
}

function showctgimg(img,ttl,height)
{
	document.getElementById('ctgimg').src=img;
	if(ie)
	{
		while(document.getElementById('ctgimg').src.indexOf(img)<0);
		alignctgimg(height);
	}
}

function alignctgimg(height)
{
	if(height)
		document.getElementById('galimg').style.height=(height+19)+'px';
	else
		document.getElementById('galimg').style.height=(document.getElementById('ctgimg').height+19)+'px';
}


