var b = "n";
var m = "n";


//AJAX'-----------------

var request;
var response;


			function populateState(Employee)
			{
						
				var nameControl = Employee.id;
				var str = nameControl.split("ddlRegion");
				partName1 = str[0] + "ddlState";
				var Territory = document.getElementById(partName1);
				if(Employee.options[Employee.selectedIndex].value != '')
			
				
				{	
					document.Form1.ddlName.value = Territory.id;
					return SendRequest(Employee.options[Employee.selectedIndex].value);
										
				}
				else
				{
					clearSelect(Territory);
					
					
				}
				
			}
			function AlmacenarValores(ddlist){
			
				var nameControl = ddlist.id;
				var str = nameControl.split("ddlState");
				partName1 = str[0] + "valores1";
				var inputValue = document.getElementById(partName1);
				inputValue.value = ddlist.options[ddlist.selectedIndex].value
			}
			function InitializeRequest()
			{
				try
				{
					request = new ActiveXObject("Microsoft.XMLHTTP");//Try creating an XMLHTTP Object
				}
				catch(Ex)
				{
					try
					{
						request = new ActiveXObject("Microsoft.XMLHTTP");//First failure, try again creating an XMLHTTP Object
					}
					catch(Ex)
					{
						request = null;//Else assign null to request
					}
				}

				if(!request&&typeof XMLHttpRequest != 'undefined')
				{
					request = new XMLHttpRequest();
				}
			}

			function SendRequest(ID)
			{
				//status.innerText = "Leyendo.....";
				InitializeRequest();
				var url = "stateByRegionAjaxServer.aspx?RegionID="+ID;
				request.onreadystatechange = ProcessRequest;
				request.open("GET", url, true);
				request.send(null);
			
			}

			function ProcessRequest()
			
			{
				if(request.readyState == 4)//If the readyState is in the "Ready" state
				{
					if(request.status == 200)//If the returned status code was 200. Everything was OK.
					{
						if(request.responseText != "")//If responseText is not blank
						{
							populateList(request.responseText);
						
							//status.innerText = "Estados leídos";
						}
					}
				}
				return true;
			}

			function populateList(response)
			{
				var Territory2 = document.getElementById(document.Form1.ddlName.value);
				if(window.ActiveXObject)
					{
					xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
					xmlDoc.async = false; 
					xmlDoc.loadXML(response);
					}
				else if(document.implementation && document.implementation.createDocument)
					{

					var parser = new DOMParser(); 
					xmlDoc = parser.parseFromString(response, "text/xml"); 
					}
				var opt;
				var TerritoriesElem = xmlDoc.getElementsByTagName("State");
				var TerritoryElem = TerritoriesElem[0].getElementsByTagName("S");

				clearSelect(Territory2);
				if(TerritoriesElem.length > 0)
				{
					for (var i = 0; i < TerritoryElem.length; i++)
					{
						var textNode = document.createTextNode(TerritoryElem[i].getAttribute("StateName"));
					
						appendToSelect(Territory2, TerritoryElem[i].getAttribute("ID"), textNode);
					}
				}
			}

			function appendToSelect(select, value, content)
			{
			
				var opt;
				opt = document.createElement("option");//Crea el elemento tipo option
				opt.value = value;//setea valores de options
				opt.appendChild(content);//añade texto a las opciones
				
				select.appendChild(opt);
			}

			function clearSelect(select)
			{
				select.options.length = 1;
										  
			}
//----------------------------
function toggle(e,count) 
{
	z="div" + count;
	changeSub(m);
    limpiar(b);
	targetid = e.id + "b";
	target = document.getElementById(targetid);
    if (target.style.display == "none")
     {
        target.style.display = "";
     } 
    else 
    {
     target.style.display = "none";
     }
   
	if (document.getElementById(z).innerHTML ="+") 
		{
			document.getElementById(z).innerHTML = "-";
		} 
		else 
		{
			document.getElementById(z).innerHTML="+&nbsp;&nbsp;";
		}
 
b = e;
m = z;
}


function limpiar(b){

targetid = b.id + "b";

	if (b != "n"){
	    document.getElementById(targetid).style.display = "none";
	 
	}
}


function changeSub(z){
if (b != "n")
	{
	if (document.getElementById(z).innerHTML="-&nbsp;&nbsp;") {
			document.getElementById(z).innerHTML = "+&nbsp;&nbsp;";
		} else {
			document.getElementById(z).innerHTML="-&nbsp;&nbsp;";
		}
 
	}
}


function CambiarTexto(){
	document.getElementById("C5_txtSearch").value="";
}



