function MM_reloadPage(init) {
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
} MM_reloadPage(true);
function MM_findObj(n, d) { 
	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_showHideLayers() { 
	var i,p,v,obj,args=MM_showHideLayers.arguments;    
	for (i=0; i<(args.length-2); i+=3) 
		if ((obj=MM_findObj(args[i]))!=null) { 
			v=args[i+2];      
			if (obj.style) {
				obj=obj.style; 
				v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
			}
			obj.visibility=v; 
		}
	}

function abre(url,janela,larg,alt,pos1,pos2) {
	window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
function abre2(url,janela,larg,alt,pos1,pos2) {
	window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
function abre3(url,janela,larg,alt,pos1,pos2) {
	window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,top="+pos1+",left="+pos2+",screenY="+pos1+",screenX="+pos2+",width="+larg+",height="+alt);
}
function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features)}
function validacampos(){
if(document.ins.inome.value.length==""
|| document.ins.iendereco.value.length==""
|| document.ins.ibairro.value.length==""
|| document.ins.ipagamento.value.length==""
|| document.ins.icep.value.length==""
|| document.ins.icid.value.length==""
|| document.ins.iuf.value.length==""
|| document.ins.icpf.value.length==""
|| document.ins.irg.value.length==""
|| document.ins.iddd1.value.length==""
|| document.ins.itel1.value.length==""
|| document.ins.iemail.value.length==""
|| document.ins.iprofissao.value.length==""
|| document.ins.iempresa.value.length=="")
{
alert("ATENÇÃO: todos os campos são obrigatórios. As exceções estão assinaladas abaixo do campos.");
return false;}
else{
return true;}
}

function esconde (id) {
	e=document.getElementById(id);
	e.style.display = 'none';
}
function mostra (id) {
	e=document.getElementById(id);
	e.style.display = 'block';
}
function changeDisplayState (id) {
	e=document.getElementById(id);
	if (e) {
		if (e.style.display == 'none' || e.style.display == "") {
		e.style.display = 'block';
		} else {
		e.style.display = 'none';
		}
	}
}

function posicao(fonte, modo, elemento_imagem) {
	elemento_testa = document.getElementById('div_foto')
		if (!elemento_testa) {
			elemento_cria = document.createElement('div');
			elemento_cria.id = "div_foto"
			elemento_cria.innerHTML = "&nbsp;"
			document.getElementById('miolo').appendChild(elemento_cria);
		}
	elemento_testa = document.getElementById('img_foto')
		if (!elemento_testa) {
			elemento_cria = document.createElement('img');
			elemento_cria.id = "img_foto"
			document.getElementById('miolo').appendChild(elemento_cria);
		}
	elemento_testa = document.getElementById('img_foto_carregando')
		if (!elemento_testa) {
			elemento_cria = document.createElement('img');
			elemento_cria.src = "http://www.satc.edu.br/satc/imagens/galerias/1/Abadeus1.jpg"
			elemento_cria.id = "img_foto_carregando"
			document.getElementById('miolo').appendChild(elemento_cria);
		}
	elemento_testa = document.getElementById('div_fechar')
		if (!elemento_testa) {
			elemento_cria = document.createElement('div');
			elemento_cria.innerHTML = "<a href=\"javascript:void(0)\" onclick=\"javascript:fechar()\"><img src=\"../imagens/galerias/botao_fechar.jpg\"/></a>"
			elemento_cria.id = "div_fechar"
			document.getElementById('miolo').appendChild(elemento_cria);
		}
	elemento_testa = document.getElementById('div_vai_volta')
		if (!elemento_testa) {
			elemento_cria = document.createElement('div');
			elemento_cria.innerHTML = "<a href=\"javascript:void(0)\" onclick=\"javascript:fechar()\"><img src=\"../imagens/galerias/botao_traz.jpg\"/></a><a href=\"javascript:void(0)\" onclick=\"javascript:fechar()\"><img src=\"imagens/galerias/botao_frente.jpg\"/></a>"
			elemento_cria.id = "div_vai_volta"
			document.getElementById('miolo').appendChild(elemento_cria);
		}
	window.onscroll = function() { posicao('', 'posiciona') }
	if (modo == 'posiciona' && document.getElementById('div_foto').style.display != 'block') {
		return
	}
	if( typeof( window.innerWidth ) == 'number' ) {
		altura_pagina = window.innerHeight;
		largura_pagina = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		altura_pagina = document.documentElement.clientHeight;
		largura_pagina = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		altura_pagina = document.body.clientHeight;
		largura_pagina = document.body.clientWidth;
	}
	scroll_pagina = document.documentElement.scrollTop;

	elemento = document.getElementById('div_foto')
	elemento.style.width = largura_pagina+"px"
	//elemento.style.height = altura_pagina+"px"
	//elemento.style.top = scroll_pagina+"px"
	elemento.style.height = document.body.clientHeight+"px"

	document.getElementById('img_foto_carregando').style.display = "block"
	document.getElementById('div_foto').style.display = "block"

	imagem_carregando = document.getElementById('img_foto_carregando')
	imagem_carregando.onload = function() {
		altura_pagina = eval(altura_pagina)
		largura_pagina = eval(largura_pagina)
		scroll_pagina = eval(scroll_pagina)
		altura_imagem = this.height
		largura_imagem = this.width
		this.style.left = (largura_pagina/2) - (largura_imagem/2).toFixed(0) + 'px'
		this.style.top = ((altura_pagina/2) - (altura_imagem/2).toFixed(0) + scroll_pagina) + 'px'
	}
	imagem_carregando.src = "http://www.satc.edu.br/portais/imagens/ajax-loader.gif"

	imagem = document.getElementById('img_foto')
	imagem.onclick = function() {
		fechar()
	}
	imagem.onload = function() {
		document.getElementById('img_foto').style.display = "block"
		altura_pagina = eval(altura_pagina)
		largura_pagina = eval(largura_pagina)
		scroll_pagina = eval(scroll_pagina)
		altura_imagem = this.height
		largura_imagem = this.width
		if (altura_imagem + 50 > altura_pagina) {
			altura_imagem = altura_pagina-50
			this.style.height = altura_imagem
			largura_imagem = this.width
			this.onclick = function() { window.open(this.src) }
		}
		this.style.left = (largura_pagina/2) - (largura_imagem/2).toFixed(0) + 'px'
		this.style.top = ((altura_pagina/2) - (altura_imagem/2).toFixed(0) +scroll_pagina) + 'px'

		div_fecha = document.getElementById('div_fechar')
		div_fecha.style.display = "block"
		div_fecha.style.left = ( (largura_pagina/2) - (largura_imagem/2).toFixed(0) +largura_imagem - 100) + 'px'
		div_fecha.style.top = (((altura_pagina/2) - (altura_imagem/2).toFixed(0) +scroll_pagina) + altura_imagem) + 'px'

		div_vaivolta = document.getElementById('div_vai_volta')
		div_vaivolta.style.display = "block"
		div_vaivolta.style.left = ( (largura_pagina/2) - (largura_imagem/2).toFixed(0) ) + 'px'
		div_vaivolta.style.top = (((altura_pagina/2) - (altura_imagem/2).toFixed(0) +scroll_pagina) + altura_imagem) + 'px'

		document.getElementById('img_foto_carregando').style.display = "none"
	}
	imagem.style.cursor = "pointer"

	if (modo == 'posiciona') 
		imagem.src = imagem.src
	else 
		imagem.src = fonte

	if (elemento_imagem) {
		anterior_link = document.getElementById('div_vai_volta').childNodes[0]
		proxima_link = document.getElementById('div_vai_volta').childNodes[1]
		anterior = elemento_imagem.previousSibling
		proxima = elemento_imagem.nextSibling

		anterior_link.onclick = function() { null }
		proxima_link.onclick = function() { null }
		
		if (anterior) {
			if (anterior.tagName == 'IMG') {
				anterior_link.onclick = function() { posicao(anterior.src, null, anterior) }
			}
		} 
		if (proxima) {
			if (proxima.tagName == 'IMG') {
				proxima_link.onclick = function() { posicao(proxima.src, null, proxima) }
			}
		} 
	}
}
function fechar() {
	document.getElementById('div_fechar').style.display = "none"
	document.getElementById('div_vai_volta').style.display = "none"
	document.getElementById('img_foto_carregando').style.display = "none"
	document.getElementById('img_foto').style.display = "none"
	document.getElementById('div_foto').style.display = "none"
	window.onscroll = function() { void(0) }
}
var bo_ns_id = 0;

function startIeFix(){
  if(isIE()){
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}

function endIeFix(){
  if(isIE()){
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
    document.write(theCode);
  }
}

function isIE(){
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }else{
    return false;
  }
}


function mostra_dia(data) {
	if( typeof( window.innerWidth ) == 'number' ) {
		altura_pagina = window.innerHeight;
		largura_pagina = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		altura_pagina = document.documentElement.clientHeight;
		largura_pagina = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		altura_pagina = document.body.clientHeight;
		largura_pagina = document.body.clientWidth;
	}
	elemento_testa = document.getElementById('janela_calendario')
	variavel_html = "<div id='janela_calendario_'>casa"+data+"</div>"
	if (!elemento_testa) {
		elemento_cria = document.createElement('div');
		elemento_cria.innerHTML = variavel_html
		elemento_cria.id = "janela_calendario"
		document.getElementById('miolo').appendChild(elemento_cria);
	} else {
		elemento_testa.innerHTML = variavel_html
		elemento_testa.style.display = 'block'
	}
	elemento_testa = document.getElementById('div_foto')
	if (!elemento_testa) {
		elemento_cria = document.createElement('div');
		elemento_cria.id = "div_foto"
		elemento_cria.innerHTML = "&nbsp;"
		document.getElementById('miolo').appendChild(elemento_cria);
	}
	elemento = document.getElementById('div_foto')
	elemento.style.width = largura_pagina+"px"
	elemento.style.height = document.body.clientHeight+"px"
	document.getElementById('div_foto').style.display = "block"
	pega('http://www.portalsatc.com/satcportal/site/calendario/calendario_home.asp', 'janela_calendario_', 'detalhe', '', data)
}

function muda_mes(data) { 
	//alert('muda mes!');
	if (document.getElementById('calendario')) {
		/*pega('http://www.portalsatc.com/satcportal/site/calendario/calendario_home.asp', 'calendario', 'calendario', '', data)*/
		pega('calendario/calendario_home.asp', 'calendario', 'calendario', '', data)
	}
}

function pega(url, elemento, modo, form) {
	
	//alert(url);
	//alert(elemento);
	//alert(modo);
	//alert(form);
	
	var tamanho_anterior;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Navegador não Suportado")
		return;
	} 
	tabnumero=""+elemento;
	var url = url;
	url +="?modo="+modo;
	url +='&variavel_contra_cache='+Math.floor(Math.random()*11)+Date();
	url +=""+form;
	var elements = new Array();
	var variavel = "";
	var contador = 0;
	for (var i = 4; i < arguments.length; i++) {
		contador +=1;
		variavel +="&d"+contador+"="+arguments[i]
	}
	url +=variavel;
	url_envia_email = url
	e=document.getElementById(tabnumero);
	tamanho_anterior = e.offsetHeight;
	html_anterior = e.innerHTML;
	if (tamanho_anterior == 0) 
		tamanho_anterior = 25
	e.style.height = tamanho_anterior+"px";
	e.style.display = 'block';
	e.innerHTML="<div style='height: "+tamanho_anterior+"px; line-height: "+tamanho_anterior+"px; margin: auto;'><center><img src='../site/imagens/carregando.gif' alt='Carregando...'/></center></div>";
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	return 
}

