
// Очищает поле ввода при клике не нём.
function clearfield(field) {
	window.document.getElementById(field).value = '';
}



//
//
var moredisplay = 0;
function moreShow(){
    if(moredisplay ==0){
	window.document.getElementById('gBottomText').style.display = '';
	moredisplay=1;
    } else {
	window.document.getElementById('gBottomText').style.display = 'none';
	moredisplay = 0;
    }
}

function backSwitch(){
    moreDisplay = 0;
    window.document.getElementById('gBottom').style.display = 'none';
    //window.document.getElementById('butMore').style.display = 'none';
    ////window.document.getElementById('butBack').style.display = 'none';
    dirSwitch(0);
}


var directorUsed = 0;

function dirSwitch(pos){
    if (pos == directorUsed){
    } else {
        moredisplay = 0;
        window.document.getElementById('gName').innerHTML = board_name[pos];
        if(pos == 0){
		window.document.getElementById('butBack').style.display = 'none';
        } else {
		window.document.getElementById('butBack').style.display = 'block';
        }
        
        window.document.getElementById('gRight').innerHTML = board_short[pos];
        window.document.getElementById('gLeft').innerHTML = '<img src="/pic'+board_pic[pos]+'" height="230" width="180">';
        //window.document.getElementById('butMore').style.display = 'block';
        
        
        window.document.getElementById('gBottom').style.display = '';
        //window.document.getElementById('gBottom').innerHTML = board_long[pos] + '<div align="center" style=" cursor: pointer;" title="Вернуться в начало"><img src="/img/Back1.png" alt="Вернуться в начало" width="192" height="20" /></div>';
        //window.document.getElementById('gBottomText').innerHTML = board_long[pos];
        window.document.getElementById('gBottomText').innerHTML = board_long[pos] + '<span onclick="moreShow()" style=" cursor: pointer;" title="Закрыть"><img src="/img/Close-Text.png" alt="Закрыть" width="19" height="18" /></span>';
        window.document.getElementById('gBottomText').style.display = 'none';
        
        
        window.document.getElementById('gAdd').innerHTML = board_address[pos];
        window.document.getElementById('gEmail').innerHTML = board_email[pos];
        window.document.getElementById('gTel').innerHTML = board_phone[pos];
        window.document.getElementById('gFax').innerHTML = board_fax[pos];
        window.document.getElementById('gAdd1').innerHTML = board_address[pos];
        window.document.getElementById('gEmail1').innerHTML = board_email[pos];
        window.document.getElementById('gTel1').innerHTML = board_phone[pos];
	window.document.getElementById('gFax1').innerHTML = board_fax[pos];
	
	//activation and deactivating buttons
	if(pos == 0){
	} else {
	    //var qtemp = 'bottomi'+pos;
	    //alert(qtemp);
	    window.document.getElementById('bottomi'+pos).style.cursor = '';
	    window.document.getElementById('bottomt1'+pos).style.cursor = '';
	    window.document.getElementById('bottomt2'+pos).style.cursor = '';
	}
	if(directorUsed == 0){
	} else {
	    window.document.getElementById('bottomi'+directorUsed).style.cursor = 'pointer';
	    window.document.getElementById('bottomt1'+directorUsed).style.cursor = 'pointer';
	    window.document.getElementById('bottomt2'+directorUsed).style.cursor = 'pointer';
	}
	
	directorUsed = pos;
    }
}

