// JavaScript Document

/******************* Index.php *********************/

var $jq = jQuery.noConflict();

$jq(document).ready(function(){	
	$jq("#slider").easySlider({
		auto: true, 
		continuous: true,
		numeric: true,
		speed: 150,
		pause: 2000 
	});
});

jQuery(document).ready(function($jq) {
  $jq('a[rel*=facebox]').facebox(); 
});


/*
var myMenu = new MenuMatic();

jQuery(function(){
	jQuery('ul.sf-menu').superfish();
});

jQuery(window).bind("load", function() {
	jQuery("div#slider1").codaSlider();
});

function formatText(index, panel) {
  return index + "";
}

$jq(function () {

	$jq('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 2000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime: 600,             // How long the slide transition takes
		hashTags: true,                 // Should links change the hashtag in the URL?
		buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "",             // Start text
		stopText: "",               // Stop text
		navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
	});
	
	$jq("#slide-jump").click(function(){
		$jq('.anythingSlider').anythingSlider(6);
	});
	
});*/

/* Menu*/

	

/*Menu Principal
$jq(document).ready(function(){

	$jq("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$jq("ul.topnav li span").click(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$jq(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$jq(this).parent().hover(function() {
		}, function(){
			$jq(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$jq(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$jq(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});*/

 

window.addEvent('domready', function(){
									 
//smooooooth scrolling enabled 
  //new SmoothScroll({ options }, window); 

new SmoothScroll({ duration:700 }, window); //700 milliseconds to get there 
									 
		
});

/************************************************/

/************* Generic Functions ***************/

function findPosX(obj)
{
  var curleft = 0;
  if(obj.offsetParent)
      while(1) 
      {
        curleft += obj.offsetLeft;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.x)
      curleft += obj.x;
  return curleft;
}

function findPosY(obj)
{
  var curtop = 0;
  if(obj.offsetParent)
      while(1)
      {
        curtop += obj.offsetTop;
        if(!obj.offsetParent)
          break;
        obj = obj.offsetParent;
      }
  else if(obj.y)
      curtop += obj.y;
  return curtop;
}

function effect_ajax_simple(divtoupdate,how,vars,dir,op) {
	$('main_container').set('opacity',0);
	var fx = new Fx.Morph('main_container', {duration: 2000});
	var req = new Request.HTML({
		method: how,
		url: dir,
		data: vars,
		update: $(divtoupdate),
		onRequest: function(response) { $(divtoupdate).innerHTML = ""; $('loader_div').innerHTML = "<img class='prepend-1' src='images/loader.gif' />"; },
		onComplete: function(response) {
			
		if(op == 1) {
		} else if(op == 2) {
			
			
			
		}
		
		$('loader_div').innerHTML = ""; 
		fx.start({
			'opacity':[0,1]
		});
		
		},
		evalScripts: true 
		
	}).send();
	
}

/*$('button_1').addEvent('click', function(event) {
	$('main_container').set('opacity',0);
	var fx = new Fx.Morph('main_container', {duration: 2000});
	event.stop();
	var req = new Request({
		method: 'get',
		url: 'web/historia',
		data: '',
		onRequest: function(response) { $('loader_div').innerHTML = "<center><br><br><br><br><br><br><br><br><br><img src='images/loader.gif' /><br><br><br><br><br><br><br><br><br></center>"; },
		onComplete: function(response) {
		
		$('loader_div').innerHTML = "";
		fx.start({
			'opacity':[0,1]
		});

		},
		onSuccess: function(texto){
		$('main_container').innerHTML = texto;},
		evalScripts: true 
	}).send();
});*/

/***********************************************/


		

