<!--
function selectList(This,value){
		/*var length = This.length;
		var n;*/
		This.value=value;
		/*if(value != ""){
			for(n=0;n<length;n++){
				if(This.options[n].value == value){
					This.selectedIndex = n;
					return;
				}
			}
		}*/
}
function requireField(element,altvalue)//usage "return requireField(new Array(document.form1.email,document.form1.pass),new Array('Email address is required !','Password is required !'));"
{
	for(i=0;i<element.length;i++)
	{
		if(element[i].value == '')
		{
			alert(altvalue[i]);
			element[i].focus();
			return false;
		}
	}
	return true;
}

function checkMatch(element1,element2,altvalue)
{
	if(element1.value != element2.value)
	{
		alert(altvalue);
		element2.focus();
		return false;
	}
	return true;
}

function validEmail(This)
{
	var result,address,user;
	var i;
	address=This.value;
	components=new Array();
	if (address.match(/^[\w_\-\.]+\@[\w_\-]+\.[\w_\-\.]+$/))
	{
		address=address.replace('@','.');
		components=address.split('.');
		for (i=0; i<components.length-1; i++)
		{
			if (components[i].match(/[^\w_\-]/))
			{
				result=false;
				break;				
			}
		}
		if (result!=false)
			result=true;
	}
	else
		result=false;

	if (result == false)
	{
		alert('Invalid email address.');
		This.focus();
		return false;
	}
	return true;
}

function validEmail2(val)
{
	var result,address,user;
	var i;
	//address=This.value;
	address = val.replace(" ", "");
	components=new Array();
	if (address.match(/^[\w_\-\.]+\@[\w_\-]+\.[\w_\-\.]+$/))
	{
		address=address.replace('@','.');
		components=address.split('.');
		for (i=0; i<components.length-1; i++)
		{
			if (components[i].match(/[^\w_\-]/))
			{
				result=false;
				break;				
			}
		}
		if (result!=false)
			result=true;
	}
	else
		result=false;

	if (result == false)
	{
		alert('Invalid email address.');
		return false;
	}
	return true;
}

function validNumber(This)
{
	var x=This.value;
	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	if (anum.test(x) || x == "")
		return 1;
	else
	{
		alert("Please input a valid number!");
		This.focus();
		return 0;
	}
}
function validNumber_null(This)
{
	return 1;
}
function checkLength(This,min,max,Null)//This is element ,Null =1 is allow null else not allow null
{
	if(This.value == "" && Null == 1)//if Null set 0 that is not allow null value
		return 1;
	else
	{
	
	  if(validNumber(This)){
    
        return 0;
    
    }else	if(This.value.length < min)
		{
			alert('Length is not less than '+min+' digits');
			This.focus();	
			return 0;
		}
		else if (This.value.length > max)
		{
			alert('Length is not greater than '+max+' digits');
			This.focus();	
			return 0
		}
	}
	return 1;
}
function checkLength2(This,min,max,Null,mes1,mes2)//This is element ,Null =1 is allow null else not allow null, mes1 when less ,mes2 when greater
{
	if(This.value == "" && Null == 1)//if Null set 0 that is not allow null value
		return 1;
	else
	{
	  if(!validNumber(This)){    
        return 0;    
    }else		if(This.value.length < min)
		{
			alert(mes1+' '+min+' digits');
			This.focus();	
			return 0;
		}
		else if (This.value.length > max)
		{
			alert(mes2+' '+min+' digits');
			This.focus();	
			return 0
		}
	}
	return 1;
}
function browserSniffer() 
{
  	var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);
	var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));

	var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));

	var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||

                          (agt.indexOf("; nav") != -1)) );

    var is_nav5 = (is_nav && (is_major == 5));
    var is_nav5up = (is_nav && (is_major >= 5));

	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie4up  = (is_ie && (is_major >= 4));
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

	var is_aol   = (agt.indexOf("aol") != -1);
    var is_aol3  = (is_aol && is_ie3);
    var is_aol4  = (is_aol && is_ie4);
    var is_opera = (agt.indexOf("opera") != -1);
    var is_webtv = (agt.indexOf("webtv") != -1);

	//alert(agt);
	if(!(is_ie5up))//if not ie 5 up redirect
		return 1;
	else
		return 0;
}
function flush_decimal(value,X)
{
	X = (!X ? 2 : X);

	value = ''+value+'';
	pos = value.indexOf('.');
	num = value.length - (pos+1);//count of decimal such as 3.0990 then num is 4
	
	if(pos != -1)//if find (.) position
	{
		if(num == 1)
			ans = value + "0";
		else if(num <= X)
			ans = value;
		else if(num > X)
			ans = value.substr(0,pos+X-1);
	}
	else
		ans = value + ".00";
	
	return ans;
}
function round(amount,X)
{
	// rounds number to X decimal places, defaults to 2
	amount= ''+amount+'';

	amount.replace("$","")
	amount.replace("?","")

	X = (!X ? 2 : X);
	return flush_decimal(Math.round(amount*Math.pow(10,X))/Math.pow(10,X),X);
}
function preview_pass(e_main,e_prev)
{
	e_prev.value = e_main.value;
}

