$(function() {
    
    $("#Player ul").cycle({
        fx: "fade",
        speed: 2000,
        timeout: 8000,
        pager: ".pager",
        next: "#next",
        prev: "#prev"
    });
    
    $(".ui-button, .sendnewstdsearchbut, .CSmaincatmenu, .CSmaincatmenucheck").button();
    
    $(".CSmaincatmenucheck").css("bakcground", "#b00c74");
    
    $('ul.sf-menu').superfish({
        autoArrows: false
    });
    
    $("#username").val("Felhasználó név");
    
    $("#username").click(function() {
        if ($(this).val()=="Felhasználó név")
        {
            $(this).val("");
        }
    }).blur(function() {
        if ($("#username").val()=="")
        {
            $("#username").val("Felhasználó név");
        } 
    });
    
    $("#password").val("123456");
    
    $("#password").click(
    function() {
        if ($(this).val()=="123456")
        {
            $(this).val("");
        }
    }).blur(function() {
        if ($(this).val()=="")
            $("#password").val("123456");
    });
    
    $("#kerdezzen").css({cssFloat: "right", margin: 3});
    
    $("#kerdezzen").mouseover(function(e) {
       
       if (!document.getElementById("titler"))
       {
           var title = $(this).attr("rel");
                      
           $("<div class=\"titler\" id=\"titler\">"+title+"</div>").css({
            background: "url(http://www.nice.hu/images/2042/titler-png_20111024122142_19.png) no-repeat top left",
            width: 170,
            padding: 15,
            height: 100,
            paddingBottom: 30,
            color: "#b00c74",
            fontSize: "12px",
            position: "absolute",
            lineHeight: "16px",
            left: e.pageX-135,
            top: e.pageY-150,
            zIndex: 2000
           }).insertAfter($("#kerdezzen"));
       }
       else
       {
          $("#titler").css({
            left: e.pageX-135,
            top: e.pageY-145,
            zIndex: 2000
          }) 
       }
       
    }).mouseleave(function() {
        $("#titler").fadeOut(200, function() {$("#titler").remove();});
    });

});



function forgotPwd() {
    
    if (!document.getElementById("forgotDialog"))
    {
        $("body").append("<div id=\"forgotDialog\" />");
    }
    
    $("#forgotDialog").html('<b>Adja meg az e-mail címét, amivel regisztrált: </b><br /><br /><input type="text" id="forgotEmail" class="ui-input" onclick="this.value=\'\';" value="pl. valaki@szolgaltato.hu" style="width: 240px;" /></form>').dialog({
        autoOpen:true,
        modal: true,
        bgiframe: true,
        width: 500,
        height: 200,
        title: "Elfelejtett jelszó",
        resizable: false,
        buttons: {
            "Új jelszó küldése": function() 
            {
                
              var email = $("#forgotEmail").val();
              
              if (email.length<3 || email.indexOf("@")<0 || email=='pl. valaki@szolgaltato.hu')
              {
                
                if ($(".forgoterror").index()<0)
                    $("<span class=\"forgoterror\">A megadott e-mail cím hibás!</span>").insertAfter("#forgotEmail");
                 
              }
              else
              {
                $(".forgoterror").remove();
                    $.post("/documents/nice-new/php/forgotpwd.php?a="+Math.random(),
                    {
                        email: email
                    },
                    function(xml) {
                       infoMessage(xml, "Elfelejtett jelszó"); 
                    });
              }  
            },
            "Bezár": function() 
            {
                $(this).dialog("destroy");
            }
        }
    });
        
}

