﻿function Pik(PageName) {
    location.href = 'Pikcv.aspx?Pik=' + PageName;
}

function ShowDate(ddl, Value, IsSetDefault) {
    if (ddl.options[ddl.selectedIndex].value==Value) { 
        document.getElementById('trDate').style.display='';
        if (IsSetDefault != 1) { SetDefault(); }
    }
    else { 
        document.getElementById('trDate').style.display='none';
        SetMinDate();
    }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var pen = window.open(theURL,winName,features);
  pen.focus();
}

function DateControl(ddlDay, ddlMonth, ddlYear) {

    //0 doğru
    //1 eksik
    //2 yanlış

    var Day = document.getElementById(ddlDay).value;
    var Month = document.getElementById(ddlMonth).value;
    var Year = document.getElementById(ddlYear).value;
    
    if ((Day == "0") || (Month == "0") || (Year == "0")) { return 1; }

    switch(Month)
    {
    case "02":
        if ((Day > 29) || ((Year % 4 != 0) && (Day == 29)))  {
            //alert("Lütfen Doğru Tarih Giriniz");
            return 2;
        }

    case "04":
        if (Day > 30) {        
            //alert("Lütfen Doğru Tarih Giriniz");
            return 2;
        }

    case "06":
        if (Day > 30) {        
            //alert("Lütfen Doğru Tarih Giriniz");
            return 2;
        }        

    case "09":
        if (Day > 30) {        
            //alert("Lütfen Doğru Tarih Giriniz");
            return 2;
        }  

    case "11":
        if (Day > 30) {        
            //alert("Lütfen Doğru Tarih Giriniz");
            return 2;
        } 
        
    default:
        return 0;
    break;
    }
}


function BeginTest(TestType) {
    var wpen = window.open('Test.aspx?TestType=' + TestType, 'PIKCVTest', 'toolbar=no,resizable, scrollbars');
    wpen.focus();
}

/*
function MainJobsTabChange() {
    if (li1.className == 'TabActive') {
        li1.className = '';
        li2.className = 'TabActive'
        $get('MainJobs1').style.display='none';
        $get('MainJobs2').style.display='';
    } else {
        $get('MainJobs1').style.display='';
        $get('MainJobs2').style.display='none';
        li1.className = 'TabActive';
        li2.className = '';
    }
}*/

function MainJobsTabChange(clickedTab) 
{
    switch (clickedTab) {
        case 1:
            li1.className = 'TabActive';
            li2.className = '';
            li3.className = '';
            li4.className = '';

            $get('MainJobs1').style.display = '';
            $get('MainJobs2').style.display = 'none';
            $get('MainJobs3').style.display = 'none';
            $get('MainJobs4').style.display = 'none';
            
            break;
        case 2:
            li1.className = '';
            li2.className = 'TabActive';
            li3.className = '';
            li4.className = '';

            $get('MainJobs1').style.display = 'none';
            $get('MainJobs2').style.display = '';
            $get('MainJobs3').style.display = 'none';
            $get('MainJobs4').style.display = 'none';
            break;
        case 3:
            li1.className = '';
            li2.className = '';
            li3.className = 'TabActive';
            li4.className = '';

            $get('MainJobs1').style.display = 'none';
            $get('MainJobs2').style.display = 'none';
            $get('MainJobs3').style.display = '';
            $get('MainJobs4').style.display = 'none';
            break;
        case 4:
            li1.className = '';
            li2.className = '';
            li3.className = '';
            li4.className = 'TabActive';

            $get('MainJobs1').style.display = 'none';
            $get('MainJobs2').style.display = 'none';
            $get('MainJobs3').style.display = 'none';
            $get('MainJobs4').style.display = '';
            break;
    }
}


function OpenSaveFolder(FolderID) {
    var wpen = window.open('SaveFolder.aspx?FolderID=' + FolderID, 'PikcvKlasörKaydetme', 'width=450,height=300,toolbar=no');
    wpen.focus();
    return;
}