function BotonSubmit(objectId){

txtIdSearch=document.getElementById("C5_txtSearch");
buttonIdSearch=document.getElementById("C5_imgBtnSearch");
if (( objectId.which == 13) || ( objectId.keyCode == 13)) 
	{
		if (txtIdSearch.value != ''){
			buttonIdSearch.focus();
			}
		else{
			buttonId=document.getElementById("C6_imgBtnSend");
			buttonId.focus();
			}
	}
}
function SubmitSearch(objectId){
txtIdSearch=document.getElementById("C5_txtSearch");
buttonIdSearch=document.getElementById("C5_imgBtnSearch");
if (( objectId.which == 13) || ( objectId.keyCode == 13)) 
	{
		if (txtIdSearch.value != ''){
			buttonIdSearch.focus();
			}
			
	}
}



function SubmitSearchLogin(objectId){

txtIdSearch=document.getElementById("C5_txtSearch");
buttonIdSearch=document.getElementById("C5_imgBtnSearch");
buttonId=document.getElementById("imgBtnSend");

if (( objectId.which == 13) || ( objectId.keyCode == 13)) 
	{	
		if (txtIdSearch.value != ''){
			buttonIdSearch.focus();
			}
		else{
			buttonId.focus();
			}
			
	}

}


function GetValueSelected(){
var1 = document.getElementById('cmbRegion');
document.getElementById('txtHTMLRegion').value = var1.value;

}

function RefrescarLogin(){
window.opener.location.href='rej_register.aspx';
}

function MostrarImagen(button){
	var buttonVal = button.id;
	var str = buttonVal.split("button");
	imageid = "imagename" + str[1];
	fileid =str[0]+ "file" + str[1];
	targetImg = document.getElementById(imageid);
	targetFile = document.getElementById(fileid);
	targetImg.src = targetFile.value;
}
function MostrarImagen2(button){
	var buttonVal = button.id;
	var str = buttonVal.replace("button","");
	imageid = "imagename" + str;
	fileid = "file" + str;
	targetImg = document.getElementById(imageid);
	targetFile = document.getElementById(fileid);
	targetImg.src = targetFile.value;
	
}
function ShowWindow(url, popWidth, popHeight) {
	var xCenter = (screen.width - popWidth) / 2;
	var yCenter = (screen.height - popHeight) / 2;	
	window.open(url,null,'toolbar=no,location=no,directories=no,status=no,menubar=no,titlebar=no,scrollbars=no,resizable=no,help=no,width=' + popWidth + ',height=' + popHeight + ',left=' + xCenter + ',top=' + yCenter);
}

function changeFocus() 
	{
	
	}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}



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;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//----------------------------------




function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length]= img;
  } }
}

//******************************************************************************

function ValidateAllField()
{  var expr_car=/^[a-zA-ZáéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;

//-------Nombre-----------------------------------------------------------------
try
	{
	  if (document.Form1.txtName.value== '')
		{
		    alert("Introduzca el nombre");
			txtIdSearch=document.getElementById("txtName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	  else
	   {
	     if (!expr_car.test(document.Form1.txtName.value))	  
          {
           alert("Por Favor introduzca unicamente letras");
           txtIdSearch=document.getElementById("txtName1");
		   txtIdSearch.innerHTML ="!";
		   document.Form1.txtName.focus();
		   return false;
          }
          else
          {txtIdSearch=document.getElementById("txtName1");
           txtIdSearch.innerHTML="";}
 	    }
	}catch(e){} 
//------Apellido------------------------------------------------------------------
	try
	{
	  if (document.Form1.txtLastName.value== '')
		{ 
			alert("Introduzca el apellido");
			txtIdSearch=document.getElementById("txtLastName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	   else
	    {
	      if (!expr_car.test(document.Form1.txtLastName.value))	  
          {
           alert("Por Favor introduzca unicamente letras");
           txtIdSearch=document.getElementById("txtLastName1");
		   txtIdSearch.innerHTML ="!";
		   document.Form1.txtLastName.focus();
		   return false;
          }
          else
          {txtIdSearch=document.getElementById("txtLastName1");
           txtIdSearch.innerHTML="";}
 	    }
    }catch(e){}  
 //---------------Telefono--------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtCountryCode1.value!= '')||(document.Form1.txtAreaCode1.value!='')||(document.Form1.txtPhoneNumber1.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtCountryCode1.value))||(!exprenum.test(document.Form1.txtAreaCode1.value))||(!exprenum.test(document.Form1.txtPhoneNumber1.value)))
        {
          alert("Telefono Invalido, Introduzcala de nuevo");
		  document.Form1.txtCountryCode1.focus();
		  return false;
        }
       }
      }catch(e){} 
 
//---------------Telefono2-------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtCountryCode2.value!= '')||(document.Form1.txtAreaCode2.value!='')||(document.Form1.txtPhoneNumber2.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtCountryCode2.value))||(!exprenum.test(document.Form1.txtAreaCode2.value))||(!exprenum.test(document.Form1.txtPhoneNumber2.value)))
        {
          message="Telefono2 Invalido, Introduzcala de nuevo";
		  alert(message);
		  document.Form1.txtCountryCode2.focus();
		  return false;
        }
       }
      }catch(e){} //}
//---------------Email------------------------------------------------------------   
try
 { var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (document.Form1.txtEmail.value== '')
	{
	   alert("Introduzca el email");
		txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtEmail.value))
	  {
	  	alert("Introduzca el email correctamente");
		document.Form1.txtEmail.focus();
		txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="!";
		return false;
   	  }
   	    else
          {var1=document.Form1.txtEmail.value
           txtIdSearch=document.getElementById("txtEmail1");
           txtIdSearch.innerHTML="";}
		
	}
 }
 catch(e){} 
 
