/*















*/

utilities = function(){}



utilities.prototype.id = null;

utilities.prototype.url = null;

utilities.prototype.parameters = null;//for _postAjax only

utilities.prototype.wLevel = null;

utilities.prototype.xmlhttp = null;

utilities.prototype.append = "=";

utilities.prototype.returnMessage = "";



utilities.prototype = {



   id:null,

	_addEvent:function (obj,fn,evType)

	{

		try

		{

			if(obj.addEventListener)

			{

				obj.addEventListener(evType, fn, true);

			}

			else if(obj.attachEvent)

			{

				obj.attachEvent("on"+evType, fn);

			}

			obj.style.cursor = "pointer";

		}

		catch(ex)

		{

			alert(ex.message);

		}

	},

	

	_registerLimit: function(e)

	{

		alert(e.keyCode);

	},

	

	_loadContent: function(_title,_url,_w,_h)

	{

	  try

		{



		util.id="conteudo";

		util.url = _url;

		util.append = "=";

		util._getAjaxContent();

		}

		catch(ex)

		{

		    alert(ex.message);

		}

	},

	

	_openWindow: function(_title,_url,_w,_h)

	{

	  try

		{

	  var win = new Window({className: "alphacube", title: _title, 

										  top:100, left:220, width:_w, height:_h, 

										  url:_url, showEffectOptions: {duration:1.5}})

		win.show();  

		win.setZIndex(99);

		}

		catch(ex)

		{

		    alert(ex.message);

		}

	},	

	_criaCampos: function(e)

	{

		

		try

		{

			if(typeof(e)=='undefined')

			{

				var e=window.event

			}

			

			source=e.target?e.target:e.srcElement;

			

			if(source.nodeType == 3)

			{

				source = source.parentNode;

			}

			

			document.getElementById("campos").innerHTML = "";



			for(h=0;h<source.title;h++)

			{

				document.getElementById("campos").innerHTML += "<input type='file' name='arquivos[]' size='40'><br />";

			}

		}

		catch(ex)

		{

			alert("exception:_criaCampos:" + ex.message);

		}

	},

	

	_changeVisible: function(targetView,targetHide)

	{

		try

		{

			obj1 = document.getElementById(targetView);

			obj2 = document.getElementById(targetHide);

			

			obj1.previousSibling.previousSibling.innerHTML = "[-]";

			obj1.style.display = "block";

			

			obj2.previousSibling.previousSibling.innerHTML = "[+]";

			obj2.style.display = "none";

		}

		catch(ex)

		{

			alert("changeVisible:exception:" + ex.message);

		}

	},

	

  _getAjaxContent: function()

  {

    try

		{

        if(window.XMLHttpRequest)

				{

        	  xmlhttp=new XMLHttpRequest();

        }

				else if(window.ActiveXObject)

				{

        		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

        }

        

        if (xmlhttp)

        {

          xmlhttp.onreadystatechange=this._retorno;

          xmlhttp.open("GET",this.url,true);

          xmlhttp.setRequestHeader('Content-Type', 'text/html; charset=iso-8859-1');

          xmlhttp.send(null);

        }

    

    }

		catch(e)

		{

    	document.write(e.message);

    }

    return false;

  },

	

	_retorno: function ()

  {

     try

		 {

      if(xmlhttp.readyState==4)

			{

         showContent(xmlhttp.responseText);

      }

     }

		 catch(e)

		 {

      alert("erro ao ler xml: " + e.message);

     }

  },

	

  _saveByAjax: function()

  {

    try

		{

        if(window.XMLHttpRequest)

				{

        	  xmlhttp=new XMLHttpRequest();

        }

				else if(window.ActiveXObject)

				{

        		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

        }

        

        if (xmlhttp)

        {

          xmlhttp.onreadystatechange=this._retVoid;

          xmlhttp.open("GET",this.url,true);

          xmlhttp.setRequestHeader('Content-Type', 'text/html; charset=iso-8859-1');

          xmlhttp.send(null);

        }

    }

		catch(e)

		{

    	document.write(e.message);

    }

    return false;

  },

	

  _postAjaxContent: function()

  {

    try

		{

        if(window.XMLHttpRequest)

				{

        	  xmlhttp=new XMLHttpRequest();

        }

				else if(window.ActiveXObject)

				{

        		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

        }

        

        if (xmlhttp)

        {

				  xmlhttp.onreadystatechange = this._void;//this._retVoid;

          xmlhttp.open('POST', this.url, true);

          xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=iso-8859-1");

          xmlhttp.setRequestHeader("Content-length", this.parameters.length);

          xmlhttp.setRequestHeader("Connection", "close");

          xmlhttp.send(this.parameters);

        }

    }

		catch(e)

		{

    	//document.write(e.message);

    }

    return false;

  },

	_postAjaxContentReturn: function()

  {

    try

		{

        if(window.XMLHttpRequest)

				{

        	  xmlhttp=new XMLHttpRequest();

        }

				else if(window.ActiveXObject)

				{

        		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

        }

        

        if (xmlhttp)

        {

				  xmlhttp.onreadystatechange = this._retVoidPost;

          xmlhttp.open('POST', this.url, true);

          xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=iso-8859-1");

          xmlhttp.setRequestHeader("Content-length", this.parameters.length);

          xmlhttp.setRequestHeader("Connection", "close");

          xmlhttp.send(this.parameters);

        }

    }

		catch(e)

		{

    	//document.write(e.message);

    }

    return false;

  },

	_retVoidPost: function()

	{

     try

		 {

      if(xmlhttp.readyState==4)

			{

        showContent(xmlhttp.responseText);			   

				//alert("Alteração efetuada com sucesso!");

      }

     }

		 catch(e)

		 {

      alert("erro ao ler xml: " + e.message);

     }

	},

		

	_retVoid: function()

	{

     try

		 {

      if(xmlhttp.readyState==4)

			{

					if(xmlhttp.responseText==1)

					{

					   alert("Alteração efetuada com sucesso!");

					}

					else

					{

					   alert("Erro ao atualizar[" + xmlhttp.responseText + "]. Tente novamente!");

					}

      }

     }

		 catch(e)

		 {

      alert("erro ao ler xml: " + e.message);

     }

	},

		

	_void: function()

  {

     try

		 {

      if(xmlhttp.readyState==4)

			{

					if(xmlhttp.responseText==1)

					{

					   //str = xmlhttp.responseText;

					   //alert("Mensagem enviada com sucesso!");

						  util.url = "mural.php?pagina=" + pagina + "&indice=" + indice;

              util.id = "lista";

              util.append = "=";

              util._getAjaxContent();/**/

					}

					else

					{

					   //str = xmlhttp.responseText;

					   //alert("Mensagem enviada com sucesso!");

						  util.url = "mural.php?pagina=" + pagina + "&indice=" + indice;

            	util.id = "lista";

              util.append = "=";

              util._getAjaxContent();/**/

					}

      }

     }

		 catch(e)

		 {

      //alert("erro ao ler xml: " + e.message);

     }

	}	    

	

}



