﻿
var expiredate = new Date();
expiredate.setDate(expiredate.getDate() + 2)
//expiredate.setTime(expiredate.);

function SetSelectedStepBottom(_step, _cost) {

    set_cookie("Step_TierCookie", _step, expiredate);
    
    //if (typeof document.getElementById('ctl00_ContentPlaceHolder1_btnNext') != 'undefined') {
    //document.getElementById('ctl00_ContentPlaceHolder1_btnNext').disabled = false;
    //}

    set_cookie("Step_TierCost", _cost, expiredate);
    
    window.location = 'wedding-insurance-online-application.aspx';
    return false;
}
function SetSelectedStepTop(_step) {

    set_cookie("Step_TierCookie", _step, expiredate);

    //if (typeof document.getElementById('ctl00_ContentPlaceHolder1_btnNext') != 'undefined') {
    //document.getElementById('ctl00_ContentPlaceHolder1_btnNext').disabled = false;
    //}
    return true;
}
function SetSelectedStep(_step) {

    set_cookie("Step_TierCookie", _step, expiredate);

    //if (typeof document.getElementById('ctl00_ContentPlaceHolder1_btnNext') != 'undefined') {
    //document.getElementById('ctl00_ContentPlaceHolder1_btnNext').disabled = false;
    //}
    return true;
}
function SetSelectedStepHomePage(_step) {
    set_cookie("Step_TierCookie", _step, expiredate);
}


function SetAgree(_agree) {
    set_cookie("Step_AgreeCookie", _agree, expiredate);
}


//function CheckEnableAgree(_agree) {
//    if (get_cookie("Step_Convictions").value == true) {
//        alert('Cannot Unlock');
//    }
//    else {
//        alert('Unlock');
//        //document.getElementById('ctl00$ContentPlaceHolder1$btnNext').disabled = false;
//    }
//}


function SetConvictions(_agree) {
    set_cookie("Step_Convictions", _agree, expiredate);
}

function SetRefused(_agree) {
    set_cookie("Step_RefusedInsurance", _agree, expiredate);
}

function SetMedical(_agree) {
    set_cookie("Step_Medical", _agree, expiredate);
}

function SetApplicantCountry(_agree) {
    set_cookie("Step_ApplicantCountry", _agree, expiredate);
}

function SetSignUpAgreement(_agree) {
    set_cookie("Step_SignUpAgreement", _agree, expiredate);
}

function SetCeremonyCountry(_agree) {
    set_cookie("Step_CeremonyCountry", _agree, expiredate);
}

function SetReceptionCountry(_agree) {
    set_cookie("Step_ReceptionCountry", _agree, expiredate);
}

function EnableNextButtonStep4() {

    //alert('HERE');
    
    var Enable1 = false
    var Enable2 = false

    if (get_cookie("Step_CeremonyCountry").toString() == 'UK')
    {
        Enable1 = true
    }
    else
    {
        Enable1 = false
    }

    if (get_cookie("Step_ReceptionCountry").toString() != null && get_cookie("Step_ReceptionCountry").toString() == 'UK') {
        Enable2 = true
    }
    else {
        Enable2 = false
    }

    if (Enable1 == true && Enable2 == true) {
        document.getElementById('ctl00_ContentPlaceHolder1_btnNext').disabled = false;
        //alert('disabled = false ' + Enable1 + ' ' + Enable2);
    }
    else {
        document.getElementById('ctl00_ContentPlaceHolder1_btnNext').disabled = true;
        //alert('disabled = true' + Enable1 + ' ' + Enable2);
    }
    
}

//set_cookie("StepCookie", _step, expiredate);
function set_cookie(name, value, expires) {
    if (!expires) {
        expires = new Date()
        expires.setDate(expires.getDate() + 2)
    }
    document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/";
}

//get_cookie("StepCookie");
function get_cookie(cookie_name) {
    var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
    if (results) {
        return (unescape(results[2]));
    } else {
        return null;
    }
}

//delete_cookie("StepCookie");
function delete_cookie(name) {
    set_cookie(name, "", -1);
}



//  visit all cells in the specified column
function visitColumn(rows, index, callback) {
    for (var i = 0; i < rows.length; i++) {
        if (rows[i].cells[index] != null) {
            if (rows[i].cells[index].tagName != 'TH') {
                if (rows[i].cells[index] != rows[i].cells[0]) {
                    callback(rows[i].cells[index]);
                }
            }
        }
    }
}



function confirm_cancel() {
    if (confirm("Are you sure you want to cancel this policy?") == true)
        return true;
    else
        return false;
}





function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}

function EnumProperties(object) {
    var Div = document.createElement("DIV");
    Div.style.width = 300;
    Div.style.height = '100%';
    Div.style.position = "fixed";
    Div.style.backgroundColor = "FFF";
    Div.style.left = 0;
    Div.style.top = 0;
    Div.style.paddingLeft = '3px';
    Div.id = "EnumPropertiesDiv"
    Div.style.zIndex = 999999999999;
    Div.style.overflowY = "auto";
    Div.innerHTML = '<div style="width: 303px; top: 0px; left: 0px;position: fixed; background-color: #000; color: #FFF; text-align: center" onclick="document.body.removeChild(document.getElementById(' + "'EnumPropertiesDiv'" + '))">[Close]</div><br/>';
    var properties = [];
    var j = 0;
    if (object) {
        for (var i in object) {
            properties[j] = i;
            j++;
        }
    }
    if (properties.length > 0) {
        properties.sort();
        var j = 0;
        for (var i in properties) {
            Div.innerHTML += properties[j] + "<br />";
            j++;
        }
    } else {
        Div.innerHTML += "<br>NONE</br>"
    }
    document.body.appendChild(Div);
}




//function SetDateValue_ApplicantDOB(s,e) {
//    var item = s.GetValue();

//    alert('1')
//    
//    alert('DAY selected list is : ' + ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Day.GetValue());
//    alert('MONTH selected list is : ' + ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Month.GetValue());
//    alert('YEAR selected list is : ' + ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Year.GetValue());

//    alert('1')
//    
//    var Day = ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Day.GetValue();
//    var Month = ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Month.GetValue();
//    var Year = ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB_Year.GetValue();


//    ctl00_ContentPlaceHolder1_ctlWizardStep_dddApplicant_DOB.SetValue('JAMES')//Day + '/' + Month + '/' + Year)
//}
    