/** 
 * Scripts
 *  
 * @project		<Project Name>
 * @author		Gabriel Izaias <gabriel.izaias@gmail.com>
 */
$(document).ready( function(){
															
	
							
	/**
	* Browser and OS detection
	*
	* Add classes to <html> respective to OS, browser and browser version.
	* e.g.: If user is on Windows using Firefox 3: <html class="windows firefox firefox3">
	*
	* @author		Gabriel Izaias <gabriel.izaias@gmail.com>
	*/
	(function(){n=navigator.userAgent.toLowerCase(),os=n.indexOf("macintosh")!=-1?"machintosh":n.indexOf("windows")!=-1?"windows":n.indexOf("linux")!=-1?"linux":undefined,bs=/(chrome)(?:.*chrome)?[ \/]([\w.]+)/.exec(n)||/(safari)(?:.*version)?[ \/]([\w.]+)/.exec(n)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(n)||/(ie) ([\w.]+)/.exec(n)||!/compatible/.test(n)&&/(firefox)(?:.*firefox)?[ \/]([\w.]+)/.exec(n)||[],bn=bs[1]||"",bv=bs[2]||"0",$("html").addClass(bn+" "+bn+parseInt(bv)+" "+os+" "+navigator.platform)})()
	
	
	/**
	 * Accesskey user support
	 * 
	 * Adds a hint to the title attribute of elements that support accesskey shortcuts
	 * 
	 * @author		Gabriel Izaias <gabriel.izaias@gmail.com>
	 */
	$("[accesskey]").each(function(){e=$(this),t=e.attr("title")||"",os=function(){return n=navigator.userAgent.toLowerCase(),n.indexOf("macintosh")!=-1?"machintosh":n.indexOf("windows")!=-1?"windows":n.indexOf("linux")!=-1?"linux":undefined}(),nt="";switch(os){case"windows":nt=$.browser.msie||$.browser.webkit?t+" [alt+"+e.attr("accesskey")+"]":$.browser.opera?t+" [shift+esc+"+e.attr("accesskey")+"]":$.browser.mozilla?t+" [alt+shift+"+e.attr("accesskey")+"]":t;break;case"machintosh":nt=$.browser.msie||$.browser.webkit?t+" [ctrl+alt+"+e.attr("accesskey")+"]":$.browser.opera?t+" [shift+esc+"+e.attr("accesskey")+"]":$.browser.mozilla?t+" [ctrl+"+e.attr("accesskey")+"]":t;break;default:}return e.attr("title",nt)})
	
});