function stateChanged()  { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById(tabnumero).innerHTML=xmlHttp.responseText 
		setTimeout("ajusta_janela()",20);
	} 
} 

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
return objXMLHttp
}

function ajusta_janela() {
	ajusta_janela2()
}
function ajusta_janela2() {
	if (document.getElementById('janela_calendario')) {
		if( typeof( window.innerWidth ) == 'number' ) {
			altura_pagina = window.innerHeight;
			largura_pagina = window.innerWidth;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			altura_pagina = document.documentElement.clientHeight;
			largura_pagina = document.documentElement.clientWidth;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			altura_pagina = document.body.clientHeight;
			largura_pagina = document.body.clientWidth;
		}
		largura_janela = document.getElementById('janela_calendario').offsetWidth;
		document.getElementById('janela_calendario_').style.overflow = 'hidden';
		document.getElementById('janela_calendario_').style.height = 'auto';
		altura_janela = document.getElementById('janela_calendario').offsetHeight;
		if ((altura_janela)>altura_pagina) {
			tamanho_janela = document.getElementById('janela_calendario').offsetHeight - 
			document.getElementById('janela_calendario_').offsetHeight; 
			document.getElementById('janela_calendario_').style.overflow = 'auto';
			document.getElementById('janela_calendario_').style.height = ((altura_pagina-tamanho_janela)-15)+'px';
			altura_janela = document.getElementById('janela_calendario').offsetHeight;
		}
		else {
			document.getElementById('janela_calendario_').style.overflow = 'hidden';
			document.getElementById('janela_calendario_').style.height = 'auto';
		}
	
		if (largura_janela>largura_pagina-10) {
			document.getElementById('janela_calendario').style.width=largura_pagina-20+"px";
		}
		scroll_pagina = document.documentElement.scrollTop;
		if(typeof(window.pageYOffset) == 'number' ) {scroll_pagina = window.pageYOffset}
		
		style_left = ((largura_pagina/2) - (largura_janela/2)) + 'px';
		style_top = (((altura_pagina/2) - (altura_janela/2)) + scroll_pagina) + 'px';
		document.getElementById('janela_calendario').style.left = style_left;
		document.getElementById('janela_calendario').style.top = style_top;
		//ShowPopupDiv('janela');
	}
}