function showImg(img){

		try{

		   obj = new Image();

			 obj.src ="image.php?image=" + img + "&size=400";

			 imgWin = window.open("while.htm","Imagem","width=400 height=400 addressbar=no scrollbar=no");

			 imgWin.document.writeln(" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">");

        imgWin.document.writeln("<html xmlns=\"http://www.w3.org/1999/xhtml\" >");

        imgWin.document.writeln("<head>");

        imgWin.document.writeln("    <title>Galeria</title>");

        imgWin.document.writeln("    <style type=\"text/css\">");

        imgWin.document.writeln("      body,img{");

        imgWin.document.writeln("            text-align:center;margin:0px;padding:0px");

        imgWin.document.writeln("          }");

        imgWin.document.writeln("    </style>");

        imgWin.document.writeln("</head>");

        imgWin.document.writeln("<body>");

        imgWin.document.write("<img src=\"" + obj.src + "\" alt=\"Clique para fechar\" style=\"cursor:pointer\" onclick=\"javascript:window.close();\" />");

        imgWin.document.writeln("</body>");

        imgWin.document.writeln("</html>");

		}catch(e){

		   alert(e.description);

		}		

}



function visualiza(img,codigo)

{

   obj = new Image();

	 obj.src ="image.php?image=" + img + "&size=280";

	 document.getElementById("imgLocal").src = obj.src;

	 util.url = "image.php?legenda=" + codigo;

	 util.id = "txtGaleria";

   util.append = "=";

	 util._getAjaxContent();

	 document.getElementById("codigoImagem").value=codigo;

}



function showContent(text)

{

   wParent = util.wLevel!=undefined?util.wLevel+".":""; 
   //alert(wParent + "document.getElementById('" + util.id + "').innerHTML");
   eval(wParent + "document.getElementById('" + util.id + "').innerHTML" + util.append + "text");

}





function Click(e)

{

var buttonPressed = 0;

if(window.attachEvent)

{

   buttonPressed = event.button;

}

else

{

   buttonPressed = e.button;

}



if (buttonPressed == 2||buttonPressed == 4)

{

alert ('Todos os direitos reservados.VozesdeFé©2008');

return false;

}

}

//document.onmousedown=Click;

//document.oncontextmenu = function(){return false;} 





