//** tips **
(function($){$.fn.__tip=function(opciones){var cont='';opc=$.extend($.fn.__tip.opc_default,opciones);$(this).live('mouseover',function(e){$("#__flot").remove();$('<div>',{"id":"__flot","class":opc['clase']}).css({position:'absolute',display:'none'}).appendTo('body');if(opc['tipo']=='img'){cont=$(this).attr(opc['fuente']);$('<img>',{"src":fuente}).appendTo('#__flot')}else if(opc['tipo']=='txt'){cont=$(this).attr(opc['fuente']);$('#__flot').html(cont);$(this).attr(opc['fuente'],'')}else if(opc['tipo']=='cont'){cont=$(opc['fuente']).html();$('#__flot').html(cont)}else if(opc['tipo']=='cont_1'){var id=$j(this).attr('id').substring(4,$j(this).attr('id').length);cont=$(opc['fuente']+id).html();$('#__flot').html(cont)}if(opc['debug']==1){cont='Tipo : '+opc['tipo']+'<br>clase :'+opc['clase']+'<br>Fuente : '+opc['fuente']+'<br>Obtenido :'+cont;$('#__flot').html(cont)}ubi(e);if(cont!=''||cont!=undefined)$("#__flot").show()});$(this).live('mousemove',function(e){if(opc['seguir']==1)ubi(e)});$(this).live('mouseout',function(){if(opc['tipo']=='txt'){$(this).attr(opc['fuente'],cont)}$("#__flot").hide()});function ubi(e){var alto=$(window).height();var ancho=$(window).width();var top_obj=e.pageY;var left_obj=e.pageX;var alto_layer=$('#__flot').outerHeight(true);var ancho_layer=$('#__flot').outerWidth(true);var margin_left=ancho_layer/2;var margin_top=20;var b=top_obj+alto_layer+margin_top;var c=alto+$(window).scrollTop();if(b>=c){top_obj=top_obj-alto_layer-(margin_top*2)}if(left_obj-margin_left<=0){left_obj=1;margin_left=0}else if(left_obj+margin_left>=ancho){left_obj=ancho-margin_left}$('#__flot').css({top:top_obj+margin_top,left:left_obj-margin_left});return false}};$.fn.__tip.opc_default={tipo:"txt",fuente:"tip",clase:"tooltip_1",seguir:1,debug:0}})(jQuery||$j);

/**
 * @author Alexander Farkas
 * v. 1.22
 */
