/* 
	aranaz.com 2006 JS Document 
	Auskalo Interactive 
	www.auskalo.com :: info@auskalo.com
*/

// ***********************************************************************************************************************
// General Macromedia js functions  
// ***********************************************************************************************************************

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// ***********************************************************************************************************************
// Scroller fuctions
// ***********************************************************************************************************************
function flvS3(v1){//v1.0
var v2=MM_findObj(v1),v3=0,v4=0,v5=0,v6=0;if (!v2){this.x=this.y=this.h=this.w=0;return;}var v7=(document.layers)?v2:v2.style;v3=v7.left;v4=v7.top;if ((v3==""||v4=="")&&document.all&&!window.opera){if (v3==""){v3=v2.offsetLeft;}if (v4==""){v4=v2.offsetTop;}}if (v2.offsetHeight){v5=v2.offsetHeight;v6=v2.offsetWidth;}else if (document.layers){v5=v7.clip.height;v6=v7.clip.width;}this.x=parseInt(v3);this.y=parseInt(v4);this.h=parseInt(v5);this.w=parseInt(v6);}

function flvS8(v1,v2,v3){//v1.0
var v4=(document.layers)?v1:v1.style;var v5=flvS5();eval("v4.left='"+v2+v5+"'");eval("v4.top='"+v3+v5+"'");}
	
function flvS5(){//v1.0
var v1=((parseInt(navigator.appVersion)>4||navigator.userAgent.indexOf("MSIE")>-1)&&(!window.opera))?"px":"";return v1;}
				
function flvXAS1(){
var v1=arguments,v2=v1.length,v3='AutoScrollContainer',v4='AutoScrollContent';var v5=MM_findObj(v3),v6=MM_findObj(v4);if (!v5){return;}if (v5.XAS1!=null){clearTimeout(v5.XAS1);}var v7=(v2>0)?parseInt(v1[0]):1;if (v7){var v8=(v2>1)?parseInt(v1[1]):1,v9=(v2>2)?parseInt(v1[2]):50,v10=(v2>3)?parseInt(v1[3]):1;var v11=new flvS3(v3),v12=new flvS3(v4);var v13=v12.x,v14=v12.y,v15=0,v16=0;if (v10==1){var v17=-1*v12.h;v15=v12.x;if (v14>=v17){v16=v12.y-v8;}else {v16=v11.h;}}else {var v18=-1*v12.w;v16=v12.y;if (v13>=v18){v15=v12.x-v8;}else {v15=v11.w;}}flvS8(v6,v15,v16);v5.XAS1=setTimeout("flvXAS1("+v7+","+v8+","+v9+","+v10+")",v9);}}

// ***********************************************************************************************************************
// Cart fuctions
// ***********************************************************************************************************************

function _gotoUserIdentification(_lang, _okFlag){
	
	if(_okFlag == 1){
		document.frmShowCart.action = 'index.php?sec=commit&from=commitShop&language=' + _lang;
		document.frmShowCart.submit();
		//location.href = 'index.php?sec=update_cart&language=' + _lang;
	}
	else{
		alert("Su carrito esta vacio!"); //Your Cart is Empty
	}
}

function _continueShopping(_pageURL, _totCount){
	
}

function _showCart(_lang){
	
	location.href = 'index.php?sec=cart&language=' + _lang;
}

function _clearCart(_lang, prodID, rowNum,proweight){
	location.href = 'index.php?sec=clear&language=' + _lang + '&prodId=' + prodID + '&rowNum=' + rowNum+'&pro_weight='+proweight;
}

function _clearCartwithref(_lang, prodID,prodRef, rowNum,proweight){
	location.href = 'index.php?sec=clear&language=' + _lang + '&prodId=' + prodID + '&prodRef' + prodRef + '&rowNum=' + rowNum+'&pro_weight='+proweight;
}

function _execLogin(){
	document.frmLogin.submit();
}

function _commitShop(){
	//location.href = 'index.php?sec=commit&language=' + _lang + '&tp=usr';
	document.frmUserIdentification.submit();
}

