function getElementsByClass(searchClass,node,tag) {
 var classElements = new Array();
 if ( node == null )
  node = document;
 if ( tag == null )
  tag = '*';
 var els = node.getElementsByTagName(tag);
 var elsLen = els.length;

 var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
 for (i = 0, j = 0; i < elsLen; i++) {
   if ( pattern.test(els[i].className) ) {
   classElements[j] = els[i];
   j++;
  }
 }
 return classElements;
}

function show_sex() {
	if(document.getElementById('in_sex').style.display == 'block') document.getElementById('in_sex').style.display = 'none';
	else 
	{
		for(i=0; i < item.length; i++) item[i].className = 'item_sex';
		switch (document.f.sex.value) {
		case '0': item[1].className = 'item_sex_active';break;
		case '1': item[0].className = 'item_sex_active';break; 
		}
		document.getElementById('in_sex').style.display='block';
	}
}

function show_author_type() {
       if(document.getElementById('in_author_type').style.display == 'block') document.getElementById('in_author_type').style.display = 'none';
       else
       {
               for(i=0; i < item_author.length; i++) item_author[i].className = 'item_author_type';
               switch (document.f.author_type.value) {
               case '0': item_author[0].className = 'item_author_type_active';break;
               case '1': item_author[1].className = 'item_author_type_active';break;
               case '2': item_author[2].className = 'item_author_type_active';break;
               }
               document.getElementById('in_author_type').style.display='block';
       }
}

function selectItemAuthor(e, i) {
document.getElementById('top_author_type').innerHTML=e.innerHTML;
document.f.author_type.value=i;
document.getElementById('in_author_type').style.display='none';
}

function OverItemAuthor(e) {
for(i=0; i < item_author.length; i++) item_author[i].className = 'item_author_type';
e.className = 'item_author_type_active';
}



function selectItem(e, i) {
document.getElementById('top_sex').innerHTML=e.innerHTML; 
document.f.sex.value=i;
document.getElementById('in_sex').style.display='none';
}

function OverItem(e) {
for(i=0; i < item.length; i++) item[i].className = 'item_sex';
e.className = 'item_sex_active';
}



function show_day() {
	if(document.getElementById('in_day').style.display == 'block') document.getElementById('in_day').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_day.length; i++) 
		{
		if (item_day[i].innerHTML == document.f.day.value) item_day[i].className = 'item_day_active';
		else item_day[i].className = 'item_day';
		}
		document.getElementById('in_day').style.display='block';
	}
}
 
function selectItemday(e) {
	document.getElementById('top_day').innerHTML=e.innerHTML; 
	document.getElementById('in_day').style.display='none';
	document.f.day.value=e.innerHTML;
}

function OverItemday(e) {
for(i=0; i < item_day.length; i++) item_day[i].className = 'item_day';
e.className = 'item_day_active';
}

function show_month() {
	if(document.getElementById('in_month').style.display == 'block') document.getElementById('in_month').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_month.length; i++) 
		{
		if (item_month[i].innerHTML == document.f.month.value) item_month[i].className = 'item_month_active';
		else item_month[i].className = 'item_month';
		}
		document.getElementById('in_month').style.display='block';
	}
}
 
function selectItemmonth(e) {
	document.getElementById('top_month').innerHTML=e.innerHTML; 
	document.getElementById('in_month').style.display='none';
	document.f.month.value=e.innerHTML;
}

function OverItemmonth(e) {
for(i=0; i < item_month.length; i++) item_month[i].className = 'item_month';
e.className = 'item_month_active';
}

function show_year() {
	if(document.getElementById('in_year').style.display == 'block') document.getElementById('in_year').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_year.length; i++) 
		{
		if (item_year[i].innerHTML == document.f.year.value) item_year[i].className = 'item_year_active';
		else item_year[i].className = 'item_year';
		}
		document.getElementById('in_year').style.display='block';
	}
}
 
function selectItemyear(e) {
	document.getElementById('top_year').innerHTML=e.innerHTML; 
	document.getElementById('in_year').style.display='none';
	document.f.year.value=e.innerHTML;
}

function OverItemyear(e) {
for(i=0; i < item_year.length; i++) item_year[i].className = 'item_year';
e.className = 'item_year_active';
}


function show_lang() {
	if(document.getElementById('in_lang').style.display == 'block') document.getElementById('in_lang').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_lang.length; i++) 
		{
		if (item_lang[i].innerHTML == document.f.lang.value) item_lang[i].className = 'item_lang_active';
		else item_lang[i].className = 'item_lang';
		}
		document.getElementById('in_lang').style.display = 'block';
	}
}
 
