﻿
        function fjs_checklogin(val)
        {
            var old = document.aspnetForm.crOldPassword.value    
            var ses = document.aspnetForm.crSessPassword.value
            
            document.aspnetForm.crAlertOldPass.value = '';
            
            if(old!=ses)
            {
                document.aspnetForm.crAlertOldPass.value = 'Old Password is Wrong!';
                document.aspnetForm.crOldPassword.value = '';
                document.aspnetForm.crOldPassword.focus();
            }else{
                document.aspnetForm.crPassword.focus();
            }
        }
        
        function fjs_customersubmit()
        {
            var test = true;
            var where = document.aspnetForm.crCt.value;
            var check = document.aspnetForm.crCheckResult.value;
            
            if(check=='0')
            {
                if(where=="i")
                {
                    if(document.aspnetForm.crUsername.value=='')
                    {
                        document.aspnetForm.crAlertUsername.value = 'Required';
                        document.aspnetForm.crUsername.focus();
                        test=false;
                    }
                }else{
                    var old = document.aspnetForm.crOldPassword.value    
                    var ses = document.aspnetForm.crSessPassword.value
                    
                    document.aspnetForm.crAlertOldPass.value = '';
                    
                    if(old!=ses)
                    {
                        document.aspnetForm.crAlertOldPass.value = 'Old Password is Wrong!';
                        document.aspnetForm.crOldPassword.focus();
                        test=false;
                    }
                    
                    if(document.aspnetForm.crOldPassword.value=='')
                    {
                        document.aspnetForm.crAlertOldPass.value = 'Required!';
                        document.aspnetForm.crOldPassword.focus();
                        test=false;
                    }
                }
                
                var newe = document.aspnetForm.crPassword.value
                var renew = document.aspnetForm.crRetryPassword.value
                
                document.aspnetForm.crAlertPass1.value = '';   
                
                if(newe!=renew)
                {
                    document.aspnetForm.crAlertPass1.value = 'Password not same';
                    test=false;
                }
                
                if(document.aspnetForm.crPassword.value=='')
                {
                    document.aspnetForm.crAlertPass.value = 'Required!';
                    document.aspnetForm.crPassword.focus();
                    test=false;
                }
                
                if(document.aspnetForm.crRetryPassword.value=='')
                {
                    document.aspnetForm.crAlertPass1.value = 'Required!';
                    document.aspnetForm.crRetryPassword.focus();
                    test=false;
                }
                
                if(document.aspnetForm.crSecretQuestion.value=='')
                {
                    document.aspnetForm.crAlertSecretQuestion.value = 'Required!';
                    document.aspnetForm.crSecretQuestion.focus();
                    test=false;
                }
                
                if(document.aspnetForm.crSecretAnswer.value=='')
                {
                    document.aspnetForm.crAlertSecretAnswer.value = 'Required!';
                    document.aspnetForm.crSecretAnswer.focus();
                    test=false;
                }
                
                if(document.aspnetForm.crEmail.value=='')
                {
                    document.aspnetForm.crAlertEmail.value = 'Required!';
                    test=false;
                }else{                     
                  var field = document.aspnetForm.crEmail; 
                  var str = field.value; 
                  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
                  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 
                                
                  if (reg2.test(str) == false)
                  {
                    document.aspnetForm.crAlertEmail.value = 'Invalid Email Address!';
                    document.aspnetForm.crEmail.focus();
                    test=false;
                  }
                }
                
                if(document.aspnetForm.crFirstName.value=='')
                {
                    document.aspnetForm.crAlertFirstName.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crLastName.value=='')
                {
                    document.aspnetForm.crAlertLastName.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crAddress.value=='')
                {
                    document.aspnetForm.crAlertAddress.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crCity.value=='')
                {
                    document.aspnetForm.crAlertCity.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crZip.value=='')
                {
                    document.aspnetForm.crAlertZip.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crGender.value=='')
                {
                    document.aspnetForm.crAlertGender.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crGender.value=='')
                {
                    document.aspnetForm.crAlertGender.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crOccupation.value=='0')
                {
                    document.aspnetForm.crAlertOccupation.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crPhone.value=='')
                {
                    document.aspnetForm.crAlertPhone.value = 'Required!';
                    test=false;
                }
                
                if(document.aspnetForm.crFax.value=='')
                {
                    document.aspnetForm.crAlertFax.value = 'Required!';
                    test=false;
                }
                
                if(test==true)
                {
                    document.aspnetForm.method = 'post';
                    document.aspnetForm.action = 'main_customer_proses.aspx'
                    document.aspnetForm.submit();
                }
            }else{
                document.aspnetForm.crAlertUsername.value = 'Username is already taken';
            }
        }
        
        function fjs_customerclear()
        {
           document.aspnetForm.crUsername.value = '';
           document.aspnetForm.crOldPassword.value = '';
           document.aspnetForm.crAlertOldPass.value = '';
           document.aspnetForm.crPassword.value = '';
           document.aspnetForm.crAlertPass.value = '';
           document.aspnetForm.crRetryPassword.value = '';
           document.aspnetForm.crAlertPass1.value = '';
           document.aspnetForm.crSecretQuestion.value = '';
           document.aspnetForm.crAlertSecretQuestion.value = '';
           document.aspnetForm.crSecretAnswer.value = '';
           document.aspnetForm.crAlertSecretAnswer.value = '';
           document.aspnetForm.crEmail.value = '';
           document.aspnetForm.crAlertEmail.value = '';
           document.aspnetForm.crFirstName.value = '';
           document.aspnetForm.crAlertFirstName.value = '';
           document.aspnetForm.crLastName.value = '';
           document.aspnetForm.crAlertLastName.value = '';
           document.aspnetForm.crAddress.value = '';
           document.aspnetForm.crAlertAddress.value = '';
           document.aspnetForm.crCity.value = '';
           document.aspnetForm.crAlertCity.value = '';
           document.aspnetForm.crZip.value = '';
           document.aspnetForm.crAlertZip.value = '';
           document.aspnetForm.crGender.value = '';
           document.aspnetForm.crAlertGender.value = '';
           document.aspnetForm.crAlertOccupation.value = '';
           document.aspnetForm.crPhone.value = '';
           document.aspnetForm.crAlertPhone.value = '';
           document.aspnetForm.crFax.value = '';
           document.aspnetForm.crAlertFax.value = '';
           document.aspnetForm.crHandphone.value = '';
        }
        
        function fjs_checkNewPass()
        {
            var newe = document.aspnetForm.crPassword.value
            var renew = document.aspnetForm.crRetryPassword.value
            
            document.aspnetForm.crAlertPass1.value = '';   
            
            if(newe!=renew)
            {
                document.aspnetForm.crAlertPass1.value = 'Password not same';
                document.aspnetForm.crRetryPassword.value='';
                document.aspnetForm.crRetryPassword.focus();
            }else{
                document.aspnetForm.crSecretQuestion.focus();
            }
        }

        function validate_nudivas() {
            var vali = true
	        if (document.aspnetForm.user_id.value == "") {
		        alert("masukkan User ID Anda");	
		        vali = false
	        }
	        else if (document.aspnetForm.password.value == "") {
		        alert("masukkan Password Anda");	
		        vali = false
	        }
        		
	        if(vali==true)
	        {
                document.aspnetForm.action="main_quiz_proses.aspx";
                document.aspnetForm.submit();  
	        }
        }
        
        function fjs_changeShipType(val)
        {
            var vale = 0
            
            if(val=='TONS')
            {
                eval("document.aspnetForm.crShipMast"+val+".disabled=false");
                //eval("document.aspnetForm.crShipMastTREG.disabled=true");
                eval("document.aspnetForm.crShipMastDIDE.disabled=true");
                eval("document.aspnetForm.crShipMastDPES.disabled=true");
                
                vale = eval("document.aspnetForm.crShipMast"+val+".value");
            }
            
            if(val=='TREG')
            {
                //eval("document.aspnetForm.crShipMast"+val+".disabled=false");
                eval("document.aspnetForm.crShipMastTONS.disabled=false");
                eval("document.aspnetForm.crShipMastDIDE.disabled=true");
                eval("document.aspnetForm.crShipMastDPES.disabled=true");                
                
                vale = eval("document.aspnetForm.crShipMast"+val+".value");
            }
            
            if(val=='DIDE')
            {
                eval("document.aspnetForm.crShipMast"+val+".disabled=false");
                //eval("document.aspnetForm.crShipMastTREG.disabled=true");
                eval("document.aspnetForm.crShipMastTONS.disabled=true");
                eval("document.aspnetForm.crShipMastDPES.disabled=true");  
                
                vale = eval("document.aspnetForm.crShipMast"+val+".value");              
            }
            
            if(val=='DPES')
            {
                eval("document.aspnetForm.crShipMast"+val+".disabled=false");
                //eval("document.aspnetForm.crShipMastTREG.disabled=true");
                eval("document.aspnetForm.crShipMastTONS.disabled=true");
                eval("document.aspnetForm.crShipMastDIDE.disabled=true");                
                
                vale = eval("document.aspnetForm.crShipMast"+val+".value");
            }
            fjs_changeShipMast(vale)
        }
        
        function fjs_changeShipMast(val)
        {
            var has = val.split("#");
            var _totWeight = document.aspnetForm.crTotalWeight.value
            var _subtotal = document.aspnetForm.crSubTotal1.value
            var _total = document.aspnetForm.crTotal1.value
            var _shipping = document.aspnetForm.crShipping1.value
            var _shipping2 = 0
            var _totals = 0
            //crTotal 
            //crTotal1
            //crShipping
            //crShipping1
            //crSubTotal1
            
            _shipping2 = fjs_weight(has[0], has[3], has[4], has[5], has[6], has[7], has[8], _totWeight, has[9], _subtotal);
            
            _totals = parseFloat(_subtotal) + parseFloat(_shipping2);

            document.aspnetForm.crShipping.value = FormatCurrency(_shipping2);
            document.aspnetForm.crShipping1.value = _shipping2;
            
            document.aspnetForm.crTotal.value = FormatCurrency(_totals);
            document.aspnetForm.crTotal1.value = _totals;
        }
        
        
        function fjs_weight(type, fp, np, efp, efpkg, enp, enpkg, weight, currency, subtotal)
        {
            var hasil = 0
            
            //alert(fp + " " + np + " " + weight + " " + currency + " " + type)
            
            if(type=='TONS')
            {
                if(weight/1000 > 1)
                {
                    hasil = (parseFloat(fp) * parseFloat(currency)) + parseInt((weight - 1) / 1000) * (parseFloat(np) *parseFloat(currency))
                }else{
                    hasil = (parseFloat(fp) * parseFloat(currency))
                }
            }
            
            if(type=='TREG')
            {
                if(weight/1000 > 1)
                {
                    hasil = (parseFloat(fp) * parseFloat(currency)) + parseInt((weight - 1) / 1000) * (parseFloat(np) * parseFloat(currency))
                }else{
                    hasil = (parseFloat(fp) * parseFloat(currency))
                }
            }            
            
            if(type=='DPES')
            {
                if(weight/500 > 1)
                {
                    hasil = (parseFloat(fp) * parseFloat(currency)) + parseInt((weight - 1) / 500) * (parseFloat(np) * parseFloat(currency))
                }else{
                    hasil = (parseFloat(fp) * parseFloat(currency))
                }
            }
            
            if(type=='DIDE')
            {
                if(weight/500 > 1)
                {
                    hasil = (parseFloat(fp) * parseFloat(currency)) + parseInt((weight - 1) / 500) * (parseFloat(np) * parseFloat(currency))
                }else{
                    hasil = (parseFloat(fp) * parseFloat(currency))
                }
            }
            
            return hasil
        }
        
        function FormatCurrency(num) 
        { 
            var sign, cents; 
            if(isNaN(num)) 
            num = "0"; 
            sign = (num == (num = Math.abs(num))); 
            num = Math.floor(num*100+0.50000000001); 
            cents = num%100; 
            num = Math.floor(num/100).toString(); 
            if(cents<10) 
            cents = "0" + cents; 
            for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 
            num = num.substring(0,num.length-(4*i+3))+'.'+ 
            num.substring(num.length-(4*i+3)); 
            return (((sign)?'':'-')  + num ); 
        }

        function fjs_changeqty(val)
        {
            var sess = document.aspnetForm.crSess.value;
            var prodid = eval("document.aspnetForm.crProductID"+val+".value");
            var itemno = eval("document.aspnetForm.crItemNo"+val+".value");
            var qty = eval("document.aspnetForm.crQty"+val+".value");    
       
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_order_update.aspx';
            document.aspnetForm.submit();
        }



        function fjs_purchase(val)
        {
            if(val=='')
            {
                alert('Untuk melanjutkan anda harus login terlebih dahulu!');
            }else{
                if(document.aspnetForm.crShipping1.value!="0")
                {
                    document.aspnetForm.method = 'post';
                    document.aspnetForm.action = 'main_order_purchase.aspx';
                    document.aspnetForm.submit();
                }else{
                    alert('Shipping Belum Dipilih!');
                }
            }            
        }
        
        
        function fjs_delete()
        {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_order_delete.aspx';
            document.aspnetForm.submit();
        }
        
        
        function fjs_update()
        {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_order_update.aspx';
            document.aspnetForm.submit();
        }
        
        function fjs_checkall()
        {            
            var jumlah = document.aspnetForm.crJumlah.value;
            
            if(document.aspnetForm.crCheckAll.checked==true)
            {
                for(x=0;x<=parseInt(jumlah)-1;x++)
                {
                    eval("document.aspnetForm.crCheck"+x+".checked=true");                    
                }
            }else{
                for(x=0;x<=parseInt(jumlah)-1;x++)
                {
                    eval("document.aspnetForm.crCheck"+x+".checked=false");                   
                }
            }
        }
        
        function fjs_sameAs()
        {
                var _shipname = document.aspnetForm.crShipName.value;
                var _shipaddress = document.aspnetForm.crShipAddress.value;
                var _shipcity = document.aspnetForm.crShipCity.value;
                var _shipcountry = document.aspnetForm.crShipCountry.value;
                var _shipzip = document.aspnetForm.crShipZip.value;
                var _shipphone = document.aspnetForm.crShipPhone.value;
                var _shipfax = document.aspnetForm.crShipFax.value;
                
                var _billname = document.aspnetForm.crBillName.value;
                var _billnametmp = document.aspnetForm.crBillNameTmp.value;

                var _billaddress = document.aspnetForm.crBillAddress.value;
                var _billaddresstmp = document.aspnetForm.crBillAddressTmp.value;

                var _billcity = document.aspnetForm.crBillCity.value;
                var _billcitytmp = document.aspnetForm.crBillCityTmp.value;

                var _billcountry = document.aspnetForm.crBillCountry.value;
                var _billcountrytmp = document.aspnetForm.crBillCountryTmp.value;

                var _billzip = document.aspnetForm.crBillZip.value;
                var _billziptmp = document.aspnetForm.crBillZipTmp.value;

                var _billphone = document.aspnetForm.crBillPhone.value;
                var _billphonetmp = document.aspnetForm.crBillPhoneTmp.value;

                var _billfax = document.aspnetForm.crBillFax.value;
                var _billfaxtmp = document.aspnetForm.crBillFaxTmp.value;

                
                if(document.aspnetForm.crSameAs.checked==true)
                {
                    document.aspnetForm.crBillNameTmp.value = _billname
                    document.aspnetForm.crBillAddressTmp.value = _billaddress
                    document.aspnetForm.crBillCityTmp.value = _billcity
                    document.aspnetForm.crBillCountryTmp.value = _billcountry
                    document.aspnetForm.crBillZipTmp.value = _billzip
                    document.aspnetForm.crBillPhoneTmp.value =  _billphone
                    document.aspnetForm.crBillFaxTmp.value = _billfax
                     
                    document.aspnetForm.crBillName.value = _shipname
                    document.aspnetForm.crBillAddress.value = _shipaddress
                    document.aspnetForm.crBillCity.value = _shipcity
                    document.aspnetForm.crBillCountry.value = _shipcountry
                    document.aspnetForm.crBillZip.value = _shipzip
                    document.aspnetForm.crBillPhone.value = _shipphone
                    document.aspnetForm.crBillFax.value = _shipfax
                }else{
                    document.aspnetForm.crBillNameTmp.value = _billname
                    document.aspnetForm.crBillAddressTmp.value = _billaddress
                    document.aspnetForm.crBillCityTmp.value = _billcity
                    document.aspnetForm.crBillCountryTmp.value = _billcountry
                    document.aspnetForm.crBillZipTmp.value = _billzip
                    document.aspnetForm.crBillPhoneTmp.value = _billphone 
                    document.aspnetForm.crBillFaxTmp.value = _billfax
                     
                    document.aspnetForm.crBillName.value = _billnametmp
                    document.aspnetForm.crBillAddress.value = _billaddresstmp
                    document.aspnetForm.crBillCity.value = _billcitytmp
                    document.aspnetForm.crBillCountry.value = _billcountrytmp
                    document.aspnetForm.crBillZip.value = _billziptmp
                    document.aspnetForm.crBillPhone.value = _billphonetmp
                    document.aspnetForm.crBillFax.value = _billfaxtmp                   
                }
        }
        
        function fjs_shopinfo_continue()
        {
            var test = 0;
            
            if(document.aspnetForm.crShipName.value=='')
            {
                document.aspnetForm.crAlertShipName.value='Required';
                document.aspnetForm.crShipName.focus();
                test = 1;
            }
            if(document.aspnetForm.crShipAddress.value=='')
            {
                document.aspnetForm.crAlertShipAddress.value='Required';
                document.aspnetForm.crShipAddress.focus();
                test = 1;
            }
            if(document.aspnetForm.crShipCity.value=='')
            {
                document.aspnetForm.crAlertShipCity.value='Required';
                document.aspnetForm.crShipCity.focus();
                test = 1;
            }
            if(document.aspnetForm.crShipCountry.value=='')
            {
                document.aspnetForm.crAlertShipCountry.value='Required';
                document.aspnetForm.crShipCountry.focus();
                test = 1;
            }
            if(document.aspnetForm.crShipZip.value=='')
            {
                document.aspnetForm.crAlertShipZip.value='Required';
                document.aspnetForm.crShipZip.focus();
                test = 1;
            }
            if(document.aspnetForm.crShipPhone.value=='')
            {
                document.aspnetForm.crAlertShipPhone.value='Required';
                document.aspnetForm.crShipPhone.focus();
                test = 1;
            }

            if(document.aspnetForm.crBillName.value=='')
            {
                document.aspnetForm.crAlertBillName.value='Required';
                document.aspnetForm.crBillName.focus();
                test = 1;                
            }
            if(document.aspnetForm.crBillAddress.value=='')
            {
                document.aspnetForm.crAlertBillAddress.value='Required';
                document.aspnetForm.crBillAddress.focus();
                test = 1;
            }
            if(document.aspnetForm.crBillCity.value=='')
            {
                document.aspnetForm.crAlertBillCity.value='Required';
                document.aspnetForm.crBillCity.focus();
                test = 1;
            }
            if(document.aspnetForm.crBillCountry.value=='')
            {
                document.aspnetForm.crAlertBillCountry.value='Required';
                document.aspnetForm.crBillCountry.focus();
                test = 1;
            }
            if(document.aspnetForm.crBillZip.value=='')
            {
                document.aspnetForm.crAlertBillZip.value='Required';
                document.aspnetForm.crBillZip.focus();
                test = 1;
            }
            if(document.aspnetForm.crBillPhone.value=='')
            {
                document.aspnetForm.crAlertBillPhonevalue='Required';
                document.aspnetForm.crBillPhone.focus();
                test = 1;
            }
            
            if(test==0)
            {
                document.aspnetForm.method = 'post';
                document.aspnetForm.action = 'main_store_basket.aspx';
                document.aspnetForm.submit();
            }
                
        }
        
        function fjs_changeShopp(val1, val2)
        {
            if(eval("document.aspnetForm."+val1+".value")!='')
            {
                eval("document.aspnetForm."+val2+".value=''");
            }else{
                eval("document.aspnetForm."+val2+".value='Required'");
            }
        }
        
        function fjs_paymentPoint()
        {
           document.aspnetForm.crWhat.value = '1';
           document.aspnetForm.method = 'post'; 
           document.aspnetForm.action = 'main_payment_point.aspx';
           document.aspnetForm.submit();
        }
        
        function fjs_paymentTransfer()
        {
           document.aspnetForm.crWhat.value = '2';
           document.aspnetForm.method = 'post'; 
           document.aspnetForm.action = 'main_payment_transfer.aspx';
           document.aspnetForm.submit();
        }
        
        function fjs_paymentCreditCard()
        {
           document.aspnetForm.crWhat.value = '3';
           document.aspnetForm.method = 'post'; 
           document.aspnetForm.action = 'main_payment_creditcard.aspx';
           document.aspnetForm.submit();
        }
        
        function fjs_submitPoint()
        {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_payment_final.aspx';
            document.aspnetForm.submit();
        }
        
        function fjs_continueFinal()
        {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_default.aspx?f=p';
            document.aspnetForm.submit();
        }
        
        function fjs_continuePrint()
        {
            window.print();
        }
        
        function fjs_fncMoveFcs1() {
          if (document.aspnetForm.crAccountNo1.value.length == 3)
          {
            document.aspnetForm.crAccountNo2.focus();
          }
        }

        function fjs_fncMoveFcs2() {
          if (document.aspnetForm.crAccountNo2.value.length == 3)
          {
            document.aspnetForm.crAccountNo3.focus();
          }
        }
        
        function fjs_submitTransfer()
        {
            var valid = true;
            
            if (document.aspnetForm.crAccountName.value == "")                      
	        {                                                
	            alert ("Please enter Your Name.");  
	            document.aspnetForm.crAccountName.focus();                         
	            valid = false;
	        }       
         
	         if ((document.aspnetForm.crAccountNo1.value.length + document.aspnetForm.crAccountNo2.value.length + document.aspnetForm.crAccountNo3.value.length) < 10) { 
	    		        alert("Please enter Your Account Number.");
	    		        document.aspnetForm.crAccountNo1.focus();
	                    valid = false;
	         }   		

	        var checkStr = (document.aspnetForm.crAccountNo1.value + document.aspnetForm.crAccountNo2.value + document.aspnetForm.crAccountNo3.value);
	        if (checkStr != "")
	        {
		        var checkOK = "0123456789";
	  	        var allValid = true;
	  	        for (i = 0;  i < checkStr.length;  i++)
	  	        {
	    		        ch = checkStr.charAt(i);
	    		        for (j = 0;  j < checkOK.length;  j++)
	      		        if (ch == checkOK.charAt(j))
	        		        break;
	    		        if (j == checkOK.length)
	    		        {
	      			        allValid = false;
	      			        break;
	    		        }
	  	        }
	  	        if (!allValid)
	  	        {
	    		        alert("Please enter only numeric characters in the Account Number field.");
	    		        document.aspnetForm.crAccountNo1.focus();
	                    valid = false;
	  	        }
	        }

	        if (document.aspnetForm.crAccountBankName.value == "")   
	        {  	alert ("Please enter Your Bank Name.");  
		        document.aspnetForm.crAccountBankName.focus();                         
	            valid = false;
	        }  
	        
	        if(valid!=false)
	        {	            
	            if (document.aspnetForm.crBankID[1].checked == true) 
	            {
			        window.open("http://www.klikbca.com", "", "toolbar=yes, location=0, directories=yes, status=yes, menubar=1, scrollbars=yes, resizable=1, width=700, height=400");
	            }
	            
	            if (document.aspnetForm.crBankID[2].checked == true) 
	            {
			        window.open("https://ibank.cimbniaga.com/ib-niaga/Login.html", "", "toolbar=yes, location=0, directories=yes, status=yes, menubar=1, scrollbars=yes, resizable=1, width=700, height=400");
	            }
	            
	            if (document.aspnetForm.crBankID[3].checked == true) 
	            {
			        window.open("https://ib.bankmandiri.co.id/retail/Login.do?action=form&lang=in_ID", "", "toolbar=yes, location=0, directories=yes, status=yes, menubar=1, scrollbars=yes, resizable=1, width=700, height=400");
	            }
	            
	            if (document.aspnetForm.crBankID[4].checked == true) 
	            {
			        window.open("https://www.permatanet.com/login/login.asp", "", "toolbar=yes, location=0, directories=yes, status=yes, menubar=1, scrollbars=yes, resizable=1, width=700, height=400");
	            }
	            
                document.aspnetForm.method = 'post';
                document.aspnetForm.action = 'main_payment_final.aspx';
                document.aspnetForm.submit();                               
	        }
        }
 
 
        function fjs_fncDownLoad()
        {
          alert('Sorry not available for netscape');
        }

        /*function fjs_continueSave(){
             if (bName == "Netscape")
                fjs_fncDownLoad();
             else
                vbSaveAs();             
             }   
             
        if (!wpr) with (document) 
              {
               writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
               writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
               writeln('Sub window_onunload');
               writeln('On Error Resume Next');
               writeln('Set WB = nothing');
               writeln('End Sub');
               writeln( 'Sub vbPrintPage');
               
               writeln('   OLECMDID_PRINT = 6');
               writeln('   OLECMDEXECOPT_DONTPROMPTUSER = 2');
               writeln('   OLECMDEXECOPT_PROMPTUSER = 1');
               writeln('   On Error Resume Next');
               writeln('   WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER');6
               writeln('   Set WB = nothing');
               writeln('End Sub');
               writeln('<' + '/SCRIPT>');             
               }
        if (wpr) 
              document.writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
        with (document)
             {
               writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
               writeln('Sub window_onunload');
               writeln('On Error Resume Next');
               writeln('Set WB = nothing');
               writeln('End Sub');
               writeln( 'Sub vbSaveAs');
               writeln('   OLECMDID_SAVEAS = 4');
               writeln('   OLECMDEXECOPT_DONTPROMPTUSER = 2');
               writeln('   OLECMDEXECOPT_PROMPTUSER = 1');
               writeln('   On Error Resume Next');
               writeln('   WB.ExecWB OLECMDID_SAVEAS , OLECMDEXECOPT_PROMPTUSER');4
               writeln('   Set WB = nothing');
               writeln('End Sub');
               writeln('<' + '/SCRIPT>');             
               }
               
               
               
function init() {
undefined="undefined";
mkCClist();
}

function ccchk(cdi) {
//document.console.output1.value="";
if (cdi!="" && cdi!=null) {
//document.console.output1.value="Processing...";
var cf=sbtString(cdi," -/abcdefghijklmnopqrstuvwyzABCDEFGHIJLMNOPQRSTUVWYZ|\#()[]{}£$%&=!?+*.,;:'");
var cn=chkCard(cf);
var clcd=chkLCD(cf);
var clcdt="NOT PASSED"; if (clcd) {clcdt="PASSED";}
var ccck=chkCCCksum(cf,cn);
var ccckt="NOT PASSED"; if (ccck) {ccckt="PASSED";}
var cjd=false; if (clcd && ccck) {cjd=true;}
/*var out="";
out+="Card type       : "+cn+"\n";
out+="CCChecksum      : "+ccckt+"\n";
out+="Luhn Check Digit: "+clcdt+"\n";
out+=cjd;
document.console.output1.value=out;
//alert("Card type       : "+cn+"\n");
return cjd
}
}

function ccngen(p,tr) {
tr*=1.0; if (tr<1 || tr==null) {tr=1;}
//document.console.output2.value="";
if (p!="" && p!=null) {
var cn=chkCard(p);
for (var i=tr;i>=1;i--) {
//document.console.output2.value="Processing... "+i;
var cdi=sbtStringSpRnd(p,"x","0123456789");
var cf=sbtString(cdi," -/abcdefghijklmnopqrstuvwyzABCDEFGHIJLMNOPQRSTUVWYZ");
var clcd=chkLCD(cf);
var ccck=chkCCCksum(cf,cn);
if (clcd && ccck) {break;}
}
var out="Couldn't find any valid number for given pattern";
if (clcd && ccck) {
var cn=chkCard(cdi);
var ccnspc="";
for (var j=0;j<=3;j++) {
if (document.console.ccnsp.options[j].selected) {break;}
}
if (j==1) {ccnspc=" ";}
if (j==2) {ccnspc="-";}
var cdif="";
for (var i=1;i<=cdi.length;i++) {
var aS=midS(cdi,i,1); if (aS==" ") {aS=ccnspc;}
cdif+=aS;
}
var out="Valid "+cn+" # found:\n"+cdif;
}
document.console.output2.value=out;
}
}

function chgccp() {
mkCClist();
for (var j=0;j<=tw-1;j++) {
if (document.console.ccpp.options[j].selected) {break;}
}
document.console.ccp.value=c[j+1];
}

function chkCard(cdi) {
cdi+="";
if (c[1]==undefined || c[1]==null || c[1]=="") {mkCClist();}
var ccn=0; var cn="unknown"
var cf=sbtString(cdi," -/abcdefghijklmnopqrstuvwyzABCDEFGHIJLMNOPQRSTUVWYZ");
if (leftS(cf,1)=="4") {cf=leftS(cf,8);}
for (var i=1;i<=tw;i++) {
var cct=sbtString(c[i]," -/abcdefghijklmnopqrstuvwyzABCDEFGHIJLMNOPQRSTUVWYZ");
if (leftS(cf,1)=="4") {cct=leftS(cct,8);}
var ccc=cmpPattern(cf,cct);
if (ccc) {ccn=i; break;}
}
if (ccn>0) {cn=cd[i];}
return cn;
}

function chkCCCksum(cf,cn) {
var r=false;
var w="21";
// if (linstr(cn,"AmEx") || linstr(cn,"Diner")) {var w="12";}
var ml="";
var j=1;
for (var i=1;i<=cf.length-1;i++) {
var m=midS(cf,i,1)*midS(w,j,1);
m=sumDigits(m);
ml+=""+m;
j++; if (j>w.length) {j=1;}
}
var ml2=sumDigits(ml,-1); 
var ml1=(sumDigits(ml2,-1)*10-ml2)%10;
if (ml1==rightS(cf,1)) {r=true;}
return r;
}

function chkLCD(cf) {
var r=false; cf+="";
var bl=isdiv(cf.length,2);
var ctd=0;
for (var i=1;i<=cf.length;i++) {
var cdg=midS(cf,i,1);
if (isdiv(i,2)!=bl) {
cdg*=2; if (cdg>9) {cdg-=9;}
}
ctd+=cdg*1.0;
}
if (isdiv(ctd,10)) {r=true;}
return r;
}

function mkCClist() {
tw=181;
c=new makeArray(tw); cd=new makeArray(tw);
var i=1;
c[i]="3782 xxxxxx xxxxx"; cd[i]="AmEx - Small Corporate Card"; i++;
c[i]="3787 xxxxxx xxxxx"; cd[i]="AmEx - Small Corporate Card"; i++;
c[i]="37x8 xxxxxx xxxxx"; cd[i]="AmEx Gold"; i++;
c[i]="37x3 7xxxxx xxxxx"; cd[i]="AmEx Platinum"; i++;
c[i]="37xx xxxxxx 11xxx"; cd[i]="AmEx issued since 1995"; i++;
c[i]="37xx xxxxxx xxxxx"; cd[i]="AmEx"; i++;
c[i]="3xxxxx xxxxxxxx xxxxxxxx"; cd[i]="AmEx Gold"; i++;
c[i]="30xxx xxxx xxxxx"; cd[i]="Diners Club"; i++;
c[i]="31xxx xxxx xxxxx"; cd[i]="Diners Club"; i++;
c[i]="35xxx xxxx xxxxx"; cd[i]="Diners Club"; i++;
c[i]="36xxx xxxx xxxxx"; cd[i]="Diners Club"; i++;
c[i]="38xxx xxxx xxxxx"; cd[i]="Carte Blanche"; i++;
c[i]="35xx xxxx xxxx xxxx"; cd[i]="JCB (Japanese Credit Bureau)"; i++;
c[i]="4024 0238 xxxx xxxx"; cd[i]="Visa Gold - Bank of America"; i++;
c[i]="4019 xxxx xxxx xxxx"; cd[i]="Visa CV/Gold - Bank of America"; i++;
c[i]="4024 xxxx xxxx xxxx"; cd[i]="Visa PV - Bank of America"; i++;
c[i]="4040 xxxx xxxx xxxx"; cd[i]="Visa CV - Wells Fargo"; i++;
c[i]="4048 xxxx xxxx xxxx"; cd[i]="Visa CV"; i++;
c[i]="4024 0071 xxxx xxxx"; cd[i]="Visa - Wells Fargo"; i++;
c[i]="4013 xxxx xxxx xxxx"; cd[i]="Visa - Citibank"; i++;
c[i]="4019 xxxx xxxx xxxx"; cd[i]="Visa - Bank of America"; i++;
c[i]="4024 xxxx xxxx xxxx"; cd[i]="Visa - Bank of America"; i++;
c[i]="4027 xxxx xxxx xxxx"; cd[i]="Visa - Rockwell Federal Credit Union"; i++;
c[i]="4032 xxxx xxxx xxxx"; cd[i]="Visa - Household Bank"; i++;
c[i]="4052 xxxx xxxx xxxx"; cd[i]="Visa - First Cincinnati"; i++;
c[i]="4060 xxxx xxxx xxxx"; cd[i]="Visa - Associates National Bank"; i++;
c[i]="4070 xxxx xxxx xxxx"; cd[i]="Visa - Security Pacific"; i++;
c[i]="4071 xxxx xxxx xxxx"; cd[i]="Visa - Colonial National Bank"; i++;
c[i]="4094 xxxx xxxx xxxx"; cd[i]="Visa - A.M.C. Federal Credit Union"; i++;
c[i]="4113 xxxx xxxx xxxx"; cd[i]="Visa - Valley National Bank"; i++;
c[i]="4114 xxxx xxxx xxxx"; cd[i]="Visa - Chemical Bank"; i++;
c[i]="4121 xxxx xxxx xxxx"; cd[i]="Visa - Pennsylvania State Employees Credit Union"; i++; // c[i]="4121 xxxx xxxx xxxx"; cd[i]="Visa CV - Signet Bank"; i++;
c[i]="4122 xxxx xxxx xxxx"; cd[i]="Visa - Union Trust"; i++;
c[i]="4125 xxxx xxxx xxxx"; cd[i]="Visa - Marine Midland"; i++;
c[i]="4128 xxx xxx xxx"; cd[i]="Visa CV - Citibank"; i++;
c[i]="4128 xxxx xxxx xxxx"; cd[i]="Visa CV - Citibank"; i++;
c[i]="4131 xxxx xxxx xxxx"; cd[i]="Visa - State Street Bank"; i++;
c[i]="4225 xxxx xxxx xxxx"; cd[i]="Visa - Chase Manhattan Bank"; i++;
c[i]="4226 xxxx xxxx xxxx"; cd[i]="Visa - Chase Manhattan Bank"; i++;
c[i]="4231 xxxx xxxx xxxx"; cd[i]="Visa - Chase Lincoln First Classic"; i++;
c[i]="4232 xxxx xxxx xxxx"; cd[i]="Visa - Chase Lincoln First Classic"; i++;
c[i]="4239 xxxx xxxx xxxx"; cd[i]="Visa - Corestates"; i++;
c[i]="4241 xxxx xxxx xxxx"; cd[i]="Visa - National Westminster Bank"; i++;
c[i]="4250 xxxx xxxx xxxx"; cd[i]="Visa - First Chicago Bank"; i++;
c[i]="4253 xxxx xxxx xxxx"; cd[i]="Visa - Consumers Edge"; i++;
c[i]="4254 5123 6000 xxxx"; cd[i]="Visa Premier card - Security First"; i++;
c[i]="4254 5123 8500 xxxx"; cd[i]="Visa Premier card - Security First"; i++;
c[i]="4254 xxxx xxxx xxxx"; cd[i]="Visa - Security First"; i++;
c[i]="4271 382x xxxx xxxx"; cd[i]="Visa PV - Citibank"; i++;
c[i]="4271 xxxx xxxx xxxx"; cd[i]="Visa - Citibank/Citicorp"; i++;
c[i]="4301 xxxx xxxx xxxx"; cd[i]="Visa - Monogram Bank"; i++;
c[i]="4302 xxxx xxxx xxxx"; cd[i]="Visa - H.H.B.C."; i++;
c[i]="4311 xxxx xxxx xxxx"; cd[i]="Visa - First National Bank of Louisville"; i++;
c[i]="4317 xxxx xxxx xxxx"; cd[i]="Visa - Gold Dome"; i++;
c[i]="4327 xxxx xxxx xxxx"; cd[i]="Visa - First Atlanta"; i++;
c[i]="4332 xxxx xxxx xxxx"; cd[i]="Visa - First American Bank"; i++;
c[i]="4339 xxxx xxxx xxxx"; cd[i]="Visa - Primerica Bank"; i++;
c[i]="4342 xxxx xxxx xxxx"; cd[i]="Visa - N.C.M.B. / Nations Bank"; i++;
c[i]="4356 xxxx xxxx xxxx"; cd[i]="Visa - National Bank of Delaware"; i++;
c[i]="4368 xxxx xxxx xxxx"; cd[i]="Visa - National West"; i++;
c[i]="4387 xxxx xxxx xxxx"; cd[i]="Visa - Bank One"; i++;
c[i]="4388 xxxx xxxx xxxx"; cd[i]="Visa - First Signature Bank & Trust"; i++;
c[i]="4401 xxxx xxxx xxxx"; cd[i]="Visa - Gary-Wheaton Bank"; i++;
c[i]="4413 xxxx xxxx xxxx"; cd[i]="Visa - Firstier Bank Lincoln"; i++;
c[i]="4418 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Omaha"; i++;
c[i]="4421 xxxx xxxx xxxx"; cd[i]="Visa - Indiana National Bank"; i++;
c[i]="4424 xxxx xxxx xxxx"; cd[i]="Visa - Security Pacific National Bank"; i++;
c[i]="4428 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Hoven"; i++;
c[i]="4436 xxxx xxxx xxxx"; cd[i]="Visa - Security Bank & Trust"; i++;
c[i]="4443 xxxx xxxx xxxx"; cd[i]="Visa - Merril Lynch Bank & Trust"; i++;
c[i]="4447 xxxx xxxx xxxx"; cd[i]="Visa - AmeriTrust"; i++;
c[i]="4448 020 xxx xxx"; cd[i]="Visa Premier card"; i++;
c[i]="4452 xxxx xxxx xxxx"; cd[i]="Visa - Empire Affiliates Federal Credit Union"; i++;
c[i]="4498 xxxx xxxx xxxx"; cd[i]="Visa - Republic Savings"; i++;
c[i]="4502 xxxx xxxx xxxx"; cd[i]="Visa - C.I.B.C."; i++;
c[i]="4503 xxxx xxxx xxxx"; cd[i]="Visa - Canadian Imperial Bank"; i++;
c[i]="4506 xxxx xxxx xxxx"; cd[i]="Visa - Belgium A.S.L.K."; i++;
c[i]="4510 xxxx xxxx xxxx"; cd[i]="Visa - Royal Bank of Canada"; i++;
c[i]="4520 xxxx xxxx xxxx"; cd[i]="Visa - Toronto Dominion of Canada"; i++;
c[i]="4537 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Nova Scotia"; i++;
c[i]="4538 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Nova Scotia"; i++;
c[i]="4539 xxxx xxxx xxxx"; cd[i]="Visa - Barclays (UK)"; i++;
c[i]="4543 xxxx xxxx xxxx"; cd[i]="Visa - First Direct"; i++;
c[i]="4544 xxxx xxxx xxxx"; cd[i]="Visa - T.S.B. Bank"; i++;
c[i]="4556 xxxx xxxx xxxx"; cd[i]="Visa - Citibank"; i++;
c[i]="4564 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Queensland"; i++;
c[i]="4673 xxxx xxxx xxxx"; cd[i]="Visa - First Card"; i++;
c[i]="4678 xxxx xxxx xxxx"; cd[i]="Visa - Home Federal"; i++;
c[i]="4707 xxxx xxxx xxxx"; cd[i]="Visa - Tompkins County Trust"; i++;
c[i]="4712 1250 xxxx xxxx"; cd[i]="Visa - IBM Credit Union"; i++;
c[i]="4719 xxxx xxxx xxxx"; cd[i]="Visa - Rocky Mountain"; i++;
c[i]="4721 xxxx xxxx xxxx"; cd[i]="Visa - First Security"; i++;
c[i]="4722 xxxx xxxx xxxx"; cd[i]="Visa - West Bank"; i++;
c[i]="4726 xxxx xxxx xxxx"; cd[i]="Visa CV - Wells Fargo"; i++;
c[i]="4783 xxxx xxxx xxxx"; cd[i]="Visa - AT&T's Universal Card"; i++;
c[i]="4784 xxxx xxxx xxxx"; cd[i]="Visa - AT&T's Universal Card"; i++;
c[i]="4800 xxxx xxxx xxxx"; cd[i]="Visa - M.B.N.A. North America"; i++;
c[i]="4811 xxxx xxxx xxxx"; cd[i]="Visa - Bank of Hawaii"; i++;
c[i]="4819 xxxx xxxx xxxx"; cd[i]="Visa - Macom Federal Credit Union"; i++;
c[i]="4820 xxxx xxxx xxxx"; cd[i]="Visa - IBM Mid America Federal Credit Union"; i++;
c[i]="4833 xxxx xxxx xxxx"; cd[i]="Visa - U.S. Bank"; i++;
c[i]="4842 xxxx xxxx xxxx"; cd[i]="Visa - Security Pacific Washington"; i++;
c[i]="4897 xxxx xxxx xxxx"; cd[i]="Visa - Village Bank of Chicago"; i++;
c[i]="4921 xxxx xxxx xxxx"; cd[i]="Visa - Hong Kong National Bank"; i++;
c[i]="4929 xxxx xxxx xxxx"; cd[i]="Visa CV - Barclay Card (UK)"; i++;
c[i]="4539 9710 xxxx xxxx"; cd[i]="Visa - Banco di Napoli (Italy)"; i++;
c[i]="4557 xxxx xxxx xxxx"; cd[i]="Visa - BNL (Italy)"; i++;
c[i]="4908 xxxx xxxx xxxx"; cd[i]="Visa - Carta Moneta, CARIPLO/Intesa (Italy)"; i++;
c[i]="4xxx 9x60 4015 xxxx"; cd[i]="Visa - Carta Sì, Unipol Banca (Italy)"; i++;
c[i]="4xxx 9x14 4046 xxxx"; cd[i]="Visa - Carta Sì, Banco di Sardegna (Italy)"; i++;
c[i]="4xxx 9xxx 40xx xxxx"; cd[i]="Visa - Carta Sì (Italy)"; i++;
c[i]="4532 xxxx xxxx xxxx"; cd[i]="Visa - Credito Italiano (Italy)"; i++;
c[i]="4547 5900 xxxx xxxx"; cd[i]="Visa Gold - bank ganadero BBV (Colombia)"; i++;
c[i]="4916 xxxx xxxx xxxx"; cd[i]="Visa - MBNA Bank"; i++;
c[i]="4xxx xxx xxx xxxx"; cd[i]="Visa"; i++;
c[i]="4xxx xxxx xxxx xxxx"; cd[i]="Visa"; i++;
c[i]="5031 xxxx xxxx xxxx"; cd[i]="MasterCard - Maryland of North America"; i++;
c[i]="5100 xxxx xxxx xxxx"; cd[i]="MasterCard - Southwestern States Bankard Association"; i++;
c[i]="5110 xxxx xxxx xxxx"; cd[i]="MasterCard - Universal Travel Voucher"; i++;
c[i]="5120 xxxx xxxx xxxx"; cd[i]="MasterCard - Western States Bankard Association"; i++;
c[i]="5130 xxxx xxxx xxxx"; cd[i]="MasterCard - Eurocard France"; i++;
c[i]="5140 xxxx xxxx xxxx"; cd[i]="MasterCard - Mountain States Bankard Association"; i++;
c[i]="5150 xxxx xxxx xxxx"; cd[i]="MasterCard - Credit Systems, Inc."; i++;
c[i]="5160 xxxx xxxx xxxx"; cd[i]="MasterCard - Westpac Banking Corporation"; i++;
c[i]="5170 xxxx xxxx xxxx"; cd[i]="MasterCard - Midamerica Bankard Association"; i++;
c[i]="5172 xxxx xxxx xxxx"; cd[i]="MasterCard - First Bank Card Center"; i++;
c[i]="518x xxxx xxxx xxxx"; cd[i]="MasterCard - Computer Communications of America"; i++;
c[i]="519x xxxx xxxx xxxx"; cd[i]="MasterCard - Bank of Montreal"; i++;
c[i]="5201 xxxx xxxx xxxx"; cd[i]="MasterCard - Mellon Bank, N.A."; i++;
c[i]="5202 xxxx xxxx xxxx"; cd[i]="MasterCard - Central Trust Company, N.A."; i++;
c[i]="5204 xxxx xxxx xxxx"; cd[i]="MasterCard - Security Pacific National Bank"; i++;
c[i]="5205 xxxx xxxx xxxx"; cd[i]="MasterCard - Promocion y Operacion, S.A."; i++;
c[i]="5206 xxxx xxxx xxxx"; cd[i]="MasterCard - Banco Nacional do Mexico"; i++;
c[i]="5207 xxxx xxxx xxxx"; cd[i]="MasterCard - New England Bankard Association"; i++;
c[i]="5208 xxxx xxxx xxxx"; cd[i]="MasterCard - Million Card Service Co., Ltd."; i++;
c[i]="5209 xxxx xxxx xxxx"; cd[i]="MasterCard - The Citizens & Southern National Bank"; i++;
c[i]="5210 xxxx xxxx xxxx"; cd[i]="MasterCard - Kokunai Shinpan Company, Ltd."; i++;
c[i]="5211 xxxx xxxx xxxx"; cd[i]="MasterCard - Chemical Bank Delaware"; i++;
c[i]="5212 xxxx xxxx xxxx"; cd[i]="MasterCard - F.C.C. National Bank"; i++;
c[i]="5213 xxxx xxxx xxxx"; cd[i]="MasterCard - The Bankcard Association, Inc."; i++;
c[i]="5215 xxxx xxxx xxxx"; cd[i]="MasterCard - Marine Midland Bank, N.A."; i++;
c[i]="5216 xxxx xxxx xxxx"; cd[i]="MasterCard - Old Kent Bank & Trust Co."; i++;
c[i]="5217 xxxx xxxx xxxx"; cd[i]="MasterCard - Union Trust"; i++;
c[i]="5218 xxxx xxxx xxxx"; cd[i]="MasterCard - Citibank/Citicorp"; i++;
c[i]="5219 xxxx xxxx xxxx"; cd[i]="MasterCard - Central Finance Co., Ltd."; i++;
c[i]="5220 xxxx xxxx xxxx"; cd[i]="MasterCard - Sovran Bank/Central South"; i++;
c[i]="5221 xxxx xxxx xxxx"; cd[i]="MasterCard - Standard Bank of South Africa, Ltd."; i++;
c[i]="5222 xxxx xxxx xxxx"; cd[i]="MasterCard - Security Bank & Trust Company"; i++;
c[i]="5223 xxxx xxxx xxxx"; cd[i]="MasterCard - Trustmark National Bank"; i++;
c[i]="5224 xxxx xxxx xxxx"; cd[i]="MasterCard - Midland Bank"; i++;
c[i]="5225 xxxx xxxx xxxx"; cd[i]="MasterCard - First Pennsylvania Bank, N.A."; i++;
c[i]="5226 xxxx xxxx xxxx"; cd[i]="MasterCard - Eurocard Ab"; i++;
c[i]="5227 xxxx xxxx xxxx"; cd[i]="MasterCard - Rocky Mountain Bankcard System, Inc."; i++;
c[i]="5228 xxxx xxxx xxxx"; cd[i]="MasterCard - First Union National Bank of North Carolina"; i++;
c[i]="5229 xxxx xxxx xxxx"; cd[i]="MasterCard - Sunwest Bank of Albuquerque, N.A."; i++;
c[i]="5230 xxxx xxxx xxxx"; cd[i]="MasterCard - Harris Trust & Savings Bank"; i++;
c[i]="5231 xxxx xxxx xxxx"; cd[i]="MasterCard - Badische Beamtenbank EG"; i++;
c[i]="5232 xxxx xxxx xxxx"; cd[i]="MasterCard - Eurocard Deutschland"; i++;
c[i]="5233 xxxx xxxx xxxx"; cd[i]="MasterCard - Computer Systems Association, Inc."; i++;
c[i]="5234 xxxx xxxx xxxx"; cd[i]="MasterCard - Citibank Arizona"; i++;
c[i]="5235 xxxx xxxx xxxx"; cd[i]="MasterCard - Financial Transaction System, Inc."; i++;
c[i]="5236 xxxx xxxx xxxx"; cd[i]="MasterCard - First Tennessee Bank, N.A."; i++;
c[i]="5254 xxxx xxxx xxxx"; cd[i]="MasterCard - Bank of America"; i++;
c[i]="5273 xxxx xxxx xxxx"; cd[i]="MasterCard (can be Gold) - Bank of America"; i++;
c[i]="5286 xxxx xxxx xxxx"; cd[i]="MasterCard - Home Federal"; i++;
c[i]="5291 xxxx xxxx xxxx"; cd[i]="MasterCard - Signet Bank"; i++;
c[i]="5329 xxxx xxxx xxxx"; cd[i]="MasterCard - Maryland of North America"; i++;
c[i]="5410 xxxx xxxx xxxx"; cd[i]="MasterCard - Wells Fargo"; i++;
c[i]="5412 xxxx xxxx xxxx"; cd[i]="MasterCard - Wells Fargo"; i++;
c[i]="5419 xxxx xxxx xxxx"; cd[i]="MasterCard - Bank of Hoven"; i++;
c[i]="5424 xxxx xxxx xxxx"; cd[i]="MasterCard - Citibank/Citicorp"; i++;
c[i]="5434 xxxx xxxx xxxx"; cd[i]="MasterCard - National Westminster Bank"; i++;
c[i]="5465 xxxx xxxx xxxx"; cd[i]="MasterCard - Chase Manhattan"; i++;
c[i]="5255 0114 xxxx xxxx"; cd[i]="MasterCard - Banco di Sardegna (Italy)"; i++;
c[i]="5306 93xx xxxx xxxx"; cd[i]="MasterCard - Bancolombia Cadenalco (Colombia)"; i++;
c[i]="5406 251x xxxx xxxx"; cd[i]="MasterCard - Banco de Occidente (Colombia)"; i++;
c[i]="5426 xxxx xxxx xxxx"; cd[i]="MasterCard - Granahorrar (Colombia)"; i++;
c[i]="5406 xxxx xxxx xxxx"; cd[i]="MasterCard - Granahorrar (Colombia)"; i++;
c[i]="5xxx xxxx xxxx xxxx"; cd[i]="MasterCard/Access/Eurocard"; i++;
c[i]="6013 xxxx xxxx xxxx"; cd[i]="Discover - MBNA Bank"; i++;
c[i]="60xx xxxx xxxx xxxx"; cd[i]="Discover"; i++;
}

// Powered by MilkieX - http://www.ElfQrin.com

function leftS(aS,n) {
aS+="";
var rS="";
if (n>=1) {
rS=aS.substring(0,n);
}
return rS;
}

function rightS(aS,n) {
aS+="";
var rS="";
if (n>=1) {
rS=aS.substring(aS.length-n,aS.length);
}
return rS;
}

function midS(aS,n,n2) {
aS+="";
var rS="";
if (n2==null || n2=="") {n2=aS.length;}
n*=1; n2*=1;
if (n<0) {n++;}
rS=aS.substring(n-1,n-1+n2);
return rS;
}

function linstr(aS,bS) {
aS+=""; bS+="";
var r=false;
if (leftS(aS,bS.length)==bS) {r=true;}
return r;
}

function sbtString(s1,s2) {
var ous=""; s1+=""; s2+="";
for (var i=1;i<=s1.length;i++) {
var c1=s1.substring(i-1,i);
var c2=s2.indexOf(c1);
if (c2==-1) {ous+=c1;}
}
return ous;
}

function sbtStringSpRnd(s1,s2,bS) {
if (bS==null || bS=="") {bS="0123456789";}
var ous="";
bS+="";
for (var i=1;i<=s1.length;i++) {
var c1=s1.substring(i-1,i);
var c2=s2.indexOf(c1);
if (c2==-1) {ous+=c1;} else {ous+=midS(bS,Math.floor(Math.random()*(bS.length-1))+1,1);}
}
return ous;
}

function cmpPattern(a,p,x) {
if (x=="" || x==null) {x="x";}
x=""+x.substring(0,1); a+=""; p+="";
r=false; mc=0;
if (a.length==p.length) {
for (var i=1;i<=a.length;i++) {
a1=midS(a,i,1); p1=midS(p,i,1);
if (a1==p1 || p1==x) {mc++;}
}
}
if (mc==a.length) {r=true;}
return r;
}

function isdiv(a,b) {
if (b==null) {b=2;}
a*=1.0; b*=1.0;
var r=false;
if (a/b==Math.floor(a/b)) {r=true;}
return r;
}

function sumDigits(n,m) {
if (m==0 || m==null) {m=1;}
n+="";
if (m>0) {
while (n.length>m) {
var r=0;
for (var i=1;i<=n.length;i++) {
r+=1.0*midS(n,i,1);
}
n=""+r;
}
} else {
for (var j=1;j<=Math.abs(m);j++) {
var r=0;
for (var i=1;i<=n.length;i++) {
r+=1.0*midS(n,i,1);
}
n=""+r;
}
}
r=n;
return r;
}

function makeArray(n) {
this.length=n;
for (var i=1;i<=n;i++) {this[i]=0;}
return this;
}

// End of MilkieX

//var dl=""+document.location; dl=dl.toLowerCase(); if (dl.substring(0,22)!="http://www.elfqrin.com" && dl.substring(0,16)!="file:///c|/data/") {window.location="/";}

init();*/

