﻿var pos = 0;
var totalHeight = -20;
var constraint = 366;

$().ready(function(){
    
    $("div.item").each(function(){
        totalHeight += $(this).height() + 10;        
    });
    
    
    
    $("#nextNews").click(function(){        
        if(totalHeight - pos > constraint)
        {        
            pos += totalHeight - pos - constraint > 40 ? 40 : totalHeight - pos - constraint;
            //$("#news div.item").css("bottom", pos + "px");
            $("#news div.item").animate({bottom:pos},{ duration: 400, easing: "easeInOutQuad" });
        }        
    });
    
    $("#prevNews").click(function(){
        if(pos > 0)
            pos -= pos >= 40 ? 40 : pos;
            $("#news div.item").animate({bottom:pos},{ duration: 400, easing: "easeInOutQuad" });
    });
    
    if(hrSuccess)
    {
        var popup = $.create("div").attr("class","popup").appendTo($.create("div",{id:"dialoginfo"}).attr("class","dialog").appendTo("body"));
        $.create("a").click(tb_remove).appendTo($.create("div",{"class":"t"}).appendTo(popup));
        var content = $.create("div").attr("class","c").appendTo(popup);
        $.create("h1").html("Başvuru Formu").appendTo(content);
        
        $.create("p",{"class":"orange"}).html("Teşekkür ederiz.").appendTo(content);
        
        $.create("p").html("Yaptığınız başvuru değerlendirmeye alınmıştır.").appendTo(content);
        
        tb_show(null,'#TB_inline?height=300&width=400&inlineId=dialoginfo',false);
    }
});