//---------------ReEmail---------------------------------------------------------  
try
 {
	if (document.Form1.txtReEmail.value== '')
	{
	 	alert("Introduzca de nuevo el email");
		txtIdSearch=document.getElementById("txtReEmail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtReEmail.value))
	 	 {
		 alert("Introduzca el email correctamente");
		 document.Form1.txtReEmail.focus();
	 	 txtIdSearch=document.getElementById("txtReEmail1");
		 txtIdSearch.innerHTML ="!";
		 return false;
	    }
	   else
	    {
         if(var1!=document.Form1.txtReEmail.value)
          {
            alert("Introduzca el email anterior");
		    document.Form1.txtReEmail.focus();
			txtIdSearch=document.getElementById("txtReEmail1");
			txtIdSearch.innerHTML ="!";
			return false;
          }
          else
           {txtIdSearch=document.getElementById("txtReEmail1");
            txtIdSearch.innerHTML="";}	    
	    }
	}
}
 catch(e){}


//---------Pais---------------------------------------------------------------
	try
	{ var bool=true;
	 if (document.Form1.ddlCountry.selectedIndex == "0")
	 {
	   message="Seleccione un pais";
		alert(message);
		txtIdSearch=document.getElementById("ddlCountry1");
		txtIdSearch.innerHTML ="*";
		bool=false;
		return false;
	 }
	 else
	  {
	  if (bool=true)
	  {txtIdSearch=document.getElementById("ddlCountry1");
		txtIdSearch.innerHTML ="";}
	  }
  }catch(e){}
//---------------Ciudad--------------------------------------------------------
	try
	{
	 if (document.Form1.txtCity.value== '')
	 {
	  message="Introduzca la ciudad";
		alert(message);
		txtIdSearch=document.getElementById("txtCity1");
		txtIdSearch.innerHTML ="*";
		return false;
	 }
	 else
	  {
	    if (!expr_car.test(document.Form1.txtCity.value))	  
         {
           alert("Por Favor introduzca unicamente letras");
           document.Form1.txtCity.focus();
	 	   txtIdSearch=document.getElementById("txtCity1");
		   txtIdSearch.innerHTML ="!";
	       return false;
         }
          else
          {txtIdSearch=document.getElementById("txtCity1");
           txtIdSearch.innerHTML="";}
 	  }
	}catch(e){} 

//---------------Estado--------------------------------------------------------
	try
	{   
	if (document.Form1.txtState.value!= '')
	 {
	   if (!expr_car.test(document.Form1.txtState.value))	  
        {
         alert("Por Favor introduzca unicamente letras");
         document.Form1.txtState.focus()
	     document.Form1.txtState.value = "";
	     return false;
        }
 	 }
	}catch(e){}
//---------------Password-------------------------------------------------------
	try
	{
	 var exprepassw=/^([a-z|A-Z]|[0-9]|[\-|_|&|$|@])+$/;
		 
	 if (document.Form1.txtPassword.value== '')
	 {
	  	alert("Introduzca su Password");
		txtIdSearch=document.getElementById("txtPassword1");
		txtIdSearch.innerHTML ="*";
		return false;
	 }
	 else
	  {
       if (!exprepassw.test(document.Form1.txtPassword.value))	  
        {
          alert("Password Invalido, Introduzcala de nuevo");
          document.Form1.txtPassword.focus();
	     txtIdSearch=document.getElementById("txtPassword1");
		  txtIdSearch.innerHTML ="!";
	      return false;
        }
        else
          {txtIdSearch=document.getElementById("txtPassword");
           txtIdSearch.innerHTML="";}
 	  }
	}catch(e){} 
}