function OpenJobStatistics(JobID) {
    var wpen = window.open('JobStatistics.aspx?JobID=' + JobID, 'JobStatistic', 'width=550,height=700,toolbar=no, scrollbars');
    wpen.focus();
}

function OpenAddTemporaryUsers(FolderID) {
    var wpen = window.open('AddTemporaryUsers.aspx?FolderID=' + FolderID, 'PikcvGeçiciKlasörEkleme', 'width=470,height=420,toolbar=no');
    wpen.focus();
}

function OpenInsertInterview(JobID) {
    if (JobID == null) JobID = 0;
    var wpen = window.open('InsertInterview.aspx?JobID=' + JobID, 'PikcvMülakataÇağır', 'width=500,height=550,toolbar=no');
    wpen.focus();
}

function CheckAll(Check, chID) {
    for (var i = theForm.elements.length; --i>=0;) {
        if (theForm.elements[i].id == chID) {
            theForm.elements[i].checked = Check;   
        }
    }
}

function OpenJobPreview(JobID) {
    window.open('JobDetail.aspx?JobID=' + JobID, 'JobPreview', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenJobPreviewForAdmin(JobID) {
    window.open('../JobDetail.aspx?JobID=' + JobID, 'JobPreview', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenProjectDetail(CustomProjectPositionID) {
    window.open('ProjectDetail.aspx?CustomProjectPositionID=' + CustomProjectPositionID, 'ProjectDetail', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenProjectDetailForAdmin(CustomProjectPositionID) {
    window.open('../ProjectDetail.aspx?CustomProjectPositionID=' + CustomProjectPositionID, 'ProjectDetail', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenJobPreviewAtApproval(JobID, IsSecret) {
    window.open('JobDetail.aspx?JobID=' + JobID + '&IsSecret=' + IsSecret, 'JobPreview', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function SendFriend(SendFriendType, ID) {
    var wpen = window.open('SendFriend.aspx?SendFriendType=' + SendFriendType + '&ID=' + ID, 'PIKCVSendFriend', 'toolbar=no,resizable, scrollbars, width=700, height=470');
    wpen.focus();
    return;
}

function OpenUserDetail(UserID) {
    window.open('UserDetail.aspx?UserID=' + UserID, 'UserDetail', 'toolbar=no, scrollbars, width=830, height=620'); 
    return;
}

function OpenPrivacy() {
    var wpen = window.open('Privacy.aspx', 'Gizlilik', 'width=800,height=570,toolbar=no');
    wpen.focus();
}

function OpenAgreement() {
    var wpen = window.open('UserAgeement.aspx', 'ÜyelikŞartları', 'width=800,height=570,toolbar=no');
    wpen.focus();
}


function OpenConfirm(Code, ArgID, ArgStr) {
    var wpen;
    var bURL = 'Confirm.aspx?Code=' + Code + '&ArgID=' + ArgID + '&ArgStr=' + ArgStr;
    var bTitle = 'Confirm';
    var bWidth = 450;
    var bHeight = 182;
    
    if (navigator.appName.indexOf("Microsoft") != -1) {
        var Return = window.showModalDialog(bURL,bTitle,"dialogWidth: "+bWidth+"px; dialogHeight: "+bHeight+"px; center: Yes; status: No; help: No; scroll: no;");    
        if (Return.IsReload != null) { 
            if (Return.IsReload == 1) { 
                window.location.href = window.location.href.replace('PopupID', '_');
                //window.location.reload(); 
             }
            if (Return.IsReload == 2) { theForm.submit(); }
        }
    }
    else {
        wpen = window.open(bURL, bTitle, 'width=' + bWidth + ',height=' + bHeight + ',toolbar=no');
        wpen.focus();
    }
    return;
}

function OpenConfirmForAdmin(Code, ArgID, ArgStr) {
    var wpen;
    var bURL = '../Confirm.aspx?Code=' + Code + '&ArgID=' + ArgID + '&ArgStr=' + ArgStr;
    var bTitle = 'Confirm';
    var bWidth = 450;
    var bHeight = 182;
    
    if (navigator.appName.indexOf("Microsoft") != -1) {
        var Return = window.showModalDialog(bURL,bTitle,"dialogWidth: "+bWidth+"px; dialogHeight: "+bHeight+"px; center: Yes; status: No; help: No; scroll: no;");    
        if (Return.IsReload != null) { 
            if (Return.IsReload == 1) { 
                window.location.href = window.location.href.replace('PopupID', '_');
                //window.location.reload(); 
             }
            if (Return.IsReload == 2) { theForm.submit(); }
        }
    }
    else {
        wpen = window.open(bURL, bTitle, 'width=' + bWidth + ',height=' + bHeight + ',toolbar=no');
        wpen.focus();
    }
    return;
}

function OpenConfirmIDPlus7(Code, ArgID, ArgStr0, ArgStr1, ArgStr2, ArgStr3, ArgStr4, ArgStr5, ArgStr6) {
    var wpen;
    var bURL = 'Confirm.aspx?Code=' + Code + '&ArgID=' + ArgID + '&ArgStr=' + ArgStr0 + '&ArgStr1=' + ArgStr1 + '&ArgStr2=' + ArgStr2 + '&ArgStr3=' + ArgStr3 + '&ArgStr4=' + ArgStr4 + '&ArgStr5=' + ArgStr5 + '&ArgStr6=' + ArgStr6;
    var bTitle = 'Confirm';
    var bWidth = 450;
    var bHeight = 182;
    
    if (navigator.appName.indexOf("Microsoft") != -1) {
        var Return = window.showModalDialog(bURL,bTitle,"dialogWidth: "+bWidth+"px; dialogHeight: "+bHeight+"px; center: Yes; status: No; help: No; scroll: no;");    
        if (Return.IsReload != null) { 
            if (Return.IsReload == 1) { 
                window.location.href = window.location.href.replace('PopupID', '_');
                //window.location.reload(); 
             }
            if (Return.IsReload == 2) { theForm.submit(); }
        }
    }
    else {
        wpen = window.open(bURL, bTitle, 'width=' + bWidth + ',height=' + bHeight + ',toolbar=no');
        wpen.focus();
    }
    return;
}

function OpenCloseOther(OtherID, ddlID, dvOtherID) {
    if (ddlSelectedValue(ddlID) == OtherID) { $get(dvOtherID).style.display=''; }
    else $get(dvOtherID).style.display='none';
}

function OpenSaveAdminFolder(FolderID) {
    var wpen = window.open('SaveFolder.aspx?FolderID=' + FolderID, 'PikcvAdmiSaveFolder', 'width=450,height=300,toolbar=no');
    wpen.focus();
    return;
}

function OpenPikcvInterview(UserID) {
    var wpen = window.open('SavePikcvInterview.aspx?UserID=' + UserID, 'PikcvAdmiSavePikcvInterview', 'width=900,height=650,toolbar=no,scrollbars=1');
    wpen.focus();
    return;
}

function OpenMakeInstalments(InvoiceID) {
    var wpen = window.open('MakeInstalments.aspx?InvoiceID=' + InvoiceID, 'PikcvAdmiMakeInstalments', 'width=600,height=300,toolbar=no,scrollbars=0');
    wpen.focus();
    return;
}

function OpenSavePikcvInvoiceNumber(InvoiceInstalmentID, PaymentType) {
    var wpen = window.open('SavePikcvInvoiceNumber.aspx?InvoiceInstalmentID=' + InvoiceInstalmentID + '&SID=' + PaymentType, 'PikcvAdmiSavePikcvInvoiceNumber', 'width=600,height=300,toolbar=no,scrollbars=0');
    wpen.focus();
    return;
}

function OpenUserTestResults() {
    window.open('UsersTestResults.aspx', 'UsersTestResults', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenUserTestResultsAdmin() {
    window.open('../UsersTestResults.aspx', 'UsersTestResults', 'toolbar=no, scrollbars, width=830, height=580'); 
    return;
}

function OpenShareProjects(ProjectID) {
    var wpen = window.open('ShareProject.aspx?ProjectID=' + ProjectID, 'PikcvShareProjects', 'width=670,height=520,toolbar=no');
    wpen.focus();
}