//adaptado de http://www.tvzura.com.br/cadastro.jsp
function mascara(field, sMask, evtKeyPress) {
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	if(document.all) { 
		nTecla = evtKeyPress.keyCode; }
	else {
		nTecla = evtKeyPress.which;
	}
	sValue = field.value;
	sValue = sValue.toString().replace(/\-/g, "");
	sValue = sValue.toString().replace(/\./g, "");
	sValue = sValue.toString().replace(/\//g, "");
	sValue = sValue.toString().replace(/\(/g, "");
	sValue = sValue.toString().replace(/\)/g, "");
	sValue = sValue.toString().replace(/\s/g, "");
	sValue = sValue.toString().replace(/\,/g, "");
	fldLen = sValue.length;
	mskLen = sMask.length;
	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;
	if (nTecla !=8){
	   while (i <= mskLen) {
		  bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ","))
		  bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
	
		  if (bolMask) {
			 sCod += sMask.charAt(i);
			 mskLen++; 
		  } else {
			 sCod += sValue.charAt(nCount);
		     nCount++;
		  }
	       i++;
	   }	
		
	   field.value = sCod;
	}
	if (nTecla != 8) { 
		if (sMask.charAt(i-1) == "9") { 
			return ((nTecla > 47) && (nTecla < 58)); 
		} 
		else { 
			return true;
		} 
	} else {
		return true;
	}
}

/* DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */
var dtCh= "/";
var minYear=1893;
var maxYear=2100;
function isInteger(s){
	var i;
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
	return true;
}
function stripCharsInBag(s, bag){
	var i;
	var returnString = "";
	for (i = 0; i < s.length; i++){   
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}
function daysInFebruary (year){
	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}
function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	day=parseInt(strMonth)
	month=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("O formato de Data deve ser : dd/mm/aaaa")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Por favor entre com um mês válido")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Por favor entre com um dia válido")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Por favor entre com um ano de 4 digitos entre "+minYear+" e "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Por davor entre com uma data válida")
		return false
	}
return true
}


//Animated Collapsible DIV- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated June 27th, 07'. Added ability for a DIV to be initially expanded.
var uniquepageid=window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, "")

function animatedcollapse(divId, animatetime, persistexpand, initstate){
	this.divId=divId
	this.divObj=document.getElementById(divId)
	this.divObj.style.overflow="hidden"
	this.timelength=animatetime
	this.initstate=(typeof initstate!="undefined" && initstate=="block")? "block" : "contract"
	this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId)
	this.contentheight=parseInt(this.divObj.offsetHeight)
	var thisobj=this
	if (isNaN(this.contentheight)){ 
		animatedcollapse.dotask(window, function(){thisobj._getheight(persistexpand)}, "load")
		if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes") 
			this.divObj.style.visibility="hidden" 
	}
	else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes") 
		this.divObj.style.height=0 
	if (persistexpand)
		animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload")
}

