/*
********************************
**	(c)2011 R3 WEBMOTION	  **
**	contact: info@r3.com.br	  **
********************************
*/

jQuery.fn.extend({
	rotatehomeimg: function(){
		var sel = this.selector;
		if(this.length > 0){
			$("ul li.viewrotate:not(:only-child)",this).fadeOut(500, function(){
				if($(this).not(":last-child")){
					$(this).removeClass("viewrotate").next().fadeIn(500).addClass("viewrotate");
				}
				if($(this).is(":last-child")){
					$(this).removeClass("viewrotate");
					$(this).parent().find(":first-child").fadeIn(500).addClass("viewrotate");
				}
			});
			setTimeout("$('"+sel+"').rotatehomeimg()",5000);
		}
	}
});

// CONFIG

$(document).ready(function(){
	
	baseurl = '';
	dombase = 'http://'+$(document).attr("domain");
	urlraw = $(document).attr('URL').replace(dombase+baseurl,'');

	urlrw = urlraw.split('/');
	
	$("#nav ul li").mouseover(function(){ $(this).addClass("over"); }).mouseout(function(){ $(this).removeClass("over"); });
	
	$("#homeimgrotate ul li:first-child").addClass("viewrotate");
	
	setTimeout("$('#homeimgrotate').rotatehomeimg()",5000);
	
	$('a').click(function(){ $(this).blur(); });
	
	/*function ds(e){return false;} function re(){return true;}document.onselectstart = new Function ("return false");document.oncontextmenu=function(){return false;};if(window.sidebar){document.onmousedown = ds;document.onclick = re;}*/$("#content").bind("contextmenu",function(e){return false;});$("#content").live('mousedown',function(){return false;});
	
	$('div#nav ul li a[href="/'+urlrw[1]+'"]').parent().addClass('selectednav');
	
	$.superbox.settings = {
		boxId: "superbox", // Id attribute of the "superbox" element
		boxClasses: "", // Class of the "superbox" element
		overlayOpacity: .3, // Background opaqueness
		boxWidth: "750", // Default width of the box
		boxHeight: "400", // Default height of the box
		loadTxt: "Carregando...", // Loading text
		closeTxt: "Fechar", // "Close" button text
		prevTxt: "&laquo; Anterior &nbsp;", // "Previous" button text
		nextTxt: "&nbsp; Pr&oacute;ximo &raquo;" // "Next" button text
	};
	
	$.superbox();
	
});
