﻿//
//change the text below to reflect your own,
var before=""
var current=""
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function countdown(yr,m,d)
{
	theyear=yr;themonth=m;theday=d
	var today=new Date()
	var todayy=today.getYear()
	if (todayy < 1000)
	todayy+=1900
	var todaym=today.getMonth()
	var todayd=today.getDate()
	var todayh=today.getHours()
	var todaymin=today.getMinutes()
	var todaysec=today.getSeconds()
	var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
	futurestring=montharray[m-1]+" "+d+", "+yr
	dd=Date.parse(futurestring)-Date.parse(todaystring)
	dday=Math.floor(dd/(60*60*1000*24)*1) 
	dday=(parseFloat(dday)+1);
	dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
	dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
	dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
	document.getElementById("lbldays").innerText= dday
	document.getElementById("lblhrs").innerText= dhour
	document.getElementById("lblmins").innerText= dmin
	document.getElementById("lblsecs").innerText= dsec
	setTimeout("countdown(theyear,themonth,theday)",1000)
}


// JScript File
function Void()
{
    //WReturn = window.showModalDialog("Include/SendFriendMail.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    var divSelect = document.getElementById("divSelect1");
    var divModalBG =  document.getElementById ('divModalBGS');
    var scrollWidth, scrollHeight;
    var winW = 400, winH = 300;
    
    winW = document.body.scrollWidth;
    winH = document.body.scrollWidth;
    
    getPageSizeWithScroll();
    
    if (winW==0)
        winW = window.innerWidth;
    if (winH==0)
        winH = window.innerHeight;
    
    scrollWidth = 500;
    scrollHeight = 230;    
    scrollWidth = document.body.scrollWidth;
    scrollHeight = document.body.scrollHeight;
    
    if (scrollHeight==0)
        scrollHeight=(window.innerHeight/2);
   	        
    
   with(divSelect.style)
    {
        left = 350 + 'px' ;
        top = 200 + 'px';
        position = 'absolute';
        display = 'block';
        zIndex = 102;
    }
    with(divModalBG.style)
    {
        position='absolute';
        display='';
        left = 0 + 'px';
        top = 0 + 'px';
        height = yWithScroll + 'px';
        width = xWithScroll + 'px';
        zIndex = 100;
    }
                
    var framAtnPick = document.getElementById("framAtnPick1");
    framAtnPick.src = 'include/SendFriendMail.aspx';
    framAtnPick.style.display = '';
    return;
}
function MonthlyAcknowledgement()
{
    //WReturn = window.showModalDialog("Include/SendFriendMail.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    var divSelect = document.getElementById("divSelectAck");
    var divModalBG =  document.getElementById ('divModalBGSAck');
    var scrollWidth, scrollHeight;
    var winW = 500, winH = 300;
    
    winW = document.body.scrollWidth;
    winH = document.body.scrollWidth;
    
    getPageSizeWithScroll();
    
    if (winW==0)
        winW = window.innerWidth;
    if (winH==0)
        winH = window.innerHeight;
    
    scrollWidth = 500;
    scrollHeight = 230;    
    scrollWidth = document.body.scrollWidth;
    scrollHeight = document.body.scrollHeight;
    
    if (scrollHeight==0)
        scrollHeight=(window.innerHeight/2);
   	        
    
   with(divSelect.style)
    {
        left = 250 + 'px' ;
        top = 350 + 'px';
        position = 'absolute';
        display = 'block';
        zIndex = 102;
    }
    with(divModalBG.style)
    {
        position='absolute';
        display='';
        left = 0 + 'px';
        top = 0 + 'px';
        height = yWithScroll + 'px';
        width = xWithScroll + 'px';
        zIndex = 100;
    }
                
    var framAtnPick = document.getElementById("framAtnPickAck");
    framAtnPick.src = 'include/GameAcknowledgement.aspx?ack=M';
    framAtnPick.style.display = '';
    return false;
}
function gameAcknowledgement()
{
    //WReturn = window.showModalDialog("Include/SendFriendMail.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    var divSelect = document.getElementById("divSelectAck");
    var divModalBG =  document.getElementById ('divModalBGSAck');
    var scrollWidth, scrollHeight;
    var winW = 500, winH = 300;
    
    winW = document.body.scrollWidth;
    winH = document.body.scrollWidth;
    
    getPageSizeWithScroll();
    
    if (winW==0)
        winW = window.innerWidth;
    if (winH==0)
        winH = window.innerHeight;
    
    scrollWidth = 500;
    scrollHeight = 230;    
    scrollWidth = document.body.scrollWidth;
    scrollHeight = document.body.scrollHeight;
    
    if (scrollHeight==0)
        scrollHeight=(window.innerHeight/2);
   	        
    
   with(divSelect.style)
    {
        left = 250 + 'px' ;
        top = 350 + 'px';
        position = 'absolute';
        display = 'block';
        zIndex = 102;
    }
    with(divModalBG.style)
    {
        position='absolute';
        display='';
        left = 0 + 'px';
        top = 0 + 'px';
        height = yWithScroll + 'px';
        width = xWithScroll + 'px';
        zIndex = 100;
    }
                
    var framAtnPick = document.getElementById("framAtnPickAck");
    framAtnPick.src = 'include/GameAcknowledgement.aspx?ack=I';
    framAtnPick.style.display = '';
    return false;
}
function gameInstructions()
{
    //WReturn = window.showModalDialog("Include/SendFriendMail.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    var divSelect = document.getElementById("divSelectIns1");
    var divModalBG =  document.getElementById ('divModalBGSIns1');
    var scrollWidth, scrollHeight;
    var winW = 500, winH = 300;
    
    winW = document.body.scrollWidth;
    winH = document.body.scrollWidth;
    
    getPageSizeWithScroll();
    
    if (winW==0)
        winW = window.innerWidth;
    if (winH==0)
        winH = window.innerHeight;
    
    scrollWidth = 500;
    scrollHeight = 230;    
    scrollWidth = document.body.scrollWidth;
    scrollHeight = document.body.scrollHeight;
    
    if (scrollHeight==0)
        scrollHeight=(window.innerHeight/2);
   	        
    
   with(divSelect.style)
    {
        left = 250 + 'px' ;
        top = 350 + 'px';
        position = 'absolute';
        display = 'block';
        zIndex = 102;
    }
    with(divModalBG.style)
    {
        position='absolute';
        display='';
        left = 0 + 'px';
        top = 0 + 'px';
        height = yWithScroll + 'px';
        width = xWithScroll + 'px';
        zIndex = 100;
    }
                
    var framAtnPick = document.getElementById("framAtnPickIns1");
    framAtnPick.src = 'include/GameInstruction.aspx?ins=G';
    framAtnPick.style.display = '';
    return false;
}
function CloseAckPage()
{
     var framAtnPick = window.parent.document.getElementById("framAtnPickAck");
     var divSelect = window.parent.document.getElementById("divSelectAck");
     var divModalBG =  window.parent.document.getElementById ('divModalBGSAck');
     framAtnPick.style.display = 'none';
     divSelect.style.display = 'none';
     divModalBG.style.display = 'none';
     return false;
}
function CloseInsPage1()
{
    var framAtnPick = window.parent.document.getElementById("framAtnPickIns1");
     var divSelect = window.parent.document.getElementById("divSelectIns1");
     var divModalBG =  window.parent.document.getElementById ('divModalBGSIns1');
     framAtnPick.style.display = 'none';
     divSelect.style.display = 'none';
     divModalBG.style.display = 'none';
     return false;
}
function AutoInstructions()
{
    //WReturn = window.showModalDialog("Include/SendFriendMail.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    var divSelect = document.getElementById("divSelectIns");
    var divModalBG =  document.getElementById ('divModalBGSIns');
    var scrollWidth, scrollHeight;
    var winW = 500, winH = 300;
    
    winW = document.body.scrollWidth;
    winH = document.body.scrollWidth;
    
    getPageSizeWithScroll();
    
    if (winW==0)
        winW = window.innerWidth;
    if (winH==0)
        winH = window.innerHeight;
    
    scrollWidth = 500;
    scrollHeight = 230;    
    scrollWidth = document.body.scrollWidth;
    scrollHeight = document.body.scrollHeight;
    
    if (scrollHeight==0)
        scrollHeight=(window.innerHeight/2);
   	        
    
   with(divSelect.style)
    {
        left = 250 + 'px' ;
        top = 350 + 'px';
        position = 'absolute';
        display = 'block';
        zIndex = 102;
    }
    with(divModalBG.style)
    {
        position='absolute';
        display='';
        left = 0 + 'px';
        top = 0 + 'px';
        height = yWithScroll + 'px';
        width = xWithScroll + 'px';
        zIndex = 100;
    }
                
    var framAtnPick = document.getElementById("framAtnPickIns");
    framAtnPick.src = 'include/AutoplayInstructions.aspx';
    framAtnPick.style.display = '';
    return false;
}
function CloseInsPage()
{
    var framAtnPick = document.getElementById("framAtnPickIns");
     var divSelect = document.getElementById("divSelectIns");
     var divModalBG =  document.getElementById ('divModalBGSIns');;
     framAtnPick.style.display = 'none';
     divSelect.style.display = 'none';
     divModalBG.style.display = 'none';
     return false;
}
function ClosePageforSendfriend()
{
    var framAtnPick = document.getElementById("framAtnPick1");
     var divSelect = document.getElementById("divSelect1");
     var divModalBG =  document.getElementById ('divModalBGS');;
     framAtnPick.style.display = 'none';
     divSelect.style.display = 'none';
     divModalBG.style.display = 'none';
     return false; 
}
function CheckLog(pId,pval)
{
    if(document.getElementById(pId).value == "true")
    {
//        WReturn = window.showModalDialog("Include/login.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:165px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
//        if(WReturn != null && WReturn != undefined){
//            if(WReturn.Check == "true"){
//                if(pval == "P")
//                    window.location.href="ActiveCompetitions.aspx";
//                else
//                    window.location.href="MembershipZone.aspx";
//            }else if(WReturn.Check == "Reg"){
//                window.location.href="MemberRegister.aspx";
//            }else{
//                window.location.href="ActiveCompetitions.aspx";
//            }
//        }
            var divSelect = document.getElementById("divSelect");
            var divModalBG =  document.getElementById ('divModalBG');
            var scrollWidth, scrollHeight;
            var winW = 400, winH = 300;
            
    		winW = document.body.scrollWidth;
            winH = document.body.scrollWidth;
            
            getPageSizeWithScroll();
            
            if (winW==0)
                winW = window.innerWidth;
            if (winH==0)
                winH = window.innerHeight;
            
            scrollWidth = 500;
            scrollHeight = 230;    
            scrollWidth = document.body.scrollWidth;
            scrollHeight = document.body.scrollHeight;
            
            if (scrollHeight==0)
                scrollHeight=(window.innerHeight/2);
           	        
            
           with(divSelect.style)
            {
                left = 350 + 'px' ;
                top = 200 + 'px';
                position = 'absolute';
                display = 'block';
                zIndex = 102;
            }
            with(divModalBG.style)
	        {
	            position='absolute';
	            display='';
	            left = 0 + 'px';
	            top = 0 + 'px';
	            height = yWithScroll + 'px';
	            width = xWithScroll + 'px';
	            zIndex = 100;
	        }
                        
	        var framAtnPick = document.getElementById("framAtnPick");
	        framAtnPick.src = 'include/login.aspx?pId='+pval;
   	        framAtnPick.style.display = '';
   	        return false;
    }
    else
    {
        if(pval == "P")
            window.location.href="ActiveCompetitions.aspx";
        else
            window.location.href="MembershipZone.aspx";
    }
}
function ClosePage()
{
    var framAtnPick = document.getElementById("framAtnPick");
     var divSelect = document.getElementById("divSelect");
     var divModalBG =  document.getElementById ('divModalBG');;
     framAtnPick.style.display = 'none';
     divSelect.style.display = 'none';
     divModalBG.style.display = 'none';
     return false; 
}
function promptClosePage()
{
    window.parent.location = "ActiveCompetitions.aspx";
}
function cancelClosePage()
{
    window.parent.location = "ActiveCompetitions.aspx";
}
function NewRegister()
{
    var framAtnPick = window.parent.document.getElementById("framAtnPickP");
    var divSelect = window.parent.document.getElementById("divSelectP");
    var divModalBG = window.parent.document.getElementById ('divModalBGP');
   // window.parent.document.getElementById ('hidCheck').value="NO";
    framAtnPick.style.display = 'none';
    divSelect.style.display = 'none';
    divModalBG.style.display = 'none';
    return false;     
}

