
			var intTotalGlobal = 0
			
			//Recalculte total amount
			function fnRecalc()
			{
				//Get objects
				var objT100 = document.getElementById('T100');
				var objP100 = document.getElementById('P100');
				var objT200 = document.getElementById('T200');
				var objP200 = document.getElementById('P200');
				var objT300 = document.getElementById('T300');
				var objP300 = document.getElementById('P300');
				var objT500 = document.getElementById('T500');
				var objP500 = document.getElementById('P500');	
				var objTotal = document.getElementById('Total');	
				
				//Calc
				subtotal100 = (parseInt(objP100.value) * 100);
				subtotal200 = (parseInt(objP200.value) * 200);
				subtotal300 = (parseInt(objP300.value) * 300);
				subtotal500 = (parseInt(objP500.value) * 500);
			
				//Checks 1
				if (subtotal100.toString() != "NaN")
				{
					objT100.innerHTML = subtotal100;
				}
				else
				{
					objT100.innerHTML = '0';
				}
				
				//Checks 2
				if (subtotal200.toString() != "NaN")
				{
					objT200.innerHTML = subtotal200;
				}
				else
				{
					objT200.innerHTML = '0';
				}
				
				//Checks 3
				if (subtotal300.toString() != "NaN")
				{
					objT300.innerHTML = subtotal300;
				}
				else
				{
					objT300.innerHTML = '0';
				}
				
				//Checks 4
				if (subtotal500.toString() != "NaN")
				{
					objT500.innerHTML = subtotal500;
				}
				else
				{
					objT500.innerHTML = '0';
				}
				
				var intTotal  = parseInt(objT100.innerHTML) + parseInt(objT200.innerHTML) + parseInt(objT300.innerHTML) + parseInt(objT500.innerHTML)
				intTotalGlobal = intTotal;
				objTotal.innerHTML = 'Total MXN: ' + intTotal.toString();
			}  
			
			function confirmation()
			{
				var objEmail = document.getElementById('email')
				var objEmail2 = document.getElementById('email2')
				var objName = document.getElementById('name');
				var strEmail = trim(objEmail.value);
				var strEmail2 = trim(objEmail2.value);
				var strName = trim(objName.value);
				
				var div1 = document.getElementById('div1');
				var div2 = document.getElementById('div2');
				var div3 = document.getElementById('div3');
				
				//Email syntax check
				var x = strEmail;
				var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

				//Checks on input
				if (strName == '')
				{
					alert('Nombre es un campo obligatorio');
				}
				else if (strEmail == '')
				{
					alert('Correo electrónico es un campo obligatorio'); 
				}
				else if (!filter.test(x))
				{
					alert('El correo electrónico no es valida');
				}
				else if (strEmail != strEmail2)
				{
					alert('Los correos electrónicos no coinciden');
				}
				else if (intTotalGlobal > 0)
				{
					var answer = confirm("Su pedido es de " + intTotalGlobal + " Pesos.-\r\n\r\nConfirmar?");
					if (answer)
					{
						//Submit form to iframe
						var objForm = document.getElementById('frm_ficha');
						
						//Change divs
						div1.style.display = 'none'
						div2.style.display = 'block';
						div3.style.display = 'none';
						
						objForm.submit();
						return false;
					}
					else
					{
						//Return to form
						return true;
					}
				}
				else
				{
					alert("Favor de seleccionar tarjetas primero");
				}
				
			}
			
			function trim(string)
			{
				while(string.substr(0,1)==" ")
				string = string.substring(1,string.length) ;
				while(string.substr(string.length-1,1)==" ")
				string = string.substring(0,string.length-2) ;
				return string;
			}
			
			function fnThankYou(blnResult,companyName,companyCode,transactionNumber,totalAmount,email)
			{
				var div1 = document.getElementById('div1');
				var div2 = document.getElementById('div2');
				var div3 = document.getElementById('div3');
				var div4 = document.getElementById('div4');
				var div5 = document.getElementById('div5');
				var divUpperBox = document.getElementById('upperbox');
				
				if (blnResult == 'true')
				{
					div1.style.display = 'none';
					div2.style.display = 'none';
					div3.style.display = 'block';
					div4.style.display = 'none';
					divUpperBox.innerHTML = 'Su pedido ha sido procesada de manera exitosa. Se ha enviado una confirmación a <b>' + email + '</b>. Para recibir el código Wallie debes de acudir a una sucursal de <?php echo $bank; ?> y pagar la ficha RAP. Recibirás el código Wallie dentro de 12 horas después de haber efectuado el pago.';
					var strText = 'Puedes imprimir la ficha RAP hacienda click en el boton "Mostrar ficha RAP" abajo o llenar una ficha RAP en el banco con los siguientes datos:';
					strText += '<br /><br />';
					strText += 'Nombre del servicio: <b>' + companyName + '</b><br />';
					strText += 'Clave: <b>' + companyCode + '</b><br />';
					strText += 'Referencia 1: <b>' + transactionNumber + '</b><br />';
					strText += 'Monto: <b>' + totalAmount + '</b><br />';
					strText += '<br /><br />';
					strText += '<input onclick="fnPopWindow(\'showrap.php\',800,600,\'no\',\'rapvoucher\');" type=\'button\' name=\'completerap\' id=\'completerap\' value=\'Mostrar ficha RAP\' />';
					div3.innerHTML = strText;
				}
				else
				{
					div1.style.display = 'block';
					div2.style.display = 'none';
					div3.style.display = 'none';
					div4.style.display = 'block';
				}
			}
			
			function init()
			{
				fnDisplayError();
			}
			
			function fnDisplayError()
			{
					div1.style.display = 'none';
					div2.style.display = 'none';
					div3.style.display = 'none';
					div4.style.display = 'block';
					div5.style.display = 'none';
			}
			
			function fnPopWindow(theUrl,width,height,mod,naam)
			{
				toolbar = 'no';
				resizable = 'yes';
				personalbar = 'no';
				locationbar = 'no';
				status = 'no';
				scrollbars='no';
				menubar='no';
				
				IE = ((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1)) ? true : false;

				if (IE && mod=='yes')
				{
					window.showModelessDialog(theUrl,window,"dialogWidth: "+width+"px; dialogHeight: "+height+"px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; scroll: "+scrollbars+"; resizable: "+resizable+"; status: "+status+";");
				}
				
				else
				{
					var winleft = (screen.width - width) / 2;
					var winUp = (screen.height - height) / 2;
					winUp = winUp -40;
					var winProp = 'width='+width+',height='+height+',left='+winleft+',top='+winUp+',scrollbars='+scrollbars+',resizable='+resizable+',menubar='+menubar+',toolbar='+toolbar+',personalbar='+personalbar+',location='+locationbar+',status='+status+''
					if (naam=='')
					{
						naam= date.getSeconds ;
					}
					Win = window.open(theUrl, naam, winProp)
				}
			}
			
			/*
			PopUpURL    = "The right click options are disabled for this window";

			isIE=document.all;
			isNN=!document.all&&document.getElementById;
			isN4=document.layers;

			if (isIE||isNN)
			{
			 document.oncontextmenu=checkV;
			}
			else
			{
			 document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
			 document.onmousedown=checkV;
			} 

			function checkV(e)
			{
				if (isN4)
				 {
				if (e.which==2||e.which==3)
					{
					dPUW=alert(PopUpURL);
					return false;
					}
				}
				else
				{
				dPUW=alert(PopUpURL);
				return false;
				}
			}
			
		*/
			
		
			//Disable textbox pasting
			function disablePastOnElement(e,type)
			{
				//Return value
				var blnReturn = true;
				
				//If keydown
				if (type == 'key')
				{
					var keynum = null;
					var keychar = null;
					
					if (window.event) // IE
					{
						keynum = e.keyCode
					}
					else if (e.which) // Netscape/Firefox/Opera
					{
						keynum = e.which
					}

					if (keynum == 17)
					{
						//blnReturn = false;
					}
				}
				else if (type == 'rclick')
				{
					
					if (event.button == 2)
					{
						blnReturn = false;
					}
				}
				
			
				//Return value
				if (blnReturn)
				{	
					return true;
				}
				else
				{
					alert('Please type your e-mail address and do not paste it');
					return '';
					
				}
			}	
