//var fullurl = window.location.href;
//var fulllist = fullurl.split('?');
//var url = window.location.hostname;
//var list = url.split('.');
//if(window.location.protocol != "https:" && list[0] == 'futurarewards')
//{
//    if(fulllist[1] == null)
//        window.location ="https://www." + window.location.hostname +":"+ window.location.port  + window.location.pathname;
//    else
//        window.location ="https://www." + window.location.hostname +":"+ window.location.port  + window.location.pathname + "?" + fulllist[1];
//}
//else if(window.location.protocol != "https:" && list[0] == 'primesfutura')
//{
//    if(fulllist[1] == null)
//        window.location ="https://www." + window.location.hostname +":"+ window.location.port  + window.location.pathname;
//    else    
//        window.location ="https://www." + window.location.hostname +":"+ window.location.port  + window.location.pathname + "?" + fulllist[1];
//}
//else if(window.location.protocol != "https:" && list[0] == 'www')
//{
//    if(fulllist[1] == null)
//        window.location ="https://" + window.location.hostname +":"+ window.location.port  + window.location.pathname;
//    else
//        window.location ="https://" + window.location.hostname +":"+ window.location.port  + window.location.pathname + "?" + fulllist[1];
//}

function DisableButton(b)
{
   if(b.disabled == true)
   {
   }
   else
   {
      b.disabled = true;
      //b.form.submit();
      __doPostBack('submit_confirm', '');
   }
}

function CheckPayout()
{
        //document.getElementById("CancelPayout").style.display = '';
        //document.getElementById("CancelTransfer").style.display = '';
        //var button = document.getElementById("submit_form");
        //alert("TEST");
        if (document.getElementById("cPayout").checked == true)
        {
            if (document.getElementById("cPayout").disabled == false)
            {
                document.getElementById("submit_form").disabled = false;
            }
        }
        else if (document.getElementById("cPayout").checked == false)
        {
            if (document.getElementById("cTransfer").checked == false)
            {
                document.getElementById("submit_form").disabled = true;
            }
        }
}
function CheckTransfer()
{
        //document.getElementById("CancelPayout").style.display = '';
        //document.getElementById("CancelTransfer").style.display = '';
        //var button = document.getElementById("submit_form");
        //alert("TEST");
        if (document.getElementById("cTransfer").checked == true)
        {
            if (document.getElementById("cTransfer").disabled == false)
            {
                document.getElementById("submit_form").disabled = false;
            }
        }
        else if (document.getElementById("cTransfer").checked == false)
        {
            if (document.getElementById("cPayout").checked == false)
            {
                document.getElementById("submit_form").disabled = true;
            }
        }
}
function validate()
{
        //document.getElementById("CancelPayout").style.display = '';
        //document.getElementById("CancelTransfer").style.display = '';
        //var button = document.getElementById("submit_form");
        confirm("Are you sure you want to proceed?");
}

function show()
{
        document.getElementById("CancelPayout").style.display = '';
        document.getElementById("CancelTransfer").style.display = '';
        document.getElementById("submit_form").disabled = true;
        document.getElementById("cPayout").checked = false;
        document.getElementById("cTransfer").checked = false;
        //var button = document.getElementById("submit_form");
}

function hide()
{
        document.getElementById("CancelPayout").style.display = 'none';
        document.getElementById("CancelTransfer").style.display = 'none';
        document.getElementById("submit_form").disabled = false;
}

function doClick(buttonName,e)
    {
//the purpose of this function is to allow the enter key to 
//point to the correct button to click.
        var key;

         if(window.event)
              key = window.event.keyCode;     //IE
         else
              key = e.which;     //firefox
    
        if (key == 13)
        {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null)
            { //If we find the button click it
                btn.click();
                event.keyCode = 0
            }
        }
}


function dayminus(obj) {
    obj.value--;
    if (obj.value < 1){
        obj.value = 1;
    }
    
    if (obj.value.length < 2 ){
        obj.value = '0' + obj.value;
    }
}

function daycheck(obj) {

    if (obj.value < 1){
        obj.value = 1;
    }
    if (obj.value > 31){
        obj.value = 31;
    }
    if (obj.value.length < 2 ){
        obj.value = "0" + obj.value;
    }
    if (! isNumeric(obj.value)){
        obj.value = "01";
    }
}

function dayplus(obj) {
    obj.value++;
    if (obj.value > 31){
        obj.value = 31;
    }
    
    if (obj.value.length < 2 ){
        obj.value = "0" + obj.value;
    }
}

function monthminus(obj) {
    if (obj.value == "Jan"){
        obj.value = "Dec";
    }else if (obj.value == "Feb"){
        obj.value = "Jan";
    }else if (obj.value == "Mar"){
        obj.value = "Feb";
    }else if (obj.value == "Apr"){
        obj.value = "Mar";
    }else if (obj.value == "May"){
        obj.value = "Apr";
    }else if (obj.value == "Jun"){
        obj.value = "May";
    }else if (obj.value == "Jul"){
        obj.value = "Jun";
    }else if (obj.value == "Aug"){
        obj.value = "Jul";
    }else if (obj.value == "Sep"){
        obj.value = "Aug";
    }else if (obj.value == "Oct"){
        obj.value = "Sep";
    }else if (obj.value == "Nov"){
        obj.value = "Oct";
    }else if (obj.value == "Dec"){
        obj.value = "Nov";
    }
}
function monthplus(obj) {

    if (obj.value == "Jan"){
        obj.value = "Feb";
    }else if (obj.value == "Feb"){
        obj.value = "Mar";
    }else if (obj.value == "Mar"){
        obj.value = "Apr";
    }else if (obj.value == "Apr"){
        obj.value = "May";
    }else if (obj.value == "May"){
        obj.value = "Jun";
    }else if (obj.value == "Jun"){
        obj.value = "Jul";
    }else if (obj.value == "Jul"){
        obj.value = "Aug";
    }else if (obj.value == "Aug"){
        obj.value = "Sep";
    }else if (obj.value == "Sep"){
        obj.value = "Oct";
    }else if (obj.value == "Oct"){
        obj.value = "Nov";
    }else if (obj.value == "Nov"){
        obj.value = "Dec";
    }else if (obj.value == "Dec"){
        obj.value = "Jan";
    }
        
}


function yearminus(obj) {
    obj.value--;
}

function yearcheck(obj) {
    if (obj.value < 1){
        obj.value = 1;
    }
    if (obj.value > 2050){
        obj.value = 2050;
    }
    if (! isNumeric(obj.value)){
        obj.value = "2000";
    }
}

function yearplus(obj) {
    obj.value++;
}

function isNumeric(value) {
  if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
  return true;
}

