/**
 * Executed when document is finished loading elements into DOM
 */
$(document).ready(function() {
	/**
	 * Display confirmation dialog whenever link
	 * with className "confirm" is slicked
	 */
	$('.confirm').click(function(){
		return confirm('Do you really want to continue');
	});

	/**
	 * Syntax highlighter
	 */
	SyntaxHighlighter.autoloader(
		'py python									'+webroot+'js/sh/shBrushPython.js',
		'c cpp											'+webroot+'js/sh/shBrushCpp.js',
		'asm x86										'+webroot+'js/sh/shBrushAsm.js',
		'bash shell									'+webroot+'js/sh/shBrushBash.js',
		'diff patch									'+webroot+'js/sh/shBrushDiff.js',
		'latex tex									'+webroot+'js/sh/shBrushLatex.js',
		'lua												'+webroot+'js/sh/shBrushLua.js',
		'mathematica mm							'+webroot+'js/sh/shBrushMathematica.js',
		'matlab											'+webroot+'js/sh/shBrushMatlab.js',
		'plain text									'+webroot+'js/sh/shBrushPlain.js',
		'sql												'+webroot+'js/sh/shBrushSql.js',
		'xml xhtml xslt html xhtml	'+webroot+'js/sh/shBrushXml.js',
		'php												'+webroot+'js/sh/shBrushPhp.js'
	);
  SyntaxHighlighter.defaults['tab-size']= 2;
  SyntaxHighlighter.defaults['toolbar']= 0;
  SyntaxHighlighter.all();

	$('.pop').fancybox();

});

/**
 * Print email link (protection from spambots)
 * If javascript is disabled, nothing is visible
 *
 * @param string p1 Part 1 - this is username
 * @param string p2 Part 2 - this is domain and TLD
 */
function writemail(p1, p2) {
	document.write("<a href='mailto:"+p1+"@"+p2+"'>"+p1+"@"+p2+"</a>");
}
