// Favoritos
function addBookmark(titulo, url) {
	if (window.sidebar) { window.sidebar.addPanel(titulo, url,""); } else if( document.all ) { window.external.AddFavorite(url, titulo); } else if( window.opera && window.print ) { return true; }
}

// Texto en notas
function textSize(action) {
	var noticia	= document.getElementById('masmenos');

	if(noticia.style.fontSize == '') { noticia.style.fontSize = '12px'; }

	switch(action) {
		case '+':
			size = noticia.style.fontSize;
			size = size.replace('px', '');
			size++;

			noticia.style.fontSize = size + 'px';
		break;

		case '-':
			size = noticia.style.fontSize;
			size = size.replace('px', '');
			size--;

			noticia.style.fontSize = size + 'px';
		break;
	}
}

// Buscador
var buscador	= 1;

function search(site, string) {
	if(string == "") { alert("Debe completar el campo de busqueda"); return false; }

	switch(buscador) {
		case 1:
			window.location	= site + "/buscador_resultados.php?type=1&search=" + string;
		break;

		case 2:
			window.location	= site + "/buscadorGoogle.php?domains=www.lmneuquen.com.ar&q=" + string + "&client=pub-0567998802536288&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23CC0000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A940F04%3BLC%3A940F04%3BT%3A000000%3BGFNT%3A940F04%3BGIMP%3A940F04%3BFORID%3A11&hl=es";
		break;
	}
}

// Noticias - Tabla Principal
var newsCursor		= 0;
var newsInterval	= null;

var LinkTP		= '';