function get_width(about) {
	var width = document.body.clientWidth;

	if (width > 1200 && !about) {
	//if (width > 1200) {

		window.document.getElementById('down').style.display = 'none';
		
		window.document.getElementById('right').style.display = 'block';
		
		//window.document.getElementById('right').width = '265';
		
		//window.document.getElementById('top_right').style.display = 'block';
		//window.document.getElementById('top_right').width = '265';
		//window.document.getElementById('top_menu').width = '945';
		//window.document.getElementById('main_table').width = '945';
		window.document.getElementById('top_right').width = '298';
		window.document.getElementById('top_menu').width = '978';
		window.document.getElementById('main_table').width = '978';
		window.document.getElementById('top_right').style.display = 'block';
		window.document.getElementById('top_right_text').style.width = "100%";
		window.document.getElementById('main_table').style.background = "#CCC";
		
		// Для страницы Партнёры
		//window.document.getElementById('partn_bottom').style.display = 'block';
		//window.document.getElementById('partn_right').style.display = 'none';
		
		// Показывать в новостях вверху четыре фильма.
		//window.document.getElementById('main_news_4').style.display = 'block';
	} else if (width > 1200 && about) {
	
		
		window.document.getElementById('right').style.display = 'block';
	
	
		//window.document.getElementById('right_table').height = '680';
		
		//alert(window.document.getElementById('left_table').width);
		//alert("afdafd");
		//window.document.getElementById('down').style.display = 'none';
		
		window.document.getElementById('prodline').style.display = 'none';
		window.document.getElementById('prodinfo').style.display = 'none';
		
		//window.document.getElementById('right').width = '265';
		
		window.document.getElementById('top_right').style.display = 'block';
		//window.document.getElementById('top_right_text').innerHTML = 'Контактная информация';
		window.document.getElementById('top_right_text').style.width = "100%";
		window.document.getElementById('top_right').width = '298';
		window.document.getElementById('top_menu').width = '978';
		window.document.getElementById('main_table').width = '978';
		//alert(navigator.appName);
		if (navigator.appName.indexOf('Microsoft') != -1){
		    //IE 7
		    //alert(navigator.appVersion);
		    window.document.getElementById('variabletd').height = '200';
		    window.document.getElementById('variabletd').style.height = '200px';
		    var temphtml = window.document.getElementById('vartd2').innerHTML;
		    window.document.getElementById('vartd2').innerHTML = '<br>' + temphtml + '<br>';
		} else {
		    window.document.getElementById('variabletd').style.height = '230px';
		    window.document.getElementById('variabletd').height = '230';
		    //window.document.getElementById('variabletd').height = '255';
		}
		window.document.getElementById('main_table').style.background = "#CCC";
		//alert(window.document.getElementById('right_table').height);
	}
	else {
		// Для страницы Партнёры
		//window.document.getElementById('partn_bottom').style.display = 'none';
		//window.document.getElementById('partn_right').style.display = 'block';
	}
	

	//alert(width);
}


function scroll_left() {
    
    var d = document.getElementById('blks_inner');
    var Npages = parseInt(d.offsetWidth / ScrollN); //alert(d.offsetWidth);
    //var Npages = parseInt(550 / ScrollN);
    //alert (Npages);
    
    if(Npages < 1) {
    	Npages = 1;
    } 
	

	if (Npages - Scroll > spp) {
		Scroll = Scroll + 1;
		d.style.left = "-" + parseInt(Scroll * ScrollN) + "px";
		//d.style.left = '-100px';
	}
	
	//alert('Npages = ' + Npages + ', Scroll = ' + Scroll + ', ScrollN = ' + ScrollN);
	//alert (Npages - Scroll);
	if (Npages - Scroll <= spp) {
		
		document.getElementById('img_scroll_left').src = "img/Icons/Narrow-Right-Grey.gif";
		
	}
	
	 
	if (Scroll > 0) {
	
		document.getElementById('img_scroll_right').src = "img/Icons/Narrow-Left-Red.gif";
	
	}

	return false;
}


function scroll_right() {
    
    var d = document.getElementById('blks_inner');
    var Npages = parseInt(d.offsetWidth / ScrollN); 
    
    if(Npages < 1) {
		Npages = 1;
	}
    
    Scroll = Scroll - 1;
    
    if (Scroll >= 0) {
		d.style.left = "-" + parseInt(Scroll * ScrollN) + "px";
    } else {
		Scroll = 0;
    }
    
	//alert ('scroll = ' + Scroll + ', Npages = ' + Npages);
	
	// Если количество скриншотов больше ...
	if (Scroll > 0) {
		document.getElementById('img_scroll_left').src = "img/Icons/Narrow-Right-Red.gif";
	}
	else {
		document.getElementById('img_scroll_right').src = "img/Icons/Narrow-Left-Grey.gif";
	}
	
	
//	if (Npages - Scroll > spp) {
//		document.getElementById('img_scroll_left').src = "img/Icons/Narrow-Right-Red.png";
//	}

    
    return false;
}



function button_w(button) {
	var id = "btn_"+button;
	
	document.getElementById(id).style.background = "url('/img/White-Button.gif')";
}
	
	
function pointer(left,right) { //alert(left);
	if (left == 'grey') {
		document.getElementById('img_scroll_left').src = "/img/Icons/Narrow-Right-Grey.gif";
	}
	else if (left == 'red') {
		document.getElementById('img_scroll_left').src = "/img/Icons/Narrow-Right-Red.gif";
	}

}

function _search_button(state) {
	if (state == 'active') {
		document.getElementById('search_button').src = "/img/Icons/Search-Button-Active.gif";
		document.getElementById('search_button_r').src = "/img/Icons/Search-Button-Active.gif";
	}
	if (state == 'not_active') {
		document.getElementById('search_button').src = "/img/Icons/Search-Button.gif";
		document.getElementById('search_button_r').src = "/img/Icons/Search-Button.gif";
	}
}