function selectItemlang(e, id) {
	document.getElementById('top_lang').innerHTML = e.innerHTML; 
	document.getElementById('in_lang').style.display = 'none';
	document.f.lang.value = e.innerHTML;
	document.f.langid.value = id;
}

function OverItemlang(e) {
for(i=0; i < item_lang.length; i++) item_lang[i].className = 'item_lang';
e.className = 'item_lang_active';
}




function show_creation_day_from() {
	if(document.getElementById('in_creation_day_from').style.display == 'block') document.getElementById('in_creation_day_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_day_from.length; i++) 
		{
		if (item_creation_day_from[i].innerHTML == document.f.creation_day_from.value) item_creation_day_from[i].className = 'item_creation_day_from_active';
		else item_creation_day_from[i].className = 'item_creation_day_from';
		}
		document.getElementById('in_creation_day_from').style.display='block';
	}
}
 
function selectItemcreation_day_from(e) {
	document.getElementById('top_creation_day_from').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_day_from').style.display='none';
	document.f.creation_day_from.value=e.innerHTML;
}

function OverItemcreation_day_from(e) {
for(i=0; i < item_creation_day_from.length; i++) item_creation_day_from[i].className = 'item_creation_day_from';
e.className = 'item_creation_day_from_active';
}

function show_creation_month_from() {
	if(document.getElementById('in_creation_month_from').style.display == 'block') document.getElementById('in_creation_month_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_month_from.length; i++) 
		{
		if (item_creation_month_from[i].innerHTML == document.f.creation_month_from.value) item_creation_month_from[i].className = 'item_creation_month_from_active';
		else item_creation_month_from[i].className = 'item_creation_month_from';
		}
		document.getElementById('in_creation_month_from').style.display='block';
	}
}
 
function selectItemcreation_month_from(e) {
	document.getElementById('top_creation_month_from').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_month_from').style.display='none';
	document.f.creation_month_from.value=e.innerHTML;
}

function OverItemcreation_month_from(e) {
for(i=0; i < item_creation_month_from.length; i++) item_creation_month_from[i].className = 'item_creation_month_from';
e.className = 'item_creation_month_from_active';
}

function show_creation_year_from() {
	if(document.getElementById('in_creation_year_from').style.display == 'block') document.getElementById('in_creation_year_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_year_from.length; i++) 
		{
		if (item_creation_year_from[i].innerHTML == document.f.creation_year_from.value) item_creation_year_from[i].className = 'item_creation_year_from_active';
		else item_creation_year_from[i].className = 'item_creation_year_from';
		}
		document.getElementById('in_creation_year_from').style.display='block';
	}
}
 
function selectItemcreation_year_from(e) {
	document.getElementById('top_creation_year_from').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_year_from').style.display='none';
	document.f.creation_year_from.value=e.innerHTML;
}

function OverItemcreation_year_from(e) {
for(i=0; i < item_creation_year_from.length; i++) item_creation_year_from[i].className = 'item_creation_year_from';
e.className = 'item_creation_year_from_active';
}

function show_creation_day_to() {
	if(document.getElementById('in_creation_day_to').style.display == 'block') document.getElementById('in_creation_day_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_day_to.length; i++) 
		{
		if (item_creation_day_to[i].innerHTML == document.f.creation_day_to.value) item_creation_day_to[i].className = 'item_creation_day_to_active';
		else item_creation_day_to[i].className = 'item_creation_day_to';
		}
		document.getElementById('in_creation_day_to').style.display='block';
	}
}
 
function selectItemcreation_day_to(e) {
	document.getElementById('top_creation_day_to').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_day_to').style.display='none';
	document.f.creation_day_to.value=e.innerHTML;
}

function OverItemcreation_day_to(e) {
for(i=0; i < item_creation_day_to.length; i++) item_creation_day_to[i].className = 'item_creation_day_to';
e.className = 'item_creation_day_to_active';
}

function show_creation_month_to() {
	if(document.getElementById('in_creation_month_to').style.display == 'block') document.getElementById('in_creation_month_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_month_to.length; i++) 
		{
		if (item_creation_month_to[i].innerHTML == document.f.creation_month_to.value) item_creation_month_to[i].className = 'item_creation_month_to_active';
		else item_creation_month_to[i].className = 'item_creation_month_to';
		}
		document.getElementById('in_creation_month_to').style.display='block';
	}
}
 
