﻿// form hikayeleri



function formCont() {
   
    var gelenDate = document.getElementById('ctl00_cpMaster_search1_ctChin').value
    var ilaveGun = document.getElementById('ctl00_cpMaster_search1_ctNight').value
   
   
    var gun = (gelenDate.slice(0, 2))
    var ay = (gelenDate.slice(3, 5))
    var yil = (gelenDate.slice(6, 10))
    var Tarih = ay + "-" + gun + "-" + yil
    new Date(Tarih);
    var n = Date.parse(Date());
    var d = Date.parse(Tarih);


   
    if (gelenDate == "" || d < n) {
        if (gelenDate == "") {
            alert("Lütfen Giriş Tarihinizi Seçiniz ! ");
        }
        if (d < n) {
            alert("Giriş Tarihi seçimi Yarın veya daha sonrası olmalıdır ! ");
        }
        event.returnValue = false;
        return false;
    } else {
        var ilaveGun = document.getElementById('ctl00_cpMaster_search1_ctNight').value
        if (ilaveGun == "a") {
            alert("Lütfen Gece Sayısını Seçiniz ! ");


            event.returnValue = false;
            return false;
        } else {
          
          
         
            event.returnValue = true;
            return true;
           
            
        }
        event.returnValue = true;
        return true;
       
    }
}

function  addDay(){
    var gelenDate = document.getElementById('ctl00_cpMaster_search1_ctChin').value
    var ilaveGun = document.getElementById('ctl00_cpMaster_search1_ctNight').value
    if (gelenDate == "") {
        alert("Lütfen Giriş Tarihinizi Seçiniz ! ");
        return false;
    }
     {
   

        ilaveGun = parseInt(ilaveGun);
        var gun = (gelenDate.slice(0, 2))
        var ay = (gelenDate.slice(3, 5))
        var yil = (gelenDate.slice(6, 10))
        var Tarih = ay + "-" + gun + "-" + yil

        var javaTarih = new Date(Tarih)
        //document.getElementById('TextBox1').value;

        javaTarih.setDate(javaTarih.getDate() + ilaveGun);

        da = javaTarih // Create a Date Object set to the last modifed date 
        dy = da.getFullYear() // Get full year (as opposed to last two digits only) 
        dm = da.getMonth() + 1 // Get month and correct it (getMonth() returns 0 to 11) 
        dd = da.getDate() // Get date within month 
        if (dy < 1970) dy = dy + 100; // We still have to fix the millennium bug 
        ys = new String(dy) // Convert year, month and date to strings 
        ms = new String(dm)
        ds = new String(dd)
        if (ms.length == 1) ms = "0" + ms; // Add leading zeros to month and date if required 
        if (ds.length == 1) ds = "0" + ds;
        ys = ds + "/" + ms + "/" + ys  // Combine year, month and date in ISO format

        

        document.getElementById("ctl00_cpMaster_search1_ctChout").value = ys;
      
        
    }
}


