function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function blockAction(id, action) {
 obj = MM_findObj(id);
 obj.style.display = action;
}

function reaonlyAction(id, action) {
	obj = MM_findObj(id);

	if (action == false){
 		obj.className = "button btn-green";
 	}else{
 		obj.className = "button btn-gray";
 	}
 	//obj.disabled = action;
}
function confirmLink(theLink, msg) {
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + msg);
    if (is_confirmed) {
        theLink.href += '&is_jsconf=delete';
    }

    return is_confirmed;
}
var confirmMsg  = ' ';

sfHover = function() {
	var sfEls = document.getElementById("mm").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

$(function() {
    $('input[title]').bind({
        focus: function() {
            if ($(this).attr('title') == $(this).attr('value')) {
                $(this).attr('value', '');
            }
        },
        blur: function() {
            if ($(this).attr('value') == '') {
                $(this).attr('value', $(this).attr('title'));
            }
        }
    });
});

$(document).ready(function(){
    $("#emlist-frm").submit(function() {
    var email = $('#email').attr('value');   
        $.ajax({
            type: "POST",
            url: "/maillist.php",
            data: "email="+ email,
           success: function(html){
               $('#emlist-frm').hide();
               $("#emlist").append(html);
            }
        });
    return false;
    });
});

function getBrowserInfo() {
	var t,v = undefined;
	
	if (window.chrome) t = 'Chrome';
	else if (window.opera) t = 'Opera';
	else if (document.all) {
		t = 'IE';
		var nv = navigator.appVersion;
		var s = nv.indexOf('MSIE')+5;
		v = nv.substring(s,s+1);
	} 
	else if (navigator.appName) t = 'Netscape';
	
	return {type:t,version:v};
}

function bookmark(a){
	var url = window.document.location;
	var title = window.document.title;
	var b = getBrowserInfo();
	
	if (b.type == 'IE' && 8 >= b.version && b.version >= 4) window.external.AddFavorite(url,title);
	else if (b.type == 'Opera') {
		a.href = url;
		a.rel = "sidebar";
		a.title = url+','+title;
		return true;
	}
	else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
	else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
	return false;
}  

