﻿/*
CSS Browser Selector v0.3.5 (Feb 05, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

function showmenu(elmnt)
        {
            document.getElementById(elmnt).style.display = "block";
        }
        
function hidemenu(elmnt)
        {
	        document.getElementById(elmnt).style.display = "none";
        }  
function showhide(c,tp,t){
   for(i=1;i<=t;i++){
        tipo = tp+i;
        document.getElementById(tipo).style.display = "none";
    }
   document.getElementById(c).style.display = "block";
}

function abas(){
var j=1;
   for(i=2;i<arguments.length;i++){
        tipo = arguments[1]+j;
        
        document.getElementById(tipo).className = arguments[i];
        j++;
    }
   //document.getElementById(arguments[0]).className = st;
}

function limparPadrao(campo) 
    {
        if (campo.value == campo.defaultValue) 
        {
            campo.value = "";
        }
    }
        
function escreverPadrao(campo) 
    {
        if (campo.value == "") 
        {
            campo.value = campo.defaultValue;
        }
    } 
function onlynumber(myfield, e, tolerado) {
      if (myfield.length == 0)
          myfield.value = 0;

      var key;
      var keychar;

      if (window.event)
          key = window.event.keyCode;
      else if (e)
          key = e.which;
      else
          return true;

      keychar = String.fromCharCode(key);

      if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 13) || (key == 27))
          return true;
      else if ((("0123456789" + tolerado).indexOf(keychar) > -1)) {
          if (((myfield.value).indexOf(tolerado) > -1) && (keychar == tolerado))
              return false;
          else if ((myfield.value.length == 0) && (keychar == tolerado)) {
              myfield.value = "0";
              return true;
          }
          else
              return true;
      }
      else
          return false;
  }
  
function setaMenuOver(elmnt,classe)
        {
            document.getElementById(elmnt).className = '';	
        }
function setaMenuOut(elmnt,classe)
        {
            document.getElementById(elmnt).className = classe;	
        }
        


function initialize() {
      if (GBrowserIsCompatible()) {
		 
        map = new GMap2(document.getElementById("map_canvas"));
        
        map.setUIToDefault();        
        geocoder = new GClientGeocoder();
		showAddress('Av. Washington Luís, 5794, São Paulo - SP - Brasil',map);   
      }
     
    }
	
	function showAddress(address,obj) {
      if (geocoder) {
        geocoder.getLatLng(address,function(point) {
													if (!point) {
														alert(address + " not found");
													} else {
														obj.setCenter(point, 16);
														
														var mark = new GMarker(point);
														obj.openInfoWindow(obj.getCenter(),
                 document.innerHTML="<img src='/images/usercontrols/topo/logo_mapa.jpg'>");
														//GEvent.addListener(mark, "load", function() {
                                                        //    mark.openInfoWindowHtml('Minha Casa');
                                                        //});
														
														obj.addOverlay(mark);
													}
													}
							);	
					}
		}
		
		
		

