function on3(picture)   { document[picture].src = eval(picture + "on.src"); }
function off3(picture)  { document[picture].src = eval(picture + "off.src"); }

version = true;

function on(name)       { if (version) on3(name); }
function off(name)      { if (version) off3(name); }

function goTo(where) {
	 document.location.reload(where);
	 return false;
}

function votec(obj,p)
{
  if(document.getElementById)
  {
  for(i=1; i<=5; i++)
  {
  if(obj.value==i)
  document.getElementById('vote'+i).background=p+'i/voteon.gif';
  else document.getElementById('vote'+i).background=p+'i/vote.gif';
  }
  }
}

function popupWindow(goLocation,wname,wdth,hght,stl)
{
 var v=parseInt(navigator.appVersion);
 isNetscape=navigator.appName.indexOf('Netscape')>=0;
 isExplorer=navigator.appName.indexOf('Explorer')>=0;

 var ww = wdth;
 var wh = hght;
 var scrl;
 scrl=stl;

 if(scrl=='') scrl='0';

 positionCode='';
 if(v>=4)
 {
  if(isExplorer) positionCode='left='+(screen.width/2-ww/2)+',top='+(screen.height/2-wh/2)+',';
  if(isNetscape) positionCode='screenX='+(screen.width/2-ww/2)+',screenY='+(screen.height/2-wh/2)+',';
 }

 newWindow=window.open(goLocation,wname,
 'width='+ww+',height='+wh+','+
 positionCode+
 'location=0,'+
 'toolbar=0,'+
 'scrollbars='+scrl+','+
 'status=0,'+
 'resizable=1');
  if(v>=3) newWindow.focus();
  return newWindow;
}

function btnon(obj,val)
{
	obj.src=val;
}

function btnoff(obj,val)
{
	obj.src=val;
}

function votesubmit(id,p,razdel,pic,pics)
{
	pic.src=pics;

	var Collection;
	Collection=document.forms('votefrm').vote;

	for (i=0; i<Collection.length;i++) {
    if(Collection[i].checked)
    {
     popupWindow(p+'vote.php?id='+id+'&val='+(i+1)+'&razdel='+razdel,'vote','300','200','');
     return true;
    }
    }

    alert('Please choose an estimation!');
    return false;
}

function submcomment(pic,p,obj)
{
	pic.src=p;
	if(obj.nick.value=='')
	{
		alert('Please input name (nick) and comments!');
		return false;
	}
	return true;
}

function chamgearchivemonth(obj,id,lang,p)
{
	var urlval;
	if(obj.options[obj.selectedIndex].value!="")
	{
	urlval=p+'articles/'+document.forms('archivefrm').archy.options[document.forms('archivefrm').archy.selectedIndex].value+'-'+obj.options[obj.selectedIndex].value+'/'+lang+'/';
	if(id!='') urlval=urlval+id+'/';

	document.location.assign(urlval);
	}
}

function chamgearchivemonthpic(obj,id,p)
{
	var urlval;
	urlval=p+'pictures/'+document.forms('archivefrm').archy.options[document.forms('archivefrm').archy.selectedIndex].value+'-'+obj.options[obj.selectedIndex].value+'/';
	if(id!='') urlval=urlval+id+'/';

	document.location.assign(urlval);
}

function addarticle(pic,p,path,lang)
{
	pic.src=p;

    popupWindow(path+'article.php?lang='+lang,'addarticle','600','560','1');
	return true;
}

function senddata(pic,p,obj)
{
	pic.src=p;

   if(obj.titl.value=='' || obj.contents.innerText=='' || obj.author.value=='')
	{
		alert('Please input all the fields!');
		return false;
	}
	return true;
}

function addphoto(pic,p,path)
{
	pic.src=p;

    popupWindow(path+'gallery.php','addphoto','600','560','1');
	return true;
}

function sendphoto(pic,p,obj)
{
	pic.src=p;
	return true;
}