var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

var pageTracker = _gat._getTracker("UA-6330517-1");
pageTracker._trackPageview();

// função da popup
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// função imprimir
function imprimir() { //v2.0
  window.print();
}

// cria uma função somente com objetos Microsoft
function criarObjMSXMLHttp() {
	var versoes = ["MSXML2.XMLHttp.6.0",
					"MSXML2.XMLHttp.5.0",
					"MSXML2.XMLHttp.4.0", "MSXML2.XMLHttp.3.0",
					"MSXML2.XMLHttp", "Microsoft.XMLHttp"
					];
	for (var i = 0; i< versoes.length; i++) {
		try {
			var objetoXMLHttp = new ActiveXObject(versoes[i]);
			return objetoXMLHttp;
		} catch(ex) {
			//nada aqui
		}
	}
	return false;
}

// chamada dos dados para paginas
function dados(url){
	var ajax = false;
	if(window.XMLHttpRequest) { //Mozilla, Safari, ...
		ajax = new XMLHttpRequest();
	} else if(window.ActiveXObject) { //IE
		ajax = criarObjMSXMLHttp();
	}
	if(ajax) {
		ajax.open("GET", "teste.php", true);

		ajax.onreadystatechange = function() {
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					mensagem(ajax.responseText);
				} else {
					mensagem("Ocorreu um erro: "+ ajax.responseText);
				}
			}
		}
	}
	ajax.send(null);
}

function mensagem(msg) {
	document.getElementById("videos").innerHTML = msg;
}







/*
*
*  ajax pras imagens negras
*
*/
/* Curso iMasters - Criando Web Sites com Ajax - 2006 */
/* Autor: Leandro Vieira Pinho [ leandroimasters@plugsites.net ] */

// Esta função instancia o objeto XMLHttpRequest
function openAjax() {
	var ajax;
	try {
		ajax = new XMLHttpRequest();
	} catch(ee) {
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(E) {
				ajax = false;
			}
		}
	}
	return ajax;
}

function image(image){
  bgBody();
  boxCad();
  var ajax = openAjax();
  ajax.open('GET', 'blocks/imagenot/index.php?f='+image, true);
  ajax.onreadystatechange = function() {

    if(ajax.readyState == 1){
      document.getElementById('boxCad').innerHTML = '[Carregando]';
    }

  	if (ajax.readyState == 4) {
  		if (ajax.status == 200) {
  			document.getElementById('boxCad').innerHTML = ajax.responseText;
  		}
  	}
  }
  ajax.send(null);

}

function bgBody(){
  var e = document.getElementsByTagName('body').item(0);
  var sizePage = getPageSize();
  var no = document.createElement('DIV');

  no.setAttribute('id', 'bgBody');
  no.style.height = arrayPageSize[1] + 'px';
  no.style.width = arrayPageSize[0] + 'px';
  e.insertBefore(no, e.firstChild);

}

function boxCad() {
    var e = document.getElementsByTagName('body').item(0);
    var sizePage = getPageSize();
    var no = document.createElement('DIV');

    no.setAttribute('id', 'boxCad');
    var wPage = arrayPageSize[0];
    var hPage = arrayPageSize[1];
    no.style.height = (wPage / 2) + 'px';
    no.style.marginTop = -(wPage / 6) + 'px';
    e.insertBefore(no, e.firstChild);
}

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;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

}

function removerDivs() {
	var bgBody = document.getElementById('bgBody');
	var boxCad = document.getElementById('boxCad');
	bgBody.parentNode.removeChild(bgBody);
	boxCad.parentNode.removeChild(boxCad);
}
