//************************************
//* Funções Javascript
//* code by Cristiano Dias
//* www.technosoft.com.br © 2006
//************************************
<!--
function AddFavoriteEx() {
         //external.AddFavorite('http://www.paraisoverdepescaelazer.com.br', 'Paraiso Verde Pesca e Lazer');
  		 window.external.addFavorite('http://www.paraisoverdepescaelazer.com.br', document.title)
		 alert("Obrigado por adcionar o nosso site aos seus favoritos !!!");
}

function bookmarksite(title,url){
 		 if (window.sidebar) // firefox
			window.sidebar.addPanel(title, url, "");
		 else if(window.opera && window.print){ // opera
			var elem = document.createElement('a');
			elem.setAttribute('href',url);
			elem.setAttribute('title',title);
			elem.setAttribute('rel','sidebar');
			elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document;
  if(d.images){
	  if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0){
			   d.MM_p[j]=new Image;
			   d.MM_p[j++].src=a[i];
			 }
		}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function abrirJanela(strUrl,numWidth,numHeight){
	     LeftPosition = (screen.width) ? (screen.width-numWidth)/2 : 0;
	     TopPosition = (screen.height) ? (screen.height-numHeight)/2 : 0;
	     strFeature = "tollbar=yes,status=yes,menubar=0,scrollbars=1,resizable=no,top=" + TopPosition + ",left=" + LeftPosition + ",width=" + numWidth + ",height=" + numHeight;
    	 window.open(strUrl,"",strFeature);
}

// Preload and play audio files with event handler (MouseOver sound)
var aySound = new Array();
aySound[0] = "/sounds/tsSoundOver.wav";
aySound[1] = "/sounds/tsSoundClick.wav";

document.write('<BGSOUND ID="auIEContainer">')
IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
ver4 = IE||NS? 1:0;
onload=auPreload;

function auPreload() {
		 if (!ver4) return;
		 if (NS) auEmb = new Layer(0,window);
		 else {
			   Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
			   document.body.insertAdjacentHTML("BeforeEnd",Str);
		 }
		 var Str = '';
		 for (i=0;i<aySound.length;i++)
		     Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
		     if (IE) auEmb.innerHTML = Str;
			 else {
			       auEmb.document.open();
				   auEmb.document.write(Str);
				   auEmb.document.close();
			 }
		     auCon = IE? document.all.auIEContainer:auEmb;
			 auCon.control = auCtrl;
}

function auCtrl(whSound,play) {
		 if (IE) this.src = play? aySound[whSound]:'';
		 else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
}

function playSound(whSound) {
	     if (window.auCon) auCon.control(whSound,true);
}

function stopSound(whSound) {
	     if (window.auCon) auCon.control(whSound,false);
}

//Gradual IMAGE SCRIPT
//----------------------
//By C.Dias (06/06/2006)

var baseopacity=61

function slowhigh(which2){
         imgobj=which2
         browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
         instantset(baseopacity)
         highlighting=setInterval("gradualfade(imgobj)",61)
}
function slowlow(which2){
         cleartimer()
         instantset(baseopacity)
}
function instantset(degree){
         if (browserdetect=="mozilla")
            imgobj.style.MozOpacity=degree/100
         else if (browserdetect=="ie")
            imgobj.filters.alpha.opacity=degree
}
function cleartimer(){
         if (window.highlighting) clearInterval(highlighting)
}
function gradualfade(cur2){
         if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
            cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
         else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
            cur2.filters.alpha.opacity+=10
            else if (window.highlighting)
                 clearInterval(highlighting)
}


//Mask Fileds FORM
//-----------------------------
//By C.Dias (07/06/2006)

addEvent = function(o, e, f, s){
	var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
	r[r.length] = [f, s || o], o[e] = function(e){
		try{
			(e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
			e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
			e.target || (e.target = e.srcElement || null);
			e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
		}catch(f){}
		for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
		return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
	for(var i = (e = o["_on" + e] || []).length; i;)
		if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
			return delete e[i];
	return false;
};

MaskInput = function(f, m){ //v1.0
	function mask(e){
		var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[À-ÿ]/i, "8": /./ },
			rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
		function accept(c, rule){
			for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
				if(r & i && patterns[i].test(c))
					break;
				return i <= r || c == rule;
		}
		var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
		(!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
			r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
			: (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
			r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
	}
	for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
		addEvent(f, i, mask);
};

function FormatCurrency(o, n, dig, dec){
    o.c = !isNaN(n) ? Math.abs(n) : 2;
    o.dec = typeof dec != "string" ? "," : dec, o.dig = typeof dig != "string" ? "." : dig;
    addEvent(o, "keypress", function(e){
        if(e.key > 47 && e.key < 58){
            var o, s, l = (s = ((o = this).value.replace(/^0+/g, "") + String.fromCharCode(e.key)).replace(/\D/g, "")).length, n;
            if(o.maxLength + 1 && l >= o.maxLength) return false;
            l <= (n = o.c) && (s = new Array(n - l + 2).join("0") + s);
            for(var i = (l = (s = s.split("")).length) - n; (i -= 3) > 0; s[i - 1] += o.dig);
            n && n < l && (s[l - ++n] += o.dec);
            o.value = s.join("");
        }
        e.key > 30 && e.preventDefault();
    });
}

//VALIDAR CPF e CNPJ
//-----------------------------
//By C.Dias (24/08/2007)

function valida_cpf(cpf)
	  //script by Cristiano Dias (Technosoft Systemworks - www.technosoft.com.br)	
      {
      var numeros, digitos, soma, i, resultado, digitos_iguais;
      digitos_iguais = 1;
	  var stringCPF=cpf;
	  var stringCPF2=stringCPF.substring(0,3) + stringCPF.substring(4,7) + stringCPF.substring(8,11) + stringCPF.substring(12,14);
	  cpf=stringCPF2;
	  
      if (cpf.length < 11)
            return false;
      for (i = 0; i < cpf.length - 1; i++)
            if (cpf.charAt(i) != cpf.charAt(i + 1))
                  {
                  digitos_iguais = 0;
                  break;
                  }
      if (!digitos_iguais)
            {
            numeros = cpf.substring(0,9);
            digitos = cpf.substring(9);
            soma = 0;
            for (i = 10; i > 1; i--)
                  soma += numeros.charAt(10 - i) * i;
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(0))
                  return false;
            numeros = cpf.substring(0,10);
            soma = 0;
            for (i = 11; i > 1; i--)
                  soma += numeros.charAt(11 - i) * i;
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(1))
                  return false;
            return true;
			
            }
      else
			return false;
      }

function valida_cnpj(cnpj)
	  //script by Cristiano Dias (Technosoft Systemworks - www.technosoft.com.br)
      {
      var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
      digitos_iguais = 1;
      if (cnpj.length < 14 && cnpj.length < 15)
            return false;
      for (i = 0; i < cnpj.length - 1; i++)
            if (cnpj.charAt(i) != cnpj.charAt(i + 1))
                  {
                  digitos_iguais = 0;
                  break;
                  }
      if (!digitos_iguais)
            {
            tamanho = cnpj.length - 2
            numeros = cnpj.substring(0,tamanho);
            digitos = cnpj.substring(tamanho);
            soma = 0;
            pos = tamanho - 7;
            for (i = tamanho; i >= 1; i--)
                  {
                  soma += numeros.charAt(tamanho - i) * pos--;
                  if (pos < 2)
                        pos = 9;
                  }
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(0))
                  return false;
            tamanho = tamanho + 1;
            numeros = cnpj.substring(0,tamanho);
            soma = 0;
            pos = tamanho - 7;
            for (i = tamanho; i >= 1; i--)
                  {
                  soma += numeros.charAt(tamanho - i) * pos--;
                  if (pos < 2)
                        pos = 9;
                  }
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(1))
                  return false;
            return true;
            }
      else
            return false;
      } 


//IMAGENS
function MM_swapImgRestore() { //v3.0
         var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
         var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
         var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
         if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
         var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
		 {
             d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
		 }
         if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
         for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
         if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
         var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
         if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function execLink()
        {
		 alert("Este link não está liberado para acesso !");
	     return false;
		}

//-->