function selectItemcreation_month_to(e) {
	document.getElementById('top_creation_month_to').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_month_to').style.display='none';
	document.f.creation_month_to.value=e.innerHTML;
}

function OverItemcreation_month_to(e) {
for(i=0; i < item_creation_month_to.length; i++) item_creation_month_to[i].className = 'item_creation_month_to';
e.className = 'item_creation_month_to_active';
}

function show_creation_year_to() {
	if(document.getElementById('in_creation_year_to').style.display == 'block') document.getElementById('in_creation_year_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_creation_year_to.length; i++) 
		{
		if (item_creation_year_to[i].innerHTML == document.f.creation_year_to.value) item_creation_year_to[i].className = 'item_creation_year_to_active';
		else item_creation_year_to[i].className = 'item_creation_year_to';
		}
		document.getElementById('in_creation_year_to').style.display='block';
	}
}
 
function selectItemcreation_year_to(e) {
	document.getElementById('top_creation_year_to').innerHTML=e.innerHTML; 
	document.getElementById('in_creation_year_to').style.display='none';
	document.f.creation_year_to.value=e.innerHTML;
}

function OverItemcreation_year_to(e) {
for(i=0; i < item_creation_year_to.length; i++) item_creation_year_to[i].className = 'item_creation_year_to';
e.className = 'item_creation_year_to_active';
}

function show_add_day_from() {
	if(document.getElementById('in_add_day_from').style.display == 'block') document.getElementById('in_add_day_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_day_from.length; i++) 
		{
		if (item_add_day_from[i].innerHTML == document.f.add_day_from.value) item_add_day_from[i].className = 'item_add_day_from_active';
		else item_add_day_from[i].className = 'item_add_day_from';
		}
		document.getElementById('in_add_day_from').style.display='block';
	}
}
 
function selectItemadd_day_from(e) {
	document.getElementById('top_add_day_from').innerHTML=e.innerHTML; 
	document.getElementById('in_add_day_from').style.display='none';
	document.f.add_day_from.value=e.innerHTML;
}

function OverItemadd_day_from(e) {
for(i=0; i < item_add_day_from.length; i++) item_add_day_from[i].className = 'item_add_day_from';
e.className = 'item_add_day_from_active';
}

function show_add_month_from() {
	if(document.getElementById('in_add_month_from').style.display == 'block') document.getElementById('in_add_month_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_month_from.length; i++) 
		{
		if (item_add_month_from[i].innerHTML == document.f.add_month_from.value) item_add_month_from[i].className = 'item_add_month_from_active';
		else item_add_month_from[i].className = 'item_add_month_from';
		}
		document.getElementById('in_add_month_from').style.display='block';
	}
}
 
function selectItemadd_month_from(e) {
	document.getElementById('top_add_month_from').innerHTML=e.innerHTML; 
	document.getElementById('in_add_month_from').style.display='none';
	document.f.add_month_from.value=e.innerHTML;
}

function OverItemadd_month_from(e) {
for(i=0; i < item_add_month_from.length; i++) item_add_month_from[i].className = 'item_add_month_from';
e.className = 'item_add_month_from_active';
}

function show_add_year_from() {
	if(document.getElementById('in_add_year_from').style.display == 'block') document.getElementById('in_add_year_from').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_year_from.length; i++) 
		{
		if (item_add_year_from[i].innerHTML == document.f.add_year_from.value) item_add_year_from[i].className = 'item_add_year_from_active';
		else item_add_year_from[i].className = 'item_add_year_from';
		}
		document.getElementById('in_add_year_from').style.display='block';
	}
}
 
function selectItemadd_year_from(e) {
	document.getElementById('top_add_year_from').innerHTML=e.innerHTML; 
	document.getElementById('in_add_year_from').style.display='none';
	document.f.add_year_from.value=e.innerHTML;
}

function OverItemadd_year_from(e) {
for(i=0; i < item_add_year_from.length; i++) item_add_year_from[i].className = 'item_add_year_from';
e.className = 'item_add_year_from_active';
}

function show_add_day_to() {
	if(document.getElementById('in_add_day_to').style.display == 'block') document.getElementById('in_add_day_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_day_to.length; i++) 
		{
		if (item_add_day_to[i].innerHTML == document.f.add_day_to.value) item_add_day_to[i].className = 'item_add_day_to_active';
		else item_add_day_to[i].className = 'item_add_day_to';
		}
		document.getElementById('in_add_day_to').style.display='block';
	}
}
 
