var curImage1, curImage2, curImage3;

var TmpTxt;
var tmpar = new Array;
var textar = new Array('7pt', '8pt', '9pt', '10pt', '11pt', '12pt');
var curt = 2;
 
var bkmarkurl, bkmarktitle;
function addbkmark(bkm_u, bkm_t){
	if (bkm_u == ""){
		if (!bkmarkurl) bkmarkurl = location.href;
		bkm_u = bkmarkurl;
	}
	if (bkm_t == ""){
		if (!bkmarktitle) bkmarktitle = document.title;
		bkm_t = bkmarktitle;
	}


	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")){
		window.sidebar.addPanel (bkm_t, bkm_u, "");
	}else if (typeof window.external == "object"){
		window.external.AddFavorite(bkm_u, bkm_t);
	}else{
		prompt("Ваш браузер не поддерживает автоматическое добавление закладок. Тем не менее, вы можете вруную добвить закладку на текущую страницу. Адрес текущей страницы указан в поле ввода.", bkm_u);
	}
}
function getbkmark(){
	if (!bkmarkurl) bkmarkurl = location.href;
	if (!bkmarktitle) bkmarktitle = document.title;
	if (window.opera && document.createElement){
		document.getElementById("mybkmark").innerHTML = '<a title="'+ bkmarktitle + '" href="' + bkmarkurl + '" rel="sidebar"><img alt="favor" width="33px" height="33px" src="/img/fav.gif" class="tp"></a>';
	}else{
		document.getElementById("mybkmark").innerHTML = "<a title='Добавить данную страницу в закладки' href='javascript:addbkmark(\"\", \"\");'><img alt='favor' width='33px' height='33px' src='/img/fav.gif' class='tp'></a>";
	}
}   
function showG1(direct) {
	if(direct > 1 || direct == 0)curImage1=direct; else curImage1 += direct;
	if(curImage1>maxImage1)curImage1=0;
	if(curImage1<0)curImage1=maxImage1;
	document.getElementById('igalery1').setAttribute('src','galary/small/interier/' + curImage1 + '.jpg');
	document.getElementById('agalery1').setAttribute('href','galary.php?u=' + curImage1);
}
function showG2(direct) {
	if(direct > 1 || direct == 0)curImage2=direct; else curImage2 += direct;
	if(curImage2>maxImage2)curImage2=0;
	if(curImage2<0)curImage2=maxImage2;
	document.getElementById('igalery2').setAttribute('src','galary/small/fon/' + curImage2 + '.jpg');
	document.getElementById('agalery2').setAttribute('href','galary.php?u=' + (curImage2 + 1000));
}
function showG3(direct) {
	if(direct > 1 || direct == 0)curImage3=direct; else curImage3 += direct;
	if(curImage3>maxImage3)curImage3=0;
	if(curImage3<0)curImage3=maxImage3;
	document.getElementById('igalery3').setAttribute('src','galary/small/other/' + curImage3 + '.jpg');
	document.getElementById('agalery3').setAttribute('href','galary.php?u=' + (curImage3 + 2000));
}
function fTxtMore(myid) {
	document.getElementById('pAboutB' + myid).style.display = 'block';
	document.getElementById('aAboutB' + myid).style.display = 'none';
}
function fTxtLess(myid) {
	document.getElementById('pAboutB' + myid).style.display = 'none';
	document.getElementById('aAboutB' + myid).style.display = 'inline';
}
function fBlock(myid) {
	switch(myid) {
	case "1":
		if (document.getElementById('div_12').style.display == 'none'){
			if (bIsHide == '0') {
				document.getElementById('div_11').style.display = 'block';
			}
			document.getElementById('a_fHideMap').style.display = 'block';
			document.getElementById('div_12').style.display = 'block';
		}
		if (document.getElementById('div_21').style.display == 'none'){
			document.getElementById('div_21').style.display = 'block';
		}
		break;

	case "2":
		if (document.getElementById('div_12').style.display != 'none'){
			document.getElementById('a_fHideMap').style.display = 'none';
			document.getElementById('div_11').style.display = 'none';
			document.getElementById('div_12').style.display = 'none';
		}
		if (document.getElementById('div_21').style.display == 'none'){
			document.getElementById('div_21').style.display = 'block';
		}
		break;
	case "3":
		if (document.getElementById('div_12').style.display != 'none'){
			document.getElementById('a_fHideMap').style.display = 'none';
			document.getElementById('div_11').style.display = 'none';
			document.getElementById('div_12').style.display = 'none';
		}
		if (document.getElementById('div_21').style.display != 'none'){
			document.getElementById('div_21').style.display = 'none';
		}
		break;
	}
}

