function getPageScroll()
{

	var yScroll;
	
	if (self.pageYOffset) 
	{
		yScroll = self.pageYOffset;
	} 
	else if(document.documentElement && document.documentElement.scrollTop)
	{ // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} 
	else if (document.body) 
	{// all other Explorers
		yScroll = document.body.scrollTop;
	}
	
	arrayPageScroll = new Array('',yScroll)
	
	return arrayPageScroll;
}
	
function getPageSize()
{
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) 
	{
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else 
	{ // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) 
	{ // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body) 
	{ // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	}
	else 
	{
		pageHeight = yScroll;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth)
	{
		pageWidth = windowWidth - 18;
	} 
	else 
	{
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}


var Window =
{
	
	'_open': function() 
	{
	
	document.getElementById('acessorapido').style.display='block';
	document.getElementById('acessorapido').focus();
	//if (document.all)
	//var pos = evt.clientY;
	//else
	// var pos = window.pageYOffset;
	
	var pageSize = getPageSize();
	
	var objScroll = getPageScroll();
	
	//alert(objScroll[1]);
	
	var winW = pageSize[0];
	var winY = pageSize[1];
	
	//menos a largura da div
	var w = (winW - 363) / 2;
	 //menos a altura da div
	var y = (winY - 138) / 2;
	
	//alert(w);
	//alert(y);
	
	document.getElementById('acessorapido').style.left = w + 'px';
	document.getElementById('acessorapido').style.top = y + 'px';
	
	}
} 





//Pega o código da tecla
function getKey(e){
	if (e == null) { // ie
		keycode = event.keyCode;
	} else { // mozilla
		keycode = e.which;
	}
	//key = fromCharCode(keycode).toLowerCase();
	
	return keycode;
}



//Bloqueia caracteres que não sejam números
function teclas(campo,event){
    if(((event.keyCode < 96) || (event.keyCode > 105)) && ((event.keyCode < 48) || (event.keyCode > 57)) ){
           campo.value = campo.value.replace(String.fromCharCode(event.keyCode).toLowerCase(),"");
    }
}
//Função para formatar moeda R$
function formataMoeda(campo,event){
   
   //para evitar caracteres alfas.
   teclas(campo,event);
   str = campo.value;

   while(str.search(",") != -1)
	   str = str.replace(",","");
   i = 0;

   while(i< str.length){
	   if(str.substr(i,1) == ".")
		  str = str.replace(".","");
		  i++;
   }

   part1 = str.substr(0,str.length - 2);
   while(part1.search(" ") != -1)
	   part1 = part1.replace(" ","");

	   part2 = str.substr(str.length - 2,2);
	   res = "";
	   i = part1.length;
	   sob = i % 3;
	   if((sob != 0) && (i > 2))
		  res = part1.substr(0,sob) + ".";
	   else
		  res = part1.substr(0,sob);
	   j = 1;
	   part1 = part1.substr(sob);
	   i = 0;
	   while(i < part1.length){
		  if(j == 3){
			 if(i + 1 == part1.length)
				res = res + part1.substr(i-2,3);
			 else res = res + part1.substr(i-2,3) + ".";
		  }
		  i++;
		  j = j<3?j+1:1;
	   }
	   campo.value = res + "," + part2;
}

//CEP = onkeyup=formatar(this, '##.###-###')
function formatar(src, mask)
{
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)
	if(texto.substring(0,1) != saida)
		src.value += texto.substring(0,1);
}

var Contato = 
{
	'valida': function()
	{
		if($('nome').value==""){
			alert('Você precisa digitar seu nome ! ')
			$('nome').focus();
			return false;
		}
		
		if($('email').value =="" || $('email').value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
		{
			alert('Você precisa digitar um endereço de e-mail válido ! ')
			$('email').focus();
			return false;
		}
		
		if($('mensagem').value==""){
			alert('Você precisa digitar uma mensagem ! ')
			$('mensagem').focus();
			return false;
		}
	}
}
//--------------------------------------------------------------------------------------//
// administra os eventos de botões
//--------------------------------------------------------------------------------------//
var buttons =
{
	
	//função para mudar a imagem(via background_image css) de um botão quando chamado um evento
	'mudaImg':function(id,imagem){
		$(id).style.backgroundImage=imagem;
	},

	//função para mudar a imagem(via src) de um botão quando chamado um evento
	'mudaImgSrc':function(id,imagem){
		$(id).src=imagem;
	},
	
	//função para carregar outra página quando um botão for clicado
	'clica_bt':function(pagina){
		document.location = pagina;
	}

}
// para checar tamanho
var Carrega =
{
	'lateral':function(pagina)
	{
		if (screen.availWidth < 1000)
		{
			document.getElementById('auxiliar').style.display = 'none';
			document.getElementById('colLeft2').style.display = 'block';
			document.getElementById('colLeft').style.display = 'none';
			document.getElementById('colRight').style.display = 'none';
			document.getElementById('headerPrincipal').style.width = '775px';
			document.getElementById('imgHeader').style.width = '775px';
			document.getElementById('allContent').style.width = '775px';
			document.getElementById('allContent').style.float = 'left';
			document.getElementById('content').style.width = '775px';
			document.getElementById('footer').style.width = '778px';
			document.getElementById('footer').style.margin = 'auto';
			document.getElementById('footerPrincipal').style.width = '780px';
			if (document.all)
				document.getElementById('colCenter').style.marginLeft = '9px';
			else
				document.getElementById('colCenter').style.marginLeft = '15px';
			
		} 
		else
		{
			document.getElementById('auxiliar').style.display = 'none';
			document.getElementById('colLeft').style.display = 'block';
			document.getElementById('colLeft2').style.display = 'none'; 
		}
	}
}

var Cliente = 
{
	'Delete': function(ID)
	{
	   if(confirm('Tens certeza que deseja excluir ? '))
	   document.location = 'main.php?cmd=excluir&ID=' + ID;
	},
	
	// Mascara data tamanho,nome
	'Data': function(tamanho,id)
	{
		if (tamanho == 2)
			document.getElementById(id).value += "/";
		if (tamanho == 5)
			document.getElementById(id).value += "/"; 
	}, 
	
	// Mascara telefone tamanho,nome
	'Telefone': function(tamanho,id)
	{
		if (tamanho == 1)
			document.getElementById(id).value = '('+ document.getElementById(id).value; 
		if (tamanho == 3)
			document.getElementById(id).value += ") ";
		if (tamanho == 9)
			document.getElementById(id).value += '-'; 
	},
	'loadCidades': function(uf) {
		//alert(uf);
		loadAjax('load-cidades.php?uf=' + uf, 'divCidade', null, null);
		
	},
	'loadBairros': function(cidade) {
		//alert(cidade);
		loadAjax('load-bairros.php?cidade=' + cidade, 'divBairro', null, null);
		
	},
	
	'Email': function()
	{
		if($('email').value =="" || $('email').value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)
		{
			alert('Você precisa digitar um endereço de e-mail válido ! ')
			$('email').focus();
			return false;
		}	
	},
	
	'login1': function()
	{
		if($('email1').value==""){
			alert('Você precisa digitar seu login ! ')
			$('email1').focus();
			return false;
		}
		
		if($('senha1').value==""){
			alert('Você precisa digitar sua senha ! ')
			$('senha1').focus();
			return false;
		}
	},
	
	'login2': function()
	{
		if($('email2').value == "")
		{
			alert('Você precisa digitar seu email ! ')
			$('email2').focus();
			return false;
		}
		
		if($('senha2').value=="")
		{
			alert('Você precisa digitar sua senha ! ')
			$('senha2').focus();
			return false;
		}
	},

		'login3': function()
	{
		if($('email3').value == "")
		{
			alert('Você precisa digitar seu email ! ')
			$('email3').focus();
			return false;
		}
		
		if($('senha3').value=="")
		{
			alert('Você precisa digitar sua senha ! ')
			$('senha3').focus();
			return false;
		}
	},
	

	'valida': function()
	{
		if($('nome_cliente').value==""){
			alert('Você precisa digitar seu nome ! ')
			$('nome_cliente').focus();
			return false;
		}
		
		if($('endereco').value==""){
			alert('Você precisa digitar seu endereço ! ')
			$('endereco').focus();
			return false;
		}
		
		if($('uf').value==""){
			alert('Você precisa digitar seu estado! ')
			$('uf').focus();
			return false;
		}
		
		if($('id_cidade').value==""){
			alert('Você precisa digitar sua cidade ! ')
			$('id_cidade').focus();
			return false;
		}
		
		if($('id_bairro').value==""){
			alert('Você precisa digitar seu bairro ! ')
			$('id_bairro').focus();
			return false;
		}
		
		if($('rg').value==""){
			alert('Você precisa digitar seu RG ! ')
			$('rg').focus();
			return false;
		}
		
		if($('cpf').value==""){
			alert('Você precisa digitar seu CPF ! ')
			$('cpf').focus();
			return false;
		}
		
		//valida o CPF digitado
		if($('cpf').value != "")
		{
			
			var CPF = $('cpf').value;
			exp = /\.|\-/g
			CPF = CPF.toString().replace( exp, "" );
			
			// Aqui começa a checagem do CPF
			var POSICAO, I, SOMA, DV, DV_INFORMADO;
			var DIGITO = new Array(10);
			DV_INFORMADO = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado
			
			// Desemembra o número do CPF na array DIGITO
			for (I=0; I<=8; I++)
			{
			  DIGITO[I] = CPF.substr( I, 1);
			}
			
			// Calcula o valor do 10º dígito da verificação
			POSICAO = 10;
			SOMA = 0;
		    for (I=0; I<=8; I++)
		    {
			   SOMA = SOMA + DIGITO[I] * POSICAO;
			   POSICAO = POSICAO - 1;
		    }
			DIGITO[9] = SOMA % 11;
		    if (DIGITO[9] < 2) 
		    {
				DIGITO[9] = 0;
			}
		    else
		    {
			   DIGITO[9] = 11 - DIGITO[9];
			}
		
			// Calcula o valor do 11º dígito da verificação
			POSICAO = 11;
			SOMA = 0;
		   	for (I=0; I<=9; I++) 
		   	{
			  SOMA = SOMA + DIGITO[I] * POSICAO;
			  POSICAO = POSICAO - 1;
		    }
			DIGITO[10] = SOMA % 11;
		   	if (DIGITO[10] < 2) 
		   	{
				DIGITO[10] = 0;
		   	}
		   	else 
			{
				DIGITO[10] = 11 - DIGITO[10];
		   	}
		
			// Verifica se os valores dos dígitos verificadores conferem
			DV = DIGITO[9] * 10 + DIGITO[10];
		   if (DV != DV_INFORMADO)
		   {
			  alert('CPF inválido');
			  $('cpf').value = '';
			  $('cpf').focus();
			  return false;
		   } 
	  	}
		
		if($('email').value == "" && $('email').value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
			alert('Você precisa digitar um endereço de e-mail válido ! ')
			$('email').focus();
			return false;
		}
		
		if($('data_nasc').value==""){
			alert('Você precisa digitar sua data de aniversario ! ')
			$('data_nasc').focus();
			return false;
		}
		
		if($('senha').value==""){
			alert('Você precisa digitar sua senha ! ')
			$('senha').focus();
			return false;
		}
		
		if($('fone').value==""){
			alert('Você precisa digitar seu telefone ! ')
			$('fone').focus();
			return false;
		}
	}
}

// usado para campos checkbox na abertura e fechamento de div
//obj = nome do campo cheked
//div = div que abre ou fecha
//campo = caso feche ele zera
function Div(obj,div,campo)
{
	if ($(obj).checked == true)
	{
		$(div).style.display='block';
	}
	else if ($(obj).checked == false)
	{
		$(campo).value ='';
		$(div).style.display='none';
	}
}

//funcao para retorno de valores moeda valor pago e troco
// no onsubmit testa valor do troco e vem setado como 1
// valor = nome do check
// tipo  = seta o valor, se onsubimit vem com 1 e executa verificação de troco
// senão vem com 0 e não e não faz nada
function carrinho(valor,tipo)
{
	//alert(campo);
	var total = valor;
	var dinheiro = 0;
	var cheque = 0;
	var tkeletronico = 0;
	var tkpapel = 0;
	var pago = 0;
	var troco = 0;
	
	if ($('dinheiro').value != "")
	{
		dinheiro = $('dinheiro').value;
		dinheiro = dinheiro.replace(".","");
		dinheiro = dinheiro.replace(",",".");
	}
	
	if ($('tickteletronico').value != "")
	{
		tkeletronico = $('tickteletronico').value;
		tkeletronico = tkeletronico.replace(".","");
		tkeletronico = tkeletronico.replace(",",".");
	}
	
	if ($('ticktpapel').value != "")
	{
		tkpapel = $('ticktpapel').value;
		tkpapel = tkpapel.replace(".","");
		tkpapel = tkpapel.replace(",",".");
	}
	
	if ($('cheque').value != "")
	{
		cheque = $('cheque').value;
		cheque = cheque.replace(".","");
		cheque = cheque.replace(",",".");
	}
	
	pago = Number(dinheiro) + Number(cheque) + Number(tkpapel) + Number(tkeletronico);
	
	troco = pago - total;
	
	//retorna valor formatado com duas casas depois do ponto 
	pago = (Math.round(pago*100))/100; 
	troco = (Math.round(troco*100))/100; 

	//retorna valor formatado com ponto e virgula
	function formataValorMoeda(num) 
	{
	
	   var x = 0;
	
	   if(num<0) {
		  num = Math.abs(num);
		  x = 1;
	   }
	
	   if(isNaN(num)) num = "0";
		  cents = Math.floor((num*100+0.5)%100);
	
	   num = Math.floor((num*100+0.5)/100).toString();
	
	   if(cents < 10) cents = "0" + cents;
		  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			 num = num.substring(0,num.length-(4*i+3))+'.'
				   +num.substring(num.length-(4*i+3));
	
	   ret = num + ',' + cents;
	
	   if (x == 1) 
	   	ret = ' - ' + ret;
	   return ret;
	
	}
		
	$('troco').value = formataValorMoeda(troco);
	$('pago').value = formataValorMoeda(pago);
	
	//verifica troco
	if (tipo == 1)
	{
		if (pago < total)
		{
			alert('O valor do pagamento é inferior ao valor do pedido ! ');
			return false;
		}
		
		if (troco > dinheiro)
		{
			alert('O valor do troco não pode ser superior ao valor pago em dinheiro! ');
			return false;
		}
		
		if($('ckticketpapel').checked == true )
		{
			if($('selectticketpapel').value == "T") 
			{
				alert('Você escolher um ticket papel! ')
				$('selectticketpapel').focus();
				return false;	
			}
		}
		
		if($('cktickteletronico').checked == true )
		{
			if($('selecttickteletronico').value == "T") 
			{
				alert('Você escolher um ticket eletrônico! ')
				$('selecttickteletronico').focus();
				return false;	
			}
		}
		
		if($('ckcheque').checked == true)
		{
			if($('numerobanco').value=="")
			{
				alert('Você precisa digitar o numero do banco ! ')
				$('numerobanco').focus();
				return false;
			}
			
			if($('numeroagencia').value=="")
			{
				alert('Você precisa digitar o numero da agência ! ')
				$('numeroagencia').focus();
				return false;
			}
			
			if($('contacorrente').value=="")
			{
				alert('Você precisa digitar sua conta corrente ! ')
				$('contacorrente').focus();
				return false;
			}
			
			if($('numerocheque').value=="")
			{
				alert('Você precisa digitar o numero do cheque ! ')
				$('numerocheque').focus();
				return false;
			}
			
			if($('c3').value=="")
			{
				alert('Você precisa digitar o campo C3 de seu cheque ! ')
				$('c3').focus();
				return false;
			}
			
			if($('titularcheque').value=="")
			{
				alert('Você precisa digitar o nome do titular ! ')
				$('titularcheque').focus();
				return false;
			}
			
			if($('cpf').value=="")
			{
				alert('Você precisa digitar seu CPF ! ')
				$('cpf').focus();
				return false;
			}
			
						//valida o CPF digitado
			if($('cpf').value != "")
			{
				
				var CPF = $('cpf').value;
				exp = /\.|\-/g
				CPF = CPF.toString().replace( exp, "" );
				
				// Aqui começa a checagem do CPF
				var POSICAO, I, SOMA, DV, DV_INFORMADO;
				var DIGITO = new Array(10);
				DV_INFORMADO = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado
				
				// Desemembra o número do CPF na array DIGITO
				for (I=0; I<=8; I++)
				{
				  DIGITO[I] = CPF.substr( I, 1);
				}
				
				// Calcula o valor do 10º dígito da verificação
				POSICAO = 10;
				SOMA = 0;
			   for (I=0; I<=8; I++)
			   {
				  SOMA = SOMA + DIGITO[I] * POSICAO;
				  POSICAO = POSICAO - 1;
			   }
				DIGITO[9] = SOMA % 11;
			   if (DIGITO[9] < 2) 
			   {
					DIGITO[9] = 0;
		       }
			   else
			   {
				   DIGITO[9] = 11 - DIGITO[9];
			   }
				
				// Calcula o valor do 11º dígito da verificação
				POSICAO = 11;
				SOMA = 0;
			   for (I=0; I<=9; I++) 
			   {
				  SOMA = SOMA + DIGITO[I] * POSICAO;
				  POSICAO = POSICAO - 1;
			   }
				DIGITO[10] = SOMA % 11;
			   if (DIGITO[10] < 2) 
			   {
					DIGITO[10] = 0;
			   }
			   else 
			   {
					DIGITO[10] = 11 - DIGITO[10];
			   }
				
				// Verifica se os valores dos dígitos verificadores conferem
				DV = DIGITO[9] * 10 + DIGITO[10];
			   if (DV != DV_INFORMADO)
			   {
				  alert('CPF inválido');
				  $('cpf').value = '';
				  $('cpf').focus();
				  return false;
			   } 
		   }

			
			if($('bancoano').value=="")
			{
				alert('Você precisa digitar desde quando é cliente do banco ! ')
				$('bancoano').focus();
				return false;
			}
		}
		if(confirm('Seu pedido será enviado e não poderá mais ser alterado.\nVocê confirma?'))
		return true;
		else
		return false;
	
	}
	
}

// para checar tamanho
var Carrega =
{
	'lateral':function(pagina)
	{
		if (screen.availWidth < 1000)
		{
			document.getElementById('auxiliar').style.display = 'none';
			document.getElementById('colLeft2').style.display = 'block';
			document.getElementById('colLeft').style.display = 'none';
			document.getElementById('colRight').style.display = 'none';
			document.getElementById('headerPrincipal').style.width = '775px';
			document.getElementById('imgHeader').style.width = '775px';
			document.getElementById('allContent').style.width = '775px';
			document.getElementById('allContent').style.float = 'left';
			document.getElementById('content').style.width = '775px';
			document.getElementById('footer').style.width = '778px';
			document.getElementById('footer').style.margin = 'auto';
			document.getElementById('footerPrincipal').style.width = '780px';
			if (document.all)
				document.getElementById('colCenter').style.marginLeft = '9px';
			else
				document.getElementById('colCenter').style.marginLeft = '15px';
			
		} 
		else
		{
			document.getElementById('auxiliar').style.display = 'none';
			document.getElementById('colLeft').style.display = 'block';
			document.getElementById('colLeft2').style.display = 'none'; 
		}
	}
}

//-------------------------------------------------------------------------------------------------------------------//

//AJAX GERAL
var reqs = new Array();

function uncache(url)
{
	var d = new Date();
	var time = d.getTime();

	if (new String(url).indexOf("?") < 0)
		strurl = "?";
	else
		strurl = "&";

	url = url + strurl + 'timecache='+time;
	return url;
} 

function CXMLReq(type, xmlhttp, target, func)
{
	this.type = type;
	this.xmlhttp = xmlhttp; 
	this.target = target;
	this.func = func;
}

function mostraLog(msg)
{
	if ($('logErros'))
		$('logErros').innerHTML += msg + '<BR>';
}

function loadAjax(url, target, func, msg) {
	
	//mostraLog('jah: url->' + url + ', target->' + target + ', func->' + func + ', msg->' + msg);
	var xhr = false;
	// native XMLHttpRequest object
	if(msg !== null){
		if(msg)
			mensagem = '<div id="loading"><img src="img/loading.gif" align="absmiddle">&nbsp;' + msg + '</div>';
		else
			mensagem = '<div id="loading"><img src="img/loading.gif" align="absmiddle">&nbsp;Aguarde, carregando...</div>';
	document.getElementById(target).innerHTML = mensagem;
	}
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
		xhr.onreadystatechange = function() {jahDone();};
		xhr.open("GET", url, true);
		xhr.send(null);
		// IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
		if (xhr) {
			xhr.onreadystatechange = function() {jahDone();};
			xhr.open("GET", uncache(url), true);
			xhr.send();
		}
	}
	
	var xmlreq = new CXMLReq('', xhr, target, func);
	reqs.push(xmlreq);
}    

function jahDone() {
	if (typeof(window['reqs']) == "undefined") return;
	// only if req is "loaded"
	for (var req=0; req<reqs.length; req++)
	{
		if (reqs[req].xmlhttp.readyState == 4) {
			// only if "OK"
			results = reqs[req].xmlhttp.responseText;
			target = reqs[req].target;
			func = reqs[req].func;
			statusText = reqs[req].xmlhttp.statusText;
			if (reqs[req].xmlhttp.status == 200 || reqs[req].xmlhttp.status == 304) {
				reqs.splice(req,1); req --;
				var o = document.getElementById(target);
				o.innerHTML = results;
				if (haveJS(o))
					execJS(o);
				if (func)
					eval(func);
			} else {
				$(target).innerHTML="jah erro:\n" + statusText;
				reqs.splice(req,1); req --;
			}
		}
	}
}

var bSaf = (navigator.userAgent.indexOf('Safari') != -1);
var bMoz = (navigator.appName == 'Netscape');

function haveJS(node)
{
  var st = node.getElementsByTagName('SCRIPT');
  if (st.length > 0)
  	return true;
  else
    return false;
}

function execJS(node) 
{
  var st = node.getElementsByTagName('SCRIPT');
  var strExec;
  for(var i=0;i<st.length; i++) {
	if (bSaf) {
	  strExec = st[i].innerHTML;
	}
	else if (bMoz) {
	  strExec = st[i].textContent;
	}
	else {
	  strExec = st[i].text;
	}
	try {
	  //mostraLog('chamando isso:' + strExec);
	  eval(strExec);
	} catch(e) {
	  alert(strExec);
	  if (window.ActiveXObject)
		  alert(e.description);
	  else
	  	  alert(e);
	}
  }
}