function selectItemadd_day_to(e) {
	document.getElementById('top_add_day_to').innerHTML=e.innerHTML; 
	document.getElementById('in_add_day_to').style.display='none';
	document.f.add_day_to.value=e.innerHTML;
}

function OverItemadd_day_to(e) {
for(i=0; i < item_add_day_to.length; i++) item_add_day_to[i].className = 'item_add_day_to';
e.className = 'item_add_day_to_active';
}

function show_add_month_to() {
	if(document.getElementById('in_add_month_to').style.display == 'block') document.getElementById('in_add_month_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_month_to.length; i++) 
		{
		if (item_add_month_to[i].innerHTML == document.f.add_month_to.value) item_add_month_to[i].className = 'item_add_month_to_active';
		else item_add_month_to[i].className = 'item_add_month_to';
		}
		document.getElementById('in_add_month_to').style.display='block';
	}
}
 
function selectItemadd_month_to(e) {
	document.getElementById('top_add_month_to').innerHTML=e.innerHTML; 
	document.getElementById('in_add_month_to').style.display='none';
	document.f.add_month_to.value=e.innerHTML;
}

function OverItemadd_month_to(e) {
for(i=0; i < item_add_month_to.length; i++) item_add_month_to[i].className = 'item_add_month_to';
e.className = 'item_add_month_to_active';
}

function show_add_year_to() {
	if(document.getElementById('in_add_year_to').style.display == 'block') document.getElementById('in_add_year_to').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_add_year_to.length; i++) 
		{
		if (item_add_year_to[i].innerHTML == document.f.add_year_to.value) item_add_year_to[i].className = 'item_add_year_to_active';
		else item_add_year_to[i].className = 'item_add_year_to';
		}
		document.getElementById('in_add_year_to').style.display='block';
	}
}
 
function selectItemadd_year_to(e) {
	document.getElementById('top_add_year_to').innerHTML=e.innerHTML; 
	document.getElementById('in_add_year_to').style.display='none';
	document.f.add_year_to.value=e.innerHTML;
}

function OverItemadd_year_to(e) {
for(i=0; i < item_add_year_to.length; i++) item_add_year_to[i].className = 'item_add_year_to';
e.className = 'item_add_year_to_active';
}


function show_auditorium() {
	if(document.getElementById('in_auditorium').style.display == 'block') document.getElementById('in_auditorium').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_auditorium.length; i++) 
		{
		if (item_auditorium[i].innerHTML == document.f.auditorium.value) item_auditorium[i].className = 'item_auditorium_active';
		else item_auditorium[i].className = 'item_auditorium';
		}
		document.getElementById('in_auditorium').style.display = 'block';
	}
}
 
function selectItemauditorium(e) {
	document.getElementById('top_auditorium').innerHTML = e.innerHTML; 
	document.getElementById('in_auditorium').style.display = 'none';
	document.f.auditorium.value = e.innerHTML;
}

function OverItemauditorium(e) {
for(i=0; i < item_auditorium.length; i++) item_auditorium[i].className = 'item_auditorium';
e.className = 'item_auditorium_active';
}


function show_temp() {
	if(document.getElementById('in_temp').style.display == 'block') document.getElementById('in_temp').style.display = 'none';
	else 
	{
		bodyclick();
		for(i=0; i < item_temp.length; i++) 
		{
		if (item_temp[i].innerHTML == document.f.temp.value) item_temp[i].className = 'item_temp_active';
		else item_temp[i].className = 'item_temp';
		}
		document.getElementById('in_temp').style.display = 'block';
	}
}
 
function selectItemtemp(e) {
	document.getElementById('top_temp').innerHTML = e.innerHTML; 
	document.getElementById('in_temp').style.display = 'none';
	document.f.temp.value = e.innerHTML;
}

function OverItemtemp(e) {
for(i=0; i < item_temp.length; i++) item_temp[i].className = 'item_temp';
e.className = 'item_temp_active';
}



var now = new Date();

function paste_days() {
	for (i=1; i<=31; i++) 
		if (i<10) document.write('<div class="item_day" onClick="event.cancelBubble = true; selectItemday(this);" onMouseOver="OverItemday(this);">0'+i+'</div>');
		else document.write('<div class="item_day" onClick="event.cancelBubble = true; selectItemday(this);" onMouseOver="OverItemday(this);">'+i+'</div>');
}

