/* KNet Solutions, Javascript Functions
 * ---------------
 * Copyright 2007-2011 KNet Solutions
 */
/* -------- Settings Vars -------- */
var speedBox = new Array(600,400,300); /* Time for opening/closing Box {Width,Height} */
var speedLayer = 300;  /* Time for opening/closing Layout */
var speedBreathe = 250; /* Time for the Breathe */
var pauseBreathe = 0; /* Pause between to breathe */
var speedOpacityLinks = 240;
var speedLoadingLabs = 300;
var speedShineLinks = 400;
var easeBreatheIn = 'easeInSine';
var easeBreatheOut = 'easeOutSine';
var easeOpacityLinks = 'easeOutCirc';
var easeShineLinks = 'easeOutCirc';
var easeOpenBox = 'easeOutCirc';
var easeCloseBox = 'easeOutCirc';
/* -------- End Vars -------- */
$.fx.step.textShadowBlur = function(fx) { $(fx.elem).css({textShadow: '0 0 ' + Math.floor(fx.now) + 'px #FFFDB7'}); }
function fullScreen(){ window.moveTo(0, 0); if(document.all){ top.window.resizeTo(screen.availWidth, screen.availHeight); }else if(document.layers || document.getElementById){ if(top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){top.window.outerHeight = screen.availHeight;top.window.outerWidth = screen.availWidth;}}}
function changeContentCaption(id){ $.post("inc/ajax_rpc.php",{ what: "getcaption",id: id, css3: BORDER_RADIUS_SUPPORTED },function(data){ $("#caption").html(data); }); }
function breathe(){
	$("#"+$("#breatheCircle").val()).animate({width: '+=6px', height: '+=6px', top: '-=3px', left: '-=3px'},{ duration: speedBreathe, easing: easeBreatheOut}).animate({width: '-=10px', height: '-=10px', top: '+=5px', left: '+=5px'},{ duration: Math.round(speedBreathe*2), easing: easeBreatheIn}).animate({width: '+=4px', height: '+=4px', top: '-=2px', left: '-=2px'},{ duration: speedBreathe, easing: easeBreatheOut});
	audioPlay();
	if($("#breatheCircle").val() != "" && $("#breatheCircle").val() != "none"){ setTimeout("breathe()",Math.round((speedBreathe*3) + pauseBreathe)); }else{ audioStop(); }
}
function setLang(lang){
	if(lang == "0"){ var hash = window.location.hash.split("/"); var setlang = hash[1]; }else{ var setlang = lang; }
	$.post("inc/ajax_rpc.php",{ what: "setlang", lang: setlang, css3: BORDER_RADIUS_SUPPORTED },function(data){ 
		$(".langchange").removeClass("active"); 
		$(".langchange[rel="+data+"]").addClass("active"); 
		$("html").attr("lang",data); 
		window.location.hash = "#/"+$("html").attr('lang')+"/"; 
		if(lang != "0"){ 
		$.post("inc/ajax_rpc.php",{ what: "gettrad", id: "contactus" }, function(data){ $("#contact").attr('title',data).qtip("destroy").qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '300px', tip: 'bottomMiddle', }, position:{ corner: { target: 'topMiddle', tooltip: 'bottomMiddle'}} }); });
		$.post("inc/ajax_rpc.php",{ what: "gettrad", id: "legales" }, function(data){ $("#legales").attr('title',data).qtip("destroy").qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '300px', tip: 'bottomMiddle', }, position:{ corner: { target: 'topMiddle', tooltip: 'bottomMiddle'}} }); });
		}
	});
	$(".details").each(function(){ if($(this).is(":visible")){ var windowSize = new Array($(window).width(),$(window).height()); var boxid = $(this).attr('contextmenu'); switch(boxid){ case "1": var what = "about"; break; case "2": var what = "portfolio"; break; case "3": var what = "labs"; break;} $.post("inc/ajax_rpc.php",{ what: what, lang: $("html").attr("lang"), height: windowSize[1], css3: BORDER_RADIUS_SUPPORTED },function(data){ closeBox(what+"Details"); $("#"+what+"Details").html(data); openBox(what+"Details",boxid); }); }});
	$.post("inc/ajax_rpc.php",{what: "changelang", init: lang},function(data){ $("#langs").html(data); $(".qtip").hide(); $(".langchange").qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '160px', tip: 'topRight', }, position:{ corner: { target: 'leftBottom', tooltip: 'topRight'}} }); if(lang == "0"){ $(".changelang").hide(); shineControl(); }});
}
function openBox(object,id){
	$("#"+object).removeAttr('style');
	var windowSize = new Array($(window).width(),$(window).height());
	var sizeBox = new Array($("#"+object).outerWidth(),$("#"+object).outerHeight());
	$("#layout").show().css({'z-index': 4 }).animate({ opacity: "0.2"},speedLayer);
	$.post("inc/ajax_rpc.php",{ what: 'gettitle', id: id, css3: BORDER_RADIUS_SUPPORTED },function(data){ $("#circleTitle").html(data).fadeIn(speedOpacityLinks); });
	$("#"+object).clearQueue().css({ display: "block",width: "0px", height: "20px",left: Math.round(windowSize[0] / 2) +"px",top: Math.round(((windowSize[1] - sizeBox[1])/2) - 50) +"px"})
	.animate({ width:'+='+sizeBox[0]+'px',left: '-='+ Math.round(sizeBox[0]/2)+'px'},{duration: speedBox[0], easing: easeOpenBox, complete: function(){ if(id != "3"){ openFlower(id);} }})
	.animate({height:'+='+sizeBox[1]+'px'},{duration: speedBox[1], easing: easeOpenBox, complete: function(){
		switch(id){
			case '1': $("#aboutContent > p").animate({ opacity: 1},{duration: speedBox[3], easing: easeOpacityLinks}); $("#boxLogo").fadeIn(speedBox[3]); break;
			case '2': $("#cycleNav").fadeIn(speedBox[3]); $("#slider").fadeIn(speedBox[3]); break;
			case '3': $("#labsContent").css({ height: sizeBox[1]+'px'}); $("#labsLoading").css({ margin: Math.round((sizeBox[1]/2) - 128)+'px auto' }); openFlower(id); $("#navLabs li").animate({ width: '30px'}, {duration: speedBox[3], easing: easeCloseBox}).qtip({ position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' } }, content:{ text: false }, style:{ 'font-weight': 'bold', textAlign: 'center', background: '#61A164', color: 'black', tip: 'leftMiddle', border: { width: 1, radius: 5, color: '#61A164'} } }); break;
		}
		shineControl();
	}});
}
function openTopBox(object){
	$("#otherDetails").removeAttr('style');
	var size = new Array($(window).width(),$(window).height());
	var sizeBox = new Array($("#otherDetails").outerWidth(),$("#otherDetails").outerHeight()); 
	var top = Math.round(((size[1] - sizeBox[1])/2) - 80);
	var left = Math.round((size[0] - sizeBox[0])/2);
	switch(object){ case "legales": var offset = 40; break; case "contact": var offset = 80; break; }
	$("#layout").show().css({'z-index': 11, 'backgroundColor': '#505050'}).animate({ opacity: '0.2'},speedLayer);
	$("#otherDetails").css({display: 'block',width: '0px', height: '0px', left: Math.round(size[0]/2)+'px', top: Math.round(size[1]/2)+'px', 'z-index': 12}).animate({width: Math.round(sizeBox[0])+'px', left: left +'px'},{duration: speedBox[0], easing: easeOpenBox, complete: function(){ $(this).animate({height: '+='+Math.round(sizeBox[1]+offset)+'px',top: top + 'px'},{duration: speedBox[0], easing: easeOpenBox, complete: function(){ $("#otherContent").animate({ opacity: 1},{duration: speedBox[3], easing: easeOpacityLinks}); $("#boxLogoLegales").fadeIn(speedBox[3]); shineControl(); }}); }});
}
function closeBox(object){
	var windowSize = new Array($(window).width(),$(window).height());
	switch(object){
		case "frameLab":
			$("#layout").css({'z-index': 4, 'background-color': '#000000'});
			$("#liveframe").fadeOut(speedBox[3]).attr('src','');
			$("#liveInfos").fadeOut(speedBox[3]).fadeOut({duration: speedBox[3], complete: function(){$(this).html('');
			$(".closeBox[rel=frameLab]").fadeOut(speedBox[3]);
			$("#frameLab").animate({width: '0px',height:'0px', left: '+='+Math.round(windowSize[0]/2)+'px', top: '+='+Math.round(windowSize[1]/2)+'px' },{duration: speedBox[0], easing: easeOpenBox, complete: function(){ $(this).css({display: 'none', 'z-index': 1}); }});
			}});
		break;
		
		case "otherDetails":
			$("#boxLogoLegales").fadeOut(speedBox[3]);
			$("#otherContent").fadeOut(speedBox[3]).html('');
			$(".closeBox[rel=otherDetails]").fadeOut({duration: speedBox[3], complete: function(){
				$("#otherDetails").animate({width: '0px',height:'0px', left: Math.round(windowSize[0]/2)+'px', top: Math.round(windowSize[1]/2)+'px' },{duration: speedBox[0], easing: easeOpenBox, complete: function(){
					$(this).css({display: 'none', 'z-index': 1}); 
					var trigger_visible = false; $(".box").each(function(){ if($(this).is(":visible")){ trigger_visible = true; }}); if(trigger_visible){ $("#layout").css({'z-index': 4, 'background-color': '#000000'}); }else{ $("#layout").css({'z-index': 1, 'background-color': '#000000'}); } 
				}});
			}});
		break;
		
		default:
			var sizeBox = new Array($("#"+object).outerWidth(),$("#"+object).outerHeight());
			var id = $("#"+object).attr('contextmenu');
			$("#layout").animate({ opacity: "0" },speedLayer,function(){ $(this).css('z-index','1'); });
			$("#circleTitle").fadeOut(speedOpacityLinks,function(){ $(this).html(""); });
			closeFlower(id);
			switch(id){
				case '1': $("#aboutContent > p").animate({ opacity: 0},{duration: speedBox[3], easing: easeOpacityLinks}); $("#boxLogo").fadeOut(speedBox[3]); break;
				case '2': $("#cycleNav").fadeOut(speedBox[3]); $("#slider").fadeOut(speedBox[3]); break;
				case '3': $("#labsContent").fadeOut(speedBox[3]); $("#navLabs").animate({ width: '0px'}, {duration: speedBox[3], easing: easeCloseBox, complete: function(){ $(this).html(""); }}); break;
			}
			$(".closeBox").fadeOut(speedBox[3]);
			$("#"+object).animate({opacity: 1},{duration: speedBox[2]}).animate({ height: '-='+ Math.round(sizeBox[1] - 20) +'px'}, {duration: speedBox[1], easing: easeCloseBox})
			.animate({ width: '-='+ sizeBox[0] +'px', left: '+='+ Math.round(sizeBox[0]/2)+'px'}, {duration: speedBox[0], easing: easeCloseBox, complete: function(){ $(this).html("").css({ display: "none", height: '0px', width: '0px', left: '0px', top: '0px'}); }});
			window.location.hash = "#/"+$("html").attr('lang')+"/";
			document.title = $("#home").html();
		break;
	}
}
function openFlower(id){
	switch(id){
		case "1":
			var top = $("#aboutDetails").css('top').replace('px','') - 44 + 79; var left = $("#aboutDetails").css('left').replace('px','') - 56 + 75; 
			var width = 160; var height = 155;
			$("#flower"+id).css({top: top+'px', left: left+'px'}).animate({ width: '+='+width+'px', height: '+='+height+'px', left: '-='+Math.round(width / 2)+'px', top: '-='+Math.round(height / 2)+'px'},{duration: speedBox[3], easing: easeOpenBox, complete: function(){ $(this).css({'z-index': 9}); }});
		break;
		case "2":
			var topbox = Math.round($("#portfolioDetails").css('top').replace('px','')); var leftbox = Math.round($("#portfolioDetails").css('left').replace('px',''));
			var top = Math.round(topbox - 50 + 100); var left = Math.round(leftbox + 808 - 99); var width = 200; var height = 198;
			$("#flower"+id).css({top: top+'px', left: left+'px'})
			.animate({ width: '+='+width+'px', height: '+='+height+'px', left: '+='+Math.round(width / 2)+'px', top: '-='+Math.round(height / 2)+'px' },{duration: speedBox[3], easing: easeOpenBox, complete: function(){ $(this).css({'z-index': 9}); }});
		break;
		case "3":
			var topbox = Math.round($("#labsDetails").css('top').replace('px','')); var leftbox = Math.round($("#labsDetails").css('left').replace('px','')); var heightbox = Math.round($("#labsDetails").css('height').replace('px',''));
			var top = Math.round(topbox + heightbox - 153); var left = Math.round(leftbox - 60 + 107); var width = 204; var height = 180;
			$("#flower"+id).css({top: top+'px', left: left+'px'}).animate({ width: '+='+width+'px', height: '+='+height+'px', left: '-='+Math.round(width / 2)+'px', top: '+='+Math.round(height / 2)+'px' },{duration: speedBox[3], easing: easeOpenBox, complete: function(){ $(this).css({'z-index': 9}); }});
		break;
	}
}
function closeFlower(id){
	switch(id){
		case "1":
			var top = $("#aboutDetails").css('top').replace('px','') - 44 + 80; var left = $("#aboutDetails").css('left').replace('px','') - 56 + 77; var width = 160; var height = 155;
			$("#flower"+id).css({'z-index': 6}).animate({ width: '-='+width+'px', height: '-='+height+'px', left: '+='+Math.round(width / 2)+'px', top: '+='+Math.round(height / 2)+'px' },{duration: speedBox[3], easing: easeCloseBox});
		break;
		case "2":
			var topbox = Math.round($("#portfolioDetails").css('top').replace('px',''));
			var leftbox = Math.round($("#portfolioDetails").css('left').replace('px',''));
			var top = Math.round(topbox - 50 - 100); var left = Math.round(leftbox + 808 + 99); var width = 200; var height = 198;
			$("#flower"+id).css({'z-index': 6}).animate({ width: '-='+width+'px', height: '-='+height+'px', left: '-='+Math.round(width / 2)+'px', top: '+='+Math.round(height / 2)+'px' },{duration: speedBox[3], easing: easeCloseBox});
		break;
		case "3":
			var topbox = Math.round($("#labsDetails").css('top').replace('px',''));
			var leftbox = Math.round($("#labsDetails").css('left').replace('px',''));
			var top = Math.round(topbox + 217 - 90); var left = Math.round(leftbox - 60 + 102); var width = 204; var height = 180;
			$("#flower"+id).css({'z-index': 6}).css({top: top+'px', left: left+'px'}).animate({ width: '-='+width+'px', height: '-='+height+'px', left: '+='+Math.round(width / 2)+'px', top: '-='+Math.round(height / 2)+'px' },{duration: speedBox[3], easing: easeOpenBox});
		break;
	}
}
function openLabProject(id){
	$("#labsProject").fadeOut({duration: speedOpacityLinks, easing: easeOpacityLinks, complete: function(){
		$("#labsLoading").fadeIn({duration: speedLoadingLabs, easing: easeOpacityLinks, complete: function(){
			$.post("inc/ajax_rpc.php",{
				what: 'labsproject',
				height: $("#labsRight").height(),
				id: id
			},function(data){
				$("#labsLoading").fadeOut({duration: Math.round(speedLoadingLabs / 2), easing: easeOpacityLinks, complete: function(){
					
					$("#labsProject").html(data).fadeIn({duration: speedOpacityLinks, easing: easeOpacityLinks, complete: function(){ shineControl(".shinectrl"); }});
				}});
			});
		}})
	}});
}
function shineControl(){
	var $ctrls = $('.shinectrl:hidden');
	$ctrls.hide();
	var steps = [];
	$ctrls.each(function(i, el) {
		steps[i] = function(callback) {
			$(el).css({opacity: 0, textShadowBlur:0}).show()
			.animate({opacity: 1, textShadowBlur:15},{ duration: speedShineLinks, easing: easeShineLinks,complete: function(){
				$(this).animate(
				{opacity: 0.6, textShadowBlur:0},
				{ duration: Math.round(speedShineLinks / 2), complete: callback,
				easing: easeShineLinks });
			}});
		};
	});
	(function animate() {
		(steps.shift() || function() {}) (function() { window.setTimeout(animate, 2); });
	})();
}
function openLiveTest(id){
	var size =  new Array($(window).width(),$(window).height());
	$("#layout").css({'z-index': 11, 'backgroundColor': '#808080'});
	$("#frameLab").css({display: 'block', left: Math.round(size[0]/2)+'px', top: Math.round(size[0]/2)+'px', 'z-index': 12})
	.animate({width:'+='+Math.round(size[0] - 60)+'px',left: '20px'},{duration: speedBox[0], easing: easeOpenBox, complete: function(){
		$(this).animate({height:'+='+Math.round(size[1] - 100)+'px',top: '20px'},{duration: speedBox[0], easing: easeOpenBox, complete: function(){
			$.post("inc/ajax_rpc.php",{
				what: 'getLiveInfos',
				id: id
			},function(data){
				var infos = data.split("#_#");
				$("#liveframe").attr('src',infos[0]).css({height: Math.round(size[1] - 170)+'px'}).fadeIn(speedBox[3]);
				$("#liveInfos").html(infos[1]).fadeIn(speedBox[3]);
				$("#liveBoxClose").show();
				shineControl();
			});
		}});
	}});
}
function init(){
	setLang("0");
	var size =  new Array($(window).width(),$(window).height());
	var about = new Array(Math.round(((size[0] / 2) - 200) + (Math.random() * 100)),Math.round(((size[1] / 2) - 200) + (Math.random() * 100)));
	var portfolio = new Array(Math.round(size[0] - (((size[0] / 2) - 220) + (Math.random() * 100))),Math.round(((size[1] / 2) - 100) + (Math.random() * 100)));
	var labs = new Array(Math.round(((size[0] / 2) - 300) + (Math.random() * 100)),Math.round(size[1] - (((size[1] / 2) - 230) + (Math.random() * 100))));
	$("#about").css({left: about[0]+'px', top: about[1]+'px'}).animate({ width: '+=200px', height: '+=200px', left: '-=100px', top: '-=100px'},{duration: 1000,easing: 'easeOutCirc'});
	$("#portfolio").css({left: portfolio[0]+'px', top: portfolio[1]+'px'}).delay(300).animate({ width: '+=240px', height: '+=240px', left: '-=120px', top: '-=120px'},{duration:1000,easing: 'easeOutCirc'});
	$("#labs").css({left: labs[0]+'px', top: labs[1]+'px'}).delay(500).animate({ width: '+=160px', height: '+=160px', left: '-=80px', top: '-=80px'},{duration:1000,easing: 'easeOutCirc', complete: function(){ $("#footer").animate({ height: '+=50px'},{duration: 1000, easing: 'easeOutBack', complete: function(){shineControl();}}); }});
}
$(window).resize(function(){
	var size =  new Array($(window).width(),$(window).height());
	var about = new Array(Math.round(((size[0] / 2) - 200) + (Math.random() * 100) - 100),Math.round(((size[1] / 2) - 200) + (Math.random() * 100) - 100));
	var portfolio = new Array(Math.round(size[0] - (((size[0] / 2) - 220) + (Math.random() * 100)) - 120),Math.round(((size[1] / 2) - 100) + (Math.random() * 100) - 120));
	var labs = new Array(Math.round(((size[0] / 2) - 300) + (Math.random() * 100) - 80),Math.round(size[1] - (((size[1] / 2) - 230) + (Math.random() * 100)) - 80));
	$("#about").css({left: about[0]+'px', top: about[1]+'px'});
	$("#portfolio").css({left: portfolio[0]+'px', top: portfolio[1]+'px'});
	$("#labs").css({left: labs[0]+'px', top: labs[1]+'px'});
});
$(document).ready(function(){
	init();
	$(document).bind('keypress keyup', function(e){
		var keyCode = e.keyCode || e.which;
		/* Check if Upper Z-index boxes are open then the Lower Z-index & close only one box at once */
		if(($("#layout").css('z-index') == 4 || $("#layout").css('z-index') == 11) && keyCode == 27){
			var counter = 0;
			$(".box").each(function(){ if($(this).is(":visible") && counter == 0 && $(this).css('z-index') == 12){ closeBox($(this).attr('id')); counter++; }});
			$(".box").each(function(){ if($(this).is(":visible") && counter == 0 && $(this).css('z-index') == 7){ closeBox($(this).attr('id')); counter++; }});
		}
	});
	$(".circle").live("mouseover mouseout click",function(event){
		switch(event.type)
		{
			case "mouseover":
				$.post("inc/ajax_rpc.php",{ what: "gettitle", id: $(this).attr('contextmenu'), css3: BORDER_RADIUS_SUPPORTED }, function(data){ if($("#circleTitle").is(":visible")){ $("#circleTitle").stop(true,true).html(data).fadeIn(70); }else{ $("#circleTitle").stop(true,true).html(data).fadeIn(70); } });
				$("#breatheCircle").val($(this).attr('id'));
				breathe();
			break;
			
			case "mouseout":
				$("#breatheCircle").val("none");
				if($("#circleTitle").is(":visible")){ $("#circleTitle").stop(true,true).fadeOut(70, function(){$(this).html('');}); }else{ $("#circleTitle").html(""); }
			break;
			
			case "click":
				switch($(this).attr('id'))
				{
					case "about":
						var hash = "About";
						var title = "About";
						$.post("inc/ajax_rpc.php",{
							what: "about",
							lang: $("html").attr("lang"), 
							css3: BORDER_RADIUS_SUPPORTED
						},function(data){
							$("#aboutDetails").html(data);
							openBox("aboutDetails","1");
						});
					break;
					case "portfolio":
						var hash = "Portfolio";
						var title = "Portfolio";
						var windowSize = new Array($(window).width(),$(window).height());
						$.post("inc/ajax_rpc.php",{
							what: "portfolio",
							lang: $("html").attr("lang"),
							height: windowSize[1], 
							css3: BORDER_RADIUS_SUPPORTED
						},function(data){
							$("#portfolioDetails").html(data);
							openBox("portfolioDetails","2");
						});
					break;
					case "labs":
						var hash = "Labs";
						var title = "Laboratory";
						var windowSize = new Array($(window).width(),$(window).height());
						$.post("inc/ajax_rpc.php",{
							what: "labs",
							lang: $("html").attr("lang"),
							height: windowSize[1],
							css3: BORDER_RADIUS_SUPPORTED
						},function(data){
							$("#labsDetails").html(data);
							openBox("labsDetails","3");
						});
					break;
				}
				$.post("inc/ajax_rpc.php",{ what: "gettitle", id: $(this).attr('contextmenu'), css3: BORDER_RADIUS_SUPPORTED }, function(data){ document.title = $("#home").html()+" - "+data; $("#circleTitle").stop(true,true).html(data).show(); });
				window.location.hash = "#/"+$("html").attr('lang')+"/"+hash+"/";
			break;
		}
	});
	$(".shinectrl").live("mouseover mouseout",function(event){ switch(event.type){ case "mouseover": $(this).animate({ opacity: "1"}, {duration: speedOpacityLinks, easing: easeOpacityLinks }); break; case "mouseout": $(this).animate({ opacity: "0.6"}, {duration: speedOpacityLinks, easing: easeOpacityLinks }); break; } });
	$("#cycleNav > li a").live("mouseover mouseout",function(event){ switch(event.type){ case "mouseover": $(this).animate({ opacity: "1" }, {duration: speedOpacityLinks, easing: easeOpacityLinks }); break; case "mouseout": if(!$(this).parent().hasClass("activeSlide")){ $(this).animate({ opacity: "1" }, {duration: speedOpacityLinks, easing: easeOpacityLinks }); } break; } });
	$(".navLab").live("mouseover mouseout click",function(event){ switch(event.type){ case "mouseover": $(this).animate({width: '+=5px'}, {duration: speedOpacityLinks, easing: easeOpacityLinks }); break; case "mouseout": $(this).animate({ width: '-=5px' }, {duration: speedOpacityLinks, easing: easeOpacityLinks }); break; case "click": openLabProject($(this).attr('rel')); break; } });
	$(".closeBox").live("click",function(){ closeBox($(this).attr('rel')); });
	$(".showDetails").live("click",function(){ if($("#labDesc").is(":visible")){ $("#labDesc").fadeOut('fast'); }else{ $("#labDesc").fadeIn('fast'); }});
	$(".showLive").live("click",function(){ openLiveTest($(this).attr('rel')); });
	$(".langchange").live("click",function(){ if(!$(this).hasClass("active")){ setLang($(this).attr('rel'));}}).qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '300px', tip: 'topRight', }, position:{ corner: { target: 'leftBottom', tooltip: 'topRight'}} });
	$("#contact").live("click",function(){ $.post("inc/ajax_rpc.php",{ what: "contact" },function(data){ $("#otherDetails").html(data);openTopBox("contact"); })}).qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '300px', tip: 'bottomMiddle', }, position:{ corner: { target: 'topMiddle', tooltip: 'bottomMiddle'}} });
	$("#legales").live("click",function(){ $.post("inc/ajax_rpc.php",{ what: "legales" },function(data){ $("#otherDetails").html(data);openTopBox("legales"); })}).qtip({ style: { name: 'dark', background: '#202020', border: { width: 2, radius: 5 }, width: '300px', tip: 'bottomMiddle', }, position:{ corner: { target: 'topMiddle', tooltip: 'bottomMiddle'}} });
});