function loadTP(site, action, auto) {
	var ImagenTP	= document.getElementById('ImagenTP');
	//var FechaTP	= document.getElementById('FechaTP');
	//var TituloTP	= document.getElementById('TituloTP');
	//var CopeteTP	= document.getElementById('CopeteTP');
	//var ComentarioTP	= document.getElementById('ComentarioTP');

	switch(action) {
		case 'next':
			if((++newsCursor) > (noticias.length - 1)) { newsCursor = 0; }

			if(auto == false) {
				clearInterval(newsInterval);

				document.getElementById('playpauseTP').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'previous':
			if((--newsCursor) < 0) { newsCursor = (noticias.length - 1); }

			if(auto == false) {
				clearInterval(newsInterval);

				document.getElementById('playpauseTP').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'playpause':
			if(newsInterval == null) {
				newsInterval	= setInterval("loadTP('" + site + "', 'next', true)", 5000);

				document.getElementById('playpauseTP').src	= site + '/images/btn_pausa.gif';
			}else{

				clearInterval(newsInterval);

				newsInterval	= null;

				document.getElementById('playpauseTP').src	= site + '/images/btn_play.gif';
			}
		break;
	}

	LinkTP			= site + noticias[newsCursor]['archivo'];

	ImagenTP.src		= site + noticias[newsCursor]['imagenLink'];
	//FechaTP.innerHTML	= '<span class="t12_Gris_oscuro_B">' + noticias[newsCursor]['fecha'] + '</span>&nbsp;|&nbsp;' + noticias[newsCursor]['hora'] + ((noticias[newsCursor]['videoID'] > 0)? '&nbsp<img align="absmiddle" src="' + site + '/images/home_icono_video.gif" border="0">':'');
	//TituloTP.innerHTML	= '<a href="' + site + noticias[newsCursor]['archivo'] + '" class="a30_Gris_oscuro">' + noticias[newsCursor]['titulo'] + '</a>';
	//CopeteTP.innerHTML	= '<a href="' + site +  noticias[newsCursor]['archivo'] + '" class="v12_Gris_oscuro">' + noticias[newsCursor]['copete'] + '</a>';
	//ComentarioTP.innerHTML	= '<a href="' + site  + noticias[newsCursor]['archivo'] + '#comentarios" class="v12_Gris_oscuro" align="left" style="padding:3px;">Enviá tu comentario  <spam class="t11_Bordo"> (' + noticias[newsCursor]['comentario'] + ')</spam></a>';
	
}

// Multimedia - Galeria de fotos
var mediaCursor		= 0;
var mediaInterval	= null;

function loadMedia(site, action, auto) {
	var ImagenMedia	= document.getElementById('ImagenMedia');

	switch(action) {
		case 'next':
			if((++mediaCursor) > (media.length - 1)) { mediaCursor = 0; }

			if(auto == false) {
				clearInterval(mediaInterval);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'previous':
			if((--mediaCursor) < 0) { mediaCursor = (media.length - 1); }

			if(auto == false) {
				clearInterval(mediaInterval);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'playpause':
			if(mediaInterval == null) {
				mediaInterval	= setInterval("loadMedia('" + site + "', 'next', true)", 5000);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_pausa.gif';
			}else{
				clearInterval(mediaInterval);

				mediaInterval	= null;

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;
	}

	ImagenMedia.src	= site + media[mediaCursor]['link'];
}
// Multimedia - Galeria de fotos AMIGOS
var mediaCursor2		= 0;
var mediaInterval2	= null;

function loadMedia2(site, action, auto) {
	var ImagenMedia2	= document.getElementById('ImagenMedia2');

	switch(action) {
		case 'next':
			if((++mediaCursor2) > (media2.length - 1)) { mediaCursor2 = 0; }

			if(auto == false) {
				clearInterval(mediaInterval2);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'previous':
			if((--mediaCursor2) < 0) { mediaCursor2 = (media2.length - 1); }

			if(auto == false) {
				clearInterval(mediaInterval2);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;

		case 'playpause':
			if(mediaInterval2 == null) {
				mediaInterval2	= setInterval("loadMedia2('" + site + "', 'next', true)", 5000);

				document.getElementById('playpauseMedia').src	= site + '/images/btn_pausa.gif';
			}else{
				clearInterval(mediaInterval2);

				mediaInterval2	= null;

				document.getElementById('playpauseMedia').src	= site + '/images/btn_play.gif';
			}
		break;
	}

	ImagenMedia2.src	= site + media2[mediaCursor2]['link'];
}


// Tiempo en header
function headerTime() {
	var date	= new Date();

	var tDay	= date.getDay();
	var tDate	= date.getDate();
	var tMonth	= date.getMonth() + 1;
	var tYear	= date.getFullYear();

	var tHour	= date.getHours();
	var tMinutes	= date.getMinutes();

	//var tAMPM	= null;

	// Array de dias
	var tDays	= new Array('Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado');

	// AM o PM ?
	//if(tHour == 24) {
		//tHour	= 0;
		//tAMPM	= 'AM';
	//}else if(tHour >= 12) {
		//tAMPM	= 'PM';
	//}else if(tHour < 12) {
		//tAMPM	= 'AM';
	//}

	return tDays[tDay] + '  ' + ((tDate < 10)? '0' + tDate: tDate) + '.' + ((tMonth < 10)? '0' + tMonth: tMonth) + '.' + tYear + ' - ' + ((tHour < 10)? '0' + tHour: tHour) + ':' + ((tMinutes < 10)? '0' + tMinutes: tMinutes) + ' ' + '';
}

// Checkall en buscador avanzado
function checkall(type, status) {
	switch(type) {
		case 1:
			if(status == 1) {
				for(index = 0; index < document.getElementsByName('sec[]').length; index++) {
					document.getElementsByName('sec[]')[index].checked = true;
				}
			}else{
				for(index = 0; index < document.getElementsByName('sec[]').length; index++) {
					document.getElementsByName('sec[]')[index].checked = false;
				}
			}
		break;

		case 2:
			if(status == 1) {
				for(index = 0; index < document.getElementsByName('sec[]').length; index++) {
					document.getElementsByName('sup[]')[index].checked = true;
				}
			}else{
				for(index = 0; index < document.getElementsByName('sec[]').length; index++) {
					document.getElementsByName('sup[]')[index].checked = false;
				}
			}
		break;
	}
}

function enterSearch(e, site, string) {
	var keynum;
	var keychar;
	var numcheck;

	if(window.event) {
		keynum = e.keyCode;
	}else if(e.which) {
		keynum = e.which;
	}

	if(keynum == 13) {
		return search(site, string);
	}
}


//Cookies
function setCookie(cookieName,cookieValue,expires,path,domain,secure) { 
document.cookie= 
escape(cookieName)+'='+escape(cookieValue) 
+(expires?'; EXPIRES='+expires.toGMTString():'') 
+(path?'; PATH='+path:'') 
+(domain?'; DOMAIN='+domain:'') 
+(secure?'; SECURE':''); 
} 

function getCookie(cookieName) { 
var cookieValue=null; 
var posName=document.cookie.indexOf(escape(cookieName)+'='); 
if (posName!=-1) { 
var posValue=posName+(escape(cookieName)+'=').length; 
var endPos=document.cookie.indexOf(';',posValue); 
if (endPos!=-1) cookieValue=unescape(document.cookie.substring(posValue,endPos)); 
else cookieValue=unescape(document.cookie.substring(posValue)); 
} 
return cookieValue; 
} 













