/*
==============================
 Index Functions
==============================
 2009-2010 Linoa All Rights Reserved
==============================
*/

//$(document).ready(function(){
//    initOutertitle();
//    //max anno
//    $("div[id^='anno_preview']").eq(3).click();
//    $("div[id^='anno_preview']").eq(4).click();
//    $("div[id^='anno_preview']").eq(5).click();
//    
//});

function initOutertitle() {
    $("div[id^='anno_preview']").each( function () {
        $(this).bind('click', function() {
            togAnno($(this).attr("id").replace('anno_preview',''));
        });
        $(this).bind('mousemove', function() {
            $(this).css("cursor","pointer")
        });
    });
//    $("a[id^='anno_func']").each( function () {
//        $(this).bind('click', function() {
//            togAnno(getID($(this).attr("id"),"anno_func"));
//        });
//    });
}



function togAnno(id) {
    var f=$("#anno_func"+id).html()
    if (f=='[-]')  {
        //tog off
        $("#anno_text"+id).hide();
        $("#anno_func"+id).html("[+]");
    }
    else {
        $("#anno_text"+id).show();
        $("#anno_func"+id).html("[-]");
    }
}



function logout() {
    $.ajax(
    {
    	url:"json/account.json.php?action=logout",
        beforeSend: function(){
            $("#logout_output").html(__AJAX_LOADING_IMG);
        },
        success:function(e) {
            if (e.success) {
            	$("#logout_output").html('');
            	window.location.href="/";
            }
            else {
                //alert(e.msg);
            }
        },
        error:function() {
            //alert(__AJAX_ERROR);
        },
        complete:function() {
        	//
        }
    }
    );
}

$(document).ready(function(){
    initAjaxForm('login',{
            'callback':"setTimeout('window.location.href=\"/main.php\"', 1000)",
            'successBtn':false,
            'failBtn':true,
            'alertMsg':true});
});
