function tvCondor(id) {
	var combo_tv = document.getElementById('tvcondor_id');

	for(var i=0; i<combo_tv.length; i++) {
	document.getElementById('tvcondor_'+combo_tv[i].value).style.display = 'none';
	}

	document.getElementById('tvcondor_'+id).style.display = 'block';
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.display = document.layers ? (iState ? "show" : "hide") :
   (iState ? "block" : "none");
}

function popup(url, name, width, height)
{
   var str = "height=" + height + ",innerHeight=" + height;
		str += ",width=" + width + ",innerWidth=" + width;
		str += ",status=no,scrollbars=yes,resizable=no";
		  if (window.screen)
		{
				var ah = screen.availHeight - 30;
				var aw = screen.availWidth - 10;
				var xc = (aw - width) / 2;
				var yc = (ah - height) / 2;

				str += ",left=" + xc + ",screenX=" + xc;
				str += ",top=" + yc + ",screenY=" + yc;
		}
		var win = window.open(url, name, str);
}

function mensagemIniciar(imageLink) {

	hideSelectBoxes();

	// stretch overlay to fill page and fade in
	var arrayPageSize = getPageSize();
	Element.setHeight('overlay', arrayPageSize[1]);
	new Effect.Appear('overlay', { duration: 0.2, from: 0.0, to: 0.8 });

	imageArray = [];
	imageNum = 0;

	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName('a');

	// if image is NOT part of a set..
	if((imageLink.getAttribute('rel') == 'lightbox')){
		// add single image to imageArray
		imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
	} else {
	// if image is part of a set..

		// loop through anchors, find other images in set, and add them to imageArray
		for (var i=0; i<anchors.length; i++){
			var anchor = anchors[i];
			if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
				imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
			}
		}
		imageArray.removeDuplicates();
		while(imageArray[imageNum][0] != imageLink.getAttribute('href')) { imageNum++;}
	}

	// calculate top offset for the lightbox and display
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);

	Element.setTop('lightbox', lightboxTop);
	Element.show('lightbox');

	this.changeImage(imageNum);
}

function mensagemAlerta() {
	var arrayPageSize = getPageSize();
	Element.setHeight('overlay', arrayPageSize[1]);
}

function mensagemTamanho(imgWidth, imgHeight) {

		// get current height and width
		this.wCur = Element.getWidth('outerTextContainer');
		this.hCur = Element.getHeight('outerTextContainer');

		// scalars based on change from old to new
		this.xScale = ((imgWidth  + (borderSize * 2)) / this.wCur) * 100;
		this.yScale = ((imgHeight  + (borderSize * 2)) / this.hCur) * 100;

		// calculate size difference between new and old image, and resize if necessary
		wDiff = (this.wCur - borderSize * 2) - imgWidth;
		hDiff = (this.hCur - borderSize * 2) - imgHeight;

		if(!( hDiff == 0)){ new Effect.Scale('outerTextContainer', this.yScale, {scaleX: false, duration: resizeDuration, queue: 'front'}); }
		if(!( wDiff == 0)){ new Effect.Scale('outerTextContainer', this.xScale, {scaleY: false, delay: resizeDuration, duration: resizeDuration}); }

		// if new and old image are same size and no scaling transition is necessary,
		// do a quick pause to prevent image flicker.
		if((hDiff == 0) && (wDiff == 0)){
			if (navigator.appVersion.indexOf("MSIE")!=-1){ pause(250); } else { pause(100);}
		}

		// Element.setHeight('prevLink', imgHeight);
		// Element.setHeight('nextLink', imgHeight);
		// Element.setWidth( 'imageDataContainer', imgWidth + (borderSize * 2));

		this.showImage();
	}
	function passaCEP() {
		// 0 e 1 para os 2 campos hiddens do form calculaCep
		var cep = document.getElementById('usuario_cepres_left').value;

		if (cep.length==5) {
			document.getElementById('usuario_cepres_right').value='';
			document.getElementById('usuario_cepres_right').focus();
			return false;
		}
	}
	function passaCartao1() {
		// 0 e 1 para os 2 campos hiddens do form calculaCep
		var cep = document.getElementById('digitos1').value;

		if (cep.length==4) {
			document.getElementById('digitos2').value='';
			document.getElementById('digitos2').focus();
			return false;
		}
	}
	function passaCartao2() {
		// 0 e 1 para os 2 campos hiddens do form calculaCep
		var cep = document.getElementById('digitos2').value;

		if (cep.length==4) {
			document.getElementById('digitos3').value='';
			document.getElementById('digitos3').focus();
			return false;
		}
	}
	function passaCartao3() {
		// 0 e 1 para os 2 campos hiddens do form calculaCep
		var cep = document.getElementById('digitos3').value;

		if (cep.length==4) {
			document.getElementById('digitos4').value='';
			document.getElementById('digitos4').focus();
			return false;
		}
	}
