// ru_interface.js

function show_pages(current, total){

	var path = document.URL;
	path = path.substring(0, path.lastIndexOf('.'));
	var pathe = new Array();
	pathe = path.split('_');
	//alert(path);
	// <img border=0 src=imgs/nav_left_inactive.png align=absmiddle> Страница <input class=pages_input value=1> из 67 <img border=0 src=imgs/nav_right_active.png align=absmiddle>
	var out = '';
	if (current==1){
		out=out+'<img border=0 src="/imgs/nav_left_inactive.png" align=absmiddle> ';
	} else {
		var prev = current-2;
		// correct pathe[0]
		if (current>10){
			pathe[0]=pathe[0].substring(0, pathe[0].length-2);
		} else {
			pathe[0]=pathe[0].substring(0, pathe[0].length-1);
		}
		
		var ulink=pathe[0]+(prev>0 ? prev : '')+'.html';
		out=out+'<a href="'+ulink+'"><img border=0 src="/imgs/nav_left_active.png" align=absmiddle></a> ';
	}
	out=out+'Страница <input name=pages onfocus="this.select()" onchange="jump_page(this.value,'+current+', '+total+')" class=pages_input value="'+current+'"> из '+total+' ';
	
	if (current==total){
		out=out+' <img border=0 src="/imgs/nav_right_inactive.png" align=absmiddle>';
	} else {
		var next = current;
		
		// correct pathe[0]
		if (current>10){
			pathe[0]=pathe[0].substring(0, pathe[0].length);
		} else {
			if (current>1){
				pathe[0]=pathe[0].substring(0, pathe[0].length);
			}
		}
		
		
		var ulink=pathe[0]+next+'.html';
		out=out+' <a href="'+ulink+'"><img border=0 src="/imgs/nav_right_active.png" align=absmiddle></a>';
	}
	
	document.write(out);
	
}
function trap_jump(num, current, total){

if (num<1 || num>total){
		var error = 'Введите число из диапазона 1..'+total;
		alert(error);
		return false;
	} else {
		var path = document.URL;
		path = path.substring(0, path.lastIndexOf('.'));
		var pathe = new Array();
		pathe = path.split('_');
		
		// correct pathe[0]
		if (current>10){
			pathe[0]=pathe[0].substring(0, pathe[0].length-2);
		} else {
			if (current>1){
				pathe[0]=pathe[0].substring(0, pathe[0].length-1);
			} else {
				pathe[0]=pathe[0].substring(0, pathe[0].length);
			}
		}
		
		
		var nnum = num-1;
		var ulink=pathe[0]+(nnum ? nnum : '')+'.html';
		
		document.perpage.action=ulink;
		document.perpage.method='get';
		document.perpage.pages.value="";
	}

return true;
}

function jump_page(num, current, total){

	if (num<1 || num>total){
		var error = 'Введите число из диапазона 1..'+total;
		alert(error);
		return false;
	} else {
		var path = document.URL;
		path = path.substring(0, path.lastIndexOf('.'));
		var pathe = new Array();
		pathe = path.split('_');
		
		// correct pathe[0]
		if (current>10){
			pathe[0]=pathe[0].substring(0, pathe[0].length-2);
		} else {
			if (current>1){
				pathe[0]=pathe[0].substring(0, pathe[0].length-1);
			} else {
				pathe[0]=pathe[0].substring(0, pathe[0].length);
			}
		}
		
		
		var nnum = num-1;
		var ulink=pathe[0]+(nnum ? nnum : '')+'.html';
		
		document.location.href=ulink;
	}
	
}

function submit_search_query(){

}


// check for form
var path = document.URL;
var pathe = new Array();
pathe = path.split('?');
if(pathe[1]=="sendform"){
	alert('Ваше сообщение отправлено!');
}
