var $xx = jQuery.noConflict();

		$xx(document).ready(function() {
			/*
			*   Examples - images
			*/

      
         $xx("a#close-link").click(function () {
$xx(".jquery-notify-bar").fadeOut();
});
      
      
      
			$xx("a#example1").fancybox();

			$xx("a#example2").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$xx("a#example3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});

			$xx("a#example4").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none'
			});

			$xx("a#example5").fancybox();

			$xx("a#example6").fancybox({
				'titlePosition'		: 'outside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9
			});

			$xx("a#example7").fancybox({
				'titlePosition'	: 'inside'
			});

			$xx("a#example8").fancybox({
				'titlePosition'	: 'over'
			});

			$xx("a[rel=galerias]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$xx(".various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'type'				: 'iframe'
			});
			$xx(".retrieve").fancybox({
				'width'				: 600,
				'height'			: 450,
				'titlePosition'		: 'inside',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'type'				: 'iframe',
				'showCloseButton':false,
				'hideOnOverlayClick': false,
				'padding': 0
			});
			
			$xx(".editprofile").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'type'				: 'iframe'
			});
			$xx(".register").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'type'				: 'iframe',
				'autoScale'			: true,
				'width'				: 780,
				'height'			: 800,
				'padding': 0,
				'hideOnOverlayClick':false,
				'showCloseButton':false,
			});

			$xx("#various2").fancybox();

			$xx(".various3").fancybox({
				'width'				: 600,
				'height'			: 450,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type': 'swf',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9
			});
$xx(".get-information").fancybox({
		    'width'				: 780,
				'height'			: 800,
            'titlePosition'         : 'inside',
            'transitionIn'          : 'fade',
            'transitionOut'         : 'fade',
            'overlayColor'          : '#000',
            'overlayOpacity'        : 0.9,
			'hideOnOverlayClick': false,
			'showCloseButton':false,
			'autoScale'			: true,
			'type'				: 'iframe',
			'padding': 1
        }).trigger("click");
window.setTimeout('$xx(".get-information")', 5000);


$xx(".alert-activation").fancybox({
		    'width'				: 600,
				'height'			: 450,
            'titlePosition'         : 'inside',
            'transitionIn'          : 'fade',
            'transitionOut'         : 'fade',
            'overlayColor'          : '#000',
            'overlayOpacity'        : 0.9,
			
			'autoScale'			: true,
			'type'				: 'iframe',
			'padding': 1
        }).trigger("click");
window.setTimeout('$xx(".alert-activation")', 5000);

if($xx.cookie("getinfo") != 'true')
    {    
        $xx('.get-information').fancybox(
        {  
               'width'             : 780,
                'height'            : 800,
                'transitionIn'      : 'none',
                'transitionOut'     : 'elastic',
                'centerOnScroll'    : 'true',
                'overlayOpacity'    : 0.9,
                'overlayColor'      : '#000',
                'modal'             : 'true',
                'type'              : 'iframe',
				'hideOnOverlayClick': false,
			'showCloseButton':false,
			'autoScale'			: true
            }
        ).trigger("click");
         $xx.cookie("getinfo", "true", { path: '/', expires: 0 });
    } 




		});

function editProfile(id){
	
		window.location.href='http://www.descubriendo.cl/nuevoprogramador/newsite/pages/profile.php?='+id;
	
}


