// date

function CTVDate () {
var time = new Date()
var date = time.getDate()
var day = time.getDay()
var month = time.getMonth()
var year = time.getYear()
var daytext = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado")
  	        var monthtext = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
 	        document.write(daytext[day] + " " + date + " de " + monthtext[month] + ", 19" +year)
		
}

// image rollover

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_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_findObj(n, d) { //v3.0
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); 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 navMouseOver(imgid,imgnew) {
if (document.images) {
document.images[imgid].src=eval(imgnew + ".src");
}
}

// cell color rollover

function cOvr(src) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
}
}

function cOut(src) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
}
}

function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}

function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
}
}

function mClk(src) {
if(event.srcElement.tagName=='TD'){
src.children.tags('A')[0].click();
}
}

// popup detection resolution code

agent = navigator.userAgent;
if (parseInt(agent.substring(8,9)) > 3) {
if (screen.width >= 800) {
winwidth = 760;
winheight = 520;
} else {
winwidth = 620;
winheight = 420;
}
}
if (parseInt(agent.substring(8,9)) <= 3) {
winwidth = 620;
winheight = 420;
}

// normal centered 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 (document.layers) {
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';
}
//Agrega el codigo anti-caching
tienesp=false;
for (i=0; i<url.length; i++)
	if (url.charAt(i)=='?')
		tienesp=true;
if (tienesp)
	nocach='&nocache='+mstr;
else
	nocach='?nocache='+mstr;

window.open(url + nocach ,name,attr);
}


// recommend hazmat popup

function recomienda(pagina)
{
laURL= 'http://www.asohazmat.com.ve/index.html'
popup(laURL,'recomienda','450','375');
}

function gbpop(pagina)
{
laURL= '../guest/gbpop.php'
popup(laURL,'gbpop','450','375');
}

// chat rules and regulations popup

function chatrules(pagina)
{
laURL= '/chat/reglas-condiciones-de-uso-chat.php'
popup(laURL,'chatrules','450','375','yes','yes');
}


// statement popup

function statement(pagina)
{
laURL= '/legal/declaracion.php'
popup(laURL,'statement','440','270');
}


// audio and video spec requirements popup

function audiovideospecs(pagina)
{
laURL= '/audio-video/requerimientos-audiovideo.php'
popup(laURL,'audiovideospecs','450','420','yes','yes');
}


// webcam popup

function webcam(pagina)
{
laURL= '/webcam.php'
popup(laURL,'webcam','375','350');
}


// launch top dropdown menus

function gotoSite(obj)
{
var s;
s=obj.options[obj.selectedIndex].value
if (s!="") {
window.top.location.href=s;
}
}

// netscape resize bug fix

if (document.layers) {
origWidth = innerWidth;
origHeight = innerHeight;}

function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}

if (document.layers) onresize = reDo;

// search validation script

function valida_buscador() {
if ((document.formbuscador.texto.value=="") || (document.formbuscador.texto.value==" ") || (document.formbuscador.texto.value=="  ") || (document.formbuscador.texto.value=="   ")) {
alert("Debe ingresar una palabra para que inicie la búsqueda ");
return (false);
} else {
var checkOK = "._-áéíóúAÉÍÚÓçÇãÃõÕüÜàÀêÊ~`@!#$%^&*()-_=+[]{}''|\/<>,.;:\"";
var checkStr = document.formbuscador.texto.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
return (true);

} else {
alert("Ingresá una palabra");
return (false);
}
}
}


// cookie reader

function getValue(cadena, valor)
{
valor = valor + "=";
offset = cadena.indexOf(valor);
if (offset !=-1) { // Existe el valor
offset += valor.length;
end = cadena.indexOf("&", offset);
if (end == -1)
end = cadena.length;
return cadena.substring(offset, end);
} else {
return "";
}
}

function getCookie(Name, value) {
var search =  "; " + Name + "="
if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(search)
	if (offset != -1) { // if cookie exists	
		 search =  "; " + Name + "="
	} else {
		 search = Name + "="
	}
		
} 
if (document.cookie.length > 0) { // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (end == -1)
end = document.cookie.length
return getValue(unescape(document.cookie.substring(offset, end)), value);
} else {
return "";
}
} else {
return "";
}
}

// Este script AsoHazMat - www.asohazmat.com.ve

var mymessage = "\nAsoHazMat\n\ \n\
El contenido de estas páginas web, imágenes y código\n\
no pueden ser copiados ni utilizados fuera de este\n\
sitio sin el consentimiento del Webmaster\n\ \n\
Por favor lee los términos de uso para más información.\n\ \n\
AsoHazMat\n\
All rights reserved. Todos los derechos reservados.";

function rtclickcheck(keyp){
  if (navigator.appName == "Netscape" && keyp.which == 3) {
    alert(mymessage);
    return false;
  }

  if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {
    alert(mymessage);
    return false;
  }
}

document.onmousedown = rtclickcheck