function ValidateAllField1()
{
//-------Nombre-----------------------------------------------------------------
  try
	{ var expr_car=/^[a-zA-ZáéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;
	  if (document.Form1.txtName.value== '')
		{
		    alert("Introduzca el nombre");
			txtIdSearch=document.getElementById("txtName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	  else
	   {
	     if (!expr_car.test(document.Form1.txtName.value))	  
          {
           alert("Por Favor introduzca unicamente letras");
           txtIdSearch=document.getElementById("txtName1");
		   txtIdSearch.innerHTML ="!";
		   document.Form1.txtName.focus();
		   return false;
          }
          else
          {txtIdSearch=document.getElementById("txtName1");
           txtIdSearch.innerHTML="";}
 	    }
	}catch(e){} 

//---------------Telefono--------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtPhoneCode1.value!= '')||(document.Form1.txtPhoneCode2.value!='')||(document.Form1.txtPhoneNumber.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtPhoneCode1.value))||(!exprenum.test(document.Form1.txtPhoneCode2.value))||(!exprenum.test(document.Form1.txtPhoneNumber.value)))
        {
          alert("Telefono Invalido, Introduzcala de nuevo");
		  document.Form1.txtPhoneCode1.focus();
		  return false;
        }
       }
      }catch(e){} 

//---------------Email------------------------------------------------------------   
try
 { var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (document.Form1.txtEmail.value== '')
	{
	   alert("Introduzca el email");
		txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtEmail.value))
	  {
	  	alert("Introduzca el email correctamente");
		document.Form1.txtEmail.focus();
	 	txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="!";
		return false;
   	  }
   	    else
          {var1=document.Form1.txtEmail.value
           txtIdSearch=document.getElementById("txtEmail1");
           txtIdSearch.innerHTML="";}
		
	}
 }
 catch(e){}
 
 //---------------Ciudad--------------------------------------------------------  
	try
	{
	 if (document.Form1.txtCity.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtCity.value))
        {
          alert("Por Favor introduzca unicamente letras");
		  document.Form1.txtCity.focus();
		  return false;
        }
       }
      }catch(e){} 
 
//---------------Asunto--------------------------------------------------------  
	try
	{
	 if (document.Form1.txtAsunto.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtAsunto.value))
        {
          alert("Por Favor introduzca unicamente letras");
		  document.Form1.txtAsunto.focus();
		  return false;
        }
       }
      }catch(e){} 
  
//---------------Mensaje--------------------------------------------------------  
	try
	{var expr_car=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;
	 if (document.Form1.txtMensaje.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtMensaje.value))
        {
          alert("Por Favor introduzca unicamente letras y numeros");
		  document.Form1.txtMensaje.focus();
		  return false;
        }
       }
      }catch(e){} 
}

function ValidateAlllLoglogin()
{
  var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	 if ((document.Form1.txtLogin.value!= '')&&(!expreemail.test(document.Form1.txtLogin.value)))
	 {  
	  	alert("Introduzca el usuario correctamente");
		document.Form1.txtLogin.focus();
		return false;
   	  	 }
	 else
	  {  
	  if (document.Form1.txtLogin.value== '')
             { alert("Por Favor introduzca su usuario");
               document.Form1.txtLogin.focus();
	           return false;}
	 
       else 
       {
		if ((document.Form1.txtLogin.value!= '')&&(document.Form1.txtPassword.value== ''))
         {  
          alert("Por Favor introduzca su contrasena");
	      document.Form1.txtPassword.focus();
	      return false;
         }
          
       }
    }
}

