function indgal(how,end,model){


var $number;
$number = document.getElementById('ingalval').value;

if (how == 'next') {var $next = ($number - 0) + (1 - 0);} else {var $next = ($number - 0) - (1 - 0);}


if ($next >= 1 && $next <= end) {


document.getElementById('ingalval').value = $next;

if ($next <= '1') {document.getElementById('prevgal').src='/img/arr_no.png';} else {document.getElementById('prevgal').src='/img/arr_l.png';}

if ($next >= end) {document.getElementById('nextgal').src='/img/arr_no.png';} else {document.getElementById('nextgal').src='/img/arr_r.png';}

$('#indexgal').fadeOut(200);
setTimeout(function() {document.getElementById('indexgal').src='/img/model/galery/'+model+'_'+$next+'_sm.jpg';}, 200)
$('#indexgal').fadeIn(200);

}
			}

function endd(){

var end = document.getElementById('answer').value.length;
  document.getElementById('answer').setSelectionRange(end,end);
  document.getElementById('answer').focus();
  
}

function indb(id){

$('#indb_tuning').slideUp(400);
$('#indb_repair').slideUp(400);
$('#indb_on_road').slideUp(400);

$('#indb_'+id).delay(400).slideDown(400);

document.getElementById('indb-tuning').className="indbmenu";
document.getElementById('indb-repair').className="indbmenu";
document.getElementById('indb-on_road').className="indbmenu";

document.getElementById('indb-'+id).className="indbmenuov";


}

function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }
function doDefault(theText) { if (theText.value == "") { theText.value = theText.defaultValue } }

function topup(){
$('#topup').toggle('slow');
if(document.getElementById("topupbut").className=="topupbut"){document.getElementById("topupbut").className="uptopupbut"} else {document.getElementById("topupbut").className="topupbut"};
}

function topupbut(){
document.getElementById('topupbut').src='/img/topuparrover.png';
}

function forumanswer(forumsub){
if(forumsub != ''){	document.answ.answer.value='[quote]'+forumsub+'[/quote] \n';} else {document.answ.answer.value='';}
		$('#forumanswer').fadeIn(400);
}

function forumnew(themech){
document.newtheme.theme[themech].selected = true;
		$('#forumnew').fadeIn(400);
}

function showmenu(news){
$('#menunews').css('visibility','visible');
}
function podskazka(what){
	$('#'+what).fadeIn(400);
}

function hide(what){
	$('#'+what).fadeOut(400);
}

function hidedelay(what,del){
	$('#'+what).delay(del).fadeOut(400);
}

function toggle(what){
	$('#'+what).toggle('slow');
}

function popup(whathide){
if(!jQuery("body").find("#pop").is("div"))
{
jQuery("body").append("<div onclick=\"hide('"+whathide+"'); popupclose()\" id='pop'></div>");
}}

function popupclose(){
	$('#pop').remove();
}

function model(win){
	$('#infomodel').hide();
	$('#techmodel').hide();
	$('#pricemodel').hide();
	$('#galerymodel').hide();
	$('#'+win+'model').show();

	document.getElementById('infobut').className="jqmenu";
	document.getElementById('techbut').className="jqmenu";
	document.getElementById('pricebut').className="jqmenu";
	document.getElementById('galerybut').className="jqmenu";
	document.getElementById(win+"but").className="jqmenuover";
	
		if(win == 'info') { 
		$('#mainmodel').slideDown(1000);
		} else {
		$('#mainmodel').slideUp(1000);
		}
}

function shwgal(galnum){ 
$('#mainimg').fadeOut(200);
setTimeout(function() {document.getElementById('mainimg').src='/img/model/galery/'+galnum+'.jpg';}, 200)
$('#mainimg').fadeIn(200);
}


