jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

function begen(url,id,nere)
{
    if($.cookie(nere+"begen_"+id) == null)
    {
        $.ajax({
        type: 'GET',
        url: url+'/begen.php',
        data: 'id='+id+'&nere='+nere,
        success: function(ajaxCevap) 
        {
            $('#siyah').html(ajaxCevap);
        }});
    }
    else
    {
        alert('Daha Önce Beğenmişsiniz');
    }
}

function oyb(puan,nere,id)
{
    if($.cookie(nere+"oy_"+id) == null)
    {
        $('#verdigin').html(puan);
    } 
}

function gulucuk(ne) 
{
    var newtext = ne;
    document.yorumformu.yorum.value += newtext;
}

function oyver(url,id,puan,nere)
{
    if($.cookie(nere+"oy_"+id) == null)
    {
        $.ajax({
        type: 'GET',
        url: url+'/oyver.php',
        data: 'id='+id+'&nere='+nere+'&puan='+puan,
        success: function(ajaxCevap) 
        {
            $('#toplamoy').html(ajaxCevap);
        }});
    }
    else
    {
        alert('Daha Önce Oy Vermişsiniz');
    }
}

function yorumbegen(url,id,puan)
{
    if($.cookie("yorbegen_"+id) == null)
    {
        $.ajax({
        type: 'GET',
        url: url+'/yorumbegen.php',
        data: 'id='+id+'&puan='+puan,
        success: function(ajaxCevap) 
        {
            $('#mevcut_'+id).html(ajaxCevap);
        }});
    }
    else
    {
        alert('Daha Önce Puan Vermişsiniz');
    }
}

function gonder(url,id,nere)
{
    $('#yorumsonuc').slideDown('slow');
    $("#yorumsonuc").html('<img src="'+url+'/js/ajax.gif" alt="ajax"/>');
    $.ajax
    ({
        type:'POST',
        url:url+'/yorumekle.php?id='+id+'&nere='+nere,
        data:$('#yorumform').serialize(),
        success:function(cevap)
        {
            $("#yorumsonuc").html(cevap)
        }
    })
}

function ac(id)
{
    $('.'+id).hide('slowly')
    $('#'+id).show('slowly');
}
function kapat()
{
$("#erkeksekmesi").show("fast");
$("#kadinsekmesi").hide("fast"); 
}
 
function erkek()
{
$("#erkeksekmesi").show("fast");
$("#kadinsekmesi").hide("fast"); 
}
 
 function kadin()
{
$("#erkeksekmesi").hide("fast");
$("#kadinsekmesi").show("fast"); 
}
function bat(bu)
{
   $('#'+bu).toggle('slowly');
}

function iletisim(url)
{
    $('#iletisimsonuc').slideDown('slow');
    $("#iletisimsonuc").html('<img src="'+url+'/js/ajax.gif" alt="ajax"/>');
    $.ajax
    ({
        type:'POST',
        url:url+'/iletisim.php',
        data:$('#iletform').serialize(),
        success:function(cevap)
        {
            $("#iletisimsonuc").html(cevap)
        }
    })
}