function ValidateAllEditUser()
{ 
  var expr_car=/^[a-zA-ZáéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;

//-------Nombre-----------------------------------------------------------------
try
	{
	  if (document.Form1.txtName.value== '')
		{
		    alert("Introduzca el nombre");
			txtIdSearch=document.getElementById("txtName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	  else
	   {
	     txtIdSearch=document.getElementById("txtName1");
         txtIdSearch.innerHTML="";
 	    }
	}catch(e){} 
//------Apellido------------------------------------------------------------------
	try
	{
	  if (document.Form1.txtLastName.value== '')
		{ 
			alert("Introduzca el apellido");
			txtIdSearch=document.getElementById("txtLastName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	   else
	    {
	      txtIdSearch=document.getElementById("txtLastName1");
           txtIdSearch.innerHTML="";
 	    }
    }catch(e){}  
//---------------Telefono--------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtCountryCode1.value!= '')||(document.Form1.txtAreaCode1.value!='')||(document.Form1.txtPhoneNumber1.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtCountryCode1.value))||(!exprenum.test(document.Form1.txtAreaCode1.value))||(!exprenum.test(document.Form1.txtPhoneNumber1.value)))
        {
          alert("Telefono Invalido, Introduzcala de nuevo");
		  document.Form1.txtCountryCode1.focus();
		  return false;
        }
       }
      }catch(e){} 
 
//---------------Telefono2-------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtCountryCode2.value!= '')||(document.Form1.txtAreaCode2.value!='')||(document.Form1.txtPhoneNumber2.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtCountryCode2.value))||(!exprenum.test(document.Form1.txtAreaCode2.value))||(!exprenum.test(document.Form1.txtPhoneNumber2.value)))
        {
          message="Telefono2 Invalido, Introduzcala de nuevo";
		  alert(message);
		  document.Form1.txtCountryCode2.focus();
		  return false;
        }
       }
      }catch(e){} 
//---------------Email------------------------------------------------------------   
try
 { var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (document.Form1.txtMail.value== '')
	{
	   alert("Introduzca el email");
		txtIdSearch=document.getElementById("txtMail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtMail.value))
	  {
	  	alert("Introduzca el email correctamente");
		document.Form1.txtMail.focus();
		txtIdSearch=document.getElementById("txtMail1");
		txtIdSearch.innerHTML ="!";
		return false;
   	  }
   	    else
          {var1=document.Form1.txtMail.value
           txtIdSearch=document.getElementById("txtMail1");
           txtIdSearch.innerHTML="";}
		
	}
 }
 catch(e){} 
 
//---------------ReEmail---------------------------------------------------------  
try
 {
	if (document.Form1.txtReemail.value== '')
	{
	 	alert("Introduzca de nuevo el email");
		txtIdSearch=document.getElementById("txtReemail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtReemail.value))
	 	 {
		 alert("Introduzca el email correctamente");
		 document.Form1.txtReemail.focus();
	 	 txtIdSearch=document.getElementById("txtReemail1");
		 txtIdSearch.innerHTML ="!";
		 return false;
	    }
	   else
	    {
         if(var1!=document.Form1.txtReemail.value)
          {
            alert("Introduzca el email anterior");
		    document.Form1.txtReemail.focus();
			txtIdSearch=document.getElementById("txtReemail");
			txtIdSearch.innerHTML ="!";
			return false;
          }
          else
           {txtIdSearch=document.getElementById("txtReemail1");
            txtIdSearch.innerHTML="";}	    
	    }
	}
}
 catch(e){}


//---------Pais---------------------------------------------------------------
	try
	{ var bool=true;
	 if (document.Form1.ddlCountry.selectedIndex == "0")
	 {
	 	alert("Seleccione un pais");
		txtIdSearch=document.getElementById("ddlCountry1");
		txtIdSearch.innerHTML ="*";
		bool=false;
		return false;
	 }
	 else
	  {
	  if (bool=true)
	  {txtIdSearch=document.getElementById("ddlCountry1");
		txtIdSearch.innerHTML ="";}
	  }
  }catch(e){}
//---------------Ciudad--------------------------------------------------------
	try
	{
	 if (document.Form1.txtCity.value== '')
	 {
	 	alert("Introduzca la ciudad");
		txtIdSearch=document.getElementById("txtCity1");
		txtIdSearch.innerHTML ="*";
		return false;
	 }
	 else
	  {
	    if (!expr_car.test(document.Form1.txtCity.value))	  
         {
           alert("Por Favor introduzca unicamente letras");
           document.Form1.txtCity.focus();
	 	   txtIdSearch=document.getElementById("txtCity1");
		   txtIdSearch.innerHTML ="!";
	       return false;
         }
          else
          {txtIdSearch=document.getElementById("txtCity1");
           txtIdSearch.innerHTML="";}
 	  }
	}catch(e){} 

//---------------Estado--------------------------------------------------------
	try
	{   
	if (document.Form1.txtState.value!= '')
	 {
	   if (!expr_car.test(document.Form1.txtState.value))	  
        {
         alert("Por Favor introduzca unicamente letras");
         document.Form1.txtState.focus()
	     document.Form1.txtState.value = "";
	     return false;
        }
 	 }
	}catch(e){}
/*//---------------Password-------------------------------------------------------
	try
	{
	 var exprepassw=/^([a-z|A-Z]|[0-9]|[\-|_|&|$|@])+$/;
		 
	 if (document.Form1.txtPassword.value== '')
	 {
	  	alert("Introduzca su Password");
		txtIdSearch=document.getElementById("txtPassword1");
		txtIdSearch.innerHTML ="*";
		return false;
	 }
	 else
	  {
       if (!exprepassw.test(document.Form1.txtPassword.value))	  
        {
          alert("Password Invalido, Introduzcala de nuevo");
          document.Form1.txtPassword.focus();
	     txtIdSearch=document.getElementById("txtPassword1");
		  txtIdSearch.innerHTML ="!";
	      return false;
        }
        else
          {txtIdSearch=document.getElementById("txtPassword");
           txtIdSearch.innerHTML="";}
 	  }
	}catch(e){} */
}


function ValidateAllField1()
{
//-------Nombre-----------------------------------------------------------------
  try
	{ var expr_car=/^[a-zA-ZáéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;
	  if (document.Form1.txtName.value== '')
		{
		    alert("Introduzca el nombre");
			txtIdSearch=document.getElementById("txtName1");
			txtIdSearch.innerHTML ="*";
			return false;
		}
	  else
	   {
	     if (!expr_car.test(document.Form1.txtName.value))	  
          {
           alert("Por Favor introduzca unicamente letras");
           txtIdSearch=document.getElementById("txtName1");
		   txtIdSearch.innerHTML ="!";
		   document.Form1.txtName.focus();
		   return false;
          }
          else
          {txtIdSearch=document.getElementById("txtName1");
           txtIdSearch.innerHTML="";}
 	    }
	}catch(e){} 

//---------------Telefono--------------------------------------------------------  
	try
	{
	 var exprenum=/^([0-9])+$/;
	 if ((document.Form1.txtPhoneCode1.value!= '')||(document.Form1.txtPhoneCode2.value!='')||(document.Form1.txtPhoneNumber.value!=''))
     {  
       if ((!exprenum.test(document.Form1.txtPhoneCode1.value))||(!exprenum.test(document.Form1.txtPhoneCode2.value))||(!exprenum.test(document.Form1.txtPhoneNumber.value)))
        {
          alert("Telefono Invalido, Introduzcala de nuevo");
		  document.Form1.txtPhoneCode1.focus();
		  return false;
        }
       }
      }catch(e){} 

//---------------Email------------------------------------------------------------   
try
 { var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (document.Form1.txtEmail.value== '')
	{
	   alert("Introduzca el email");
		txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtEmail.value))
	  {
	  	alert("Introduzca el email correctamente");
		document.Form1.txtEmail.focus();
	 	txtIdSearch=document.getElementById("txtEmail1");
		txtIdSearch.innerHTML ="!";
		return false;
   	  }
   	    else
          {var1=document.Form1.txtEmail.value
           txtIdSearch=document.getElementById("txtEmail1");
           txtIdSearch.innerHTML="";}
		
	}
 }
 catch(e){}
 
 //---------------Ciudad--------------------------------------------------------  
	try
	{
	 if (document.Form1.txtCity.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtCity.value))
        {
          alert("Por Favor introduzca unicamente letras");
		  document.Form1.txtCity.focus();
		  return false;
        }
       }
      }catch(e){} 
 
//---------------Asunto--------------------------------------------------------  
	try
	{
	 if (document.Form1.txtAsunto.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtAsunto.value))
        {
          alert("Por Favor introduzca unicamente letras");
		  document.Form1.txtAsunto.focus();
		  return false;
        }
       }
      }catch(e){} 
  
