﻿
    function pageInit()
    {
        var str = ajaxUICommon.getLoginHtmlSession().value;
        if(str!=null)
        {
            if (str!='')
                document.getElementById('login').innerHTML = str;
        }
        
        document.getElementById('dvOnLine').innerHTML = ajaxUICommon.getOnLineCount().value;
    }
    
    function getLogin()
    {
        var usr = document.getElementById('name');
        var pss = document.getElementById('pass');
        
        if (usr.value=='e-posta adresi' || usr.value=='')
        {
            alert('Lütfen kullanıcı adınızı giriniz');
            usr.focus();
            return null;
        }   
        if (pss.value=='sifre' || pss.value=='')
        {
            alert('Lütfen şifrenizi giriniz');
            pss.focus();
            return null;
        }   
        
        getLoginHTML(usr.value,pss.value);
    } 
    
    function getLoginHTML(usr, pss)
    {
        var strLoginHtml = ajaxUICommon.getLoginHtml(usr, pss).value;
        if(strLoginHtml=="")
        {
            var x = document.getElementById('name');
            x.focus();
            x.select();
            alert('Kullanıcı adı yada şifresi yanlış...\n\n Lütfen tekrar deneyiniz...');
            return false;
        }
        else
        {
            document.getElementById('login').innerHTML = strLoginHtml;
            return true;
        }
    }
    
    function LogOut()
    {
        ajaxUICommon.clearSession();
        window.location.href = 'default.aspx';
    }
    
    function SoruSor()
    {
        var str = ajaxUICommon.getLoginHtmlSession().value;
        
        if(str==null)
        {
            alert('Soru sorabilmek için öncelikli olarak üye girişi yapmalısınız..');
            document.getElementById('name').focus();
        }
        else
            window.location.href='sorusor.aspx';
    }   
    
    function RandevuAl()
    {
        window.location.href='randevu.aspx';
    }     
    
    
    
    function CheckDate(e, obj)
    {
        var key; //= (window.event) ? event.keyCode : e.which;
        if (window.event)
            key = event.keyCode
        else
            key = e.which

        if ( key > 47 && key < 58 || key == 8 )
        {
            if(key!=8)
            {
                var character = String.fromCharCode(key);
                var CharSayi = obj.value.length+1;
                if (CharSayi==2 | CharSayi==5 )
                {
                    obj.value += character + '/';
                    if (window.event) //IE  
                        window.event.returnValue = null;
                    else //Firefox
                        e.preventDefault();
                }
            }
        }
        else
        {
            if(key!=0) //tab
            {
                if (window.event) //IE  
                    window.event.returnValue = null;
                else //Firefox
                    e.preventDefault();
            }
        }
    }     