﻿    function OpenNewWindow(strURL){
        window.open(''+ strURL + '','','toolbar=no,status=no,width=850,height=605,directories=no,scrollbars=no,location=no,resizable=no,menubar=no')
    }
    function OpenNewWindowSmall(strURL){
        window.open(''+ strURL + '','','toolbar=no,status=no,width=600,height=650,directories=no,scrollbars=no,location=no,resizable=no,menubar=no')
    }
    function OpenNewWindowXSmall(strURL){
        window.open(''+ strURL + '','','toolbar=no,status=no,width=500,height=300,directories=no,scrollbars=no,location=no,resizable=no,menubar=no')
    }
    function OpenNewWindowLarge(strURL){
        window.open(''+ strURL + '','','toolbar=no,status=no,width=1010,height=700,directories=no,scrollbars=yes,location=no,resizable=no,menubar=no')
    }
    function OpenFullWindowLarge(strURL){
        window.open(''+ strURL + '','','toolbar=yes,status=yes,width=1010,height=700,directories=yes,scrollbars=yes,location=yes,resizable=yes,menubar=yes')
    }
    function OpenWhatsThis(strURL){
        window.open(''+ strURL + '','','toolbar=no,status=no,width=500,height=125,directories=no,scrollbars=no,location=no,resizable=no,menubar=no')
    }
    function addCommas(nStr)
    {
	    nStr += '';
	    x = nStr.split('.');
	    x1 = x[0];
	    x2 = x.length > 1 ? '.' + x[1] : '';
	    var rgx = /(\d+)(\d{3})/;
	    while (rgx.test(x1)) {
		    x1 = x1.replace(rgx, '$1' + ',' + '$2');
	    }
	    return x1 + x2;
    }
            function ParseInfo(objField){
	            var strInfo=objField.value;
                if(strInfo!=''){
                    if(strInfo.indexOf("^")>-1){
                        var mySplitResult = strInfo.split("^");
                        if(mySplitResult.length>-1){
                            var strFieldValue = mySplitResult[0].replace("%B","");
                            objField.value = strFieldValue.replace(/ /g,"");
                        }
                        if(mySplitResult.length>0){
                            var strName=mySplitResult[1];
                            if(strInfo.indexOf("/")>-1){
                                var mySplitName = strName.split("/");
                                if(mySplitName.length>-1){
                                    objLName = document.getElementById("ctl00_ContentPlaceHolder1_Cardholder_Last_Name");
                                    objLName.value = mySplitName[0].replace(/ /g,"");
                                }
                                if(mySplitName.length>0){
                                    objFName = document.getElementById("ctl00_ContentPlaceHolder1_Cardholder_First_Name");
                                    var strFName = mySplitName[1].replace(" ","");
                                    var mySplitFirstName = strFName.split(" ");
                                    if(mySplitFirstName.length>-1){
                                        strFName = mySplitFirstName[0].replace(/ /g,"");
                                    }
                                    objFName.value = strFName
                                }
                            }
                        }
                        if(mySplitResult.length>1){
                            var strDate = mySplitResult[2].replace(/ /g,"");
                            if(strDate.length>3){
                                var objYear = document.getElementById("ctl00_ContentPlaceHolder1_Expiration_Year");
                                var objMonth = document.getElementById("ctl00_ContentPlaceHolder1_Expiration_Month");
                                var strYear='20'+Mid(strDate,0,2);
                                var strMonth=Mid(strDate,2,2);
                                if(strMonth.indexOf("0")==0){
                                    strMonth=Mid(strMonth,1,1);
                                }
                                SelectIT(objYear,strYear);
                                SelectIT(objMonth,strMonth);
                            }
                        }
                    }
                }
            }
            function KeyCheck(objField)
            {
                var KeyID = event.keyCode;
                switch(KeyID)
                {
                    case 13:
                    ParseInfo(objField);
                    break;
                }
            }
            function Mid(str, start, len)
            {
                    if (start < 0 || len < 0) return "";
                    var iEnd, iLen = String(str).length;
                    if (start + len > iLen)
                        iEnd = iLen;
                    else
                        iEnd = start + len;
                    return String(str).substring(start,iEnd);
            }
            function SelectIT(selectItem, strValue){
                for(var i=0; i < selectItem.options.length; i++){
                    if (selectItem.options[i].value == strValue){
                        selectItem.selectedIndex=i;
                    }
                }
            }
   function KeepOneDemo(varGroupID){
        if(varGroupID==3){
            document.getElementById("ctl00_ContentPlaceHolder1_rpDemoGroups_ctl04_rbDemoOther").checked=false;
        }
        if(varGroupID==4){
            document.getElementById("ctl00_ContentPlaceHolder1_rpDemoGroups_ctl06_rbDemoOther").checked=false;
        }
   }
function KeepOneDemoOther(varGroupID){
    if(varGroupID==3){
        var i=0;
        for (i=0;i<=100;i++){
            try
            {
             document.getElementById("ctl00_ContentPlaceHolder1_rpDemoGroups_ctl04_rblDemoItems_" + i).checked=false;
            }
            catch(err)
            {
            }
        }
    }
    if(varGroupID==4){
        var i=0;
        for (i=0;i<=100;i++){
            try
            {
             document.getElementById("ctl00_ContentPlaceHolder1_rpDemoGroups_ctl06_rblDemoItems_" + i).checked=false;
            }
            catch(err)
            {
            }
        }
    }
}

function clicked(){
}
