/* Encuestas */
function AbrirEncuesta(form,popup) {
	var mando = 0;
	for (i=0;i<form.respId.length;i++){
		if(form.respId[i].checked == true){ mando = 1; }
	}
	if (mando == 1){
		window.open('', popup, 'toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=430,height=457');
	} else {
		alert('Seleccione un item');
		return false;
	} 
	return true;
}

function AbrirEncuestaSimple(form, popup) {
	window.open('', popup, 'toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=430,height=457');
	form.submit();
	return true;
}

function marqueeStop(){
	document.getElementById("marq").stop();
	document.getElementById("marqueeplay").style.display = "block";
	document.getElementById("marqueestop").style.display = "none";
}
function marqueePlay(){
	document.getElementById("marq").start();
	document.getElementById("marqueeplay").style.display = "none";
	document.getElementById("marqueestop").style.display = "block";
}

/* Funcion Random mas oportunidades */
function randomArray(muestra, universo)
	{if (universo < muestra)
		{vec = randomArray(universo, universo);
		 }
	 else
		{vec = new Array(muestra);
		 for(ii = 0; ii < muestra; ii++)
			{repetido = true;
			 while (repetido)
				{nn = Math.floor((Math.random() * universo));
				 repetido = false;
				 for(jj = 0; jj < ii; jj++)
					if (vec[jj] == nn)
						repetido = true;
				 }
			 vec[ii] = nn;
			 }
		 }
	return vec;
	}

/* reemplazar texto */
function stringReplace(orig, que, por)
	{pos = orig.indexOf(que);
	 while (pos > -1)
		{orig = orig.substring(0, pos) + por + orig.substring(pos + que.length, orig.length);
		 pos = orig.indexOf(que);
		 }

	return orig;
	}

/* POPUP */
function Popup(url,name,width,height,resize,scroll) {
	var dialogWin = new Object();
	dialogWin.width = width;
	dialogWin.height = height;
	now = new Date();
	var millis=now.getTime();
	var mstr=""+millis;
	if (navigator.appName == "Netscape") {
		dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
		dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
		var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	} else if (document.all) {
		dialogWin.left = (screen.width - dialogWin.width) / 2;
		dialogWin.top = (screen.height - dialogWin.height) / 2;
		var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
window.open(url,name,attr);
}

/* Cookies */
function getCookie(nameOfCookie)
        {if (document.cookie.length > 0)
                {begin = document.cookie.indexOf(nameOfCookie + "=");
                 if (begin != -1)
                        begin += nameOfCookie.length + 1;
                 else
                        return null;
                 end = document.cookie.indexOf(";", begin);
                 if (end == -1)
                        end = document.cookie.length;
                 return unescape(document.cookie.substring(begin, end));
                 }

         return null;
         }

function Galeria(ff, ss, dd, ee) {
	var foto;
	var epigrafe;
	var divepigrafe;
	var	src;
	var actual = 0;

	foto = ff;
	src = ss;
	divepigrafe = dd;
	epigrafe = ee;

	this.setFoto = setFoto;
	function setFoto(nn) {
		actual = nn;
		foto.src = src[actual];
		divepigrafe.innerHTML = epigrafe[actual] != '' ? epigrafe[actual] : ' ';
	}

	this.sgtFoto = sgtFoto;
	function sgtFoto() {
		if (actual < src.length - 1) {
			actual++;
			foto.src = src[actual];
			divepigrafe.innerHTML = epigrafe[actual] != '' ? epigrafe[actual] : ' ';
		}
	}

	this.antFoto = antFoto;
	function antFoto() {
		if (actual > 0) {
			actual--;
			foto.src = src[actual];
			divepigrafe.innerHTML = epigrafe[actual] != '' ? epigrafe[actual] : ' ';
		}
	}
}

function JumpUrl(combo){
	window.location=combo.options[combo.selectedIndex].value;
}