function MM_openBrWindow(theURL,winName,features){
  window.open(theURL,winName,features);
}
function NumValidator(CheckNumber)
{
  var checkOK = "0123456789"
  var ch
  	  for (i = 0;  i < CheckNumber.length;  i++)
	  {
	    ch = CheckNumber.charAt(i);
	    for (j = 0;  j < checkOK.length;  j++)
	      if (ch == checkOK.charAt(j))
	        break;
	    if (j == checkOK.length)
	    {
	      return false;
	      break;
	    }
	  }
   return true
}

function Validator()
{
  if (document.aspnetForm.crAccountName.value == "")
  {
    alert("Please enter your name !");
    document.aspnetForm.crAccountName.focus();
    return false;
  }

  if ((document.aspnetForm.crAccountNo1.value == ""))
  {
    alert("Please enter your credit card number !");
    document.aspnetForm.crAccountNo1.focus();
    return false;
  }

  if (ccchk(document.aspnetForm.crAccountNo1.value)==false)
  {
	alert("Invalid card number, please check your input or use another credit card!");
    document.aspnetForm.crAccountNo1.focus();
    return false;
  }

  if ((document.aspnetForm.crExpiredYear.value == "") || (!NumValidator(document.aspnetForm.crExpiredYear.value)) )
  {
    alert("Please enter a valid numeric value for the year field.");
    document.aspnetForm.crExpiredYear.focus();
    return false;
  }

  if (document.aspnetForm.crExpiredYear.value.length < 4)
  {
    alert("Please enter at least 4 characters in the year field.");
    document.theForm.crExpiredYear.focus();
    return false;
  }

  if (document.aspnetForm.crExpiredYear.value.length > 4)
  {
    alert("Please enter at most 4 characters in the year field.");
    document.theForm.crExpiredYear.focus();
    return false;
  }
  
  var taon;
  taon=new Date();
 
    if ((document.aspnetForm.crExpiredYear.value == taon.getFullYear()) && ((document.aspnetForm.crExpiredMonth.options[document.aspnetForm.crExpiredMonth.selectedIndex].value-1) < taon.getMonth()))
  {
  	alert("Please enter right month of expiration date.");
	document.aspnetForm.cboMonth.focus();
    return false;
  }
   
   if (document.aspnetForm.crExpiredYear.value < taon.getFullYear())
  {
  	alert("Please enter right year of expiration date.");
	document.aspnetForm.txtYear.focus();
    return false;
  }
  
  if (document.aspnetForm.crAccountBankName.value == "")
  {
    alert("Please enter your Issuer Bank !");
    document.aspnetForm.crAccountBankName.focus();
   return false;
  }
  
  return true;
  }


    function fjs_changePlace(val, what, key, val2, val3)
    {           
        document.aspnetForm.method = 'post';
        document.aspnetForm.action = 'main_search_result.aspx?wh='+val+'&is='+what+'&ky='+key+'&tp='+val2+'&sw='+val3;
        document.aspnetForm.submit();        
    }
    
    function fjs_gotoPage(val1, val2, val3, val4)
    {
        document.aspnetForm.method = 'post';
        document.aspnetForm.action = 'main_search_result.aspx?wh='+val2+'&pg='+val1+'&tp='+val3+'&sw='+val4;
        document.aspnetForm.submit();          
    }
    
    
    function fjs_postMsg(val)
    {    
        var test = true;
    
            if(document.aspnetForm.crEmail.value=='')
            {
                document.aspnetForm.crEmailAlert.value = 'Required!';
                test=false;
            }else{                     
              var field = document.aspnetForm.crEmail; 
              var str = field.value; 
              var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
              var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 
                            
              if (reg2.test(str) == false)
              {
                document.aspnetForm.crEmailAlert.value = 'Invalid Email Address!';
                document.aspnetForm.crEmail.focus();
                test=false;
              }
            }
            
            if(document.aspnetForm.crName.value=='')
            {
                document.aspnetForm.crNameAlert.value = 'Required!';
                document.aspnetForm.crName.focus();
                test=false;
            }
            
            if(document.aspnetForm.crSubject.value=='')
            {
                document.aspnetForm.crSubjectAlert.value = 'Required!';
                document.aspnetForm.crSubject.focus();
                test=false;
            }
            
            if(test==true)
            {
                document.aspnetForm.method = 'post';
                document.aspnetForm.action = 'main_fans_proses.aspx'
                document.aspnetForm.submit();
            }
    }
    
    function fjs_clearForm()
    {
        document.aspnetForm.crEmailAlert.value = '';
        document.aspnetForm.crEmail.value='';
        
        document.aspnetForm.crNameAlert.value='';
        document.aspnetForm.crName.value = '';
        
        document.aspnetForm.crSubjectAlert.value='';
        document.aspnetForm.crSubject.value = '';  
        
        document.aspnetForm.crMessage.value='';
    }
    
    
        function fjs_delete_wish()
        {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_order_deletewish.aspx';
            document.aspnetForm.submit();
        }
        
     function fjs_add_to_basket()
     {
            document.aspnetForm.method = 'post';
            document.aspnetForm.action = 'main_order_wishaddbasket.aspx';
            document.aspnetForm.submit();
     }
     
     function fjs_checkFranchise()
     {
           var valid = true;
           
           nama_lengkap = document.aspnetForm.nama_lengkap.value
           if (nama_lengkap != '')
	        {
		        var arr1 = "abcdefghijklmnopqrstuvwxyz0123456789@. _-ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		        if (!validate_char(nama_lengkap,arr1)) 
		        {
		              alert('masukkan nama anda !');   
		              document.aspnetForm.nama_lengkap.focus();                      
                      valid = false;
	            } 
	         } 
	        else
		         {
	              alert('masukkan nama anda !');                         
	              document.aspnetForm.nama_lengkap.focus();                      
                      valid = false;
		         } 


	        usia = document.aspnetForm.usia.value
	        if (usia != '')
		        {
			        var arr = "0123456789"
			        if (!validate_char(usia,arr)) 
			        {
		   	           alert("masukkan usia Anda");	
		              document.aspnetForm.usia.focus();                      
                      valid = false;
		            } 
		         } 
		        else
			         {
			          alert("masukkan usia Anda");	
  		              document.aspnetForm.usia.focus();                      
                      valid = false;
			         }  


	        if (document.aspnetForm.alamat.value == "") {
		        alert("masukkan alamat Anda");	
		        document.aspnetForm.alamat.focus();
                      valid = false;
	        }

	        if (document.aspnetForm.kota.value == "") {
		        alert("masukkan kota Anda");	
		        document.aspnetForm.kota.focus();		
                      valid = false;
	        }
        	
	        if (document.aspnetForm.handphone.value == "") {
		        alert("masukkan handphone Anda");	
		        document.aspnetForm.kota.focus();		
                      valid = false;
	        }

	        if (document.aspnetForm.propinsi.value == "") {
		        alert("masukkan propinsi Anda");	
		        document.aspnetForm.propinsi.focus();
                      valid = false;
	        }

	        kode_pos = document.aspnetForm.kode_pos.value
	        if (kode_pos != '')
		        {
			        var arr = "0123456789"
			        if (!validate_char(kode_pos,arr)) 
			        {
		   	           alert("masukkan kode_pos Anda");	
		              document.aspnetForm.kode_pos.focus();                      
                      valid = false;
		            } 
		         } 
		        else
			         {
			          alert("masukkan kode_pos Anda");	
  		              document.aspnetForm.kode_pos.focus();                      
                      valid = false;
			         }  

	        if ((document.aspnetForm.telp_rumah.value == "") && (document.aspnetForm.telp_rumah.value == ""))
	        {	
		        if (document.aspnetForm.telp_rumah.value == "")
		        {
			        alert("masukkan telepon rumah Anda");	
			        document.aspnetForm.telp_rumah.focus();
                      valid = false;
		        } 	
		        if (document.aspnetForm.telp_ktr.value == "")
		        {
			        alert("masukkan telepon kantor Anda");	
			        document.aspnetForm.telp_ktr.focus();
                      valid = false;
		        }
	        }

	        var emailStr = document.aspnetForm.email.value;
	        var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	        var matchArray = emailStr.match(emailPat);
	        if (document.aspnetForm.email.value =='') 
	        {
		        alert('Silahkan mengisi kolom email');
		        document.aspnetForm.email.focus();
                      valid = false;
	        }else
	        {
		        if (matchArray == null){
			        alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
			        document.aspnetForm.email.focus();
                      valid = false;
		        }
		        //else
		        //	return true;
	        }
        	
	        if (document.aspnetForm.jawab_dua.value == "") 
	        {
		        alert("Silahkan isi pertanyaan ke dua.");	
		        document.aspnetForm.jawab_dua.focus();
                      valid = false;
	        }

        	
	        if ( (document.aspnetForm.jawab_tiga(0).checked == true) && (document.aspnetForm.jawab_tiga(0).value == "1") && (document.aspnetForm.jawab_tiga_ya.value == "") )
	        {
		        alert("Silahkan isi pertanyaan ke tiga.");	
		        document.aspnetForm.jawab_tiga_ya.focus();
                      valid = false;
	        }
        		
	        if ( (document.aspnetForm.jawab_empat(0).checked == true) && (document.aspnetForm.jawab_empat(0).value == "1") && (document.aspnetForm.jawab_empat_ya.value == "") )
	        {
		        alert("Silahkan isi pertanyaan ke empat.");	
		        document.aspnetForm.jawab_empat_ya.focus();
                      valid = false;
	        }

	        if ( (document.aspnetForm.jawab_enam(2).checked == true) && (document.aspnetForm.jawab_enam(2).value == "3") && (document.aspnetForm.jawab_enam_ya.value == "") )
	        {
		        alert("Silahkan isi pertanyaan ke enam.");	
		        document.aspnetForm.jawab_enam_ya.focus();
                      valid = false;
	        }


	        if(valid==true)
	        {
                document.aspnetForm.method = 'post';
                document.aspnetForm.action = 'main_franchise_info_proses.aspx';
                document.aspnetForm.submit();
	        }
     }
     
    function validate_char(field,valid) {
    var temp;
    for (var i=0; i<field.length; i++) {
        temp = "" + field.substring(i, i+1);
        if (valid.indexOf(temp) == "-1") return false;
        }
    return true;    
    }
    
    
