

/**
 * Retorna nome do arquivo sem o path
 */
function basename(path) { 
	return path.replace( /.*\//, "" ); 
}

/**
 * Retorna o path sem arquivo
 */
function dirname (path) { return path.replace(basename(path), ""); }

/*
function get(elementId)
{
	return document.getElementById(elementId);	
}

function set(elementId, str)
{
	document.getElementById(elementId).innerHTML = str;	
}*/

function Get(id){return (id=='body')?document.body:document.getElementById(id);}
function Prepend(id,s){Get(id).insertAdjacentHTML('afterBegin',s);}
function Append(id,s){Get(id).insertAdjacentHTML('beforeEnd',s);}
function InsertBefore(id,s){Get(id).insertAdjacentHTML('beforeBegin',s);}
function NewDiv(id){return '<div id="'+id+'"></div>';}
function PrependDiv(tgt,id){Prepend(tgt,NewDiv(id));}
function AppendDiv(tgt,id){Append(tgt,NewDiv(id));}
function InsertDivBefore(tgt,id){InsertBefore(tgt,NewDiv(id));}
function Ref(id,s){var o=Get(id); if (o != null) o.innerHTML = s;}


function BdyClk()
{
	SAlt.style.display='none';

	var e = window.event.srcElement;
	while (e != null)
	{
		if (e.X != null)
			return;
		if (e.SRCH != null)
		{
			GoSrch(e.href);
			break;
		}
		if ( (e.href != null) && (  (e.tagName == 'A') || (e.tagName == 'INPUT') || (e.tagName == 'AREA')  ) )
		{
			if (e.THISWINDOW != null)
				ThisWindow(e.href);
			else
			{
				WriteG(e);
				if (e.OWA != null)
				{
					var aSiteIds = {'www.passport.net':10,'www.hotmail.msn.com':2};
					var nSiteId = aSiteIds[e.OWA];
					if (nSiteId != null)
					{
						xOpenWithAuth(e.href,nSiteId);
						break;
					}
				}
				Navigate(e.href);
			}
			break;
		}
		e = e.parentElement;
	}
	window.event.returnValue = false;	
}
function WriteG(a)
{
	if ( (a != null) && (a.TX != null) )
	{
		var s = '<script language="javascript" src="'+GPrefix+a.TX+'"></script>';
		Append('DivG',s);
	}
}
function ThisWindow(url)
{
	if (url != null)
		window.navigate(url);
}
function Navigate(url)
{
	if (url != null)
		window.open(url,'msnt');
}

function Trim(s)
{
	if (s == null)
		return null;
	var s2 = s.replace(/^\s*/gi,'').replace(/\s*$/gi,'');
	return ((s2.length<1)?null:s2);
}
function GetNodeText(item,nodepath,context)
{
	if (item == null)
		return null;
	var nd = item.selectSingleNode(nodepath);
	if ( (nd == null) || (nd.text == null) )
		return null;
	return Trim(EscapeText(nd.text,context));
}
function EscapeText(s,context)
{
	if (s == null)
		return null;
	if (  (context == 'atturl')  &&  (s.substr(0,4).toLowerCase() != 'http')  )
		return null;
	switch (context)
	{
		case 'text':
			s=s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
			break;
		case 'atttext':
		case 'attimg':
		case 'atturl':
			s=s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
			break;
	}
	return s;
}

// Function to get the settings of the user
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// Function to get the settings of the user
function getCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

// Function to remember the settings
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

// Function to remove the settings
function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function winW() 
{
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			return window.innerWidth - 32;
		} else if (document.documentElement && document.documentElement.clientWidth) {
			//IE 6+
			return document.documentElement.clientWidth - 40;
		} else if (document.body && document.body.clientWidth) {
			//IE 4
			return document.body.clientWidth - 40;
		}
	}
	
	
	return screen.width;

}


function centerDiv(div)
{
/*var pageWidth = document.body.offsetWidth ? document.body.offsetWidth : window.innerWidth;
if ((!pageWidth) || (pageWidth == undefined)) {
	pageWidth = screen.width;
}
*/
//pageWidth = winW();
//alert(document.getElementById('Advertisement').width);
//document.getElementById(div).style.left = ((pageWidth - 350) /2)+100+'px';
//document.getElementById(div).style.margin = 0;
}

$(document).ready(function(){
   $('#flutuante').css("zIndex", 9999999);
});
