﻿var texto;
var dc;
var mover_x = 0;
var mover_y = 0;
var contador = 0;
var step = 10;

function lugar() {
	if (window.innerWidth) {
		var tam_x = (((window.innerWidth - 320) / 2) - 150) + 320;
		var tam_y = ((window.innerHeight - 10) - 250);
	}
	else {
		var tam_x = (((document.documentElement.clientWidth - 320) / 2) - 150) + 320;
		var tam_y = ((document.documentElement.clientHeight - 10) - 250);
	}
	document.getElementById('prop2').style.left = '-' + (tam_x - 2) + 'px';
	document.getElementById('prop2').style.top = (tam_y - 2) + 'px';
	setTimeout("lugar()", 100);
}
function direr() {
	if (window.innerWidth) {
		var tam_x = (((window.innerWidth - 320) / 2) - 150) + 320;
		var tam_y = ((window.innerHeight - 10) - 250);
	}
	else {
		var tam_x = (((document.documentElement.clientWidth - 320) / 2) - 150) + 320;
		var tam_y = ((document.documentElement.clientHeight - 10) - 250);
	}
	document.getElementById('prop2').style.left = '-' + (tam_x - 2) + 'px';
	document.getElementById('prop2').style.top = (tam_y - 2) + 'px';
	contador = 100;
}
function move() {
	if (window.innerWidth) {
		var tam_x = (((window.innerWidth - 320) / 2) - 150) + 320;
		var tam_y = ((window.innerHeight - 10) - 250);
	}
	else {
		var tam_x = (((document.documentElement.clientWidth - 320) / 2) - 150) + 320;
		var tam_y = ((document.documentElement.clientHeight - 10) - 250);
	}
	mover_x = mover_x + (tam_x / step);
	mover_y = mover_y + (tam_y / step);
	if (tam_x <= mover_x) {
		document.getElementById('prop2').style.left = '-' + (tam_x - 2) + 'px';
		document.getElementById('prop2').style.top = (tam_y - 2) + 'px';
		contador = 100;
	}
	else {
		document.getElementById('prop2').style.left = '-' + mover_x + "px";
		document.getElementById('prop2').style.top = mover_y + "px";
	}
}
function conta() {
	if (contador >= 100) {
		lugar();
		document.getElementById('prop').style.visibility = "hidden";
		document.getElementById('flash').style.height = "100%";
		document.getElementById('flash').style.visibility = "visible";
		document.getElementById('link').style.display = "block";
	}
	if (contador >= 30) {
		document.getElementById('aqui').style.visibility = "visible";
	}
	document.getElementById('cont').innerHTML = contador + "%";
	if (contador < 200) {
		contador = contador + 2;
		document.getElementById('barr').style.marginLeft = contador + "%";
		setTimeout("conta()", 150);
		if (contador >= 80) {
			setTimeout("move()", 1);
		}
	}
}

function ocultar() {
	document.getElementById('barra').style.visibility = "hidden";
	document.getElementById('prop2').style.visibility = "hidden";
	document.getElementById('prop3').style.visibility = "hidden";
	document.getElementById('barra').style.display = "none";
	document.getElementById('mostrar').style.visibility = "visible";
	document.getElementById('flash2').style.marginLeft = "13px";
}
function mostra() {
	document.getElementById('barra').style.visibility = "visible";
	document.getElementById('barra').style.display = "block";
	document.getElementById('mostrar').style.visibility = "hidden";
	document.getElementById('flash2').style.marginLeft = "320px";
	document.getElementById('prop2').style.visibility = "visible";
	document.getElementById('prop3').style.visibility = "visible";
}
function mais() {
	dc.innerHTML = "<label id='lb1'>" + texto + " <a class='Pq' style='color:blue; cursor: pointer;' onclick='label_load();'><br/><< menos informações<\a> " + "</label>";
}
function label_load() {
	if (contador < 100)
		conta();
	dc = document.getElementById('desc');
	texto = dc.innerHTML;
	//alert(texto);
	texto = texto.replace('<', '');
	texto = texto.slice(texto.search('>') + 1, texto.search('<'));
	//window.alert(texto);
	if (texto.length > 100) {
		dc.innerHTML = "<label id='lb1' >" + texto.slice(0, 100) + "... <a class='Pq' style='color:blue; cursor: pointer;'  onclick='mais()'> <br/>mais informações >><\a> " + "</label>";
	}
	dc.style.visibility = "visible";
	dc.style.height = "auto";
}