function fjs_submitmailus() {

var emailStr = document.aspnetForm.email.value;
var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
var matchArray = emailStr.match(emailPat);
var valid = true

if (document.aspnetForm.to.value=="kosong") {
	alert ("silahkan pilih tujuan email Anda");
	valid = false;
}			 	

if (document.aspnetForm.nama.value == "") {
   alert('Silahkan isi nama anda');
   valid = false; }
else {
   if (document.aspnetForm.email.value == "") {
      alert('Silahkan isi email anda');      
      valid = false; }
   else {
   
      if (matchArray == null) 
  	  {
  	    alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
		valid = false;
  	  }
      else 
      {
        /*if (aspnetForm.other1.checked == true) {
	      if (aspnetForm.isi_other1.value==''){
	         alert('Silahkan Anda melengkapi pertanyaan nomor satu');
	         valid = false;
	       }
	    }
	    if (aspnetForm.other2.checked == true) {
	      if (aspnetForm.isi_other2.value==''){
	         alert('Silahkan Anda melengkapi pertanyaan nomor dua');
	         valid = false;             
	       }  	          
         }*/   
      }
   }
  }

 if(valid==true)
 {			 
    document.aspnetForm.action="main_mailus_result.aspx";
    document.aspnetForm.submit();
 }
}


