function animaMenus(){
	$(".menu").mousemove(function(){return false})
	$(".menu").hover(
		function(){
			$(this).animate({ 
        		borderWidth:"16px",
				height:"24px",
				marginTop:"0px"
     		}, 200);
		},
		function(){
			$(this).animate({ 
        		borderWidth:"0px",
				height:"30px",
				marginTop:"10px"
     		}, 200);
		}
	);
}
function animaListagem(){
	$(".anim").hover(
	function(){
		$(this).mousemove(function(){return false});
		$(".nat",this).animate({color:"#FFF"},200);
		$(".pre",this).animate({color:"#FFF"},200);
	},function(){
		$(this).mousemove(function(){return false});
		$(".nat",this).animate({color:"#251810"},200);
		$(".pre",this).animate({color:"#251810"},200);
	})
	//////bt favoritos
	$(".fav").hover(
	function(){
		$(this).mousemove(function(){return false});
		$(this).animate({color:"#251810"},200);
	},function(){
		$(this).mousemove(function(){return false});
		$(this).animate({color:"#796F61"},200);
	})
}
/////////////////////////
function animaAddBoard(){
	$("div#add_board").scrollable({     
    items: ".adds",
	size: 2,
	vertical:true
	});
	var api = $("div#add_board").scrollable({api: true});
	$(".prev").click(function(){
		window.clearInterval(int);
		api.prev(); 
		int=self.setInterval('$(".next").click()',2500);
	})
	$(".next").click(function(){
		window.clearInterval(int)
		api.next(); 
		int=self.setInterval('$(".next").click()',2500);
	})
	var int=self.setInterval('$(".next").click()',2500);
}

//////////////
function setAutoWidth(oContainer, oAdjust, oItem, oPagin, oResults, itemmargin){
	//ver largura do oContainer
	var wWidth=$(oContainer).width();
	if(itemmargin){
	var iWidth = $(oItem).outerWidth()+itemmargin*2;
	}
	else
	{
	var iWidth = $(oItem).outerWidth()
	}
	//ver quantos items cabem nessa largura
	var maxItemsLine = Math.floor(wWidth / iWidth);
	//ver quantos items tem
	var nItems=$(oItem).length;
	//se tiver menos itens que o permitido
	if(maxItemsLine>nItems){
	//A oAdjust tera a largura exacta do oItem x nItems
		$(oAdjust).width(nItems*iWidth);
	}
	else{
	//A oAdjust tera a largura exacta do oItem x maxItemsLine
		$(oAdjust).width(maxItemsLine*iWidth);
	}
	oMargin= (wWidth - $(oAdjust).width())/2;
	if(oPagin){
		$(oPagin).css("margin-right",oMargin);
	}if(oResults){
		$(oResults).css("margin-left",oMargin);
	}
	///
}

/////////
//exemplo:addDynData('_webcontrols/functionalities/360.spk?rid={field from='imo.id'}', '.gallery-container','ul.gallery')
function addDynData(sUrl,oTarget,oFade)
{
	/*
		$(oTarget).fadeTo('fast',0.4, function(){$(oTarget).empty();});
		baseHeight=$(oTarget).height();
		$(oTarget).append("<div class='baseLoader'><img src='_images/loader.gif'/></div>");
		$(".baseLoader").css({
		"position":"relative",
		"top":-($(oTarget).height())+"px",
		"left":"0",
		"height":$(oTarget).height()+"px",
		"width":$(oFade).width()+"px"
		});
		$(oTarget).height(baseHeight);
		$(".baseLoader img").css({
		"margin":"auto",
		"display":"block",
		"margin-top":(($(oTarget).height()/2)-$(".baseLoader img").height())+"px"
		})
		$(oTarget).height($(oTarget).height());
		$.get(sUrl, function(dados){
		$(oTarget).html((dados));
		$(oTarget).fadeTo('normal',1);
		$(oTarget).animate({"height":$(oFade).height()});
		return true;
	});
	*/
	
	$(oTarget).html((''));
	baseHeight=$(oTarget).height();
	$(oTarget).append("<img src='_images/ajax-loader_old_2.gif' class='myLoader'/>");
	//$(oTarget).height(baseHeight);
	$(".myLoader").css({
		"margin":"auto",
		"display":"block",
		"margin-top":"50%",
		"margin-left":"50%"
	});
	//$(oTarget).height($(oTarget).height());
	$.get(sUrl, function(dados){
		$(oTarget).html((dados));
		//$(oTarget).animate({"height":$(oFade).height()}).fadeTo('normal',1);
		return true;
	});	
}
/*swap pesquisa*/
function swapPesquisa(sUrl,oTarget,oFade){
		$(oTarget).fadeTo('fast',0, function(){$(oTarget).empty();});
		baseHeight=$(oTarget).height();
		$(oTarget).append("<div class='baseLoader'><img src='_images/loader.gif'/></div>");
		$(".baseLoader").css({
		"position":"relative",
		"top":-($(oTarget).height())+"px",
		"left":"0",
		"height":$(oTarget).height()+"px",
		"width":$(oFade).width()+"px"
		});
		$(oTarget).height(baseHeight);
		$(".baseLoader img").css({
		"margin":"auto",
		"display":"block",
		"margin-top":(($(oTarget).height()/2)-$(".baseLoader img").height())+"px"
		})
		$(oTarget).height($(oTarget).height());
		$.get(sUrl, function(dados){
		$(oTarget).html((dados));
		$(oTarget).fadeTo('normal',1);
		$(oTarget).animate({"height":$(oFade).height()},1000,"linear",footerPos);
		return true;
	});
}
////
//manageFavorites("_webcontrols/functionalities/fav_rem.spk?RID={field from="imo.ID"}&clid={field from="imo.CLID"}",".hidden");
function manageFavorites(favUrl,oTarget){
		$(oTarget).empty();	
		$.get(favUrl, function(dados){
			$(oTarget).html((dados));
		return true;
	});
}

