function initMenu() {
	$('#network_sbmenu ul').hide();
	$('#network_sbmenu li a').click(
		function() {
			$(this).next().slideToggle('normal');	
		}
);}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function ShowHide_AuthorBio(){
	$("#author_bio").animate({"height": "toggle"}, { duration: 500 });
}
function ShowHide_AuthorAdd(){
	$("#author_add").animate({"height": "toggle"}, { duration: 500 });
}
function ShowHide_Tags(){
	$("#tags_posts").animate({"height": "toggle"}, { duration: 500 });
}
function ShowHide_Share(){
	$("#share_post").animate({"height": "toggle"}, { duration: 500 });
}
function ShowHide_CommentRules(){
	$("#comment_rules").animate({"height": "toggle"}, { duration: 500 });
}
function ShowHide_GravatarHowTo(){
	$("#gravatar_howto").animate({"height": "toggle"}, { duration: 500 });
}
$(document).ready(function(){
	$("#shadow").css("height", $(document).height()).hide();
	$(".lightSwitcher").click(function(){
		$("#shadow").toggle();
		if ($("#shadow").is(":hidden"))
			$(this).html("Apagar as luzes").removeClass("turnedOff");
		 else
			$(this).html("Acender as luzes").addClass("turnedOff");
	});
	$(document).shortkeys({
		'1':          function () { location.hash="#shortcut_0"; },
		'2':          function () { location.hash="#shortcut_1"; },
		'3':          function () { location.hash="#shortcut_2"; },
		'4':          function () { location.hash="#shortcut_3"; },
		'5':          function () { location.hash="#shortcut_4"; },
		'6':          function () { location.hash="#shortcut_5"; },
		'7':          function () { location.hash="#shortcut_6"; },
		'8':          function () { location.hash="#shortcut_7"; },
		'9':          function () { location.hash="#shortcut_8"; },
		'0':          function () { location.hash="#shortcut_9"; }
/*		'l':          function () { location.hash="#login"; },
		'c':          function () { location.hash="#comments"; },
		'c':          function () { location.hash="#respond"; }*/
	});
	initMenu();
	$("#simpleTabs").simpleTabs({
		fadeSpeed: "fast", // @param : low, medium, fast
		defautContent: 1, // @param : number ( simpleTabs-nav-number)
		autoNav: "false", // @param : true or false
		closeTabs : "false" // @param : true or false;
	});
	$("#panelTabs").simpleTabs({
		fadeSpeed: "fast", // @param : low, medium, fast
		defautContent: 1, // @param : number ( simpleTabs-nav-number)
		autoNav: "false", // @param : true or false
		closeTabs : "false" // @param : true or false;
	});
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	});	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'70px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'116px'},{queue:false,duration:160});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'112px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160});
	});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid_destaque.caption').hover(function(){
		$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'120px'},{queue:false,duration:160});
	});		
	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});
	//Horizontal Sliding
	$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
	});
	//Partial Sliding (Only show some of background)
	$('.boxgrid.peek').hover(function(){
		$(".cover", this).stop().animate({top:'40px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	});			
});
		
/**
 * simpleTabs ( http://supercanard.phpnet.org/jquery-test/simpleTabs/ )
 * plugin jQuery pour afficher des bôites d'onglet.
 * 
 * Version 1.0
 *
 * Auteur : Jonathan Coulet ( j.coulet@gmail.com )
 * 
 **/
(function($){
	$.fn.simpleTabs = function(option){
		// Param plugin
		var param = jQuery.extend({
			fadeSpeed: "medium", // @param : low, medium, fast
			defautContent: 1, // @param : number ( simpleTabs-nav-number)
			autoNav: "false", // @param : true or false
			closeTabs : "true" // @param : true or false;
		}, option);
		$(this).each(function() {
			// Initialisation
			var $this = this;
			var $thisId = "#"+this.id;
			var nbTab = $($thisId+" > div").size();
			autoNav();
			showCloseTabs();
			hideAll();
			changeContent(param.defautContent);
			// Fonctions
			function hideAll(){
				// Masque tous les content
				$($thisId+" .simpleTabs-content").hide();
			}
			function changeContent(indice){
				// Masque tous les content - Supprime la classe actif de tous les onglets 
				// Ajoute la classe actif à l'onglet cliqué - Affiche le content ciblé - Execute showCloseTabs
				hideAll();
				$($thisId+" .simpleTabs-nav li").removeClass("actif");
				$($thisId+" #simpleTabs-nav-"+indice).addClass("actif");
				$($thisId+" #simpleTabs-content-"+indice).fadeIn(param.fadeSpeed);
				showCloseTabs();
			}
			function autoNav(){
				// Génère les onglets automatiquement
				if(param.autoNav == "true"){
					var listeNav = '';
					for(i=1; i!=nbTab; i++){
						listeNav = listeNav+'<li id="simpleTabs-nav-'+i+'">'+i+'</li>';
					}
					$($thisId+" .simpleTabs-nav").append('<ul>'+listeNav+'</ul>');
				}
			}
			function showCloseTabs(){
				// Génére un bouton de fermeture générale des content
				if(param.closeTabs == "true"){
					if($($thisId+" .simpleTabs-nav li.close").size() == 0){
						$($thisId+" .simpleTabs-nav ul").append("<li title=\"Fermer tous les onglets\" class=\"close\">x</li>");
					}
				}
			}
			// Exec
			$($thisId+" .simpleTabs-nav li").click(function(){
				var numContent = this.id.substr(this.id.length-1,this.id.length);
				changeContent(numContent);
			});
			// test function closeTabs
			$($thisId+" .simpleTabs-nav li.close").click(function(){
				hideAll();
				$($thisId+" .simpleTabs-nav li").removeClass("actif");
				$($thisId+" .simpleTabs-nav li.close").remove();
				//alert($($thisId+" .simpleTabs-nav li.close").size());
			});
		});
	}
})(jQuery);

/**
 * Shortkeys 
 **/

jQuery.fn.shortkeys = jQuery.fn.keys = function (obj, settings) {		
	var el = this;
	this.settings = jQuery.extend({
			split: "+",
			moreKeys: {}			
		}, settings || {});	
	this.wackyKeys = { '.': 190, ',': 188, ';': 59,	'Space': 32	};	
	this.formElements  = new Array("input", "select", "textarea", "button");
	this.keys = new Array();	
	this.onFormElement = false;
	this.keysDown = new Array();
	this.init = function (obj) {
		for(x in this.wackyKeys) {
			this.wackyKeys[x.toUpperCase()] = this.wackyKeys[x];
		}
		for(x in obj) {
			this.keys.push(x.split(this.settings.split));
		}
		for(i in this.keys) {
			var quickArr = new Array();
			for(j in this.keys[i]) {
				quickArr.push(this.convertToNumbers(this.keys[i][j].toUpperCase()));
			}
			quickArr.sort();
			this.keys[i] = quickArr;
		}
	};	
	this.convertToNumbers = function (inp) {
		if (this.wackyKeys[inp] != undefined) {
			return this.wackyKeys[inp];
		}
		return inp.toUpperCase().charCodeAt(0);
	};	
	this.keyAdd = function(keyCode) {
		this.keysDown.push(keyCode);
		this.keysDown.sort();
	};
	this.keyRemove = function (keyCode) {
		for(i in this.keysDown) {
			if(this.keysDown[i] == keyCode) {
				this.keysDown.splice(i,1);
			}
		};	
		this.keysDown.sort();	
	};		
	this.keyTest = function (i) {
		if (this.keys[i].length != this.keysDown.length) return false;
		for(j in this.keys[i]) {
			if(this.keys[i][j] != this.keysDown[j]) {
				return false;
			}
		}	
		return true;
	};
	this.keyRemoveAll = function () {
		this.keysDown = new Array();	
	};
	this.focused = function (bool) {
		this.onFormElement = bool;
	}	
	$(document).keydown(function(e) {
		el.keyAdd(e.keyCode);
		var i = 0;
		for(x in obj) {
			if(el.keyTest(i) && !el.onFormElement) {
				obj[x]();
				return false;
				break;	
			}			
			i++;
		};	
	});	
	$(document).keyup(function (e) {
		el.keyRemove(e.keyCode);
	});	
	for(x in this.formElements) {
		$(this.formElements[x]).focus( function () {
			el.focused(true);
		});
		$(this.formElements[x]).blur( function () {
			el.focused(false);
		});
	}	
	$(document).focus( function () {
		el.keyRemoveAll();
	});
	
	this.init(obj);
	jQuery.extend(this.wackyKeys, this.settings.moreKeys);

	return this;
}

/**
 * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = null;
			}
		}
	}
}
if (typeof window.onunload == 'function') {
	var oldunload = window.onunload;
		window.onunload = function() {
		deconcept.SWFObjectUtil.cleanupSWFs();
		oldunload();
	}
} else {
	window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;