//---------------Mensaje--------------------------------------------------------  
	try
	{var expr_car=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;
	 if (document.Form1.txtMensaje.value!= '')
     {  
       if (!expr_car.test(document.Form1.txtMensaje.value))
        {
          alert("Por Favor introduzca unicamente letras y numeros");
		  document.Form1.txtMensaje.focus();
		  return false;
        }
       }
      }catch(e){}
}

function ValidateAlllLoglogin()
{
  var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	 if ((document.Form1.txtLogin.value!= '')&&(!expreemail.test(document.Form1.txtLogin.value)))
	 {  
	  	alert("Introduzca el usuario correctamente");
		document.Form1.txtLogin.focus();
		return false;
   	  	 }
	 else
	  {  
	  if (document.Form1.txtLogin.value== '')
             { alert("Por Favor introduzca su usuario");
               document.Form1.txtLogin.focus();
	           return false;}
	 
       else 
       {
		if ((document.Form1.txtLogin.value!= '')&&(document.Form1.txtPassword.value== ''))
         {  
          alert("Por Favor introduzca su contrasena");
	      document.Form1.txtPassword.focus();
	      return false;
         }
          
       }
    }
}

function ValidateAllDefaultLogin()
{
  	var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	 if ((document.Form1.C6_txtLogin.value!= '')&&(!expreemail.test(document.Form1.C6_txtLogin.value)))
	 {  
	  	alert("Introduzca el usuario correctamente");
		document.Form1.C6_txtLogin.focus();
		return false;
   	  	 }
	 else
	  {  
	  if (document.Form1.C6_txtLogin.value== '')
             { alert("Por Favor introduzca su usuario");
               document.Form1.C6_txtLogin.focus();
	           return false;}
	 
       else 
       {
		if ((document.Form1.C6_txtLogin.value!= '')&&(document.Form1.C6_txtPassword.value== ''))
         {  
          alert("Por Favor introduzca su contrasena");
	      document.Form1.C6_txtPassword.focus();
	      return false;
         }
          
       }
    }
	
}

