// IMAGE PRELOADING
Y = new Image();
Y.src = "images/buton_1.gif"
S = new Image();
S.src = "images/buton_0.gif"

// IMAGE ROLLOVER
function YS (secenek,onoff) {
    link = onoff ==1 ? Y.src : S.src
    eval("document.getElementById('buton"+secenek+"').src = '"+link+"'")
}

function Menu(ID){
	if(eval("document.getElementById('bolum"+ID+"').style.display") == "none")
		eval("document.getElementById('bolum"+ID+"').style.display = 'block'")
    else
        eval("document.getElementById('bolum"+ID+"').style.display = 'none'")
}

function AOpen(){
    window.open('admin_login.php','adminlogin','width=200, height=100')
}

function Soru(sinav_id,soru_no){
	tur_aktif = top.document.formtur.tur[0].checked ? top.document.formtur.tur[0].value : top.document.formtur.tur[1].value
	eval("top.window.oss_soru.location.href='oss_soru.php?sinav_id="+sinav_id+"&soru_no="+soru_no+"&tur="+tur_aktif+"'")
	eval("top.document.getElementById('aktif_soru_no').value='"+soru_no+"'")
    eval("top.document.getElementById('aktif_tur').value='"+tur_aktif+"'")
}

function SecenekClear(){
	for(i=0;i<5;i++)
    	top.document.formcevapla.secenek[i].checked=false
}
/*
function SoruCevapCheck(cevaplanan_sorular){
	for(i=0; i<cevaplanan_sorular.length; i++)
        eval("top.document.getElementById('soru_"+cevaplanan_sorular[i]+"').style.backgroundColor='000000'")
}
*/
// COUNTDOWN
var down;
var min1,sec1;
var cmin2,csec2;
function Minutes(data) {
    for(var i=0;i<data.length;i++)
        if(data.substring(i,i+1)==":")
            break;
    return(data.substring(0,i));
}
function Seconds(data) {
    for(var i=0;i<data.length;i++)
        if(data.substring(i,i+1)==":")
            break;
    return(data.substring(i+1,data.length));
}
function Display(min,sec) {
    var disp;
    if(min<=9) disp=" 0";
    else disp=" ";
    disp+=min;
    return(disp);
}
function Down() {
    cmin2=1*Minutes("180");
    csec2=0+Seconds("180");
    DownRepeat();
}
function DownRepeat() {
    csec2--;
    if(csec2==-1) {
        csec2=59; cmin2--;
    }
    document.getElementById('sure').innerHTML=Display(cmin2,csec2);
    if((cmin2==0)&&(csec2==0)){
        sinav_id = document.getElementById('sinav_id_input').value
        alert("Sınav süresi sona erdi")
        eval("location.href='oss.php?sinav_id="+sinav_id+"&bitti=1'")
    }
    else down=setTimeout("DownRepeat()",1000);
}

function SinavDetayi(ID){
	durum = eval("document.getElementById('detay_"+ID+"').style.display")
    if(durum == "none")
		eval("document.getElementById('detay_"+ID+"').style.display = 'block'")
    else
    	eval("document.getElementById('detay_"+ID+"').style.display = 'none'")
}

function Jump(sayfa,deger,obj){
    if(obj.options[obj.selectedIndex].value)
        eval("self.location='"+sayfa+"?"+deger+"="+obj.options[obj.selectedIndex].value+"'")
}

function Jump2(sayfa,deger,obj){
    if(obj.options[obj.selectedIndex].value)
        eval("self.opener.location='"+sayfa+"?"+deger+"="+obj.options[obj.selectedIndex].value+"'")
}