function paste_months() {
	for (i=1; i<=12; i++) 
		if (i<10) document.write('<div class="item_month" onClick="event.cancelBubble = true; selectItemmonth(this);" onMouseOver="OverItemmonth(this);" onMouseOver="OverItemmonth(this);">0'+i+'</div>');
		else document.write('<div class="item_month" onClick="event.cancelBubble = true; selectItemmonth(this);" onMouseOver="OverItemmonth(this);" onMouseOver="OverItemmonth(this);">'+i+'</div>');
}

function paste_years() {
	for (i=1980; i<=now.getFullYear(); i++) 
		document.write('<div class="item_year" onClick="event.cancelBubble = true; selectItemyear(this);" onMouseOver="OverItemyear(this);">'+i+'</div>');
}

function paste_creation_day_from() {
	for (i=1; i<=31; i++) 
		if (i<10) document.write('<div class="item_creation_day_from" onClick="event.cancelBubble = true; selectItemcreation_day_from(this);" onMouseOver="OverItemcreation_day_from(this);">0'+i+'</div>');
		else document.write('<div class="item_creation_day_from" onClick="event.cancelBubble = true; selectItemcreation_day_from(this);" onMouseOver="OverItemcreation_day_from(this);">'+i+'</div>');
}

function paste_creation_month_from(){
	for (i=1; i<=12; i++) 
		if (i<10) document.write('<div class="item_creation_month_from" onClick="event.cancelBubble = true; selectItemcreation_month_from(this);" onMouseOver="OverItemcreation_month_from(this);">0'+i+'</div>');
		else document.write('<div class="item_creation_month_from" onClick="event.cancelBubble = true; selectItemcreation_month_from(this);" onMouseOver="OverItemcreation_month_from(this);">'+i+'</div>');
}

function paste_creation_year_from(){
	for (i=1980; i<=now.getFullYear(); i++) 
		document.write('<div class="item_creation_year_from" onClick="event.cancelBubble = true; selectItemcreation_year_from(this);" onMouseOver="OverItemcreation_year_from(this);">'+i+'</div>');
}

function paste_creation_day_to(){
	for (i=1; i<=31; i++) 
		if (i<10) document.write('<div class="item_creation_day_to" onClick="event.cancelBubble = true; selectItemcreation_day_to(this);" onMouseOver="OverItemcreation_day_to(this);">0'+i+'</div>');
		else document.write('<div class="item_creation_day_to" onClick="event.cancelBubble = true; selectItemcreation_day_to(this);" onMouseOver="OverItemcreation_day_to(this);">'+i+'</div>');
}

function paste_creation_month_to(){
	for (i=1; i<=12; i++) 
		if (i<10) document.write('<div class="item_creation_month_to" onClick="event.cancelBubble = true; selectItemcreation_month_to(this);" onMouseOver="OverItemcreation_month_to(this);">0'+i+'</div>');
		else document.write('<div class="item_creation_month_to" onClick="event.cancelBubble = true; selectItemcreation_month_to(this);" onMouseOver="OverItemcreation_month_to(this);">'+i+'</div>');
}

function paste_creation_year_to(){
	for (i=1980; i<=now.getFullYear(); i++) 
		document.write('<div class="item_creation_year_to" onClick="event.cancelBubble = true; selectItemcreation_year_to(this);" onMouseOver="OverItemcreation_year_to(this);">'+i+'</div>');
}

function paste_add_day_from(){
	for (i=1; i<=31; i++) 
		if (i<10) document.write('<div class="item_add_day_from" onClick="event.cancelBubble = true; selectItemadd_day_from(this);" onMouseOver="OverItemadd_day_from(this);">0'+i+'</div>');
		else document.write('<div class="item_add_day_from" onClick="event.cancelBubble = true; selectItemadd_day_from(this);" onMouseOver="OverItemadd_day_from(this);">'+i+'</div>');
}

function paste_add_month_from(){
	for (i=1; i<=12; i++) 
		if (i<10) document.write('<div class="item_add_month_from" onClick="event.cancelBubble = true; selectItemadd_month_from(this);" onMouseOver="OverItemadd_month_from(this);">0'+i+'</div>');
		else document.write('<div class="item_add_month_from" onClick="event.cancelBubble = true; selectItemadd_month_from(this);" onMouseOver="OverItemadd_month_from(this);">'+i+'</div>');
}

function paste_add_year_from(){
	for (i=1980; i<=now.getFullYear(); i++) 
		document.write('<div class="item_add_year_from" onClick="event.cancelBubble = true; selectItemadd_year_from(this);" onMouseOver="OverItemadd_year_from(this);">'+i+'</div>');
}