function isi_ket() {
if (document.aspnetForm.to.value == "order@disctarra.com") {  
   //document.aspnetForm.keterangan.value = "Untuk yang berhubungan dengan pesanan Anda";
   said.innerHTML = "<b>Keterangan : </b> Untuk yang berhubungan dengan pesanan Anda";
}
if (document.aspnetForm.to.value == "saran@disctarra.com") {
   //document.aspnetForm.keterangan.value = "Untuk Anda yang ingin memberikan saran kepada kami";
   said.innerHTML = "<b>Keterangan : </b> Untuk Anda yang ingin memberikan saran kepada kami";
}
if (document.aspnetForm.to.value == "techhelp@disctarra.com") {
   //document.aspnetForm.keterangan.value = "Asisten Technical Anda yang akan membantu masalah technical";
   said.innerHTML = "<b>Keterangan : </b> Asisten Technical Anda yang akan membantu masalah technical";
}
if (document.aspnetForm.to.value == "postmaster@disctarra.com") {
   //document.aspnetForm.keterangan.value = "Postmaster Anda yang akan membantu masalah email anda";
   said.innerHTML = "<b>Keterangan : </b> Postmaster Anda yang akan membantu masalah email anda";
}
if (document.aspnetForm.to.value == "marketing@disctarra.com") {
   //document.aspnetForm.keterangan.value = "Untuk Anda yang ingin memasang banner atau berhubungan dengan marketing kami";
   said.innerHTML = "<b>Keterangan : </b> Untuk Anda yang ingin memasang banner atau berhubungan dengan marketing kami";
}
if (document.aspnetForm.to.value == "store@disctarra.com") {
   //document.aspnetForm.keterangan.value = "Untuk Anda yang ingin memasukkan saran atau keluhan untuk toko retail kami";
   said.innerHTML = "<b>Keterangan : </b> Untuk Anda yang ingin memasukkan saran atau keluhan untuk toko retail kami";
}
}

