//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ iniciowindow.addEvent('domready', function() {    maxcoments = 500;    if($('imgProd') != null){    //	senTipo();    }    if($('fle0') != null){	//	iniCol(sonCols);	}	//	misPics = $$('#pr1 img');	sonPic = misPics.length;	for(var g = 0; g<sonPic; g++){		misPics[g].set("class", "picshom");	}	savposicion = -1;	posicion = 0;	onOf = 1;	actionImg();	pause();});function intervaloNow(){	posicion = dirSav;	sec = 0;}function toSec(lapase){	sec = 0;	savposicion = posicion;	posicion = lapase;	actionImg();}function ctrPagina(){	++sec;	if(sec >= 16){		sec = 0;		savposicion = posicion;		++posicion;		posicion = posicion>= sonPic ? 0 : posicion;		actionImg();	}}function actionImg(){	if(misPics[savposicion] != null){		misPics[savposicion].setStyle("position", "absolute");		misPics[savposicion].setStyle("display", "none");	}	misPics[posicion].setStyle("position", "static");	misPics[posicion].setStyle("display", "block");	//	if($('td_ctr_'+savposicion) != null) $('td_ctr_'+savposicion).set("class", "cubOf");	$('td_ctr_'+posicion).set("class", "cubOn");	//	var slide1 = new Fx.Slide(misPics[posicion],{		mode: 'horizontal',		transition: Fx.Transitions.Cubic.easeInOut,		duration: 800,		unit: '%',		onComplete: function(){			var imgNow = misPics[posicion].get("src");			$('pr1').setStyle('background-image', 'url('+imgNow+')');		}	}).hide().toggle();}//function pause(){	onOf = onOf == 1 ? 0 : 1;	if(onOf){		clearInterval(aint);		delete aint;	}else{		sec = 0;		aint = setInterval(ctrPagina, 1000);	}}//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ control de paginado de lista.//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ navegacion//------------------------------------------------------------------------------------ Carga HTMLfunction recHtml(eltipo, ruta, niveles){    var req = new Request.HTML({        url:ruta,         onComplete: function(responseHTML) {            var divSel = niveles;            $('spc'+divSel).set('html', '');            $('spc'+divSel).adopt(responseHTML);        },        onFailure: function() {            var divSel = niveles;            $('spc'+divSel).set('text', 'Falla de carga.');        },        noCache:true,        method:'post',        headers: {            'Cache-Control': 'no-cache',             'Pragma': 'no-cache',             'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'        }    });    req.send();}	function onblock(){           $('formCon').setStyle('display', 'block');    }//------------------------------------------------------------------------------------ Carga HTMLfunction recHtml2(eltipo, ruta, niveles, formaSen){    var req = new Request.HTML({        url:ruta,         onComplete: function(responseHTML) {            var divSel = niveles;            $('spc'+divSel).set('html', '');            $('spc'+divSel).adopt(responseHTML);        },        onFailure: function() {            var divSel = niveles;            $('spc'+divSel).set('text', 'Falla de carga.');        },        noCache:true,        method:'post',        headers: {            'Cache-Control': 'no-cache',             'Pragma': 'no-cache',             'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'        }    }).post(formaSen);    req.send();}//------------------------------------------------------------------------------------ Al cargar el HTMLfunction htmlCompleto(eltipo){    cade = String(eltipo);    vrSec = Number(cade[0]);     vrSubSec = Number(cade[2]);    vrTerSec = Number(cade[3]);    opTerSel = Number(cade[4]);    if($('imgProd') != null){        senTipo();    }    if($('fle0') != null){        iniCol(sonCols);    }}////------------------------------------------------------------------------------------ Carga subfunction sub1(eltr){    var slide1 = new Fx.Slide(eltr,{        mode: 'vertical',        transition: Fx.Transitions.Cubic.easeInOut,        duration: 500,        unit: '%',        onComplete: function(){			        }    }).toggle();}//------------------------------------------------------------------------------------ Carga HTMLfunction recVid(vid, parem2){    par = parem2 != null ? parem2 : "";    ruta = 'srcdsada2/videos/vid'+vid+'.php?sec='+par;		    var req = new Request.HTML({        url:ruta,         onComplete: function(responseHTML) {            $('setVid').set('html', '');            $('setVid').adopt(responseHTML);            //	var myFx = new Fx.Tween('setVid');            //myFx.get('tween', {property: 'opacity', duration: 'long'}).start(0);            //$('setVid').fade('in');            var slide1 = new Fx.Slide('setVid',{                mode: 'vertical',                transition: Fx.Transitions.Cubic.easeInOut,                duration: 500,                unit: '%',                onComplete: function(){                }				            }).hide().toggle();        },        onFailure: function() {            var divSel = niveles;            $('setVid').set('text', 'Falla de carga.');            //$('setVid').fade("out");            $('setVid').fade('in');        },        noCache:true,        method:'post',        headers: {            'Cache-Control': 'no-cache',             'Pragma': 'no-cache',             'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'        }    });    req.send();}//function recVid2(pasHoj){    ruta = pasHoj;    var req = new Request.HTML({        url:ruta,         onComplete: function(responseHTML) {            $('setVid').set('html', '');            $('setVid').adopt(responseHTML);            //	var myFx = new Fx.Tween('setVid');            //myFx.get('tween', {property: 'opacity', duration: 'long'}).start(0);            //$('setVid').fade('in');            var slide1 = new Fx.Slide('setVid',{                mode: 'vertical',                transition: Fx.Transitions.Cubic.easeInOut,                duration: 500,                unit: '%',                onComplete: function(){                }				            }).hide().toggle();        },        onFailure: function() {            $('setVid').set('text', 'Falla de carga.');            //$('setVid').fade("out");            $('setVid').fade('in');        },        noCache:true,        method:'post',        headers: {            'Cache-Control': 'no-cache',             'Pragma': 'no-cache',             'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'        }    });    req.send();}//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ control de paginado de lista.//------------------------------------------------------------------------------------ envio a pagina no.function validaPages(nopag, totPag, forma, topage){    var conten = $(nopag).get('value');    if(conten>0 && !isNaN(conten)){        if(conten>totPag){            alert("Introdusca un numero valido");        }else{            $('pageVis').set("value", conten);            $('pagForm').set("action", topage);            forma.submit();        //recHtml2(0,topage, 1, forma);        }    }else{        alert("Introdusca un numero valido");    }}//------------------------------------------------------------------------------------ navegacion function senPage(nopag, totPag, forma, topage){    if(nopag == 0){        $('pageVis').set("value", totPag-1);    }else{        $('pageVis').set("value", totPag+1);    }    //    $('pagForm').set("action", topage);    forma.submit();//recHtml2(0,topage, 1, forma);}function corta(value){    valor = value;    val = valor.substr(0,maxcoments);    thispas.value = val;}//function funCom(forSenA){    dato1 = $('dato1').get('value');    dato2 = $('dato2').get('value');	    varSpc5 = new String(dato1.split(" "));    varSpc6 = new String(dato2.split(" "));    varSpc7 = new String(dato2);    //    evaBlk = varSpc5.length+varSpc6.length;    if(dato2 != "" && dato1 != "" && evaBlk>5){        if(varSpc7.length>maxcoments){            alert("El mensaje es mayor a "+maxcoments+" chars");        }else{            var req = new Request.HTML({                url:'savChg.php',                 onComplete: function(responseHTML) {                    $('save').set('html', '');                    $('save').adopt(responseHTML);				                },                onFailure: function() {                    $('save').set('text', 'Falla de carga.');					                },                noCache:true,                method:'post',                headers: {                    'Cache-Control': 'no-cache',                     'Pragma': 'no-cache',                     'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'                }            }).post(forSenA);            req.send();        }    }else{        alert("Ningun campo debe estar vacio");    }}////------------------------------------------------------------------------ Validar Correo Electronicofunction ValidarEmail(cadena){    if (cadena.length==0){        return true;    }    else if((/^\w+([\.-_]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadena))== false){        return true;    }    else{        return false;	    }}//function funCom2(forSenA){    dato1 = $('dato1').get('value');    dato2 = $('dato2').get('value');    varSpc5 = new String(dato1.split(" "));    varSpc6 = new String(dato2.split(" "));    varSpc7 = new String(dato1);    varSpc8 = new String(dato2);    //    evaBlk = varSpc5.length+varSpc6.length;    if(dato2 != "" || dato1 != ""){        if(varSpc7.length<3 && varSpc8.length<3 ){            alert("Algun campo es menor de 3 caracters");        }else if(dato1 != "" ){            if(ValidarEmail(dato1)){                alert("El email no es valido o esta mal escrito");            }else{                enviarSa(forSenA);            }        }else{            enviarSa(forSenA);        }    }else{        alert("Al menos un campo debe estar lleno");    }}//function enviarSa(forSenA){    var req = new Request.HTML({        url:'savChg2.php',         onComplete: function(responseHTML) {            $('save').set('html', '');            $('save').adopt(responseHTML);		        },        onFailure: function() {            $('save').set('text', 'Falla de carga.');			        },        noCache:true,        method:'post',        headers: {            'Cache-Control': 'no-cache',             'Pragma': 'no-cache',             'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'        }    }).post(forSenA);    req.send();		}////function enviarform(form1){//    alert (form1);//	var req = new Request.HTML({url:'save_encuesta.php',//		onComplete: function(responseHTML) {//			$('save').set('html', '');//			$('save').adopt(responseHTML);////		},//		onFailure: function() {//			$('save').set('text', 'Falla de carga.');////		},//		noCache:true,//		method:'post',//		headers: {'Cache-Control': 'no-cache', 'Pragma': 'no-cache', 'Expires': 'Thu, 27 Mar 1980 23:59:00 GMT'}//	}).post(form1);//	req.send();//}//function toir(rutaIr, wid, hei, titulo){    pageTracker._trackPageview('/'+rutaIr+'/'+titulo);    TB_show(titulo, rutaIr+'?keepThis=false&TB_iframe=false&width='+wid+'&height='+hei+'', 'rel1');}function toir2(rutaIr, wid, hei, titulo){    pageTracker._trackPageview('/'+rutaIr+'/'+titulo);    TB_show(titulo, rutaIr+'?placeValuesBeforeTB_=savedValues&TB_iframe=true&modal=true&width='+wid+'&height='+hei+'', 'rel2');}//function onHide(){    if($('rad1').get('checked') == true){        $('hidde1').setStyle('display', 'none');    }else{        $('hidde1').setStyle('display', 'block');    }}// los valoreas de var flag  0 para  check y 1 para no checkfunction valida_enc(){    var preg1;    var preg2;    var preg3;    var tex1= "";    var  flag = false;       if($('rad1').get('checked') == true || $('rad2').get('checked') == true){        preg1= 1;        if($('rad2').get('checked') == true){            if(dameValRad('forma', 'radio2') == null){                alert("Especificanos por que no");                 flag = true;            }else{                preg2 = (dameValRad('forma', 'radio2'));                                    if(dameValRad('forma', 'radio2') == 5){                                                       tex1 = document.getElementById("otro1").value;                    if(del_space(tex1) == ""){                            alert("Especifique por que no vio toda la p&aacute;gina");                           flag = true;                                       }                                                          }              if (flag == false){                   flag  =  validno();                   if (flag == false){                       preg3 = (dameValRad('forma', 'radio3'));                   }              }                           }         }else if ($('rad1').get('checked') == true){           preg1= 2;           flag  = validno();            if (flag == false){                       preg3 = (dameValRad('forma', 'radio3'));                   }        }		    }else{        alert("Especifique si vio toda la pagina");         flag = true;      }    //  alert(preg1);      // alert (flag);    if(flag== false){             enviarformulario(preg1,preg2,preg3,tex1);    }	     		}function validno(){        if(dameValRad('forma', 'radio3') == null){        alert("Especificanos como te enteraste de la pagina");         flag = true;         return (flag);    }else{                flag = false;         return (flag);                    }		    }function enviarformulario( preg1 ,    preg2,    preg3,    tex1){     var div=document.getElementById('mensaje');    var ajax=nuevoAjax();    ajax.open("POST","save_encuesta.php",true);    ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");    ajax.onreadystatechange=function (){        if (ajax.readyState==1){        //  document.getElementById('enviaform').disabled=true;        }        else        if (ajax.readyState==4){            div.innerHTML=ajax.responseText;        // document.getElementById('enviaform').disabled=false;               $('formCon').setStyle('display', 'none');          $('result').setStyle('display', 'block');        }    }    ajax.send( "preg1="+preg1 +        "&preg2="+preg2+        "&preg3="+preg3+"&tex1="+tex1);}function nuevoAjax(){    var xmlhttp=false;    try {        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) {        try {            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");        } catch (E) {            xmlhttp = false;        }    }    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {        xmlhttp = new XMLHttpRequest();    }    return xmlhttp;}function del_space(cadena){    // Funcion equivalente a trim en PHP    var x=0, y=cadena.length-1;    while(cadena.charAt(x)==" ") x++;    while(cadena.charAt(y)==" ") y--;    return cadena.substr(x, y-x+1);}function funVacio(pascade){    var espacio1 = pascade.substring(0, 1) == " " ? 1 : 0;    if(espacio1 || pascade== ""){        return true;    }else{        return false;    }}function dameValRad(namForm, namElem){	var radSel = null;    misPics = $$("'#"+namForm+" input."+namElem+"'");	sonPic = misPics.length;	for(var g = 0; g<sonPic; g++){		if(misPics[g].get('checked') == true){			radSel = misPics[g].get('value');			o=sonPic;		}	}    return radSel; }function verNow(){	$('comp1').setStyle("display", "block");}
