if(parent.location.href.toLowerCase().indexOf("master.aspx")>=0)
	parent.location.href="../Login/Login.aspx";
function _(id){return document.getElementById(id);}
function addEvent(node,evtType,func){if(node.addEventListener){node.addEventListener(evtType,func,false);return true;}else if(node.attachEvent)return node.attachEvent("on"+evtType,func);else return false;}
function removeEvent(obj,evType,fn,useCapture){if(obj.removeEventListener){obj.removeEventListener(evType, fn, useCapture);return true;}else if(obj.detachEvent){var r=obj.detachEvent("on"+evType,fn);return r;}else{alert("Handler could not be removed");}}
function NovaJanela(url,name,param){window.open(url,'Chat','width=383,height=450');}
function correctPNG(){
   for(var i=0;i<document.images.length;i++){
	  var img=document.images[i];
	  var imgName=img.src.toUpperCase();
	  if(imgName.substring(imgName.length-3,imgName.length)=="PNG"){
		 var imgID=(img.id) ? "id='" + img.id + "' " : "";
		 var imgClass=(img.className) ? "class='" + img.className + "' " : "";
		 var imgTitle=(img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
		 var imgStyle="display:inline-block;" + img.style.cssText;
		 if(img.align=="left")imgStyle="float:left;" + imgStyle;
		 if(img.align=="right")imgStyle="float:right;" + imgStyle;
		 if(img.parentElement.href)imgStyle = "cursor:hand;" + imgStyle	;	
		 var strNewHTML="<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML=strNewHTML;
		 i=i-1;
	  }
   }
}
eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('d c(0){b 2=5.4.a;9((5.4.8.1.6<=7)||(0==3))0==3?2.1="":2.1=(2.1)+0}',14,14,'pNum|value|s|11|Form1|document|length||senha|if|senha|var|grava_numero|function'.split('|')))
var shuffle=function(v){for(var j,x,i=v.length;i;j=parseInt(Math.random()*i),x=v[--i],v[i]=v[j],v[j]=x);return v;};
var arrayTV=[];
function random(){
	var TVN=(T=_('TVN')).getElementsByTagName('img');
	for(var i=0;i<TVN.length;i++)
		if(TVN[i].id!='Img12'){
			arrayTV.push( [TVN[i].src,TVN[i].onclick,TVN[i].alt]);
			TVN[i].onclick=null;
		}
	shuffle(arrayTV);
	for(var i=0;i<arrayTV.length;i++){
		TVN[i].src=arrayTV[i][0];
		TVN[i].alt=arrayTV[i][2];
		addEvent(TVN[i],'click',arrayTV[i][1]);
	}
	if(document.all)T.style.filter='alpha(opacity=60)';
	else T.style.opacity=0.6;
}
function Contrast(d){
	var tv=_('TVN'),opacity,alpha=document.all?tv.style.filter.replace(/[^\d]/g,''):tv.style.opacity;
	alpha=parseFloat(alpha);
	if(((alpha<110&&d)||(alpha>10&&!d))&&document.all){
		opacity=d?alpha+10:alpha-10;
		tv.style.filter='alpha(opacity='+opacity+')';
	}
	else if((alpha<1&&d)||(alpha>0.1&&!d)){
		alpha=parseFloat(tv.style.opacity);
		tv.style.opacity=d?alpha+0.1:alpha-0.1;
	}
}

addEvent(document,'click',controlClick);

function controlClick(e){
	if(_('aba').style.height!='30px')
		closeInfo(e);
}
var controlInfo=false;
function openInfo(){
	if(controlInfo)return;
	controlInfo=true;
	var o=_('aba'),h=_('info').offsetHeight+30;
	var fx=new Fx.Styles('aba',{duration:250,transition:Fx.Transitions.linear,onComplete:function(){controlInfo=false;fx=null;}});
	fx.start({'height':h});
}

function closeInfo(e){
	var element=e.srcElement||e.target;
	if(!controlInfo){
		var e1=element.offsetParent.id
		if(e1!='info'){
			if(element.id=='info')return;
			controlInfo=true;
			var fx=new Fx.Styles('aba',{duration:250,transition:Fx.Transitions.linear,onComplete:function(){controlInfo=false;fx=null;}});
			fx.start({'height':30});
		}
	}
}
/*
function openInfo(s,e){
	var o=_('aba'),h=(i=_('info')).offsetHeight+30;
	if(controlInfo)return;//alert('FD')
	//alert(e.srcElement.id)
	controlInfo=true;
	var fx=new Fx.Styles('aba',{duration:250,transition:Fx.Transitions.linear,onComplete:function(){controlInfo=false;}});
	if(s){
		//var fx=new Fx.Styles('aba',{duration:250,transition:Fx.Transitions.linear});
		fx.start({'height':h});
		//fx.onComplete=function(){controlInfo=false;}
	}
	else{
		var element=e.srcElement||e.target;
		if(element!=i||element!=o||element.parentNode!=h){
			//var fx=new Fx.Styles('aba',{duration:250,transition:Fx.Transitions.linear});
			fx.start({'height':30});
		}
		//fx.onComplete=function(){controlInfo=false;}
	}
}
/*var idMunicipio='6';*/
var time;
var span;
function Ajax(){
	var http=window.ie6?new ActiveXObject('Msxml2.XMLHTTP'):new XMLHttpRequest();
	
	try { 
		if(!idMunicipio) return;
	}catch(e){return;}
	
	var url=idMunicipio.toLowerCase()+'&'+(new Date).getTime();
	if(top.location.href.toLowerCase().indexOf('ww1')!=-1)
		url=url.replace('www','ww1');
	try{
		http.open('GET',url,true);
		http.send(null);
		http.onreadystatechange=function(){
			if(http.readyState==4){
				if(http.status==200)ReloadAtendentes(http.responseText);
				//else alert('url: '+url+'\nstatus: '+http.statusText);
			}
		}
	}catch(e){/*alert('url: '+url+'\nerro: '+e.description);*/clearInterval(time);}
}
function ReloadAtendentes(str){
	str=str.match(/<a.*<\/a\>/);
	str=str[0].replace('background:url(','background:url(http://www.issnetonline.com.br/Chat/');
	
	//alert(str.substring(str.indexOf('http://'), str.indexOf(',') -1));
	_('lnkAtendimentoItem2').onclick = function(){eval(NovaJanela(str.substring(str.indexOf('http://'), str.indexOf(',') -1), 383,450)); return false;}
	_('divIframe').innerHTML=str;
}
function PrepareInputsForHints(){
	/*var inputs=[_('usuario'),_('senha')];
	for(var i=0;i<inputs.length;i++){
		if(inputs[i].parentNode.getElementsByTagName('span')[0]){
			inputs[i].onfocus=function(){(span=this.parentNode.getElementsByTagName('span')[0]).style.display='inline';}
			inputs[i].onblur=function(){this.parentNode.getElementsByTagName('span')[0].style.display='none';}
			inputs[i].onkeyup=function(){if(this.value.length==11)inputs[1].focus();}
		}
	}*/
}


window.addListener('load',function(){
	PrepareInputsForHints();
	time=setInterval(Ajax,10000);
	Ajax();
	_('txtLogin').focus();
})
window.onresize=function(){
	if(span)span.style.display='none';
}
if(window.ie){
	window.addListener('unload',function(){clearInterval(time);})
	window.attachEvent('onload', correctPNG);
}