function ValidateAllnewsImages()
{
   j=0;
   var expr_car1=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\.\-\_\ ]{1,40}$/;
   txtIdSearch=document.getElementById("ddlCantidad");
   var cantidad=txtIdSearch.selectedIndex;
  
   for(i=0; i<(cantidad+1)*2; i+=2)
   { 
     //Region         
     ddlRegion="MyDataList__ctl"+i+"_ddlRegion";
     ddlRegionSearch=document.getElementById(ddlRegion);
      if (ddlRegionSearch.value=="0")
	   {
	    alert("Seleccione una Region");
	    ddlRegionSearch.focus();
	   	   return false;
	   }
	     
      //Codigo
      txtCode="MyDataList__ctl"+i+"_txtCode"
      txtCodeSearch=document.getElementById(txtCode);
     /*  if (txtCodeSearch.value!='')
       {
         if (!expr_car1.test(txtCodeSearch.value))
          {alert("Por Favor introduzca unicamente letras y numeros");
       	   txtCodeSearch.focus();
		   txtCodeSearch.value = "";
		   return false;}
       }*/
      //else
      if (txtCodeSearch.value=='')
       {alert("Por Favor introduzca el codigo");
        txtCodeSearch.focus();
        return false;} 
        
     //Estado
     ddlState="MyDataList__ctl"+i+"_ddlState";
     ddlStateSearch=document.getElementById(ddlState);
     if (ddlStateSearch.value=="0")
	   {
	    alert("Seleccione un Estado");
	    ddlStateSearch.focus();
	    return false;
	   }
        
      //Extensiones
        TEventResults2="MyDataList__ctl"+i+"_file"+(j);
        TEventResults2Search=document.getElementById(TEventResults2);
        extensiones_permitidas = new Array(".jpg");
		if (TEventResults2Search.value=='')
		  {alert("Introduzca la imagen");
		    TEventResults2Search.focus();
			return false;
		  }
		else
		{ 	//recupero la extensión de este nombre de archivo
			extension = (TEventResults2Search.value.substring(TEventResults2Search.value.lastIndexOf("."))).toLowerCase();
			//compruebo si la extensión está entre las permitidas
			permitida = false;
			for (var k = 0; k < extensiones_permitidas.length; k++) 
			{
			 if (extensiones_permitidas[k] == extension)
				{permitida = true;
				break;
				}
			}
			if (!permitida) 
				{alert("Comprueba la extension de los archivos a subir. \nSolo se pueden subir archivos con extensiones: " + extensiones_permitidas.join());
				TEventResults2Search.value = "";
				TEventResults2Search.focus();
		        return false;
				}
		}
      j=j+1;
     }//for
}//funcion

function ValidateAllforgetPassword()
{
try
 { var expreemail=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (document.Form1.txtMail.value== '')
	{
	   alert("Introduzca el email");
		txtIdSearch=document.getElementById("txtMail1");
		txtIdSearch.innerHTML ="*";
		return false;
	}
	else
	{
	 if (!expreemail.test(document.Form1.txtMail.value))
	  {
	  	alert("Introduzca el email correctamente");
		document.Form1.txtMail.focus();
	    document.Form1.txtMail.value = "";
		txtIdSearch=document.getElementById("txtMail1");
		txtIdSearch.innerHTML ="!";
		return false;
   	  }
   	    else
          {var1=document.Form1.txtMail.value
           txtIdSearch=document.getElementById("txtMail1");
           txtIdSearch.innerHTML="";}
		
	}
 }
 catch(e){}
}

