function isEmail(obj){
	var str = new String(obj.value); 
	if (str.match(/^[a-zA-Z0-9_\.\-\+\#\%]+@[a-zA-Z0-9_\.\-]+\.[a-zA-Z]{2,3}$/) == null){
		return false;
	}
	return true;
}

function isFilled(obj){
	if (obj.value.length<1){
		return false;
	}
	return true;
}

function isNumeric(obj, ignoreWhiteSpace) {
	var string = new String(obj.value);
	if (string.search) {
		if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)){
			return false;
		}
	}
	return true;
}


function checkNumeric(strString){
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
   {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
      	   blnResult = false;
         }
   }
   return blnResult;
}


function fieldError(elem, errMsg)
{
	if (elem.type == "textfield" || elem.type == "textarea" || elem.type=="select")
		elem.select();
	if (elem.length > 1) elem[0].focus();
	else elem.focus();
	alert(errMsg);
}

function alertMsg(field,msg) 
{
   alert(msg);
   field.focus();   
} 

function isChecked(obj){
		
	for (var i=0;i<obj.length;i++){
		if (obj[i].checked==true)
			return true;
	}
	
	obj[0].focus();
	return false;
}

/* 1st level */
var nullValue = new Array("Please Select");
var nullValue_code = new Array("nullValue");

/*PIBB*/
var Personal_Banking = new Array("Please Select","ABBA Term Financing-i","ABBA SMILAX Financing-i","ABBA SWIFT Financing-i","ABBA Variable House Financing-i Non Prescribed","ABBA Variable House Financing-i Prescribed","ABBA Variable SMILAX Financing-i","ABBA Variable SWIFT Financing-i","ABBA Variable Term Financing-i","AITAB Hire Purchase-i","BASIC Wadiah Savings Account-i","BASIC Wadiah Current Account-i","BAE Personal Financing-i","BESTARI Mudharabah Savings Account-i","Cash Line Facility-i (Islamic Overdraft)","ABBA House Financing-i","Mudharabah General Investment Account-i","Plus BAE Personal Financing-i","Plus Cashline Personal Financing-i","Wadiah Current Account-i","Wadiah Savings Account-i","Others");
var Personal_Banking_code = new Array("nullValue","_PBABBA Term Financing-i","PBABBA SMILAX Financing-i","PBABBA SWIFT Financing-i","PBABBA Variable House Financing-i Non Prescribed","PBABBA Variable House Financing-i Prescribed","PBABBA Variable SMILAX Financing-i","PBABBA Variable SWIFT Financing-i","PBABBA Variable Term Financing-i","PBAITAB Hire Purchase-i","PBBASIC Wadiah Savings Account-i","PBBASIC Wadiah Current Account-i","PBBAE Personal Financing-i","PBBESTARI Mudharabah Savings Account-i","PBCash Line Facility-i (Islamic Overdraft)","PBABBA House Financing-i","PBMudharabah General Investment Account-i","PBPlus BAE Personal Financing-i","PBPlus Cashline Personal Financing-i","PBWadiah Current Account-i","PBWadiah Savings Account-i","PBOthers");
var Business_Banking = new Array("Please Select","ABBA Term Financing-i","ABBA SMILAX Financing-i","ABBA SWIFT Financing-i","ABBA Variable SMILAX Financing-i","ABBA Variable SWIFT Financing-i","ABBA Variable Term Financing-i","AITAB Hire Purchase-i","Cash Line Facility-i","Mudharabah General Investment Account-i","Mudharabah Special Investment Account-i","Wadiah Current Account-i","Others");
var Business_Banking_code = new Array("nullValue","BBABBA Term Financing-i","BBABBA SMILAX Financing-i","BBABBA SWIFT Financing-i","BBABBA Variable SMILAX Financing-i","BBABBA Variable SWIFT Financing-i","BBABBA Variable Term Financing-i","BBAITAB Hire Purchase-i","BBCash Line Facility-i","BBMudharabah General Investment Account-i","BBMudharabah Special Investment Account-i","BBWadiah Current Account-i","BBOthers");
/*PIBB*/

/*Others*/
/*
var Others = new Array("Please Select","Others");
var Others_code = new Array("nullValue","Others");
*/
var Others = new Array("Others");
var Others_code = new Array("Others");


function chgCategory(obj)
{	
    var objValue = obj.options[obj.selectedIndex].value;
   	var nextObjValue = document.frm1.select_product;   
   	//var nextObjValue2 = document.frm1.select_spec;   
   	var objValSelected = eval(objValue);	   	
   	var objValSelected2 = "";
   	 	    
    if(objValue == "nullValue")
    {      
         document.frm1.select_product.disabled = true;      
         setOptionText(nextObjValue, nullValue, nullValue_code);
         //setOptionText(nextObjValue2, nullValue, nullValue_code);	          
         //document.frm1.select_spec.disabled = true;    
    }
    
    if(objValue == "Others")   
    {    
         document.frm1.select_product.disabled = true;       
         setOptionText(nextObjValue, Others, Others_code);
         //setOptionText(nextObjValue, objValSelected, objValSelected2);	
         //setOptionText(nextObjValue2, nullValue, nullValue_code);	    
         //document.frm1.select_spec.disabled = true;                
    }
    else
    {      
      document.frm1.select_product.disabled = false;                
      setOptionText(nextObjValue, objValSelected, objValSelected2);	
      //setOptionText(nextObjValue2, nullValue, nullValue_code);	  
      //document.frm1.select_spec.disabled = true;        
    }       	
}

function setOptionText(objValue,objValSelected, objValSelected2)
{    
   	for (var loop=objValue.length;loop>=0;loop--) 
   	{
   		   objValue.options[loop] = null; 
   	}	
   	for (loop=0; loop < objValSelected.length; loop++)
   	{ 
   		   objValue.options[objValue.length] = new Option(objValSelected[loop],objValSelected2[loop]);    		   
   	}
} 
