



function cargar(){
	alert("hola");
	$('#Menu li').hover(function(){

		if(this.className=="sbm" || this.className=="sbm Act3"){
			$(this).addClass("Act");
			$(this).children(".subMenu").show();
		}
	},function(){
		$(this).removeClass("Act");
		$(this).children(".subMenu").hide()
	});

}

/** Header Functions for Search **/
function limpiar(elem,str) {
	if(elem.value==str)
	elem.value="";
}

function reset(elem,str) {
	if(elem.value=='')
	elem.value=str;
}
/** End Header Functions for Search **/


/** Tabs News & TopNews **/
var opts = Array();
opts[0] = Array();
opts[0][0] = "Box_News"; //id element
opts[0][1] = "News";	 //label element
opts[0][2] = "xml_news.php";
opts[1] = Array();
opts[1][0] = "Box_Top_Stories"; //id element
opts[1][1] = "Top Stories";	 	//label element
opts[1][2] = "news.php";
var box_selected_tab = 0;

function changeTab(tab,sec) {
	/** change styles page **/
	solapas(tab,2)
	box_selected_tab = tab; //set selected tab
	/** end change styles page **/

	if(tab==1) $("#curvita").show();
	else $("#hide").show();

	/** loading **/
	$("#Box_Cont_News").html('<div class="Final">Loading Data ...</div>');

	var elem = (sec==0)?'li':'div';
	//indica si es la home
	var h = (sec==0)?'true':'false';
	/** get all news **/
	$.ajax({
		dataType: "json",
		type: "POST",
		url: "ajax_box_news.php?h="+h,
		data: "type="+tab,
		success: function(data){
			var str = '';
			if(data.countRegs>0){
				for(i=0;i<parseInt(data.countRegs);i++){
					var d = data.data[i];
					str+="<"+elem+" class='"+((i==(data.countRegs-1))?'Final':((i==0 && tab==0 && elem!='div')?'Dest':''))+"'><p>"+d.Fecha+"</p><a href='/"+opts[tab][2]+"?n="+d.NoticiaId+((d.Categoria)?'&c='+d.Categoria:'')+"'>"+d.Titulo+"</a>"+((i==0 && tab==0 && elem!='div')?'<span class="Bajada">'+d.Desarrollo+'...</span>':'')+"</"+elem+">";
				}
			}else str='<div class="Final">No articles.</div>';
			$("#Box_Cont_News").html(str); //set data
		}
	});
	/** end get all news **/
}
/** End Tabs News & TopNews **/


/** activate tab **/
function solapas(activa,cant){
	var sol = cant /*Este numero tiene que ser la cantidad de solapas */

	for(i=1;i<=sol;i++){
		document.getElementById('tab_'+i).className = "";
		document.getElementById('c'+i).className = "OffL-OffR";
	}

	document.getElementById('tab_'+(activa+1)).className = "Act";

	if((activa+1) != 1){
		document.getElementById('c'+activa).className = "OffL-OnR";
		document.getElementById('c'+(activa+1)).className = "OnL-OffR";
		document.getElementById('c1p').className = "OffL";
		$("#cvtl").show();
	}else{
		$("#cvtl").hide();
		document.getElementById('c1p').className = "OnL";
		document.getElementById('c'+(activa+1)).className = "OnL-OffR";
	}

	if((activa+1) == sol) document.getElementById('c'+(activa+1)).className = "OnR";
	else document.getElementById('c'+sol).className = "OffR";
}
/** activate tab **/

/** bookmark **/
function bookmarksite(){
	var title="FatCat.com.au";
	var url = location.href;
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}
/** end bookmark **/



/** validate forms **/
function esString(strValue) {
  return (typeof strValue == 'string' && strValue != '' && isNaN(strValue));
}

function esEmail(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)) return (true)
  else return (false);
}

function esStringBlanco(str){
	var espacios = true;
	var cont = 0;
	while (espacios && (cont < str.length)) {
	  if (str.charAt(cont) != " ")   espacios = false;
	  cont++;
	}
	return espacios;
}