function ValidateAlleditImages()
{
   j=0;
   var expr_car1=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\.\-\ ]{1,40}$/;
     //Region         
      if (document.Form1.ddlRegion.value=="0")
	   {
	    alert("Seleccione una Region");
	    document.Form1.ddlRegion.focus();
	   	   return false;
	   }
	     
      //Codigo
      if (document.Form1.txtCode.value=='')
	   {
        alert("Por Favor introduzca el codigo");
        document.Form1.txtCode.focus();
        return false;
        } 
        
     //Estado
     if (document.Form1.ddlState.value=="0")
	   {
	    alert("Seleccione un Estado");
	    document.Form1.ddlState.focus();
	    return false;
	   }
        
      //Extensiones
      
       if (document.Form1.file1.value!='')
       {
         extensiones_permitidas = new Array(".jpg");
		 if (document.Form1.file1.value=='')
		   {alert("Introduzca la imagen");
		    document.Form1.file1.focus();
			return false;
		   }
		 else
	 	 { 	//recupero la extensión de este nombre de archivo
			extension = (document.Form1.file1.value.substring(document.Form1.file1.value.lastIndexOf("."))).toLowerCase();
			//compruebo si la extensión está entre las permitidas
			permitida = false;
			for (var k = 0; k < extensiones_permitidas.length; k++) 
			{
			 if (extensiones_permitidas[k] == extension)
				{permitida = true;
				break;
				}
			}
			if (!permitida) 
				{alert("Comprueba la extension de los archivos a subir. \nSolo se pueden subir archivos con extensiones: " + extensiones_permitidas.join());
				document.Form1.file1.value = "";
				document.Form1.file1.focus();
		        return false;
				}
		}
       }

}

function ValidateAllNewReport()
{
   var expr_car1=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\-\_\?\ ]{1,40}$/;
   var con=0;
    //Titulo
     if (document.Form1.txtTitleReport.value=='')
      {
        alert("Por Favor introduzca el Titulo");
        document.Form1.txtTitleReport.focus();
        return false;
       }
     //Resumen   
      if (document.Form1.txtResumeReport.value=='')
      {   
        alert("Por Favor introduzca el Resumen");
        document.Form1.txtResumeReport.focus();
        return false;
      }
  //Codigo
     if (document.Form1.txtCodeReport.value=='')
      {
       alert("Por Favor introduzca el Codigo");
       document.Form1.txtCodeReport.focus();
       return false;
      }

  for(i=0; i<=22; i+=2)
    { 
     
     txtImageCode1="MyDataList__ctl"+i+"_txtCodeImage1";
      txtImageSearch1=document.getElementById(txtImageCode1);
      
      txtImageCode2="MyDataList__ctl"+i+"_txtImageCode2";
      txtImageSearch2=document.getElementById(txtImageCode2);
          
       if (txtImageSearch1.value!='')
       { con=con+1;
        /* if (!expr_car1.test(txtImageSearch1.value))
          {alert("Por Favor introduzca unicamente letras y numeros");
       	   txtImageSearch1.focus();
		   return false;}*/
       }
     if (txtImageSearch2.value!='')
       { con=con+1;
         /*if (!expr_car1.test(txtImageSearch2.value))
          {alert("Por Favor introduzca unicamente letras y numeros");
       	   txtImageSearch2.focus();
		    return false;}*/
       }
    
   }//for
  if (con==0)
   {alert("Por Favor introduzca por lo menos una imagen");
    return false;} 
 }//funcion
 
function ValidateAlleditReport()
{
   var expr_car1=/^[a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\,\-\_\ ]{1,40}$/;
   var cont=0;
    //Titulo
     if (document.Form1.txtTitleReport.value=='')
      {
        alert("Por Favor introduzca el Titulo");
        document.Form1.txtTitleReport.focus();
        return false;
       }
       
     //Resumen   
      if (document.Form1.txtResumeReport.value=='')
      {
       alert("Por Favor introduzca el Resumen");
        document.Form1.txtResumeReport.focus();
        return false;
       }
  //Codigo
     if (document.Form1.txtCodeReport.value=='')
      {
        alert("Por Favor introduzca el Codigo");
        document.Form1.txtCodeReport.focus();
        return false;
       }

  for(i=0; i<=23; i++)
    { 
     txtImageCode1="MyDataList__ctl"+i+"_txtCodeImage1";
     txtImageSearch1=document.getElementById(txtImageCode1);
     if (txtImageSearch1.value!='')
       { cont=cont+1;
        /* if (!expr_car1.test(txtImageSearch1.value))
          {alert("Por Favor introduzca unicamente letras y numeros");
       	   txtImageSearch1.focus();
		   return false;}*/
       }
    }
  if (cont==0)
   {alert("Por Favor introduzca por lo menos una imagen");
    return false;} 
 }