function klik() {
  if (aspnetForm.other1.checked == false) {
     aspnetForm.isi_other1.value ='';     
  }
  if (aspnetForm.other2.checked == false) {
     aspnetForm.isi_other2.value = '';  
  } 
}


function fjs_cancelmailus()
{
    document.aspnetForm.nama.value='';
    document.aspnetForm.email.value='';
    document.aspnetForm.user_id.value='';
    document.aspnetForm.to.value='';
    document.aspnetForm.isi_other1.value='';
    document.aspnetForm.isi_other2.value='';
    document.aspnetForm.subject.value='';
    document.aspnetForm.isi.value='';
    said.innerHTML = ''
}

function validate_num(field,valid) {
  var temp;
  for (var i=0; i<field.length; i++) {
	temp = "" + field.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") return false;
  }
  return true;    
}

function fjs_submitads() {
  var valid = true
    
  if (document.aspnetForm.name.value == "") {
	alert('Please fill your name');
	document.aspnetForm.name.focus();
	valid = false; }
  else {
	if (document.aspnetForm.company.value == "") {
	  alert('Please fill your company name');
	  document.aspnetForm.company.focus();
	  valid = false; }
	else {
	  if (document.information.email.value == "") {
		alert('Please fill your e-mail');
		document.aspnetForm.email.focus();
		valid = false; }
	  else {
	    var emailStr = document.aspnetForm.email.value;
		var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
		var matchArray = emailStr.match(emailPat);
		if (matchArray == null) {
  		  alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
  		  document.aspnetForm.email.focus();
		  valid = false; }
		else {
		  if (document.aspnetForm.phone.value == "") {
			alert('Please fill your phone number');
			document.aspnetForm.phone.focus();
			valid = false; }
		  else {
			var phoneStr = document.aspnetForm.phone.value;
			var phoneArr = "0123456789";
			if (!validate_num(phoneStr,phoneArr)) {
     		  alert("Wrong number, please try again.");
			  document.aspnetForm.phone.focus();
			  valid = false; }
			else {
			  if (document.aspnetForm.address.value == "") {
				alert('Please fill your address');
				document.aspnetForm.address.focus();
				valid = false; }
			  else {
				if (document.aspnetForm.city.value == "") {
				  alert('Please fill your city');
				  document.aspnetForm.city.focus();
				  valid = false; }
				else {
				  if (document.aspnetForm.usaha.value == "false") {
					alert('Please choose your scope of service');
					document.aspnetForm.usaha.focus();
					valid = false; }
				  else {	
					if (document.aspnetForm.month.value == "") {
					  alert('Please choose month');
					  document.aspnetForm.month.focus();
					  valid = false; }
					else 
					  valid = true;
				  }
				}
			  }
			}
		  }
		}
      }
	}
  }
  
 if(valid==true)
 {			 
    document.aspnetForm.action="main_adinformation_result.aspx";
    document.aspnetForm.submit();
 }
}