function _doLogout(_lang){
	location.href = 'index.php?sec=logout&language=' + _lang;
}

function _forgotCheck(){
	if(document.frmUserForgot.txtEmailForgotR.value != ''){
		if (echeck(document.frmUserForgot.txtEmailForgotR.value)==false){
			document.frmUserForgot.txtEmailForgotR.value = "";
			document.frmUserForgot.txtEmailForgotR.focus();
			return false;
		}
		else{
			document.frmUserForgot.submit();
		}
	}
	else{
		alert(" E-mail invalido ");
		return false;
	}
}

function _sendMail(_lang){
	//location.href = 'index.php?sec=forgotpwd&language=' + _lang;
	if(document.frmUserIdentification.txtEmailForgot.value != ''){
		if (echeck(document.frmUserIdentification.txtEmailForgot.value)==false){
			document.frmUserIdentification.txtEmailForgot.value = "";
			document.frmUserIdentification.txtEmailForgot.focus();
			return false;
		}
		else{
			document.frmUserIdentification.submit();
		}
	}
	else{
		alert(" E-mail invalido ");
		return false;
	}
}

function _calcAmount(_idProd, _countRow, _rowPos){
	var _browserName = navigator.appName;
	
	var _netAmt = 0;
	var _totalAmt = 0;
	var _totalweight = 0;
	var _rTot = 0;
	var _rTotweight = 0;
	
	_qty = document.getElementById("txtQty_" + _idProd).value;
	if( _qty != 0){
		//_qty = 0;
	document.getElementById("hidQnty_" + _rowPos).value = document.getElementById("txtQty_" + _idProd).value;
	// Set Row Total
	_unitPrice = document.getElementById("hidUnitPrice_" + _idProd).value;
	_unitweight = document.getElementById("hidUnitweight_" + _idProd).value;
	
	_rowTotal = eval(_qty) * eval(_unitPrice);
	_rowTotal=_rowTotal.toFixed(2); // Anoop
	_totweight = eval(_qty) * eval(_unitweight);
	
	if(_browserName != 'Netscape')
		document.getElementById("lblAmount_" + _idProd).innerText = _rowTotal;
	else
		document.getElementById("lblAmount_" + _idProd).textContent = _rowTotal;
		
	document.getElementById("hidAmount_" + _rowPos).value = _rowTotal;
	
	if(_browserName != 'Netscape')
		document.getElementById("lblweight_" + _idProd).innerText = _totweight;
	else
		document.getElementById("lblweight_" + _idProd).textContent = _totweight;
		
	document.getElementById("hidweight_" + _rowPos).value = _totweight;
	
	
	// Set Importe Total
	for(j=0;j<_countRow;j++){
		//alert("asdasd")
		if(document.getElementById("hidAmount_" + j)){
			_rTot = document.getElementById("hidAmount_" + j).value;
			_totalAmt =  eval(_totalAmt) + eval(_rTot);
		}
	}
	
	if(_browserName != 'Netscape')
		document.getElementById("lblTotal").innerText = _totalAmt;
	else
		document.getElementById("lblTotal").textContent = _totalAmt;
	
	document.getElementById("hidTotal").value = _totalAmt;
	
	for(j=0;j<_countRow;j++){
		//alert("asdasd1")
		if(document.getElementById("hidweight_" + j)){
			_rTotweight = document.getElementById("hidweight_" + j).value;
			
			//_totalweight =  eval(_totalAmt) + eval(_rTot);
			_totalweight =  eval(_totalweight) + eval(_rTotweight);
		}
	}
	
	
	if(_browserName != 'Netscape')
		document.getElementById("lblTotalweight").innerText = _totalweight;
	else
		document.getElementById("lblTotalweight").textContent = _totalweight;
	
	document.getElementById("hidTotalweight").value = _totalweight;
	
	
	
	
	
	/*// Set Total Factura
	_shippingCost = document.getElementById("hidShippingCost").value;
	_finalAmt = eval(_totalAmt) + eval(_shippingCost);
	if(_browserName != 'Netscape')
		document.getElementById("lblNetAmt").innerText = _finalAmt;
	else
		document.getElementById("lblNetAmt").textContent = _finalAmt;*/
	
	}
}

