function onLoadPage(){return true;}

/* -------------------------------------------------------------
	Opening and closing blocs
------------------------------------------------------------- */
function closeBlock(x){document.getElementById(x).style.display='none'}
function openBlock(x){document.getElementById(x).style.display='block'}
function changeBlock(x, y){closeBlock(x);openBlock(y)}
function closeSearch(){
	closeBlock('search_form'); 
	closeBlock('search_btn');
	closeBlock('search_btn_1'); 
	openBlock('search_btn_2')}
function openSearch(){
	openBlock('search_form');
	openBlock('search_btn');
	openBlock('search_btn_1'); 
	closeBlock('search_btn_2')}
	
	
function exOpenBloks(blok1, blok2, blok3){
	closeBlock(blok1);
	openBlock(blok2);
	openBlock(blok3)}
function exCloseBloks(blok1, blok2, blok3){
	openBlock(blok1);
	closeBlock(blok2);	
	closeBlock(blok3)}
	
/* -------------------------------------------------------------
	Еncoding against of spume  
------------------------------------------------------------- */	
function c_em(val1,val2){document.write('<a href="mai'+'lto'+':'+val1+'@'+val2+'">'+val1+'@'+val2+'</a>')}	


/* -------------------------------------------------------------
	Questions for deleting
------------------------------------------------------------- */	
function fn_post(){return confirm ("Удалить запись?");}
function fn_comm(){return confirm ("Удалить комментарий?");}
function fn_foto(str){return confirm ("Удалить фотографию: "+str+"?");}
function fn_foto2(str,str2){if (str2=="2") {return confirm (" "+str+"?")} else return true;}
function fn_foto_s(){return confirm ("Удалить выбранные фотографии?");}
function fn_album(str){return confirm ("Удалить альбом: "+str+"?");}
function fn_cont(str){return confirm ("Очистить папку?");}
function fn_delfol(str){return confirm ("Удалить папку '"+str+"' ?");}
function fn_love(){return confirm ("Удалить признание?");}
function fn_rub(str){return confirm ("Удалить рубрику: "+str+"?");}
function fn_acc(){return confirm ("Вы действительно хотите удалить аккаунт?");}

/* -------------------------------------------------------------
	Control of control
------------------------------------------------------------- */	
function CheckAll(Element){
//	thisCheckBoxes = Element.parentNode.parentNode.parentNode.getElementsByTagName('input');
	var thisCheckBoxes = Element.form.getElementsByTagName('input');
	for (var i = 0; i < thisCheckBoxes.length; i++){if(thisCheckBoxes[i].type == 'checkbox') thisCheckBoxes[i].checked = Element.checked;}}


/* -------------------------------------------------------------
	Scroll of messages 
------------------------------------------------------------- */	
function scroll_mess(what_id){
	var what = document.getElementById(what_id);
	if(what) what.scrollTop = what.scrollHeight;}	
function focus_id(what_id){
	var what = document.getElementById(what_id);
	if(what) what.focus();}

/* -------------------------------------------------------------
	Check cookie
------------------------------------------------------------- */	
function setCookie(name, value, path){document.cookie = name + "=" + escape(value) + ((path) ? "; path=" + path : "");}
function getCookie( name ){
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1){
        begin = dc.indexOf(prefix);
        if ( begin != 0 ) return null;
    }else begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) end = dc.length;
    return unescape( dc.substring( begin + prefix.length, end ) )}


/* -------------------------------------------------------------
	Popup menu
------------------------------------------------------------- */	
var activeIcon;
var noFirstShowMenu = true;
function showMenu() {
	
	var x_menu = document.getElementById('itself_menu');
	var x_img = document.getElementById('img_menu');
	
	x_menu.style.display = "block";	
	if(noFirstShowMenu){
		var xx = x_img.offsetLeft;
		var yy = x_img.offsetTop - x_menu.offsetHeight;

		x_menu.style.left = xx + 'px';
		x_menu.style.top = yy + 'px';	
	}
		
	if (activeIcon) {activeIcon.style.display = "none";}

	if (activeIcon != x_menu ) {
		x_menu.style.display = "block";	
		activeIcon = x_menu;
		x_menu.style.display = "block";}
	else {
		activeIcon = null;
		x_menu.style.display = "none";}}

/* -------------------------------------------------------------
	Minimization and maximization photo
------------------------------------------------------------- */	
function fitPhoto(){
	var obj = document.getElementById('mainImg');
	xxImg = obj.offsetWidth;
	if(xxBody < xxImg){
		obj.style.width = xxBody  + 'px';
		changeBlock('fitImg', 'actImg')}}
	
function actualPhoto(){
	var obj = document.getElementById('mainImg');
	if(xxBody < xxImg){
		obj.style.width = xxImg + 'px';
		changeBlock('actImg', 'fitImg')}}
		
/* -------------------------------------------------------------
	Select region and city
------------------------------------------------------------- */	
//var ifIe = false;
//var browName = new String(navigator.appName);
//if(browName.indexOf('Microsoft') != -1 && (browName.indexOf('Pocket') || browName.indexOf('Mobile'))) ifIe = true;

function updateSelect(path, optValue){
	optValue.form.action = path + '/#sel_reg';
	optValue.form.submit();}
	
//function updateSelect2(path, id, optValue){
//	if(ifIe){
//		alert('ок1');
//		document.all.id.submit();
//		alert('ок2');
//	}else{
//		var optValue = document.getElementById(id);
//		optValue.action = path + '/?sel_reg';
//		optValue.submit();}}
//	