function paste_add_day_to(){
	for (i=1; i<=31; i++) 
		if (i<10) document.write('<div class="item_add_day_to" onClick="event.cancelBubble = true; selectItemadd_day_to(this);" onMouseOver="OverItemadd_day_to(this);">0'+i+'</div>');
		else document.write('<div class="item_add_day_to" onClick="event.cancelBubble = true; selectItemadd_day_to(this);" onMouseOver="OverItemadd_day_to(this);">'+i+'</div>');
}

function paste_add_month_to(){
	for (i=1; i<=12; i++) 
		if (i<10) document.write('<div class="item_add_month_to" onClick="event.cancelBubble = true; selectItemadd_month_to(this);" onMouseOver="OverItemadd_month_to(this);">0'+i+'</div>');
		else document.write('<div class="item_add_month_to" onClick="event.cancelBubble = true; selectItemadd_month_to(this);" onMouseOver="OverItemadd_month_to(this);">'+i+'</div>');
}

function paste_add_year_to(){
	for (i=1980; i<=now.getFullYear(); i++) 
		document.write('<div class="item_add_year_to" onClick="event.cancelBubble = true; selectItemadd_year_to(this);" onMouseOver="OverItemadd_year_to(this);">'+i+'</div>');
}

function paste_lang(a){
for (var i in a) document.write('<div class="item_lang" onClick="event.cancelBubble = true; selectItemlang(this, '+a[i]+');" onMouseOver="OverItemlang(this);">'+i+'</div>');
}
//old
/*
function print_paging(total){
if(arguments.length == 1) url = location.pathname+location.search; else url = arguments[1];
path=/^.+\?/.exec(url);
parameters=(/\?.+$/.exec(url))[0].slice(1);
var parts = parameters.split(/&|=/), params = new Array();
for ( var i=0; i<parts.length; i++)
params[parts[i]] = unescape(parts[++i]);
params['s'] = parseInt(params['s']);
var start=1, stop=Math.ceil(total/20);
if (total>160) {
  if (((params['s']+80)<=total) && ((params['s']-80)>=0)) {start=(params['s']/20+1)-4; stop=(params['s']/20+1)+4;} 
  else if ((params['s']+80)>total){stop=Math.ceil(total/20); start=Math.ceil(total/20)-8;}
  else {stop=9; start=1;}
}
document.write('<ul class="list_menu">');
if(params['s']>0) document.write('<li><a href="'+path+'id='+params['id']+'&s='+(params['s']-20)+'" title="&laquo; �����">&laquo; �����</a></li>');
for (i=start; i<=stop; i++) 
	if(i!=(params['s']/20+1)) document.write('<li><a href="'+path+'id='+params['id']+'&s='+((i-1)*20)+'" title="'+i+'">'+i+'</a></li>');
	else document.write('<li class="list_menu_active">'+i+'</li>');
if((params['s']+20)<total) document.write('<li><a href="'+path+'id='+params['id']+'&s='+(params['s']+20)+'" title="������ &raquo;">������ &raquo;</a></li>');
document.write('</ul>');
}
		
function print_paging_with_submit(total){
url = location.pathname+location.search;
path=/^.+\?/.exec(url);
parameters=(/\?.+$/.exec(url))[0].slice(1);
var parts = parameters.split(/&|=/), params = new Array();
for ( var i=0; i<parts.length; i++)
params[parts[i]] = unescape(parts[++i]);

var s = parseInt(document.f.s.value);
var start=1, stop=Math.ceil(total/20);
if (total>160) {
  if ((s<=total) && ((s-80)>=0)) {start=(s/20+1)-4; stop=(s/20+1)+4;} 
  else if ((s+80)>total){stop=Math.ceil(total/20); start=Math.ceil(total/20)-8;}
  else {stop=9; start=1;}
}
document.write('<ul class="list_menu">');
//if(s>0) document.write('<li><a href="'+path+'" onClick="submit_f_wiht_s('+(s-20)+'); return false;" title="&laquo; �����">&laquo; �����</a></li>');
for (i=start; i<=stop; i++) 
	if(i!=(s/20+1)) document.write('<li><a href="'+path+'id='+params['id']+'&s='+((i-1)*20)+'" onClick="submit_f_wiht_s('+((i-1)*20)+'); return false;" title="'+i+'">'+i+'</a></li>');
	else document.write('<li class="list_menu_active">'+i+'</li>');
//if((s+20)<total) document.write('<li><a href="'+path+'" onClick="submit_f_wiht_s('+(s+20)+'); return false;" title="������ &raquo;">������ &raquo;</a></li>');
document.write('</ul>');
}

function submit_f_wiht_s(s){
url = location.pathname+location.search;
path=/^.+\?/.exec(url);
parameters=(/\?.+$/.exec(url))[0].slice(1);
var parts = parameters.split(/&|=/), params = new Array();
for ( var i=0; i<parts.length; i++)
params[parts[i]] = unescape(parts[++i]);

document.f.action=path+'id='+params['id']+'&s='+s;
document.f.s.value = s;
document.f.submit();
}
*/		