function _calcAmountwithref(_idProd,_refProd, _countRow, _rowPos){
	var _browserName = navigator.appName;
	
	var _netAmt = 0;
	var _totalAmt = 0;
	var _totalweight = 0;
	var _rTot = 0;
	var _rTotweight = 0;
	_qty = document.getElementById("txtQty_" + _idProd +"_"+_refProd).value;
	if( _qty != 0){
		//_qty = 0;
	document.getElementById("hidQnty_" + _rowPos).value = document.getElementById("txtQty_" + _idProd +"_"+_refProd).value;
	// Set Row Total
	_unitPrice = document.getElementById("hidUnitPrice_" + _idProd +"_"+_refProd).value;
	_unitweight = document.getElementById("hidUnitweight_" + _idProd +"_"+_refProd).value;
	
	_rowTotal = eval(_qty) * eval(_unitPrice);
	_rowTotal=_rowTotal.toFixed(2); // Anoop
	_totweight = eval(_qty) * eval(_unitweight);
	
	document.getElementById("hidAmount_" + _rowPos).value = _rowTotal;
	//alert(_rowTotal);

if(_browserName != 'Netscape')
		document.getElementById("lblAmount_" + _idProd +"_"+_refProd).innerText = _rowTotal.replace(".", ",");
	else
		document.getElementById("lblAmount_" + _idProd +"_"+_refProd).textContent = _rowTotal.replace(".", ",");
		
	
	if(_browserName != 'Netscape')
		document.getElementById("lblweight_" + _idProd +"_"+_refProd).innerText = _totweight;
	else
		document.getElementById("lblweight_" + _idProd +"_"+_refProd).textContent = _totweight;
		
	document.getElementById("hidweight_" + _rowPos).value = _totweight;
	
	
	// Set Importe Total
	for(j=0;j<_countRow;j++){
		//alert("asdasd")
		if(document.getElementById("hidAmount_" + j)){
			_rTot = document.getElementById("hidAmount_" + j).value;
			_totalAmt =  eval(_totalAmt) + eval(_rTot);
		}
	}
	_totalAmt=_totalAmt.toFixed(2); // Anoop
	document.getElementById("hidTotal").value = _totalAmt;
	
	//alert(_totalAmt);// Anoop
	
	var _tcs = new String();
	_tcs=String(_totalAmt);

	if(_browserName != 'Netscape')
		document.getElementById("lblTotal").innerText = _tcs.replace(".", ",");
	else
		document.getElementById("lblTotal").textContent = _tcs.replace(".", ",");
	
	
	for(j=0;j<_countRow;j++){
		//alert("asdasd1")
		if(document.getElementById("hidweight_" + j)){
			_rTotweight = document.getElementById("hidweight_" + j).value;
			
			//_totalweight =  eval(_totalAmt) + eval(_rTot);
			_totalweight =  eval(_totalweight) + eval(_rTotweight);
		}
	}
	
	
	if(_browserName != 'Netscape')
		document.getElementById("lblTotalweight").innerText = _totalweight;
	else
		document.getElementById("lblTotalweight").textContent = _totalweight;
	
	document.getElementById("hidTotalweight").value = _totalweight;
	
	
	
	}
}


function _setQty(_prodId, _rowCount, _posRow){
	//alert("asd")
	_qtyGet = document.getElementById("txtQty_" + _prodId).value;
	if( _qtyGet == '' || _qtyGet == 0){
		document.getElementById("txtQty_" + _prodId).value = document.getElementById("hidQnty_" + _posRow).value;
	}
	//alert(document.getElementById("hidQnty_" + _posRow).value)
}

function _setQtywithref(_prodId,  _refProd, _rowCount, _posRow){
	//alert("asd")
	_qtyGet = document.getElementById("txtQty_" + _prodId +"_"+_refProd).value;
	if( _qtyGet == '' || _qtyGet == 0){
		document.getElementById("txtQty_" + _prodId +"_"+_refProd).value = document.getElementById("hidQnty_" + _posRow).value;
	}
	//alert(document.getElementById("hidQnty_" + _posRow).value)
}