function fjs_cancelads() {
  document.information.name.value="";
  document.information.company.value="";
  document.information.email.value="";
  document.information.phone.value="";
  document.information.address.value="";
  document.information.city.value="";
  document.information.url.value="";
  document.information.usaha.value="false";
  document.information.month.value="";
}


// ---------------------------------------------
// --- Name:    Easy DHTML Treeview           --
// --- Author:  D.D. de Kerf                  --
// --- Version: 0.1           Date: 6-6-2001  --
// ---------------------------------------------
function Toggle(node)
{
	// Unfold the branch if it isn't visible
	if (node.nextSibling.style.display == 'none')
	{
		// Change the image (if there is an image)
		if (node.children.length > 0)
		{
			if (node.children.item(0).tagName == "IMG")
			{
				node.children.item(0).src = "http://media.disctarra.com/web/tree/minus.gif";
			}
		}

		node.nextSibling.style.display = '';
	}
	// Collapse the branch if it IS visible
	else
	{
		// Change the image (if there is an image)
		if (node.children.length > 0)
		{
			if (node.children.item(0).tagName == "IMG")
			{
				node.children.item(0).src = "http://media.disctarra.com/web/tree/plus.gif";
			}
		}

		node.nextSibling.style.display = 'none';
	}

}


function submit_budget()
{
    if((document.aspnetForm.crBudgetFrom.value=="")||(document.aspnetForm.crBudgetTo.value==""))
    {
        alert("Budget value From or To must be filled!");
    }else{    
          document.aspnetForm.method = "post";
          document.aspnetForm.action = "main_search_result.aspx?tp=b";
          document.aspnetForm.submit();
    }
}

