﻿$(document).ready(function(){

});

function getTown(il_id)
{
    $("#drpTown").removeOption(/./);
    $("#drpTown").ajaxAddOption("/2009_yerel_secim_sonuclari/ilce_list.aspx?il=" + il_id + "&dt=" + cacheTime, {}, false, [{"dir":"desc"}]);  
}

function getCity()
{
    $("#drpCity").removeOption(/./);
    $("#drpCity").ajaxAddOption("/2009_yerel_secim_sonuclari/il_list.js?dt=" + cacheTime, {}, false, [{"dir":"desc"}]);    
}

function getCity2()
{
    $("#drpCity").removeOption(/./);
    $("#drpCity").ajaxAddOption("/2009_yerel_secim_sonuclari/il_list_2.js?dt=" + cacheTime, {}, false, [{"dir":"desc"}]);    
}

function sonucGetir()
{
var ilceId = $("#drpTown").selectedValues();
var ilId = $("#drpCity").selectedValues();
if(ilceId != 0) 
{
    var URLL = "/2009_yerel_secim_sonuclari/?ilce=" + ilceId + "&il=" + ilId;
    window.location = URLL;
}
else alert("Lütfen sonuçlarını görüntülemek istediğiniz il ve ilçeyi seçiniz!");
}

function sonucGetir2()
{
var URLL = "/2009_yerel_secim_sonuclari/il_genel_meclisi.aspx?il=" + $("#drpCity").selectedValues();
window.location = URLL;
}

function cubukAc(divAd, genislik){ $('#' + divAd).animate({ width: genislik + 'px' }, 2500 ); }

function cubukYukselt(divAd, uzunluk){ 
$('#' + divAd + '_cbk').animate({ height: uzunluk + 'px' }, 2500 ); 
}

function il_ilce(il)
{
getTown(il);
setTimeout(function() {
    $('#drpCity').selectOptions(il);
} ,1000);
}

function il_ilce_2(il)
{
setTimeout(function() {
$('#drpCity').selectOptions(il);
$('div.scSehir').html($("#drpCity :selected").text());
} ,1000);
}


function refSonucGetir()
{
    var URLL  = "";
    var ilId = $("#drpCity").selectedValues();
    var ilceId = $("#drpTown").selectedValues();
    if(ilceId != 0) 
    {
        URLL = "/Referandum/?ilce=" + ilceId + "&il=" + ilId;        
    }
    else
    {
        if(ilId != 100)  URLL = "/Referandum/?il=" + ilId;
        else  URLL = "/Referandum/";
    }
    
    window.location = URLL;
}

function refSonucGetir2()
    {
    var URLL = "/referandum/iller.aspx?il=" + $("#drpCity").selectedValues();
    window.location = URLL;
}

function refGetCity()
{
    $("#drpCity").removeOption(/./);
    $("#drpCity").ajaxAddOption("/referandum/il_list.js?dt=" + cacheTime, {}, false, [{"dir":"desc"}]);    
}

function refTown(il_id)
{
    $("#drpTown").removeOption(/./);
    $("#drpTown").ajaxAddOption("/referandum/ilceler.aspx?il=" + il_id + "&dt=" + cacheTime, {}, false, [{"dir":"desc"}]);  
}

function refIlIlce(il, ilce)
{
refTown(il);
setTimeout(function() {
    $('#drpCity').selectOptions(il);
    $('#drpTown').selectOptions(ilce);
} ,3000);
}
