function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;

  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  /*else if (window.opera && document.createElement)
  {
    var objLink = document.createElement('a');
	objLink.setAttribute('rel', 'sidebar');
	objLink.setAttribute('href', url);
	objLink.setAttribute('title', title);
	objLink.click();

  }
  else return false;*/

  return true;
}
function FixOperaFavorites (strUrl, strTitle, arIds) {
	if (! window.opera) {
		return;
	}

	var objLink = null;

	for (var i = 0; i < arIds.length; i++) {
		objLink = document.getElementById(arIds[i]);

		if (! objLink) {
			continue;
		}

		objLink.rel = 'sidebar';
		objLink.href = strUrl;
		objLink.title = strTitle;
	}
}
/***********************/
var W3CDOM = (document.createElement && document.getElementsByTagName);

if ( window.addEventListener ) {
	window.addEventListener('load', init, false);
} else {
	window.attachEvent('onload', init);
}

function init () {
	if (!W3CDOM) return;
	like_yandex();
}

function like_yandex(){

	var frm = document.getElementById('entrance');

	if(frm)	{
		var labels = frm.getElementsByTagName('LABEL');
		for ( var i = 0 ; i < labels.length ; i++ ) {
			if ( !labels[i].parentNode.getElementsByTagName('INPUT')[0].value ) {
				labels[i].className = 'log_pass';
			}
			labels[i].onclick = getLabel;
		}
		var inputs = frm.getElementsByTagName('INPUT');
		for ( var i = 0 ; i < inputs.length ; i++ ) {
			if ( inputs[i].className != 'text' ) continue;
			inputs[i].onblur = backToLabel;
			inputs[i].onfocus = hideLabel;
		}
	}
}

function getLabel() {
	this.className = '';
	var inpt = this.parentNode.getElementsByTagName('INPUT')[0];
	if(inpt) inpt.focus();
}
function hideLabel() {
	var labl = this.parentNode.getElementsByTagName('LABEL')[0];
	labl.className = '';
}
function backToLabel(){
	var labl = this.parentNode.getElementsByTagName('LABEL')[0];
	if ( !this.value ) {
		labl.className = 'log_pass';
	}
}

function changeSearchMode (strSelectValue) {
    var objForm = document.getElementById('search_form');

    if (!objForm) {
        return;
    }

    if (strSelectValue == 'site') {
        objForm.action = '/search/index.php';
    } else {
        objForm.action = '/photos/index.php?PAGE_NAME=search';
    }
}

//jQuery(document).ready(function () {
	//jQuery('#filter_author_simbol').change();
//});

function onSelectAuthorList (obj, author) {
	jQuery.get('/profile/moderator/user_simbol_list.php', { 'simbol' : obj.value, 'author' : author }, function (data) {
		jQuery('#filter_author').html(data);
	});
}