// ***********************************************************************************************************************
// User Identification fuctions
// ***********************************************************************************************************************

function _getLoginForm(_lang, _userType){
	location.href = 'index.php?sec=useridentification&tp=' + _userType + '&language=' + _lang;
}

/**
 *
 * Function for payment
 *
 */

 function _doPayment(){
    
    location.href = '';
    
 }

// Declaring valid date character, minimum year and maximum year
var dtCh= "-";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("El formato de fecha deberia ser dd-mm-aa"); //The date format should be : dd-mm-aa
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Por favor introduzca un mes valido"); //Please enter a valid month
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Por favor introduzca un dia valido"); //Please enter a valid day
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Por favor introduzca un año entre " + minYear + " y " + maxYear); //Please enter a valid 4 digit year between "+minYear+" and "+maxYear
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Por favor introduzca una fecha valida"); //Please enter a valid date
		return false
	}
return true
}

function _validateForm(tp){
	
	var frmName = document.frmUserIdentification;
	
	// First Name
	if( frmName.txtFirstName.value == '' ){
		alert(" Por favor introduzca su nombre! "); //Please enter the First Name
		frmName.txtFirstName.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtFirstName.value) == true ){
		alert(" Nombre invalido! "); //Invalid First Name
		frmName.txtFirstName.focus();
		return false;
	}
	
	// Middle Name
	if( frmName.txtMiddleName.value == '' ){
		alert(" Por favor introduzca su primer apellido! "); //Please enter the Middle Name
		frmName.txtMiddleName.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtMiddleName.value) == true ){
		alert(" Primer apellido invalido! "); //Invalid Middle Name
		frmName.txtMiddleName.focus();
		return false;
	}
	
	// Last Name
	if( frmName.txtLastName.value == '' ){
		alert(" Por favor introduzca su segundo apellido! "); //Please enter the Last Name
		frmName.txtLastName.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtLastName.value) == true ){
		alert(" Segundo apellido invalido! "); //Invalid Last Name
		frmName.txtLastName.focus();
		return false;
	}
	
	// Date
	var _day = document.frmUserIdentification.txtDay.value;
	var _month = document.frmUserIdentification.txtMonth.value;
	var _year = document.frmUserIdentification.txtYear.value;
	var _date = _day + '-' + _month + '-' + _year;
	document.frmUserIdentification.hidDate.value = _date;
	dt = document.frmUserIdentification.hidDate;
	//alert(dt)
	if(dt){
		if(dt.value != ''){
			if (isDate(dt.value) == false){
				document.frmUserIdentification.txtDay.value = '';
				document.frmUserIdentification.txtMonth.value = '';
				document.frmUserIdentification.txtYear.value = '';
				document.frmUserIdentification.txtDay.focus();
				//dt.focus()
				return false
			}
		}
	}
	
	// Passport
	if( frmName.txtPassportNo.value == '' ){
		alert(" Por favor introduzca su DNI/Pasaporte! "); //Please enter the DNI/Pasaporte
		frmName.txtPassportNo.focus();
		return false;
	}
	
	// Email
	var emailID = document.frmUserIdentification.txtEmail;
	if ((emailID.value==null)||(emailID.value=="")){
		alert(" Por favor introduzca su e-mail! "); //Please Enter your Email ID
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value = "";
		emailID.focus();
		return false;
	}
	
	// Sex
	myOption = -1;
	for (i=frmName.rdSex.length-1; i > -1; i--) {
		if (frmName.rdSex[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		alert(" Por favor seleccione su sexo! "); //Please select your gender
		return false;
	}
	
	// Country
	if( frmName.txtCountry.value == '' ){
		alert(" Por favor introduzca su ciudad! "); //Please enter the Country
		frmName.txtCountry.focus();
		return false;
	}
	
	// Province
	if( frmName.txtProvince.value == '' ){
		alert(" Por favor introduzca su provincia! "); //Please enter the Province
		frmName.txtProvince.focus();
		return false;
	}
	
	// via
	if( frmName.txtVia.value == '' ){
		alert(" Por favor introduzca su calle! "); //Please enter the VIA
		frmName.txtVia.focus();
		return false;
	}
	
	// zip code
	if( frmName.txtZip.value == '' ){
		alert(" Por favor introduzca su codigo postal! "); //Please enter the Zip Code
		frmName.txtZip.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtZip.value) == false ){
		alert(" Codigo postal invalido! "); //Invalid Zip Code
		frmName.txtZip.focus();
		return false;
	}
	
	// Portal
	if( frmName.txtPortal.value == '' ){
		alert(" Por favor introduzca su portal! "); //Please enter the Portal
		frmName.txtPortal.focus();
		return false;
	}
	
	// Municipality
	if( frmName.txtMunicipality.value == '' ){
		alert(" Por favor introduzca su municipio! "); //Please enter the Municipality
		frmName.txtMunicipality.focus();
		return false;
	}
	
	// Phone 1
	if( frmName.txtPhone1.value == '' ){
		alert(" Por favor introduzca su numero de telefono! "); //Please enter the Phone Number
		frmName.txtPhone1.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtPhone1.value) == false ){
		alert(" Numero de telefono invalido! "); //Invalid Phone Number
		frmName.txtPhone1.focus();
		return false;
	}
	
	if(tp == 'yes'){
		// Username
		if( frmName.txtUserNameReg.value == '' ){
			alert(" Por favor introduzca su usuario! "); //Please enter the Municipality
			frmName.txtUserNameReg.focus();
			return false;
		}
		// Password
		if( frmName.txtPasswordReg.value == '' ){
			alert(" Por favor introduzca su Contraseña! "); //Please enter the Municipality
			frmName.txtPasswordReg.focus();
			return false;
		}
	}
	
	// Accept Agrement
	if( frmName.rdAccept.checked == false){
		alert(" Tiene que aceptar el acuerdo antes de enviar los detalles! "); //You need to accept the agrement before submitting the details
		return false;
	}
	
}