animatedcollapse.prototype._getheight=function(persistexpand){
	this.contentheight=this.divObj.offsetHeight
	if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes"){ 
		this.divObj.style.height=0 
		this.divObj.style.visibility="visible"
	}
	else 
		this.divObj.style.height=this.contentheight+"px"
}

animatedcollapse.prototype._slideengine=function(direction){
	var elapsed=new Date().getTime()-this.startTime //get time animation has run
	var thisobj=this
	if (elapsed<this.timelength){ //if time run is less than specified length
		var distancepercent=(direction=="down")? animatedcollapse.curveincrement(elapsed/this.timelength) : 1-animatedcollapse.curveincrement(elapsed/this.timelength)
	this.divObj.style.height=distancepercent * this.contentheight +"px"
	this.runtimer=setTimeout(function(){thisobj._slideengine(direction)}, 10)
	}
	else{ //if animation finished
		this.divObj.style.height=(direction=="down")? this.contentheight+"px" : 0
		this.isExpanded=(direction=="down")? "yes" : "no" //remember whether content is expanded or not
		this.runtimer=null
	}
}

animatedcollapse.prototype.slidedown=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			void(0)
		else if (parseInt(this.divObj.style.height)==0){ //if content is collapsed
			this.startTime=new Date().getTime() //Set animation start time
			this._slideengine("down")
		}
	}
}

animatedcollapse.prototype.slideup=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			void(0)
		else if (parseInt(this.divObj.style.height)==this.contentheight){ //if content is expanded
			this.startTime=new Date().getTime()
			this._slideengine("up")
		}
	}
}

animatedcollapse.prototype.slideit=function(casa){
	if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
		void(0)
	else if (parseInt(this.divObj.style.height)==0)
	{
		this.slidedown()
	}

	else if (parseInt(this.divObj.style.height)==this.contentheight)
	{
		this.slideup()
	}
}

animatedcollapse.curveincrement=function(percent){
	return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
}

animatedcollapse.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
}

animatedcollapse.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

animatedcollapse.setCookie=function(name, value, days){
	if (typeof days!="undefined"){ //if set persistent cookie
		var expireDate = new Date()
		var expstring=expireDate.setDate(expireDate.getDate()+days)
		document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()
	}
	else //else if this is a session only cookie
		document.cookie = name+"="+value
}
