isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')>-1);
isKonqueror = (navigator.userAgent.toLowerCase().indexOf('konqueror')>-1);
isIE  = ((!isOpera)&&(navigator.userAgent.toLowerCase().indexOf('msie')>-1));
isIE7 = ((!isOpera)&&(navigator.userAgent.toLowerCase().indexOf('msie 7')>-1));
isIE6 = ((isIE)&&(!isIE7));
isMozilla = ((!isOpera)&&(!isKonqueror)&&(!isIE));

$(document).ready(function() {
   $(".external").click(function() { 
      window.open($(this).attr("href"));
      return false;
   });
});

function flash(src,w,h,string_values, div, scale) {

	var html = '';
	html += '<object type="application/x-shockwave-flash" data="'+src+'" width="'+w+'" height="'+h+'" wmode="transparent">';
	html += '<param name="allowScriptAccess" value="sameDomain" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="scale" value="'+(scale ? 2 :"noscale" )+'" />';
	html += '<param name="movie" value="'+src+'" />';
	html += '<param name="wmode" value="transparent" />';

	if(string_values!=undefined) {
		html += '<param name="FlashVars" value="'+string_values+'" />';
	}

	html += '<embed src="'+src+'" quality="high" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" allowScriptAccess="sameDomain" wmode="transparent"></embed>';
	html += '</object>';

	if ((div==undefined)||(!div)) {
		document.write(html);
	} else {
		if (isIE) {
			$("#"+div).html(html);
		} else {
			document.getElementById(div).innerHTML = html;
		}
	}
}

function mostraCidades(selectCidade, selectEstado) {
   $(selectCidade).html('<option value="">Carregando...</option>');

	$.get($live + "/index.php", { option: "cidade", id_estado: $(selectEstado).val(), Itemid: '10000' },
  	function(data){
		$(selectCidade).html(data);
	});
}

function mascara(o,f){
    v_obj = o;
    v_fun = f;
    setTimeout("execmascara()", 1);
}

function execmascara(){
    v_obj.value = v_fun(v_obj.value);
}

function numero(v) {
    return v.replace(/\D/g,"");
}
/*
function data(v){
  v=v.replace(/\D/g,"") 
  v=v.replace(/(\d{2})(\d)/,"$1/$2") 
  v=v.replace(/(\d{2})(\d)/,"$1/$2") 
  return v;
}*/

$(document).ready(function() {
   
   /* abas */
   (function($){
      $.fn.connerBackgroundColor = function(cor) {
         $(this).css("background-color", cor );
         $(this).find("div").each(function(){
            if($(this).css("background-color")!="transparent" && $(this).css("background-color").substr(0,4)!="rgba"){
               $(this).css("background-color", cor);
            }
         });
      };
   })(jQuery);
   
   
   if ($("#estado") && $("#cidade")) {
      $("#estado").change(function(){
         mostraCidades("#cidade", "#estado");
   	});
   }
    
   $(".box-rounded-mod1-pequeno, .box-rounded-mod1-medio, .box-rounded-mod1-grande, .box-rounded-mod2").corner({
      tl: { radius: 10 },
      tr: { radius: 10 },
      bl: false,
      br: false,
      antiAlias: true,
      autoPad: false,
      validTags: ["div"]
   });
   
   $("input[@name^=data]").mask("99/99/9999",{placeholder:" "});
   $("input[name=cep]").mask("99999-999",{placeholder:" "});
});