<!-- FORMULARIO DE REGISTROS Y OTROS VALIDACIONES CAMPOS -->
function fnValidar(){
	var f = document.frm2;
	var arrElement = "";
	var filter=/^[0-9a-zA-Z]+(?:[._][0-9a-zA-Z]+)*@[0-9a-zA-Z]+(?:[._-][0-9a-zA-Z]+)*\.[0-9a-zA-Z]{2,4}$/;
	
	if(f.txtNombre.value =="")
		arrElement = arrElement + "Debe ingresar el Nombre,";
		
	if (!filter.test(f.txtEmail.value))
	arrElement = arrElement + "Debe ingresar un Email Valido,";
	
	if(f.txtEmail.value =="")
		arrElement = arrElement + "Debe ingresar tu email,";	
	
	if(f.txtContrasena.value =="")
		arrElement = arrElement + "Debe ingresar La Contrasena,";	
		
    if(f.telefono.value =="")
		arrElement = arrElement + "Debe ingresar tu telefono,";
		
   
		
		
	
	
	if(f.ciudad.value !=="" ) { 
	if( f.ciudad.value.length < 4) 
	arrElement = arrElement + "Debe ingresar ciudad valida,";
	}	
	
	if(f.sexo.value ==0)
		arrElement = arrElement + "Debe ingresar tu sexo,";
		
	if(f.pais.value ==46) {
		
		
		if(f.region.value ==0)
		arrElement = arrElement + "Debe ingresar tu Region,";
		if(f.ciudad.value =="" )  
	arrElement = arrElement + "Debe ingresar tu ciudad,";	
	
	
	 if(f.comuna.value ==0)
		arrElement = arrElement + "Debe ingresar tu comuna,";
	}
	
	if(f.rut.value =="" || f.rut.value.length < 11)
		arrElement = arrElement + "Debes ingresar un rut valido,";
       	
		
		if(f.pais.value ==0)
		arrElement = arrElement + "Debe ingresar pais,";
		if(f.region.value ==0)
		arrElement = arrElement + "Debe ingresar tu Region,";
		if(f.comuna.value ==0)
		arrElement = arrElement + "Debe ingresar tu comuna,";
		
		
	if(f.txtContrasena.value.length < 6)
		arrElement = arrElement + "La Contrasena debe tener 6 caracteres como minimo,";	
	
	if(f.txtContrasena2.value =="")
		arrElement = arrElement + "Debe ingresar la Confirmacion de contrasena,";
	
	if(f.txtContrasena.value.length < 6)
		arrElement = arrElement + "La Contrasena debe tener 6 caracteres como minimo,";	
		
	if(f.perfil[0].checked ==false && f.perfil[1].checked ==false && f.perfil[2].checked ==false && f.perfil[3].checked ==false) {
   	
	arrElement = arrElement + "Debes Elegir tu perfil de usario,";	
	
	}
	if(f.perfil[0].checked !==false ) {
		if(f.sele0.value ==0 )
		arrElement = arrElement + "Debe ingresar tu Nivel ,";
		if(f.seler0.value ==0)
		arrElement = arrElement + "Debe ingresar tu Asignatura ,";
		if(f.txt0.value =="Nombre Colegio")
		arrElement = arrElement + "Debe ingresar tu colegio ,";
	}
		
	if(f.perfil[1].checked ==true && f.txt1.value =="Nombre Colegio")
		arrElement = arrElement + "Debe ingresar tu colegio,";
		
	if(f.perfil[2].checked ==true && f.txt2.value =="Nombre Colegio" && f.sele2.value ==0)
		arrElement = arrElement + "Debe ingresar tu Nivel y colegio,";
	
	if(f.perfil[3].checked ==true && f.txt3.value =="Profesion" ||f.txt3.value.length < 8)
		arrElement = arrElement + "Debe ingresar tu profesion,";
	
	if(arrElement != ""){
		var arrAlert = arrElement.split(",")
		msjAlerta = "";
		for(i=0; i<arrAlert.length; i++){
			var msjAlerta = msjAlerta + arrAlert[i]+"\n";
		}
	alert("Hay errores en los siguientes campos:\n\n"+msjAlerta);
	return void(0);
	}
return true;
}


function fnEnviar(){
	if(fnValidar()){
		document.frm2.submit();		
		//alert("se fue");
	}
}




function formato_rut(texto, activo) {
var invertido = "";
var dtexto = "";
var cnt = 0;
var i=0;
var j=0;
var largo = "";    
    if (activo) {
          texto = formato_rut(texto, false)
          largo = texto.length;
          for ( i=(largo-1),j=0; i>=0; i--,j++ )
            invertido = invertido + texto.charAt(i);          
          dtexto = dtexto + invertido.charAt(0);
          dtexto = dtexto + '-';          
          for ( i=1,j=2; i<largo; i++,j++ )
          {
            //alert("i=[" + i + "] j=[" + j +"]" );
            if ( cnt == 3 )
            {
              dtexto = dtexto + '.';
              j++;
              dtexto = dtexto + invertido.charAt(i);
              cnt = 1;
            }
            else
            { 
              dtexto = dtexto + invertido.charAt(i);
              cnt++;
            }
          }
          invertido = "";
          for ( i=(dtexto.length-1),j=0; i>=0; i--,j++ )
            invertido = invertido + dtexto.charAt(i);
          if (invertido == '-') invertido = ""
          texto = invertido;
    } else {
        var tmpstr = "";
        for ( i=0; i < texto.length ; i++ )
        if ( texto.charAt(i) != ' ' && texto.charAt(i) != '.' && texto.charAt(i) != '-' )
            tmpstr = tmpstr + texto.charAt(i);
        texto = tmpstr;
    }
    return texto;
}



// tip solo numeros

function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
 
return true;
}

function findselected() {
if (document.frm2.pais.value == '46') {
document.frm2.region.disabled=false;
document.frm2.ciudad.disabled=false;
document.frm2.comuna.disabled=false;
document.getElementById("comuna").value = '309'
document.getElementById("region").value = '13'
document.getElementById("pais").value = '46'
document.getElementById("ciudad").value = ''
} else {
document.frm2.region.disabled=true;
document.frm2.ciudad.disabled=true;
document.frm2.comuna.disabled=true;
document.getElementById("comuna").value = '0'

document.getElementById("region").value = '0'
document.getElementById("ciudad").value = null
}
}