//new
function print_paging(total){
  document.write('<ul id="list_menu" class="list_menu"></ul>');
  show_paging(total);
}
function show_paging(total){
  url = location.pathname+location.search;
  path=/^.+\?/.exec(url);
  parameters=(/\?.+$/.exec(url))[0].slice(1);
  var parts = parameters.split(/&|=/), params = new Array(), dopparams = '', five, page, start, stop, temp = '';
  for ( var i=0; i<parts.length; i++) {
  params[parts[i]] = unescape(parts[++i]);
  if (parts[i-1] != 'id' && parts[i-1] != 's') dopparams += '&'+parts[i-1]+'='+unescape(parts[i]);}
  if (params['s']) params['s'] = parseInt(params['s']); else params['s'] = 0;
  page = params['s']/20+1;
  if(arguments.length == 1) five = Math.floor(params['s']/100); else five = arguments[1];

  if(five>0) temp += '<li><a href="#" title="&laquo; Назад" onClick="show_paging('+total+', '+(five-1)+'); return false;">&laquo; Назад</a></li>';
  start = five*5+1; 
  if ((five*5+5)<Math.ceil((total)/20)) stop = five*5+5; else stop = Math.ceil((total)/20);
  for (i=start; i<=stop; i++) 
    if(i!=(page)) temp += '<li><a href="'+path+'id='+params['id']+dopparams+'&s='+((i-1)*20)+'" title="'+i+'">'+i+'</a></li>';
    else temp += '<li class="list_menu_active">'+i+'</li>';
  if(five<Math.floor((total-1)/100)) temp += '<li><a href="#" title="Дальше &raquo;" onClick="show_paging('+total+', '+(five+1)+'); return false;">Дальше &raquo;</a></li>';
  document.getElementById("list_menu").innerHTML=temp;
}

function print_paging_prj(total){
  document.write('<ul id="list_menu" class="list_menu"></ul>');
  show_paging_prj(total);
}
function show_paging_prj(total){
  url = location.pathname+location.search;
  path=/^.+\?/.exec(url);
  parameters=(/\?.+$/.exec(url))[0].slice(1);
  var parts = parameters.split(/&|=/), params = new Array(), dopparams = '', five, page, start, stop, temp = '';
  for ( var i=0; i<parts.length; i++) {
  params[parts[i]] = unescape(parts[++i]);
  if (parts[i-1] != 'id' && parts[i-1] != 's') dopparams += '&'+parts[i-1]+'='+unescape(parts[i]);}
  if (params['s']) params['s'] = parseInt(params['s']); else params['s'] = 0;
  page = params['s']/15+1;
  if(arguments.length == 1) five = Math.floor(params['s']/75); else five = arguments[1];

  if(five>0) temp += '<li><a href="#" title="&laquo; Назад" onClick="show_paging_prj('+total+', '+(five-1)+'); return false;">&laquo; Назад</a></li>';
  start = five*5+1; 
  if ((five*5+5)<Math.ceil((total)/15)) stop = five*5+5; else stop = Math.ceil((total)/15);
  for (i=start; i<=stop; i++) 
    if(i!=(page)) temp += '<li><a href="'+path+'id='+params['id']+dopparams+'&s='+((i-1)*15)+'" title="'+i+'">'+i+'</a></li>';
    else temp += '<li class="list_menu_active">'+i+'</li>';
  if(five<Math.floor((total-1)/75)) temp += '<li><a href="#" title="Дальше &raquo;" onClick="show_paging_prj('+total+', '+(five+1)+'); return false;">Дальше &raquo;</a></li>';
  document.getElementById("list_menu").innerHTML=temp;
}


