function setTitle()
{
//	if (!(navigator.userAgent.toLowerCase().indexOf('msie 6') > -1) )
		document.title="AlmapBBDO | + 55 11 2161.5600";
}
if ((navigator.userAgent.indexOf('MSIE 7') != -1) || (navigator.userAgent.indexOf('MSIE 6') != -1))
{
	window.setInterval(function (){document.title="AlmapBBDO | + 55 11 2161.5600";},1000);
}

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;
  	}	
  	var pageHeight, pageWidth;

	/*

  	// 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;
  	}

	*/

	pageHeight = windowHeight;
	pageWidth = windowWidth;

	setTitle();
  	return {
  		pageWidth: pageWidth ,
  		pageHeight: pageHeight , 
  		windowWidth: windowWidth, 
  		windowHeight: windowHeight
  	};
}

 function getBrowserHeigth(valor){
	
	setTitle();
	var dimens=getPageSize();
	if(valor != dimens.pageHeight){
		return dimens.pageHeight;
	}
}

window.onresize = function(){
	
	var dimens=getPageSize();
	
	if(!(navigator.userAgent.toLowerCase().indexOf('safari') > -1)) {
		
		document.getElementById("Dock2").style.width = dimens.pageWidth + "px";
		document.getElementById("Dock2").style.height = dimens.pageHeight + "px";
		document.getElementById("holder").style.width = dimens.pageWidth + "px";
		document.getElementById("holder").style.height = dimens.pageHeight + "px";
		document.getElementById("xBody").style.width = dimens.pageWidth + "px";
		document.getElementById("xBody").style.height = dimens.pageHeight + "px";
	}
}

if(navigator.userAgent.toLowerCase().indexOf('safari') > -1) {
  url=document.URL;  
}else{
  url=self.location.href;
}

var param=url.substr(url.indexOf('#'),url.length);
if (url.indexOf('#')>0)
	var param2=url.substr(url.indexOf('#'),url.length);
else
	var param2="#section=noticiat";

if (url!=(adx+param2)){
	if(param2.length < 2)
		param2 = "#section=noticiat";

// if(!(navigator.userAgent.toLowerCase().indexOf('safari') > -1)) {
   self.location.href=adx+param2;
// }
}
setTitle();



function maxWindow()
{
	if (document.all)
	{
		window.moveTo(0,0);
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById)
	{
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
		{
			window.moveTo(0,0);
			self.resizeTo(screen.availWidth,screen.availHeight);
		}
	}
}
//maxWindow();


function initialize() 
{
	// initialize our DHTML history
	// dhtmlHistory.initialize();
	// subscribe to DHTML history change
	// events
	// dhtmlHistory.addListener( historyChange);
	
	// if this is the first time we have
	// loaded the page...
	//  if (dhtmlHistory.isFirstLoad()) {
		// start adding history
		//dhtmlHistory.add("section=intro", true);               
	// }	
	var dimens=getPageSize();
	if(!(navigator.userAgent.toLowerCase().indexOf('safari') > -1)) 
	{
		document.getElementById("Dock2").style.width = dimens.pageWidth + "px";
		document.getElementById("Dock2").style.height = dimens.pageHeight + "px";
	}
	setTitle();
}

         
/** Our callback to receive history change events. */
function historyChange(newLocation, historyData) {
	
	var historyMsg = historyData;
	
	if (newLocation == "complexObject") {
	historyMsg =JSON.stringify(historyData);               
}
/*
debugMsg(
	"<b>A history change has "
	+ "occured:</b> "
	+ "newLocation="+newLocation
	+ ", historyData="+historyMsg);
*/
}

function debugMsg(msg) {
	
	var debugMsg = 
	document.getElementById("debugMsg");
	debugMsg.innerHTML = msg;
}

function setURLIndexacao(page)
{
	// dhtmlHistory.add("section="+page, true);

	self.location.href="#section="+page;
	
	if (page.substr(0,8).toLowerCase()=="trabalho")
		urchinTracker('/ALMAP/Trabalhos');
	else if (page.substr(0,4).toLowerCase()=="home")
		urchinTracker('/ALMAP/Home');
	else if (page.substr(0,8).toLowerCase()=="noticias")
		urchinTracker('/ALMAP/Notícias');
	else if (page.substr(0,7).toLowerCase()=="agencia")
		urchinTracker('/ALMAP/Agencia');
	else if (page.substr(0,8).toLowerCase()=="clientes")
		urchinTracker('/ALMAP/Clientes');
	else if (page.substr(0,7).toLowerCase()=="podcast")
		urchinTracker('/ALMAP/Almapcast');
	else if (page.substr(0,7).toLowerCase()=="contato")
		urchinTracker('/ALMAP/Contato');
	else if (page.substr(0,8).toLowerCase()=="classico")
		urchinTracker('/ALMAP/Classico');
	
	setTitle();
}
	
function getUrlSite(){
	
	if(navigator.userAgent.toLowerCase().indexOf('safari') > -1) {
		return document.URL;  
	}else{
		return self.location.href;
	}
}


function bookmark_almap(){
	
	var title = 'Almap Website';
	var url = 'http://www.almapbbdo.com.br/rss.php';
	//var url = 'http://189.73.152.49/www.almapbbdo.com.br/rss.php';

	urchinTracker('/ALMAP/RSS');

	try{
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 		
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	}
	}catch(e){}
}

function rssGoogle() {
	urchinTracker('/ALMAP/RSS');
}

function getURL_almap(){
 
 var url = adx;
 return url.substr(0,url.indexOf('index.php'));
}

function getURL_indexacao(){
	
	var url=adx.replace('http://','');
	url=url.substr(url.indexOf('/'),url.length);
	url=url.substr(0,(url.indexOf('index.php')-1));

	return url;
}

function getURL_index(){

if(navigator.userAgent.toLowerCase().indexOf('safari') > -1) {
  return document.URL;
}else{
  return self.location.href; 
}
 
}

	/*var so = new SWFObject("swf/index.swf", "flip", "100%", "100%", "8", "#FFFFFF");

if(navigator.userAgent.toLowerCase().indexOf('safari') > -1) {
  so.addVariable("urlBrowser", adx + param2);
  so.addVariable("safari","true");
}else{
  so.addVariable("urlBrowser", self.location.href);
  so.addVariable("safari", "false");
}

	
	so.write("holder");
	*/