function submit_category()
{
    if(document.all("crKeyword").value=="")
    {
        alert("Please specify what to search for!");
    }else{    
          document.aspnetForm.method = "post";
          document.aspnetForm.action = "main_search_result.aspx?tp=c";
          document.aspnetForm.submit();
    }    
}

function cattype(val)
{
    switch(val)
    {
        /*
        1 = News
        2 = Music
        3 = Video
        4 = Karaoke
        5 = Artist
        */
        case "1":
            ch_cat(0,0,1,0,0,1);
            break;
        case "2":
            ch_cat(1,0,0,0,0,1);
            break;
        case "3":
            ch_cat(0,1,0,0,0,1);
            break;        
        case "4":
            ch_cat(0,0,0,0,1,1);
            break;
        case "7":
            ch_cat(0,0,0,1,0,1);
            break;        
    }
}






function fjs_writeAlert()
{
    document.aspnetForm.crAlertUsername.value = '';
}

function fjs_submitticket()
{
    var jmlticket = document.aspnetForm.crJmlTicket.value;
    
    for(var a=0; a<=jmlticket-1; a++)
    {
        
    }
}

function fjs_checkQtyTicket()
{

}


function fjs_opinion_submit()
{
    var valid = true;
    var emailStr = document.aspnetForm.crEmail.value;
	var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {
  	  alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the email address)");
  	  document.aspnetForm.crEmail.focus();
	  valid = false; }
	else {
	  valid = true;
	}
	
	if(valid){
	    document.aspnetForm.method = "post";
	    document.aspnetForm.action = "main_opinion_result.aspx";
	    document.aspnetForm.submit();
	}    
}

function fjs_opinion_reset()
{
    document.aspnetForm.crNama.value = '';
    document.aspnetForm.crEmail.value = '';
    document.aspnetForm.crOpinion.value = '';
}

function fjs_checkusername()
{
    var userid = document.aspnetForm.crUsername.value;
    
    var xmlhttp;
    if (window.XMLHttpRequest)
      {
      // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else if (window.ActiveXObject)
      {
      // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    else
      {
      alert("Your browser does not support XMLHTTP!");
      }
    xmlhttp.onreadystatechange=function()
    {
    if(xmlhttp.readyState==4)
      {
      document.aspnetForm.crCheckResult.value=xmlhttp.responseText;
      if(xmlhttp.responseText=="1")
      {
        document.aspnetForm.crAlertUsername.value="Usename already taken";
      }else{
        document.aspnetForm.crAlertUsername.value="";        
      }
      }
    }
    xmlhttp.open("GET","../quiz/check.aspx?u="+userid,true);
    xmlhttp.send(null);    
}