//
// Numerics validation script.
function IsNumeric(strString){

	//  check for valid numeric strings	
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;
	
	if (strString.length == 0) return false;
	
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++){
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1){
			blnResult = false;
		}
	}
	return blnResult;
}

//
// DHTML email validation script
function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("E-mail invalido"); //Invalid E-mail ID
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("E-mail invalido"); //Invalid E-mail ID
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("E-mail invalido"); //Invalid E-mail ID
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("E-mail invalido"); //Invalid E-mail ID
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("E-mail invalido"); //Invalid E-mail ID
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("E-mail invalido"); //Invalid E-mail ID
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("E-mail invalido"); //Invalid E-mail ID
		return false
	 }

	 return true					
}

// For Registration form [ new user ]
function _validateRegForm(){
	
	var frmName = document.frmUserReg;
	
	// First Name
	if( frmName.txtFirstNameR.value == '' ){
		alert(" Por favor introduzca su nombre! "); //Please enter the First Name
		frmName.txtFirstNameR.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtFirstNameR.value) == true ){
		alert(" Nombre invalido! "); //Invalid First Name
		frmName.txtFirstNameR.focus();
		return false;
	}
	
	// Middle Name
	if( frmName.txtMiddleNameR.value == '' ){
		alert(" Por favor introduzca su primer apellido! "); //Please enter the Middle Name
		frmName.txtMiddleNameR.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtMiddleNameR.value) == true ){
		alert(" Primer apellido invalido! "); //Invalid Middle Name
		frmName.txtMiddleNameR.focus();
		return false;
	}
	
	// Last Name
	if( frmName.txtLastNameR.value == '' ){
		alert(" Por favor introduzca su segundo apellido! "); //Please enter the Last Name
		frmName.txtLastNameR.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtLastNameR.value) == true ){
		alert(" Segundo apellido invalido! "); //Invalid Last Name
		frmName.txtLastNameR.focus();
		return false;
	}
	
	// Date
	var _day = document.frmUserReg.txtDayR.value;
	var _month = document.frmUserReg.txtMonthR.value;
	var _year = document.frmUserReg.txtYearR.value;
	var _date = _day + '-' + _month + '-' + _year;
	document.frmUserReg.hidDateR.value = _date;
	dt = document.frmUserReg.hidDateR;
	//alert(dt)
	if(dt){
		if(dt.value != ''){
			if (isDate(dt.value) == false){
				document.frmUserReg.txtDayR.value = '';
				document.frmUserReg.txtMonthR.value = '';
				document.frmUserReg.txtYearR.value = '';
				document.frmUserReg.txtDayR.focus();
				//dt.focus()
				return false
			}
		}
	}
	
	// Passport
	if( frmName.txtPassportNoR.value == '' ){
		alert(" Por favor introduzca su DNI/Pasaporte! "); //Please enter the DNI/Pasaporte
		frmName.txtPassportNoR.focus();
		return false;
	}
	
	// Email
	var emailID = document.frmUserReg.txtEmailR;
	if ((emailID.value==null)||(emailID.value=="")){
		alert(" Por favor introduzca su e-mail! "); //Please Enter your Email ID
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value = "";
		emailID.focus();
		return false;
	}
	
	// Sex
	myOption = -1;
	for (i=frmName.rdSexR.length-1; i > -1; i--) {
		if (frmName.rdSexR[i].checked) {
			myOption = i; i = -1;
		}
	}
	if (myOption == -1) {
		alert(" Por favor seleccione su sexo! "); //Please select your gender
		return false;
	}
	
	// Country
	if( frmName.txtCountryR.value == '' ){
		alert(" Por favor introduzca su ciudad! "); //Please enter the Country
		frmName.txtCountryR.focus();
		return false;
	}
	
	// Province
	if( frmName.txtProvinceR.value == '' ){
		alert(" Por favor introduzca su provincia! "); //Please enter the Province
		frmName.txtProvinceR.focus();
		return false;
	}
	
	// via
	if( frmName.txtViaR.value == '' ){
		alert(" Por favor introduzca su calle! "); //Please enter the VIA
		frmName.txtViaR.focus();
		return false;
	}
	
	// zip code
	if( frmName.txtZipR.value == '' ){
		alert(" Por favor introduzca su codigo postal! "); //Please enter the Zip Code
		frmName.txtZipR.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtZipR.value) == false ){
		alert(" Codigo postal invalido! "); //Invalid Zip Code
		frmName.txtZip.focus();
		return false;
	}
	
	// Portal
	if( frmName.txtPortalR.value == '' ){
		alert(" Por favor introduzca su portal! "); //Please enter the Portal
		frmName.txtPortalR.focus();
		return false;
	}
	
	// Municipality
	if( frmName.txtMunicipalityR.value == '' ){
		alert(" Por favor introduzca su municipio! "); //Please enter the Municipality
		frmName.txtMunicipalityR.focus();
		return false;
	}
	
	// Phone 1
	if( frmName.txtPhone1R.value == '' ){
		alert(" Por favor introduzca su numero de telefono! "); //Please enter the Phone Number
		frmName.txtPhone1R.focus();
		return false;
	}
	else if( IsNumeric(frmName.txtPhone1R.value) == false ){
		alert(" Numero de telefono invalido! "); //Invalid Phone Number
		frmName.txtPhone1R.focus();
		return false;
	}
	
	// Username
	if( frmName.txtUserNameR.value == '' ){
		alert(" Por favor introduzca su usuario! "); //Please enter the Phone Number
		frmName.txtUserNameR.focus();
		return false;
	}
	
	// Password
	if( frmName.txtPasswordR.value == '' ){
		alert(" Por favor introduzca su Contraseña! "); //Please enter the Phone Number
		frmName.txtPasswordR.focus();
		return false;
	}
	
	// Accept Agrement
	if( frmName.rdAcceptR.checked == false){
		alert(" Tiene que aceptar el acuerdo antes de enviar los detalles! "); //You need to accept the agrement before submitting the details
		return false;
	}
}
	
