/*
 * 	Easy Slider - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */

var bodyWidth;
var bodyHeight;
var documentReady = false;
var flashMode = true;
$(document).ready(function(){
	bodyWidth=$("body").width();bodyHeight=$("body").height();
	$("#contenedor").css({"width":bodyWidth,"height":bodyHeight});
	$("#demo").css({"top":"0px","left":"0px"});
	$("#contenedorHTML").css({"top":"0px","left":bodyWidth});
	$("#reversa").css({'cursor':'pointer'});
	$("#reversa").click(function(){manageItems()});
	manageLayout();
	documentReady = true;
});
function animarDiv(){if(documentReady) manageItems()};
$(window).resize(function(){manageLayout()});
function manageLayout(){
	bodyWidth=$("body").width();
	bodyHeight=$("body").height();
	$("#contenedor").css({"width":bodyWidth,"height":bodyHeight});
	if(flashMode){
		$("#demo").css({"width":bodyWidth,"height":bodyHeight,"top":"0px","left":"0px"});
		$("#contenedorHTML").css({"width":bodyWidth,"height":bodyHeight,"top":"0px","left":bodyWidth});
	}
	else{
		$("#demo").css({"width":bodyWidth,"height":bodyHeight,"top":"0px","left":-bodyWidth});
		$("#contenedorHTML").css({"width":bodyWidth,"height":bodyHeight,"top":"0px","left":0});
	}
};
function manageItems(){
	if(flashMode){
		$("#demo").animate({left:-bodyWidth},laVelocidad);
		$("#contenedorHTML").animate({left:0},laVelocidad);
		flashMode = false;
	}
	else{
		$("#demo").animate({left:0},laVelocidad);
		$("#contenedorHTML").animate({left:bodyWidth},laVelocidad);
		flashMode = true;
	}
}