function esInt (str) {
	var i = parseInt (str);
	if (isNaN (i))
		return false;
	i = i . toString ();
	if (i != str)
		return false;
	return true;
}
/** end validate forms **/



var preload;
function cargarImg() {
	/*$.ajax({
		dataType: "json",
		type: "GET",
		url: "include/preload_images.php",
		data:"path=../img",
		success: function(data){
			preload = data;
			MM_preloadImages();
		}
	});*/
	//preload = Array("img/Hd/im_CarLoans.gif","img/Hd/im_CarLoans_h.gif");
}

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=preload; 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];}}
}
/** end preload image **/



var validator;
function search(){
	$("#accion").val("busqueda_rapida");
	$("#pattern").val($("#criterio").val());
	$("#p").val(1);
	document.f1.action="articles_search.php";
	document.f1.submit();
}

function search_date(date){
	$("#accion").val("archivo");
	$("#date_search").val(date);
	$("#p").val(1);
	document.f1.action="articles_search.php";
	document.f1.submit();
}

function go_page(p){
	$("#p").val(p);
	document.f1.submit();
}


$(document).ready(function() {
	if (document.f1.audios_list){
		if (document.f1.audios_list.length){
		  		for (i=0; i<document.f1.audios_list.length; i++){
			  		niftyplayer("audio_"+document.f1.audios_list[i].value).registerEvent('onBufferingStarted', 'audio_log("start",'+document.f1.audios_list[i].value+')');
		  			niftyplayer("audio_"+document.f1.audios_list[i].value).registerEvent('onPlay', 'audio_log("play",'+document.f1.audios_list[i].value+')');
		  			niftyplayer("audio_"+document.f1.audios_list[i].value).registerEvent('onPause', 'audio_log("pause",'+document.f1.audios_list[i].value+')');
		  			niftyplayer("audio_"+document.f1.audios_list[i].value).registerEvent('onStop', 'audio_log("stop",'+document.f1.audios_list[i].value+')');
		  			niftyplayer("audio_"+document.f1.audios_list[i].value).registerEvent('onSongOver', 'audio_log("finish",'+document.f1.audios_list[i].value+')');

				}
		}
		else{
				niftyplayer("audio_"+document.f1.audios_list.value).registerEvent('onBufferingStarted', 'audio_log("start",'+document.f1.audios_list.value+')');
	  			niftyplayer("audio_"+document.f1.audios_list.value).registerEvent('onPlay', 'audio_log("play",'+document.f1.audios_list.value+')');
	  			niftyplayer("audio_"+document.f1.audios_list.value).registerEvent('onPause', 'audio_log("pause",'+document.f1.audios_list.value+')');
	  			niftyplayer("audio_"+document.f1.audios_list.value).registerEvent('onStop', 'audio_log("stop",'+document.f1.audios_list.value+')');
	  			niftyplayer("audio_"+document.f1.audios_list.value).registerEvent('onSongOver', 'audio_log("finish",'+document.f1.audios_list.value+')');


		}
	}
});


function audio_log(event, playId){
	$.ajax({
		url: "ajax_operation.php?class=ModGallery&method=audio_log&NoticiaGaleriaId="+playId+"&Evento="+event,
		success: function(data){
		}
	});
}

function video_log(event, playId){
	$.ajax({
		url: "ajax_operation.php?class=ModGallery&method=video_log&NoticiaGaleriaId="+playId+"&Evento="+event,
		success: function(data){
		}
	});
}




/*
$(document).ready( function() {
   peps.rollover.init();
});
peps = {};
peps.rollover = {
   init: function() {
      this.preload();
      $(".roll").hover(
         function () { $(this).attr( 'src', peps.rollover.newimage($(this).attr('src')) ); },
         function () { $(this).attr( 'src', peps.rollover.oldimage($(this).attr('src')) ); }
      );
   },
preload: function(){
      $(window).bind('load', function() {
         $('.roll').each( function( key, elm ) { $('<img>').attr( 'src', peps.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   newimage: function( src ) {
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_hover' + src.match(/(\.[a-z]+)$/)[0];
   },
   oldimage: function( src ){
      return src.replace(/_hover\./, '.');
   }
};

*/