//addFav(". n{print request='clid'}");
function addFav(oFav, oText, oHref){
	$(oFav).fadeTo('fast',0.1, function(){$(oFav).swapClass("fav","nao-fav").animate({"width":"160px"});}).fadeTo('normal',1,function(){$(oFav).html(oText)});
	$(oFav).attr("href", oHref);
} 
function remFav(oFav, oText, oHref){
	$(oFav).fadeTo('fast',0.1, function(){$(oFav).swapClass("nao-fav","fav").animate({"width":"160px"});}).fadeTo('normal',1,function(){$(oFav).html(oText)});
	$(oFav).attr("href", oHref);
	if($('#container-favoritos')){
		genRequest("_webcontrols/functionalities/favoritos.spk","#container-favoritos");
		
	}
	
} 
function format(evt,oObj)
{	
	var key;
	
	if(window.event){key=evt.keyCode;}else{key=evt.which;}
	//se for pressionado o 'DEL' apaga o valor se for o 'backspace' actualiza o valor
	var sValue;
	var trueValue;
	trueValue=$(oObj).val().replace("+",'').replace(/\./g,'').replace(/,0/g,'').replace(/,/g,'');
	//alert(trueValue);
	if(key == 46){
		trueValue=0;
	}
	//passa o valor para uma string sem delimitadores para ser formatado
	sValue = new String(trueValue);
	if(sValue.lastIndexOf(',') == -1 && sValue.length>2)
		sValue=sValue.substr(0,sValue.length)+',00';
	//aplica os caractes delimitadores	
	for(var nCursor = sValue.lastIndexOf(',')-3; nCursor > 0 ; nCursor = nCursor - 3){
		sValue = sValue.substr(0,nCursor) + '.' + sValue.substr(nCursor);
		$(oObj).val(sValue.replace(',00',''));
	}
		if ($("#mpr").val()=="2.000.000"){
			$("#mpr").val("2.000.000+");
		}
		if ($("#mar").val()=="300.000"){
			$("#mar").val("300.000+");
		}
	}

function genRequest(oUrl,oTarget){
		$(oTarget).empty();	
		$.get(oUrl, function(dados){
			$(oTarget).html((dados));
		return true;
	});
}
//
$.fn.swapClass = function(c1, c2){
return this.each(function(){
  var t = $(this);
  (!t.is('.'+c1)) ?
	t.addClass(c1).removeClass(c2) : t.addClass(c2).removeClass(c1);
  });
}

