﻿var fo = null;
function initVer(){
	try{
		var actWidth = winW();
		if(deconcept.SWFObjectUtil.getPlayerVersion().major >= 8){
			if(!fo){
				var q = document.location.href.split('#')[1] || '';
				var macroArea = q.split("/")[1];
				var microArea = q.split("/")[2];
				macroArea = (macroArea != undefined) ? macroArea : '';
				microArea = (microArea != undefined) ? microArea : '';
				fo = new FlashObject('swf/wire.swf', 'lipton', "100%", "100%", false, 8, "#FFE988");
				fo.useExpressInstall('swf/expressinstall.swf');
				fo.addVariable('$swf', 'swf/');
				fo.addVariable('$fale', 'fale/default.aspx');
				fo.addVariable('$cadastro', 'cadastro/default.aspx');
				fo.addVariable('$download', 'download/');
				fo.addVariable('$macro', macroArea);
				fo.addVariable('$micro', microArea);
				fo.write('flashCont');
			}
			
			$('flashCont').style.height = ((winH() < 650)?(650+"px"):"100%");
			$('flashCont').style.width = ((winW() < 980)?(980+"px"):"100%");
		} else {
			$('msg').innerHTML = "<div id=\"logo\">Lipton</div>Para visualizar o conteúdo e as animações deste site você precisa ter o plugin Flash Player 8 ou superior instalado no seu computador. <br /> <a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\">Clique aqui para fazer o download.</a>"
		}
		window.scrollBy(0,1);
		delete actWidth;
	}catch(e){
		alert(e);
	}
}
addEvent(window,'resize',initVer);

var verifyPopup = {
	_enabledPopUp:false,
	_linkToOpen:null,
	_errorMsg:null,
	defMessage: "O bloqueador de pop-up está fazendo com que o link não seja aberto. Desabilite seu bloqueador e clique novamente.",
	test: function(o){
		o = o || false;
		this._linkToOpen = o.linkToOpen || null;
		this._errorMsg = o.errorMessage || null;
		
		if(this._enabledPopUp){
			window.open(this._linkToOpen);
			return;
		}
		
		var popup = window.open('about:blank','testPopup','width=1,height=1,top=-100,left=-100,screenX=0,screenY=0,scrollbars=no');
		try {
			popup.close();
			if(this._linkToOpen){
				window.open(this._linkToOpen);
			}
			this._enabledPopUp = true;
		}catch(e){
			if(this._errorMsg){
				alert(this._errorMsg);
			}else{
				alert(this.defMessage);
			}
		}
		
		this.popOnSuccess =
		this.popOnError = null;
	}
};
