function track(args, event) {
	if (event != undefined) {
		tracker_event(event[0], event[1], event[2], event[3]);
		//console.log("EVENT:"+ event[0], event[1], event[2], event[3]);
	} else {
		tracker(args);
		//console.log("TRACK:" + args);
	}
}

var param  = {
	allownetworking:"all",
	allowscriptaccess:"always",
	wmode:"transparent",
	bgcolor:"#000000",
	allowFullScreen:"true"
};

var attributes = { id:'flashContent', name:'flashContent' };

var flashvars = { lang:"pt-br" };

//Getting querystring params
paramPairs = window.location.search.substring(1).split("&");
for(var i = 0; i < paramPairs.length; i++)
{
	var pair = paramPairs[i].split("=");
	flashvars[pair[0]] = pair[1];
}

flashvars.debug = false;

// <html>
// <head>
// <script type="text/javascript" src="loadxmldoc.js"></script>
// </head>
// <body>
// <script type="text/javascript">
// xmlDoc=loadXMLDoc("books.xml");
// 
// document.write(xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue + "<br />");
// document.write(xmlDoc.getElementsByTagName("author")[0].childNodes[0].nodeValue + "<br />");
// document.write(xmlDoc.getElementsByTagName("year")[0].childNodes[0].nodeValue);
// </script>
// </body>
// </html>

var flashVersionRequired = "10.1.0";

if (swfobject.hasFlashPlayerVersion(flashVersionRequired))
{
	swfobject.embedSWF("nivea_silver_ions_loader.swf", "flashContent", "100%", "100%", flashVersionRequired, null, flashvars, param, attributes);
}

// function loadXMLDoc(dname)
// {
// 	if (window.XMLHttpRequest)
// 	{
// 		xhttp=new XMLHttpRequest();
// 	}
// 	else
// 	{
//  		xhttp=new ActiveXObject("Microsoft.XMLHTTP");
// 	}
// 	xhttp.open("GET",dname,false);
// 	xhttp.send();
// 	return xhttp.responseXML;
// }

// appConfigXML = loadXMLDoc("data/xml/appconfig.xml");
// 
// var appID = parseInt(appConfigXML.getElementsByTagName("fbAppID")[0].childNodes[0].nodeValue);
// 
// FB.init({ appId : appID });
// 
// FB.Event.subscribe( 'auth.login', function( response )
// {
// 	console.log("login");
// 	console.log(response);
// });
// 
// FB.Event.subscribe( 'auth.prompt', function( response )
// {
// 	console.log("prompt");
// 	console.log(response);
// });
// 
// FB.Event.subscribe( 'auth.sessionChange', function( response )
// {
// 	console.log("init callback recieved");
// 	if (response)
// 	{
// 		console.log("response is object");
// 	}
// 	else
// 	{
// 		console.log("response is null");
// 		document.getElementById("flashContent").document.write('<h1>You need at least Flash Player 10.0 to view this page.</h1><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>');
// 	}
// });

// swffit.fit("flashContent", 650, 500);

function openPopup(url, id, width, height)
{
	var popup = window.open(url, id, "status=0,toolbar=0,resizable=1,width="+width+",height="+height+",scrollbars=1");
	popup.moveTo(screen.width/2 - width/2, screen.height/2 - height/2);
}