function get_year(oContent){
var ano=new Date();
$(oContent).html(ano.getFullYear());
};
////
function footerPos(){
	$(".wrap_footer").css("top","0px");
	var docHeight=$(document).height();
	$(".wrap_footer").css("top",docHeight+"px");
}
////imprimir
function impressao() {
	link = window.open("printex.spk?RID={FIELD FROM='detalhes.id'}","_blank","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620");
}
///janelinha caracteristicas
var featArr = new Array();
function show(nID){	
	if ($('#featID').val() != nID)
	{
		$('#featType' + $('#featID').val()).css("text-decoration", "none");
		$('#featType' + nID).css("text-decoration", "underline");
		$('#feats').fadeOut("fast",function(){$('#feats').html(featArr[nID])}).fadeIn("fast");
		$('#featID').val(nID);
	}
	else
	{
		$('#featType' + $('#featID').val()).css("text-decoration", "none");
		$('#feats').fadeOut("fast",function(){$('#feats').html('')}).fadeIn("fast");
		$('#featID').val("0");
	}
}
//////////
/*solucao para cantos arredondados*/
/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.02 (12-NOV-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl. 
 *           by default, all four corners are adorned. 
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (and yes, it must be pixels).
 *
 * @author Dave Methvin (http://methvin.com/jquery/jq-corner.html)
 * @author Mike Alsup   (http://jquery.malsup.com/corner/)
 */
;(function($){var ua=navigator.userAgent;var moz=$.browser.mozilla&&/gecko/i.test(ua);var webkit=$.browser.safari&&/Safari\/[5-9]/.test(ua);var expr=$.browser.msie&&(function(){var div=document.createElement('div');try{div.style.setExpression('width','0+0');}
catch(e){return false;}
return true;})();function sz(el,p){return parseInt($.css(el,p))||0;};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s;};function gpc(node){for(;node&&node.nodeName.toLowerCase()!='html';node=node.parentNode){var v=$.css(node,'backgroundColor');if(v=='rgba(0, 0, 0, 0)')
continue;if(v.indexOf('rgb')>=0){var rgb=v.match(/\d+/g);return'#'+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2]);}
if(v&&v!='transparent')
return v;}
return'#ffffff';};function getWidth(fx,i,width){switch(fx){case'round':return Math.round(width*(1-Math.cos(Math.asin(i/width))));case'cool':return Math.round(width*(1+Math.cos(Math.asin(i/width))));case'sharp':return Math.round(width*(1-Math.cos(Math.acos(i/width))));case'bite':return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));case'slide':return Math.round(width*(Math.atan2(i,width/i)));case'jut':return Math.round(width*(Math.atan2(width,(width-i-1))));case'curl':return Math.round(width*(Math.atan(i)));case'tear':return Math.round(width*(Math.cos(i)));case'wicked':return Math.round(width*(Math.tan(i)));case'long':return Math.round(width*(Math.sqrt(i)));case'sculpt':return Math.round(width*(Math.log((width-i-1),width)));case'dog':return(i&1)?(i+1):width;case'dog2':return(i&2)?(i+1):width;case'dog3':return(i&3)?(i+1):width;case'fray':return(i%2)*width;case'notch':return width;case'bevel':return i+1;}};$.fn.corner=function(options){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).corner(options);});}
return this;}
return this.each(function(index){var $this=$(this);var o=[options||'',$this.attr($.fn.corner.defaults.metaAttr)||''].join(' ').toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var fx=((o.match(re)||['round'])[0]);var edges={T:0,B:1};var opts={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR)
opts={TL:1,TR:1,BL:1,BR:1};if($.fn.corner.defaults.useNative&&fx=='round'&&(moz||webkit)&&!cc&&!sc){if(opts.TL)
$this.css(moz?'-moz-border-radius-topleft':'-webkit-border-top-left-radius',width+'px');if(opts.TR)
$this.css(moz?'-moz-border-radius-topright':'-webkit-border-top-right-radius',width+'px');if(opts.BL)
$this.css(moz?'-moz-border-radius-bottomleft':'-webkit-border-bottom-left-radius',width+'px');if(opts.BR)
$this.css(moz?'-moz-border-radius-bottomright':'-webkit-border-bottom-right-radius',width+'px');return;}
var strip=document.createElement('div');strip.style.overflow='hidden';strip.style.height='1px';strip.style.backgroundColor=sc||'transparent';strip.style.borderStyle='solid';var pad={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!keep)this.style.border='none';strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=$.curCSS(this,'height');for(var j in edges){var bot=edges[j];if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){strip.style.borderStyle='none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!='auto'){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.bottom=ds.left=ds.padding=ds.margin='0';if(expr)
ds.setExpression('width','this.parentNode.offsetWidth');else
ds.width='100%';}
else if(!bot&&$.browser.msie){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.top=ds.left=ds.right=ds.padding=ds.margin='0';if(expr){var bw=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');ds.setExpression('width','this.parentNode.offsetWidth - '+bw+'+ "px"');}
else
ds.width='100%';}
else{ds.position='relative';ds.margin=!bot?'-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px':(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';}
for(var i=0;i<width;i++){var w=Math.max(0,getWidth(fx,i,width));var e=strip.cloneNode(false);e.style.borderWidth='0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';bot?d.appendChild(e):d.insertBefore(e,d.firstChild);}}}});};$.fn.uncorner=function(){if(moz||webkit)
this.css(moz?'-moz-border-radius':'-webkit-border-radius',0);$('div.jquery-corner',this).remove();return this;};$.fn.corner.defaults={useNative:true,metaAttr:'data-corner'};})(jQuery);
$(".round").corner("6px");