function check_badpin(badpinlist,e_pin)
{	
	badpinlist = new Array();

	badpinlist[0] = 11111;
	badpinlist[1] = 22222;
	badpinlist[2] = 33333;
	badpinlist[3] = 44444;
	badpinlist[4] = 55555;
	badpinlist[5] = 66666;
	badpinlist[6] = 77777;
	badpinlist[7] = 88888;
	badpinlist[8] = 99999;
	badpinlist[9] = 00000;
	badpinlist[10] = 12345;
	badpinlist[11] = 01234;
	badpinlist[12] = 11223;

	var str = e_pin.value;	

	for(i=0;i<badpinlist.length;i++){
		if(badpinlist[i] == str.substr(0,5))
		{
			alert('Your pin number is easy to guess !!');
			e_pin.focus();
			return false;
		}
	}
	return true;
}


function check_badpin_old(badpinlist,e_pin)
{	
	badpinlist = new Array();

	badpinlist[0] = 1111111111;
	badpinlist[1] = 111111111;
	badpinlist[2] = 1111111;
	badpinlist[3] = 2222222222;
	badpinlist[4] = 222222222;
	badpinlist[5] = 2222222;
	badpinlist[6] = 3333333333;
	badpinlist[7] = 333333333;
	badpinlist[8] = 3333333;
	badpinlist[9] = 4444444444;
	badpinlist[10] = 444444444;
	badpinlist[11] = 4444444;
	badpinlist[12] = 5555555555;
	badpinlist[13] = 555555555;
	badpinlist[14] = 5555555;
	badpinlist[15] = 6666666666;
	badpinlist[16] = 666666666;
	badpinlist[17] = 6666666;
	badpinlist[18] = 7777777777;
	badpinlist[19] = 777777777;
	badpinlist[20] = 7777777;
	badpinlist[21] = 8888888888;
	badpinlist[22] = 888888888;
	badpinlist[23] = 8888888;
	badpinlist[24] = 9999999999;
	badpinlist[25] = 999999999;
	badpinlist[26] = 9999999;
	badpinlist[27] = 0000000000;
	badpinlist[28] = 000000000;
	badpinlist[29] = 0000000;
	badpinlist[30] = 1234567890;
	badpinlist[31] = '0123456789';
	badpinlist[32] = 1234567;
	badpinlist[33] = 12345678;
	badpinlist[34] = 1122334455;
	badpinlist[35] = 1122334;
	badpinlist[36] = 1234567890;	

	for(i=0;i<badpinlist.length;i++)
	{
		if(badpinlist[i] == e_pin.value)
		{
			alert('Your pin number is easy to guess !!');
			e_pin.focus();
			return false;
		}
	}
	return true;
}


function handleEnter (field, event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		return false;
	}
	else
		return true;
}

function hidePin(frm, val, rowid) {
	var row = document.getElementById(rowid);


	if ( (val == "NewPin") || (val == "ChooseNewPin") ){
		row.style.display = '';
		frm.pin.style.display="inline";
		frm.pin.disabled=false;
	}	
	else if (val == "Recharge") {
		row.style.display = 'none';
		frm.pin.style.display="none";
		frm.pin.disabled=true;
		
	}	
}

function hidePrice(frm, val, rowid) {
	var row = document.getElementById(rowid);


	if ( (val == "NewPin") || (val == "ChooseNewPin") ){
		row.style.display = '';
	}	
	else if (val == "Recharge") {
		row.style.display = 'none';
		
	}	
}
//-->