//**** bg moving
(function($) {
	if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
		var oldCurCSS = $.curCSS;
		$.curCSS = function(elem, name, force){
			if(name === 'background-position'){
				name = 'backgroundPosition';
			}
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
	
	var oldAnim = $.fn.animate;
	$.fn.animate = function(prop){
		if('background-position' in prop){
			prop.backgroundPosition = prop['background-position'];
			delete prop['background-position'];
		}
		if('backgroundPosition' in prop){
			prop.backgroundPosition = '('+ prop.backgroundPosition;
		}
		return oldAnim.apply(this, arguments);
	};
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			var start = $.curCSS(fx.elem,'backgroundPosition');
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			fx.start = [start[0],start[2]];
			var end = toArray(fx.end);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		//return;
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);

//**** slider index js
(function($) {var params=new Array;
	var images=new Array;
	var interval=new Array;
	var imagePos=new Array;
	var appInterval=new Array;	
	var squarePos=new Array;	
	$.fn.coinslider=$.fn.CoinSlider=function(options){init=function(el){
			images[el.id]=new Array();
			imagePos[el.id]=0;
			squarePos[el.id]=0;
			params[el.id]=$.extend({},$.fn.coinslider.defaults,options);
			$.each($('#'+el.id+' img'),function(i,item){images[el.id][i]=$(item).attr('src');
			});
			$(el).css({background:'url('+images[el.id][0]+')',width:617,height:445,position:'relative',backgroundPosition:'top left'}).wrap("<div class='coin-slider' id='coin-slider-"+el.id+"' />");
			$('#'+el.id).append("<div class='cs-"+el.id+"' id='cs-"+el.id+"' style='width:100%;height:100%;left:0;top:0;position:absolute;background-position:0 0;'></div>");
			$('.cs-'+el.id).hover(function(){$('#cs-navigation-'+el.id).show();params[el.id].pause=true},function(){$('#cs-navigation-'+el.id).hide();params[el.id].pause=false});
			$('#coin-slider-'+el.id).append("<div id='cs-buttons-"+el.id+"' class='cs-buttons'></div>")
			for(k=1;k<images[el.id].length+1;k++){
				$('#cs-buttons-'+el.id).append("<a class='cs-button-"+el.id+"' id='cs-button-"+el.id+"-"+k+"'></a>")
			}
			$.each($('.cs-button-'+el.id),function(i,item){$(item).click(
				function(e){
					if($(this).hasClass('cs-active')){return false}
					else{
						$('.cs-button-'+el.id).removeClass('cs-active');
						$(this).addClass('cs-active');
						$.transition(el,i);
						$.transitionCall(el)
					}
				})
			})
			$.transitionCall(el)
			$('.cs-button-'+el.id).eq(0).addClass('cs-active');
			$('.banner').css({opacity:0}).eq(0).css({opacity:1}).find('>strong').eq(1).animate({left:0},300,'easeOutExpo',function(){$(this).prev().animate({top:72},600,'easeOutExpo').next().next().delay(150).animate({bottom:222},600,'easeOutExpo')});
		}
		$.transitionCall=function(el){
			clearInterval(interval[el.id]);	
			delay=params[el.id].delay;interval[el.id]=setInterval(function(){$.transition(el)},delay);
		}
		$.transition=function(el,direction){if(params[el.id].pause==true)return;
			squarePos[el.id]=0;
			$(el).css({'background-image':'url('+images[el.id][imagePos[el.id]]+')'});
			if(typeof(direction)=="undefined") imagePos[el.id]++;
			else if(direction=='prev') imagePos[el.id]--;
			else imagePos[el.id]=direction;
			if(imagePos[el.id]==images[el.id].length){imagePos[el.id]=0}
			if(imagePos[el.id]==-1){imagePos[el.id]=images[el.id].length-1}
			$('.cs-button-'+el.id).removeClass('cs-active');
			$('#cs-button-'+el.id+"-"+(imagePos[el.id]+1)).addClass('cs-active');
			$('.banner').each(function(){$(this).animate({opacity:0},600,function(){
				$(this).find('>strong').eq(0).css({top:-84}).next().css({left:-460}).next().css({bottom:-31})
				appInterval[el.id]=setInterval(function(){$.appereance(el,0)})})
			})
		};
		$.appereance=function(el,sid){
			if(squarePos[el.id]==1){clearInterval(appInterval[el.id]);return}
			$('#cs-'+el.id).css({opacity:0,'background-image':'url('+images[el.id][imagePos[el.id]]+')'}).stop().animate({opacity:1},1000,function(){$('.banner').eq(imagePos[el.id]).css({opacity:1}).find('>strong').eq(1).animate({left:0},300,'easeOutExpo',function(){$(this).prev().animate({top:72},600,'easeOutExpo').next().next().delay(160).animate({bottom:222},600,'easeOutExpo')})});
			squarePos[el.id]++;
		}
		this.each (
			function(){init(this);}
		);
	};
	$.fn.coinslider.defaults={
		delay:8000,// delay between images in ms
		sDelay:0
	};	
})(jQuery);
$(function(){$('#coin-slider').coinslider()})




$(document).ready(function(){
   $(".tips").__tip({tipo:"txt",fuente:"title",clase:"tooltip_2 sombra round",seguir:1,debug:0});
   $('.sf-menu a').mouseover(function(){
    $(this).animate({'backgroundPosition':'0px 0px'});
    $(this).css({'color':'#fff','text-shadow':'0 0 1px #fff'});
   });
   $('.sf-menu a').mouseout(function(){
    $(this).animate({'backgroundPosition':'0px -94px'});
    $(this).css({'color':'#969696','text-shadow':'0 0 1px #969696'});
   });
   $('.pic-head .links li a').append('<span></span>').hover(function(){$(this).stop().animate({backgroundPosition:'0 0',color:'#fff'},{duration:200,queue:false}).find('>span').animate({backgroundColor:'#8d6f1d',marginLeft:0,width:0},{duration:100,queue:false,complete:function(){$(this).animate({backgroundColor:'#242323',marginLeft:-12,width:23},100)}})},function(){$(this).stop().animate({backgroundPosition:'0 -156px',color:'#b9aa81'},{duration:200,queue:false}).find('>span').animate({backgroundColor:'#8d6f1d',marginLeft:0,width:0},{duration:100,queue:false,complete:function(){$(this).animate({backgroundColor:'#f5ba16',marginLeft:-12,width:23},100)}})})
   $('.list-1 li').prepend('<span></span>').find('>a').wrap('<div></div>').hover(function(){$(this).parent().prev().animate({height:0,marginTop:10,backgroundColor:'#858585'},100,function(){$(this).animate({height:19,marginTop:0,backgroundColor:'#000'},100)})},function(){$(this).parent().prev().stop().animate({height:0,marginTop:10,backgroundColor:'#858585'},100,function(){$(this).animate({height:19,marginTop:0,backgroundColor:'#fff'},100)})})
   //*** formulario contacto *****************
   $('.enviar_form').live('click',function(){
        var frm = $('.cap_form');
		$('<div>',{'class':'foot_loading','text':'enviando...'}).appendTo('#resp');
		$(this).attr('disabled','disabled');
		$.ajax({
			type: 'POST',
			cache:false,
			url: $(frm).attr('action'),
			data: $(frm).serialize(),
			success: function(data) {
				$('#resp').html(data);
			}
		})
		return false;
   });
   
   //**** live chat ************
   $('.live').click(function(){
    crea_chat();
   });
   
   
   
   
   $('#enviar').live('click',function() {
		var frm = $('.cap_form');
		$('<div>',{'class':'foot_loading','text':'enviando...'}).appendTo('.pop_foot');
		$(this).attr('disabled','disabled');
		$.ajax({
			type: 'POST',
			cache:false,
			url: $(frm).attr('action'),
			data: $(frm).serialize(),
			success: function(data) {
				$('.pop_foot').html('');
				$('.cap_form').html('<h2>'+data+'</h2>');
			}
		})
		return false;
	});
   
   //****close pop **//
   $('#close_pop').live('click',function(){
        $('#pop').remove();
        $('#pop_bloker').remove();
   });
   
   
   
   //**** Limpia NPS *****
   $('.inp').live('click',function(){
        if(!$(this).attr('def')){
            $(this).attr('def',$(this).val());
        }
        $(this).val('');
        $(this).css({'color':'#444'});
   });
   $('.inp').live('blur',function(){
        if($(this).attr('def') && $(this).val() == ''){
            $(this).val($(this).attr('def'));
            $(this).css({'color':'#ccc'});   
        }
   });
    
});

function block_form(){
    
    $('.inp').css({'opacity':'0.5'});
    $('.bt_goo').hide();
}
function  block_web(){
    $("<div>",  {"id": "pop_bloker"}).css({'position':'absolute','background':'#000000','top':0,'left':0,'z-index':'1000'}).appendTo("body");
	var maskHeight = $(document).height();
	var maskWidth  = $(window).width();
	$('#pop_bloker').css({'width':maskWidth,'height':maskHeight});
	$('#pop_bloker').fadeTo("slow",0.6);
}
function crea_chat(){
     block_web();
    $('#pop').remove();
	$('<div>',{"id":"pop","class":"round"}).css({'position':'fixed'}).appendTo('body');
	$('<div>',{"class":"pop_in"}).appendTo('#pop');
	$('<div>',{"class":"pop_tit","text":"Networking live Chat"}).appendTo('.pop_in');
    $('<a>',{"id":"close_pop","text":"X"}).appendTo('.pop_tit');
    
    ancho = 500;
    alto = 400;
	ancho_web = $(window).width();
	pos_l = ancho_web / 2 - ancho / 2;
	pos_top     = ($(window).height() / 2)- 300;
    
    $('<iframe>',{'src':'http://inmoxxi.no-ip.org/Inmoxxi/App_Pages/OnlineDesk.aspx','frameborder':'0'}).css({'width':ancho-10,'height':alto-30}).appendTo('.pop_in');
    
	$('#pop').css({top:pos_top,'left': pos_l,'width':ancho,'height':alto});
	$('#pop').fadeIn();
}
