function fotoChenger(option){
	
    if(option == 0){
        if(n >= 2){
            n = n - 2;
        }
        else{
            n = n - 1;
        }
    }
    if(n + 3 != imegesNamber){
        for(var j = 0; j < imegesNamber; j++){
            pic[j].style.display = 'none';
        }
        for(var i = 0; i < 4; i++){
            pic[i + n].style.display = 'block';
        }
        n = n + 1;
    }
}

function zeroing(el){
	if(el.value == 'e-mail' || el.value == 'Мобильный телефон'){
		el.value='';
	}
}

function restoration(el, n){
	if(el.value == ''){
		if(n == 1){
		el.value='e-mail';
		}
		if(n == 2){
		el.value='Мобильный телефон';
		}
	}
}


function showForm(){
	var forms = document.getElementById('form_index');
	forms.style.display = 'block';
	document.getElementById('akciiContentBottom').style.background = 'url(/tpls/content/users/images/akciiContentBottom.gif)';
	document.getElementById('shower').style.display = 'none';
}

function verification(){
	var mail = document.getElementById('email_index').value;
	var tel = document.getElementById('input_telefon').value;
	var mailArry = mail.split('@');
	if((mailArry.length != 2) && (tel == '' || tel == 'Мобильный телефон')){
		alert('Пожалуйста, заполните форму правильно');
			return false;
	}
}


function f1(){
    if(document.getElementById('back')){
    	document.getElementById('back').onclick = function(){fotoChenger(0)};
    	document.getElementById('next').onclick = function(){fotoChenger(1)};
    }

}

function f2(){
	if(page == '22896'){
        document.getElementById('akciiContentBottom').style.background = 'url(/tpls/content/users/images/akciiContentBottomIndex.gif)';
    }
}



function f3(){
if(page == '23008'){
	var tt = document.getElementById('akciiTop');
        if(tt){
		tt.style.background = 'url(/tpls/content/users/images/akciiContentTop.gif)';
        	document.getElementById('spSport').style.display = 'block';
	}
}
}

function f4(){
	var sh = document.getElementById('shower');
	if(sh){
		sh.onclick = function(){showForm()};
	}
	var mail = document.getElementById('email_index');
	var tel = document.getElementById('input_telefon');
	var forms = document.getElementById('form_index');
	if(tel){
 		mail.onclick = function(){zeroing(this)};
 		mail.onblur = function(){restoration(this, '1')};
 		tel.onclick = function(){zeroing(this);};
 		tel.onblur = function(){restoration(this, '2')};
		forms.onsubmit = function(){return verification()};
	}
}

function f5(){
	if(navigator.appName == 'Netscape'){
   		document.getElementsByTagName('body')[0].style.backgroundAttachment = 'scroll';
	}
}

function heighter(){
	var elHak = document.getElementById('hak').style;
	var windowHeight = Number(document.body.clientHeight);
	
	var heightBan = 0;
	var elBan = document.getElementById('akcii');
	if(elBan){
		heightBan = Number(elBan.clientHeight);
	}
	var contentHeight = windowHeight - 376 - heightBan;
	elHak.height = contentHeight + 'px';
// 	elHak.border = '1px red solid';
// 	alert('w = ' + windowHeight + '   el = ' + contentHeight);
}

window.onresize = function(){
	heighter();
}

window.onload = function() {
	f1();
	f2();
	f3();
	f4();
	f5();
// 	id(page == '22896'){
		heighter();
// 	}
}