function fHideMap() {
	if (document.getElementById('div_12').style.display != 'none'){	
		if (bIsHide == "1"){
			document.getElementById('div_11').style.display = 'block';
			bIsHide = '0';
			document.getElementById('img_fHideMap').setAttribute('src','img/leftarrow.gif');
		}else{
			document.getElementById('div_11').style.display = 'none';
			bIsHide = '1';
			document.getElementById('img_fHideMap').setAttribute('src','img/rightarrow.gif');
		}
	}
}

function fHideGal(galNum) {
	if (document.getElementById('dgalery' + galNum).style.display != 'none'){	
		document.getElementById('dgalery' + galNum).style.display = 'none';
		document.getElementById('argalery' + galNum).setAttribute('src','img/downarrow.gif');
	}else{
		document.getElementById('dgalery' + galNum).style.display = 'block';
		document.getElementById('argalery' + galNum).setAttribute('src','img/uparrow.gif');
	}
}

function fInputOver(fthis, txt) {
	TmpTxt = fthis.getAttribute('value');
	if (TmpTxt == txt || txt == "*") {	fthis.setAttribute('value', '');}
}
function showUser(fthis) {
	if (document.getElementById(fthis).style.display == 'block') {
		document.getElementById(fthis).style.display = 'none';
	} else {
		document.getElementById(fthis).style.display = 'block';
	}
}
function fufind(pp){
	if (document.getElementById('fchangedirect')== null){
	}else{
		document.getElementById('fchangedirect').setAttribute('action', pp);
	}
}

function atagcreator(arg1){
	document.getElementById('fchangedirect').setAttribute('action', arg1);
	document.getElementById('fchangedirect').submit();
}

//Yandex form find code
nN = navigator.appName;

    function fsearch(str) {
        if(document.fform.myradio[0].checked) {
            open('http://yandex.ru/yandsearch?text=' + str + '&serverurl=' + document.location.hostname);
        } else {
            open('http://yandex.ru/yandsearch?text=' + str);
        }
    }

function faddon(reg_cur, reg_all){
	for (var i = 1; i <= reg_all; i++){
		if (reg_cur == i){ document.getElementById('reg_func_' + i).style.display = 'block';}else{document.getElementById('reg_func_' + i).style.display = 'none';}
	}
}
function fprpn(reg_cur){
if (reg_cur == "1"){
	document.getElementById('pr_pn1').style.display = 'none';
	document.getElementById('pr_pn2').style.display = 'block';
}else{
	document.getElementById('pr_pn1').style.display = 'block';
	document.getElementById('pr_pn2').style.display = 'none';
}
}

function afind(txt){
	document.getElementById('id_user_name').value = txt;
	document.getElementById('fchangedirect').submit();
}

function pmenu(mnu){
	document.getElementById(mnu).style.left = document.getElementById('apmenu1').offsetLeft + document.getElementById('apmenu1').offsetWidth - 63;
	document.getElementById(mnu).style.top = 22;
	document.getElementById(mnu).style.display = 'block';
}
function hmenu(mnu){
	document.getElementById(mnu).style.display = 'none';
}

function fmov_block(y){
	if (y != undefined){
		if (y > 0){
			document.getElementById('is_desk').style.top = "+" + y + "px";
		}else{
			document.getElementById('is_desk').style.top = y + "px";
		}
	}
}