function print_paging_with_submit(total){
  document.write('<ul id="list_menu" class="list_menu"></ul>');
  show_paging_with_submit(total);
}
function show_paging_with_submit(total){
  url = location.pathname+location.search;
  path=/^.+\?/.exec(url);
  parameters=(/\?.+$/.exec(url))[0].slice(1);
  var parts = parameters.split(/&|=/), params = new Array(), dopparams = '', five, page, start, stop, temp = '';
  for ( var i=0; i<parts.length; i++) {
  params[parts[i]] = unescape(parts[++i]);
  if (parts[i-1] != 'id' && parts[i-1] != 's') dopparams += '&'+parts[i-1]+'='+unescape(parts[i]);}
  if (document.f.s.value) params['s'] = parseInt(document.f.s.value); else params['s'] = 0;
  page = params['s']/20+1;
  if(arguments.length == 1) five = Math.floor(params['s']/100); else five = arguments[1];

  if(five>0) temp += '<li><a href="#" title="&laquo; Назад" onClick="show_paging_with_submit('+total+', '+(five-1)+'); return false;">&laquo; Назад</a></li>';
  start = five*5+1; 
  if ((five*5+5)<Math.ceil((total)/20)) stop = five*5+5; else stop = Math.ceil((total)/20);
  for (i=start; i<=stop; i++) 
    if(i!=(page)) temp += '<li><a href="'+path+'id='+params['id']+dopparams+'&s='+((i-1)*20)+'" onClick="submit_f_wiht_s('+((i-1)*20)+'); return false;" title="'+i+'">'+i+'</a></li>';
    else temp += '<li class="list_menu_active">'+i+'</li>';
  if(five<Math.floor((total-1)/100)) temp += '<li><a href="#" title="Дальше &raquo;" onClick="show_paging_with_submit('+total+', '+(five+1)+'); return false;">Дальше &raquo;</a></li>';
  document.getElementById("list_menu").innerHTML=temp;
}

function submit_f_wiht_s(s){
  url = location.pathname+location.search;
  path=/^.+\?/.exec(url);
  parameters=(/\?.+$/.exec(url))[0].slice(1);
  var parts = parameters.split(/&|=/), params = new Array(), dopparams = '';
  for ( var i=0; i<parts.length; i++) {
  params[parts[i]] = unescape(parts[++i]);
  if (parts[i-1] != 'id' && parts[i-1] != 's') dopparams += '&'+parts[i-1]+'='+unescape(parts[i]);}

  document.f.action=path+'id='+params['id']+dopparams+'&s='+s;
  document.f.s.value = s;
  document.f.submit();
}

function del_from_favorits(id){
  document.f.del_favorit_id.value = id;
  document.f.submit();
}

function delete_attach_file(id, type){
  document.f.id.value = id;
  document.f.type.value = type;
  document.f.isdelete.value = 1;
  document.f.submit();
}

function add_attach_file(id, type, name, author_name){
  document.f.search_type.value=0;
  document.f.id.value = id;
  document.f.type.value = 1;
  document.f.file_name.value = name;
  document.f.author_name.value = author_name;
  document.f.submit();
}


function submit_f_wiht_sort(e, type){
  document.f.action=e.getAttribute('href');
  document.f.type.value = 1;
  document.f.submit();
}

function add_to_user(id, name){
  if(document.f.to_name.value != '') document.f.to_name.value = document.f.to_name.value + ', ' + name; else document.f.to_name.value = name;
  if(document.f.to_id.value != '') document.f.to_id.value = document.f.to_id.value + ', ' + id; else document.f.to_id.value = id;
  document.f.to_all.value = 0;
}


var FF=!document.all||self.opera;
var elementToDrag = null;
var offX, offY, cX, cY, MaxZ = 5;

function captureCoords(event){
	event = event || window.event
	if (FF){
		event.preventDefault();
		offX = event.layerX;
		offY = event.layerY;
		if (self.opera){
			offX = event.offsetX;
			offY = event.offsetY;
		}
		cX = (document.body.clientWidth-940)/2.0;
		cY = 10; 
	}
	else{
		offX = event.offsetX;
		offY = event.offsetY;
	}
}
function captureElement(id){
	elementToDrag = document.getElementById(id);
	elementToDrag.style.zIndex = ++MaxZ;
}

function releaseElement (){ 
	elementToDrag = null;
}    

function dragElement (event){ 
event = event || window.event;
	if (elementToDrag){
		if (FF) {
			elementToDrag.style.left = (event.pageX - offX - cX) +'px';
			elementToDrag.style.top = (event.pageY - offY - cY) +'px';
		}
		else{
			elementToDrag.style.pixelLeft = event.x - offX;
			elementToDrag.style.pixelTop = event.y - offY;
		}
}
}
