function getPageSizeWithScroll()
{     
	if (window.innerHeight && window.scrollMaxY) {// Firefox         
		yWithScroll = window.innerHeight + window.scrollMaxY;         
		xWithScroll = window.innerWidth + window.scrollMaxX;     
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{ // all but Explorer Mac         
		yWithScroll = document.body.scrollHeight;         
		xWithScroll = document.body.scrollWidth;     
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari         
		yWithScroll = document.body.offsetHeight;         
		xWithScroll = document.body.offsetWidth;       
	}     
}
function CheckLogPassword()
{
        WReturn = window.showModalDialog("Include/ChangePassword.aspx",null,"dialogWIDTH:380px;dialogHEIGHT:200px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
        return false;
}
function MembershipZoneValidation(pId,pParterlistID)
{
    m_TxtNewTeam = document.getElementById(pId);
    m_txtParterlistID = document.getElementById(pParterlistID);
    if(m_TxtNewTeam != null){
        if(trim(m_TxtNewTeam.value) == "")
        {
            alert("Please enter the valid Team Name.");
            m_TxtNewTeam.focus();
            return false;
        }
    }
    
    if(m_txtParterlistID.value == "Select")
    {
        alert("Please select the Patner Name.");
        m_txtParterlistID.focus();
        return false;
    }
    return true;
}
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
function closeWindow()
{
 window.close();
}
function PersonalDetailsValidation(pNewEmail,pConfirmEmail,pLine1,pCity,pClubname,pCountry,pCounty,PdrpROICounty,PdrpUKCounty,pZipCode,pPhone,pHandicap)
{
    NewEmail = document.getElementById(pNewEmail);
    ConfirmEmail = document.getElementById(pConfirmEmail);
    Line1 = document.getElementById(pLine1);
    City = document.getElementById(pCity);
    ClubName=document.getElementById(pClubname);
    Country = document.getElementById(pCountry);
    county=document.getElementById(pCounty);
    Ukcounty=document.getElementById(PdrpUKCounty);
    ROIcounty=document.getElementById(PdrpROICounty);
    ZipCode=document.getElementById(pZipCode);
    Phone = document.getElementById(pPhone);
    Handicap = document.getElementById(pHandicap);
    
    if(trim(NewEmail.value) == "")
    {
        alert("Please enter the Email.")
        NewEmail.focus();
        return false;
    }
    if(trim(NewEmail.value) != "")
    {
        if(!chkEmailIds(NewEmail,'Email.'))		
        return false;
    }
    if(trim(ConfirmEmail.value) == "")
    {
        alert("Please enter the Confirm Email.")
        ConfirmEmail.focus();
        return false;
    }
    if(trim(ConfirmEmail.value) != "")
    {
        if(!chkEmailIds(ConfirmEmail,'Confirm Email.'))		
        return false;
    }
    if(NewEmail.value != ConfirmEmail.value)
    {
        alert("Email and Confirm Email are different.");
        ConfirmEmail.focus();
        return false; 
    }
    if(trim(Line1.value) == "")
    {
        alert("Please enter the Address 1.")
        Line1.focus();
        return false;
    }
    if(trim(City.value) == "")
    {
        alert("Please enter the City.")
        City.focus();
        return false;
    }
    if(trim(Phone.value) == "")
    {
        alert("Please enter the phone.");
        Phone.focus();
        return false; 
    }
    if(trim(Country.value) == "")
    {
        alert("Please select the Country.");
        Country.focus();
        return false; 
    }
    if(trim(Country.value) == "United Kingdom"){
        if(trim(Ukcounty.value) == "")
        {
            alert("Please select the County.");
            Ukcounty.focus();
            return false; 
        }
    }
     if(trim(Country.value) == "Republic of Ireland"){
        if(trim(ROIcounty.value) == "")
        {
            alert("Please select the County.");
            ROIcounty.focus();
            return false; 
        }
    }
     if(trim(Country.value) == ""){
        if(trim(county.value) == "")
        {
            alert("Please select the County.");
            county.focus();
            return false; 
        }
    }
    if(trim(ClubName.value) == "")
    {
        alert("Please enter the Club Name.");
        ClubName.focus();
        return false; 
    }
    if(Country.value == "United Kingdom")
    {
        if(trim(ZipCode.value) == "")
        {
            alert("Please enter the Postcode / ZIP.")
            ZipCode.focus();
            return false;
        }
    }
//    if(trim(Handicap.value) != "")
//    {
//        if(isNaN(trim(Handicap.value)))
//        {
//            alert("Please enter the valid club handicap.");
//            Handicap.focus();
//            return false;
//        }
//    }
    return true;
}
function PasswordValidation(pOldPassword,pNewPassword,pConfirmPassword)
{
    OldPassword = document.getElementById(pOldPassword);
    NewPassword = document.getElementById(pNewPassword);
    ConfirmPassword = document.getElementById(pConfirmPassword);
    if(trim(OldPassword.value) == "")
    {
        alert("Please enter the Old Password.");
        OldPassword.focus();
        return false;
    }
    if(trim(NewPassword.value) == "")
    {
        alert("Please enter the Password.");
        NewPassword.focus();
        return false;
    }
    if(trim(NewPassword.value).length < 5)
    {
       alert("Password must be more than 4 characters.");
       NewPassword.focus();
       return false;
    }
    if(trim(ConfirmPassword.value) == "")
    {
         alert("Please enter the Confirm Password.");
        ConfirmPassword.focus();
        return false;
    }
    if(trim(ConfirmPassword.value).length < 5)
    {
       alert("Password must be more than 4 characters.");
       ConfirmPassword.focus();
       return false;
    }
    if(NewPassword.value!=ConfirmPassword.value)
    {
        alert("Password and Confirm Password are different.");
        ConfirmPassword.focus();
        return false;
    }
}


//Payment page
function credictcardValidation(Ctypeddl,Cnotxt,CsecCodetxt,exMonthddl,exYearddl,hNametxt,mon,year)
{
    if(document.getElementById('ctl00_ContentPlaceHolder1_m_tblcredictCard').style.display == 'block')
    {
        if(document.getElementById(Ctypeddl).selectedIndex <= 0)
        {
            alert("Please select the Card Type.");
            document.getElementById(Ctypeddl).focus();
            return false;        
        }
        if(trim(document.getElementById(Cnotxt).value) == "")
        {
            alert("Please enter the Card Number.");
            document.getElementById(Cnotxt).focus();
            return false;        
        } 
        else 
        {
            if(isNaN(trim(document.getElementById(Cnotxt).value)))
            {
                alert("Please enter a valid Card Number.");
                document.getElementById(Cnotxt).focus();
                return false; 
            }
            else
            {
                if(trim(document.getElementById(Cnotxt).value).length < 15)
                {
                    alert("Please enter a valid Card Number.");
                    document.getElementById(Cnotxt).focus();
                    return false; 
                }
            }
        }
        if(trim(document.getElementById(CsecCodetxt).value) == "")
        {
            alert("Please enter the Security Code.");
            document.getElementById(CsecCodetxt).focus();
            return false;        
        }
        else
        {
            if(isNaN(trim(document.getElementById(CsecCodetxt).value)))
            {
                alert("Please enter a valid Security Code.");
                document.getElementById(CsecCodetxt).focus();
                return false; 
            }
            else
            {
                if((trim(document.getElementById(CsecCodetxt).value).length >= 3) && (trim(document.getElementById(CsecCodetxt).value).length <= 4))
                {
                   
                }
                else
                {
                    alert("Please enter a valid Security Code.");
                    document.getElementById(CsecCodetxt).focus();
                    return false;
                }
            }
        }    
        if(document.getElementById(exMonthddl).selectedIndex <= 0)
        {
            alert("Please select the Expired Month.");
            document.getElementById(exMonthddl).focus();
            return false;        
        }
        if(document.getElementById(exYearddl).selectedIndex <= 0)
        {
            alert("Please select the Expired Year.");
            document.getElementById(exYearddl).focus();
            return false;        
        }
        if(document.getElementById(exYearddl).selectedIndex == 1)
        {
           if(document.getElementById(exMonthddl).selectedIndex < mon)
           {
            alert("Expiry month and year should not less than current month and year.");
            return false;
           }        
        }
        if(trim(document.getElementById(hNametxt).value) == "")
        {
            alert("Please enter the Cardholder Name.");
            document.getElementById(hNametxt).focus();
            return false;        
        }
    }
    return true;
}
function showtable(rdCredictcard,tblPayment,tblCC)
{
    if(document.getElementById(rdCredictcard).checked == true)
    {
        document.getElementById(tblCC).style.display = 'block';
    }
    else
    {
        document.getElementById(tblCC).style.display = 'none';
    }
}
function EnableCardDetails(tblPament,rdPayment,rdRedeem)
{
    if(document.getElementById(rdPayment).checked == true)
    {
        document.getElementById(tblPament).style.display = 'block';
        document.getElementById(rdRedeem).checked = false; 
        document.getElementById(rdPayment).checked = true; 
    }      
}
function DisableCardDetails(tblPament,rdPayment,rdRedeem)
{
    if(document.getElementById(rdRedeem).checked == true)
    {
        document.getElementById(tblPament).style.display = 'none';
        document.getElementById(rdPayment).checked = false; 
        document.getElementById(rdRedeem).checked = true; 
    }   
   
}
function ValidateCardDetails(tblPament,rdPayment,rdRedeem,ddlCardType,CardNumber,SecurityCode,ddlMonth,ddlYear,HolderName,Month,Year)
{   
    if(document.getElementById(tblPament).style.display == 'block')
    {
        if(document.getElementById(ddlCardType).selectedIndex <= 0)
        {
            alert("Please select the Card Type.");
            document.getElementById(ddlCardType).focus();
            return false;        
        }
        if(trim(document.getElementById(CardNumber).value) == "")
        {
            alert("Please enter the Card Number.");
            document.getElementById(CardNumber).focus();
            return false;        
        } 
        else 
        {
            if(isNaN(trim(document.getElementById(CardNumber).value)))
            {
                alert("Please enter a valid Card Number.");
                document.getElementById(CardNumber).focus();
                return false; 
            }
            else
            {
                if((trim(document.getElementById(CardNumber).value).length < 12 ) || (trim(document.getElementById(CardNumber).value).length > 19))
                {
                    alert("Please enter a valid Card Number.");
                    document.getElementById(CardNumber).focus();
                    return false; 
                }
                var number = trim(document.getElementById(CardNumber).value);
                var i, sum, weight;
                sum=0;
                for (i = 0; i < number.length - 1; i++) {
                weight = number.substr(number.length - (i + 2), 1) * (2 - (i % 2));
                sum += ((weight < 10) ? weight : (weight - 9));
                }
                if (parseInt(number.substr(number.length-1)) == ((10 - sum % 10) % 10)) {
                //return true;
                } else {
                alert("Card Number Is Not Valid");
                return false;
                }
                // Card validation here....
            }
        }
        if(trim(document.getElementById(SecurityCode).value) == "")
        {
            alert("Please enter the Security Code.");
            document.getElementById(SecurityCode).focus();
            return false;        
        }
        else
        {
            if(isNaN(trim(document.getElementById(SecurityCode).value)))
            {
                alert("Please enter a valid Security Code.");
                document.getElementById(SecurityCode).focus();
                return false; 
            }
            else
            {
                if((trim(document.getElementById(SecurityCode).value).length >= 3) && (trim(document.getElementById(SecurityCode).value).length <= 4))
                {
                   
                }
                else
                {
                    alert("Please enter a valid Security Code.");
                    document.getElementById(SecurityCode).focus();
                    return false;
                }
            }
        } 
        if(document.getElementById(ddlMonth).selectedIndex <= 0)
        {
            alert("Please select the Expired Month.");
            document.getElementById(ddlMonth).selectedIndex = 0;
            return false;        
        }
        if(document.getElementById(ddlYear).selectedIndex <= 0)
        {
            alert("Please select the Expired Year.");
            document.getElementById(ddlYear).selectedIndex = 0;
            return false;        
        }
        if(document.getElementById(ddlYear).selectedIndex == 1)
        {
           if(document.getElementById(ddlMonth).selectedIndex < Month)
           {
            alert("Expiry month and year should not less than current month and year.");
            return false;
           }        
        }
        if(trim(document.getElementById(HolderName).value) == "")
        {
            alert("Please enter the Cardholder Name.");
            document.getElementById(HolderName).focus();
            return false;        
        } 
    } 
    return true;
}
function ShowSecurityCode()
{
    var win = open("Images/CardVerificationNumbers.gif","", "width=400,height=300")
    win.moveTo(350,300);  
    return false;      
}
function showcode()
{
    //window.open("../Images/CardVerificationNumbers.gif","" ,"Height=150; Width=140;");
    WReturn = window.showModalDialog("Images/CardVerificationNumbers.gif",null,"dialogWIDTH:500px;dialogHEIGHT:300px;help:0;SCROLL:1;RESIZABLE:0;STATUS:0")
    //window.moveTo(200,200);
    return false;
}

//Redeem voucher page

function checkRedeemSubmit(hdTotal,hdRedeemed)
{   
    if(parseInt(document.getElementById(hdTotal).value) >  parseInt(document.getElementById(hdRedeemed).value))
    {
        alert("You have pending amount to redeem."); 
        return false;
    }
    return true;
}
function cancelConfirm()
{
    return confirm("Are you sure to cancel redeem voucher.");
}

function ckBtnAdd(txtCode)
{
    if(trim(document.getElementById(txtCode).value) == "")
    {
        alert("Please enter voucher code to redeem.");
        document.getElementById(txtCode).focus();
        return false;
    }
}