/*
	CHROMELESS WINDOWS v.35.1 [ 8.1K ]
	Licensed under GNU LGPL (www.gnu.org)

	(c) Gabriel Suchowolski,2000 >> www.microbians.com
	Thanks to Gustavo Ponce >> www.urbanlove.org (resize addon)
        This script featured on Dynamic Drive (http://www.dynamicdrive.com)
*/

function openIT(u,W,H,X,Y,n,b,x,m,r,texto,cor) {
	var cU  = 'images/comando/close.gif'   //gif for close on normal state.
	var cO  = 'images/comando/close.gif'  //gif for close on mouseover.
	var cL  = 'js/images/clock.gif'      //gif for loading indicator.
	var mU  = 'images/comando/box-minimiz.gif'     //gif for minimize to taskbar on normal state.
	var mO  = 'images/comando/box-minimiz.gif'    //gif for minimize to taskbar on mouseover.
	var xU  = 'js/images/max.gif'     //gif for maximize normal state.
	var xO  = 'js/images/max.gif'    //gif for maximize on mouseover.
	var rU  = 'js/images/restore.gif'     //gif for minimize on normal state.
	var rO  = 'js/images/restore.gif'    //gif for minimize on mouseover.
	//var tH  = '<b><font face=verdana size=2>Museu do Carro Eléctrico</font><b>'   //title for the title bar in html format.
	var tH  =   setTitle(texto,cor); //title for the title bar in html format.
	var tW  = 'burmesterporto.com'   //title for the task bar of Windows.
	var wB  = '#DEE9EF'   //Border color.
	var wBs = '#AAAAAA'   //Border color on window drag.
	var wBG = '#DEE9EF'   //Background of the title bar.
	var wBGs= '#AAAAAA'   //Background of the title bar on window drag.
	var wNS = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'  //Html parameters for Netscape.
	var fSO ='scrolling=no noresize'   //Html parameters for main content frame.
	var brd =b||0;   //Extra border size.
	var max =x||false;   //Maxzimize option (true|false).
	var min =m||false;   //Minimize to taskbar option (true|false).
	var res =r||false;   //Resizable window (true|false).
	var tsz =28;   //Height of title bar.
	return chromeless(u,n,W,H,X,Y,cU,cO,cL,mU,mO,xU,xO,rU,rO,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO,brd,max,min,res,tsz)
}


function chromeless(u,n,W,H,X,Y,cU,cO,cL,mU,mO,xU,xO,rU,rO,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO,brd,max,min,res,tsz){
	var c=(document.all&&navigator.userAgent.indexOf("Win")!=-1)?1:0
	var v=navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5,navigator.appVersion.indexOf("MSIE ")+8)
	min=(v>=5.5?min:false);
	var w=window.screen.width; var h=window.screen.height
	var W=W||w; W=(typeof(W)=='string'?Math.ceil(parseInt(W)*w/100):W); W+=(brd*2+2)*c
	var H=H||h; H=(typeof(H)=='string'?Math.ceil(parseInt(H)*h/100):H); H+=(tsz+brd+2)*c
	var X=X||Math.ceil((w-W)/2)
	var Y=Y||Math.ceil((h-H)/2)
	var s=",width="+W+",height="+H


	if(c){
		var cTIT='\n'+
		'<html><head><META HTTP-EQUIV="imagetoolbar" CONTENT="no">\n'+
		'<LINK href=\"Styles/comando.css\" type=\"text/css\" rel=\"stylesheet\">\n' + 
		'<script language=\"javascript\" src=\"scripts/comando.js\"></script>\n' +
		'<script>\n'+
		'var IcU=new Image();IcU.src="'+cU+'";var IcO=new Image();IcO.src="'+cO+'";var IcL=new Image();IcL.src="'+cL+'";var IxU=new Image();IxU.src="'+xU+'";var IxO=new Image();IxO.src="'+xO+'";var IrU=new Image();IrU.src="'+rU+'";var IrO=new Image();IrO.src="'+rO+'";var ImU=new Image();ImU.src="'+mU+'";var ImO=new Image();ImO.src="'+mO+'"\n'+
		'document.onmousemove=document.onselectstart=document.ondragstart=document.oncontextmenu=new Function("wMOV();return false");\n'+
		'b=-1\n'+
		'wLOA=function(){if(top.ok&&document.body){'+(min?'bMIN.style.visibility="visible";':'')+'bLOA.style.visibility="hidden";wRSZ()}else setTimeout("wLOA()",500)};wLOA()\n'+
		'wRSZ=function(){var dw=document.body.clientWidth;bCLO.style.pixelLeft=dw-22;bMIN.style.pixelLeft=bLOA.style.pixelLeft=dw-62;bFUL.style.pixelLeft=bRES.style.pixelLeft=dw-42}\n'+
		'wMAX=function(m){top.mod=m;if(m){top.mT(0,0);top.rT('+w+','+h+');bFUL.style.visibility="hidden";bRES.style.visibility="visible"}else{top.mT(top.px,top.py);top.rT(top.sW,top.sH);bFUL.style.visibility="visible";bRES.style.visibility="hidden"}}\n'+
		'wDBL=function(){if(!top.mod)wMAX(1);else wMAX(0)}\n'+
		'wMIN=function(){top.window.moveTo(0,-4000);if(top.opener&&!top.opener.closed){top.opener.window.focus()};top.window.blur()}\n'+
		'wMOV=function(){\n'+
		'if(b==0){top.bCOL("'+wBG+'","'+wB+'");b=-1}\n'+
		'if(b==2&&!top.mod){top.px=event.screenX-ofx-1;top.py=event.screenY-ofy-1;top.mT(top.px,top.py)}\n'+
		'if(b==1){top.bCOL("'+wBGs+'","'+wBs+'");ofx=event.x;ofy=event.y;b=2}\n'+
		'}</script></head>\n'+
		'<body onresize="wRSZ()" bgcolor='+wBG+' background=\"images/comando/barra-top.gif\">'+
		'<div style="position:absolute;left:-2px;top:5px;width:2000px">'+tH+'</div>\n'+
		'<img id=bMOV style="position:absolute;left:-50px;top:-50px" '+(max?'ondblclick="wDBL()"':'')+' onmousemove="wMOV()" onmousedown="b=1;wMOV()" onmouseup="b=0;wMOV()" border=0 src="" width=2000 height=2000>\n'+
		'<img id=bFUL style="position:absolute;top:4px;left:'+(W-42)+'px;'+(max?'':'display:none')+'" src="'+xU+'" border=0 onmouseover="this.src=IxO.src" onmouseout="this.src=IxU.src" onmouseup="this.src=IxU.src" onmousedown="this.src=IxU.src" onclick="wMAX(1)">\n'+
		'<img id=bRES style="position:absolute;top:4px;left:'+(W-42)+'px;visibility:hidden" src="'+rU+'" border=0  onmouseover="this.src=IrO.src" onmouseout="this.src=IrU.src" onmouseup="this.src=IrU.src" onmousedown="this.src=IrU.src" onclick="wMAX(0)">\n'+
		'<img id=bCLO style="position:absolute;top:4px;left:'+(W-22)+'px;" src="'+cU+'" border=0  onmouseover="this.src=IcO.src" onmouseout="this.src=IcU.src" onmouseup="this.src=IcU.src" onmousedown="this.src=IcU.src" onclick="top.window.close()">\n'+
		'<img id=bLOA style="position:absolute;top:4px;left:'+(W-62)+'px;" src="'+cL+'" border=0 >\n'+
		'<img id=bMIN style="display:none;position:absolute;top:4px;left:'+(W-22)+'px;" src="'+mU+'" border=0  onclick="wMIN();">\n'+
		'</body>\n'+
		'</html>'
		
		cTIT=cTIT.replace(/\//g,"\\\/").replace(/\"/g,"\\\"").replace(/\n/g,"\\n")


		cRES=function(b,s){
			var tmp='\n'+
			'<html><head><META HTTP-EQUIV="imagetoolbar" CONTENT="no">\n'+
			'<script>\n'+
			'document.onmousemove=document.onselectstart=document.ondragstart=document.oncontextmenu=new Function("wMOV();return false");\n'+
			'b=-1\n'+
			'wMOV=function(){if(!top.mod){\n'+
			'if(b==0){top.sH=top.fH;top.sW=top.fW;b=-1}\n'+
			'if(b==2&&(1=='+b+'||4=='+b+'||5=='+b+')){tmp=event.screenY-oH;if(top.sH+tmp>100){top.fH=top.sH+tmp}}\n'+
			'if(b==2&&(2=='+b+'||4=='+b+')){tmp=event.screenX-oW;if(top.sW-tmp>100){top.fW=top.sW-tmp;top.px=event.screenX-ofx-1}}\n'+
			'if(b==2&&(3=='+b+'||5=='+b+')){tmp=event.screenX-oW;top.fW=top.sW+tmp}\n'+
			'if(b==2){setTimeout("top.rT(top.fW,top.fH);top.mT(top.px,top.py);",10)}\n'+
			'if(b==1){ofx=event.x;oH=event.screenY;oW=event.screenX;b=2}\n'+
			'}}</script></head>\n'+
			'<body bgcolor='+wBG+'>\n'+
			'<img style="cursor:'+s+'-resize" id=bMOV style="position:absolute;left:-50px;top:-50px" onmousemove="wMOV()" onmousedown="b=1;wMOV()" onmouseup="b=0;wMOV()" border=0 src="" width=3000 height=2000>\n'+
			'</body>\n'+
			'</html>'
			return tmp.replace(/\//g,"\\\/").replace(/\"/g,"\\\"").replace(/\n/g,"\\n")
		}

		var cRESd=cRES(1,'s'),cRESl=cRES(2,'w'),cRESr=cRES(3,'e'),cRESbl=cRES(4,'sw'),cRESbr=cRES(5,'se')

		var cFRM='<HTML><HEAD><TITLE>'+tW+'</TITLE>\n'+
		'<script>\n'+
		'ok=0;mod=0;sH=fH='+(H)+';sW=fW='+(W)+';px='+(X)+';py='+(Y)+'\n'+
		'bCOL=function(c1,c2){fT.document.bgColor=n0.document.bgColor=n1.document.bgColor=n2.document.bgColor=n3.document.bgColor=n4.document.bgColor=c1;bL.document.bgColor=bT.document.bgColor=bR.document.bgColor=bB.document.bgColor=c2}\n'+
		'mTIT=function(){if(frames.length>8){fT.document.write("'+cTIT+'");fT.document.close();if ('+res+'){n2.document.write("'+cRESd+'");n2.document.close();n1.document.write("'+cRESr+'");n1.document.close();n0.document.write("'+cRESl+'");n0.document.close();n3.document.write("'+cRESbl+'");n3.document.close();n4.document.write("'+cRESbr+'");n4.document.close()};top.bCOL("'+wBG+'","'+wB+'")}else{setTimeout("mTIT()",20)}}\n'+
		'mT=function(x,y){top.window.moveTo(x,y)}\n'+
		'rT=function(w,h){top.window.resizeTo(w,h)}\n'+
		'top.rT(fW,fH);top.mT(px,py)\n'+
		'mTIT()\n'+
		'</script></HEAD>\n'+
		'<frameset onselectstart="return false" onload="top.ok=1" onfocus="if (top.ok&&fT&&fT.wMAX) fT.wMAX(top.mod)" border=0 framespacing=0 frameborder=0 rows="'+tsz+',100%,'+brd+'">\n'+
		'	<frame id=\"titleFrm\" name=fT src="about:blank" scrolling=no noresize>\n'+
		'	<frameset id=\"comandofrm\" border=0 framespacing=0 frameborder=0 cols="'+brd+',1,100%,1,'+brd+'">\n'+
		'		<frame name=n0 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=bL src="about:blank" scrolling=no noresize>\n'+
		'			<frameset border=0 framespacing=0 frameborder=0 rows="1,100%,1">\n'+
		'				<frame name=bT src="about:blank" scrolling=no noresize>\n'+
		'				<frame name=main src="'+u+'" '+fSO+'>\n'+
		'				<frame name=bB src="about:blank" scrolling=no noresize>\n'+
		'			</frameset>\n'+
		'		<frame name=bR src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n1 src="about:blank" scrolling=no noresize>\n'+
		'	</frameset>\n'+
		'	<frameset border=0 framespacing=0 frameborder=0 cols="'+brd+',100%,'+brd+'">\n'+
		'		<frame name=n3 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n2 src="about:blank" scrolling=no noresize>\n'+
		'		<frame name=n4 src="about:blank" scrolling=no noresize>\n'+
		'	</frameset>\n'+
		'</frameset>\n'+
		'</HTML>'

		if (bw.ie6sp1) {
			var CWIN=window.open("",n,"fullscreen=0,width=180,height=174")
		} else {
			var CWIN=window.open("",n,"fullscreen=1"+s)
		}

		CWIN.moveTo(5000,0)
		CWIN.ft=true
		CWIN.document.write(cFRM)
		CWIN.document.close()
	} else {
		var CWIN=window.open(u,n,wNS+s,true)
		CWIN.moveTo(X,Y)
	}
	CWIN.focus()
	CWIN.setURL=function(u) { if (this && !this.closed) { if (this.frames.main) this.frames.main.location.href=u; else this.location.href=u } }
	CWIN.closeIT=function() { if (this && !this.closed) this.close() }
	return CWIN
}                                                                               
                                                                               

////////////////////////////////////////////////////////////////
//                                                            //
//           BYKLEIN CHROMELESS WINDOW OBJECT 1.0             //
//             FOR MICROSOFT IEXPLORER 5.5 & UP               //
//                                                            //
//   (c) Copyright 2002. Mariano Klein || www.byklein.com     //
//         Distributed under the terms of the GNU GPL         //
//                                                            //
//    Thanks to Gabriel Suchowolski || www.microbians.com     //
////////////////////////////////////////////////////////////////

ChromelessWindow = function ()
{
	this.URL = null;
	this.title = null;
	this.titleFont = null;
	this.titleSize = 0;
	this.titleColor = null;
	this.titlebarImage = null;
	this.titlebarHeight = 0;
	this.scrollbars = null;
	this.w = 0;
	this.h = 0;
	this.centered = null;
	this.xPos = 0;
	this.yPos = 0;
	this.borderColor = null;
	this.borderSize = 0;
	this.closeBottom = null;
	this.minimizeBottom = null;
	
	this.chromelessCompatible = navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4 ? true:false;
	this.titlebarContent = null;
	this.chromelessWW = null;
	
	
}

ChromelessWindow.prototype.openChromeless = function()
{
	this.runCode();
	
}

ChromelessWindow.prototype.closeChromeless = function()
{
	this.chromelessWW.close();
}

ChromelessWindow.prototype.setURL = function(newURL)
{
	this.URL = newURL;
	if(this.chromelessWW)
	{
		this.chromelessWW.execScript("b.all.canvas.URL='"+newURL+"'");
		this.chromelessWW.execScript("showChromeless()");
	}
}

ChromelessWindow.prototype.moveTo = function()
{
	this.xPos = arguments[0];
	this.yPos = arguments[1];
	if(this.chromelessWW)
	{
		this.chromelessWW.execScript('var cx='+this.xPos+';');
		this.chromelessWW.execScript('var cy='+this.yPos+';');
		this.chromelessWW.execScript("showChromeless()");
	}
}

ChromelessWindow.prototype.resizeTo = function()
{
	this.w = arguments[0];
	this.h = arguments[1];
	this.cH = (this.h-this.titlebarHeight)-this.borderSize;
	this.cW = this.w -(this.borderSize*2);
	if(this.chromelessWW)
	{
		this.chromelessWW.execScript('var cw='+this.w+';');
		this.chromelessWW.execScript('var ch='+this.h+';');
		this.chromelessWW.execScript("b.all.canvas.style.width='"+this.cW+"'");
		this.chromelessWW.execScript("b.all.canvas.style.height='"+this.cH+"'");
		this.chromelessWW.execScript("b.all.closeBottom.style.right='"+this.borderSize+"'");
		this.chromelessWW.execScript("b.all.minimizeBottom.style.right='"+(this.borderSize+20)+"'");
		this.chromelessWW.execScript("showChromeless()");
	}
}



ChromelessWindow.prototype.runCode = function()
{
	if(this.centered=="yes")
	{
		var tempX = this.w;
		var tempY = this.h;
		this.xPos = (screen.availWidth/2)-(tempX/2);
		this.yPos = (screen.availHeight/2)-(tempY/2);
	}
	if (this.chromelessCompatible)
	{
		alert("ola")
		this.chromelessWW = window.open("about:blank","","top=5000,left=5000,width=100,height=100,scrollbars="+this.scrollbars);
	}
	else
	{
		this.chromelessWW = window.open(this.URL, "chromelessWindow", "top="+this.yPos+",left="+this.xPos+",width="+this.w+",height="+this.h+",toolbar=0,scrollbars="+this.scrollbars+",resizable=0");
	}
	this.cH = (this.h-this.titlebarHeight)-this.borderSize;
	this.cW = this.w -(this.borderSize*2);
	this.c = "<object type='text/html' border='0' style='position:absolute;z-index:2;top:"+this.titlebarHeight+"px;left:"+this.borderSize+"px;width:"+this.cW+"px;height:"+this.cH+"px;' data='"+this.URL+"' id='canvas'></object>";

	if((this.titlebarImage==undefined)||(this.titlebarImage==null)||(this.titlebarImage==""))
	{
		this.titlebarContent="";
		this.tb = false;
	}
	else
	{
		this.titlebarContent="<img id='menu' unselectable='on' src='"+this.titlebarImage+"' style='position:absolute; top:0px; left:0px;z-index:2'>";
		this.tb = true;
	}
	this.menu = "\
		<div id='Title' unselectable='on' style='font-family:Arial;font-size:11px;font-weight:bold;position:absolute;top:5px;left:"+this.borderSize+"px;width:70%;height:15px;cursor:default;font-family:"+this.titleFont+";font-size:"+this.titleSize+";color:"+this.titleColor+";z-index:3'>"+this.title+"</div>\
		<img id='closeBottom' unselectable='on' src='"+this.closeBottom+"' width='16' height='10' style='position:absolute; top:5px; right:"+(this.borderSize)+"px;z-index:3'>\
		"+this.titlebarContent+"\
		<img id='minimizeBottom' unselectable='on' src='"+this.minimizeBottom+"' width='16' height='10' style='position:absolute; top:5px; right:"+(this.borderSize+20)+"px;z-index:3'>\
		<div id='fondo' unselectable='on' style='position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:"+this.borderColor+";z-index:1'></div>";

	if (this.chromelessCompatible)
	{
		this.chromelessWW.moveTo(300,-5000);
		this.chromelessWW.resizeTo(800,600);
		this.chromelessWW.document.writeln('<html>');
		this.chromelessWW.document.writeln('<head>');
		this.chromelessWW.document.writeln('<META HTTP-EQUIV="imagetoolbar" CONTENT="no">');
		this.chromelessWW.document.writeln('<style>');
		this.chromelessWW.document.writeln('BODY{border:0px !important}');
		this.chromelessWW.document.writeln('</style>');
		this.chromelessWW.document.writeln('</head>');
		this.chromelessWW.document.writeln('<body>');
		this.chromelessWW.document.writeln('<script>');
		this.chromelessWW.document.writeln('var c=window.createPopup();');
		this.chromelessWW.document.writeln('var b=c.document.body;');
		this.chromelessWW.document.writeln("var ox=oy=ix=iy=0;");
		this.chromelessWW.document.writeln("var allContent =\""+this.menu+this.c+"\";");
		this.chromelessWW.document.writeln('b.innerHTML=allContent;');
		this.chromelessWW.document.writeln('var cx='+this.xPos+';');
		this.chromelessWW.document.writeln('var cy='+this.yPos+';');
		this.chromelessWW.document.writeln('var cw='+this.w+';');
		this.chromelessWW.document.writeln('var ch='+this.h+';');
		this.chromelessWW.document.writeln('function showChromeless(){');
		this.chromelessWW.document.writeln('c.show(cx,cy,cw,ch);focus()');
		this.chromelessWW.document.writeln('}');
		this.chromelessWW.document.writeln('var mm=false;');
		this.chromelessWW.document.writeln('var cmove=b.all("fondo");');
		this.chromelessWW.document.writeln('var allb=b.all("allborders");');
		this.chromelessWW.document.writeln('var cmove2=(b.all("menu"))?b.all("menu"):"";');
		this.chromelessWW.document.writeln('var ctitle=b.all("Title");');
		this.chromelessWW.document.writeln('ctitle.style.visibility=('+this.tb+')?"hidden":"visible";');
		this.chromelessWW.document.writeln('var cclose=b.all("closeBottom");');
		this.chromelessWW.document.writeln('var cminimize=b.all("minimizeBottom");');
		this.chromelessWW.document.writeln('cclose.onclick=function(){opener=self;self.close()};');
		this.chromelessWW.document.writeln('cminimize.onclick=function(){if(top.opener&&!top.opener.closed){top.opener.window.focus()};top.window.blur()};');
		this.chromelessWW.document.writeln('var ox=oy=ix=iy=0;');
		this.chromelessWW.document.writeln('var m=0;');
		this.chromelessWW.document.writeln('ctitle.onmousedown=function(){m=1};');
		this.chromelessWW.document.writeln('ctitle.onmouseup=function(){m=0};');
		this.chromelessWW.document.writeln('cmove.onmousedown=function(){m=1};');
		this.chromelessWW.document.writeln('cmove.onmouseup=function(){m=0};');
		this.chromelessWW.document.writeln('cmove2.onmousedown=function(){m=1};');
		this.chromelessWW.document.writeln('cmove2.onmouseup=function(){m=0};');
		this.chromelessWW.document.writeln('document.body.onclick=function(){ if (m) { focus();cx=ix+event.screenX-ox;cy=iy+event.screenY-oy;c.show(cx,cy,cw,ch) }else { ix=cx; iy=cy; ox=event.screenX; oy=event.screenY } };');
		this.chromelessWW.document.writeln('setInterval("document.body.click()",20);');
		this.chromelessWW.document.writeln('onfocus=function(){showChromeless();}');
		this.chromelessWW.document.writeln('</script>');
		this.chromelessWW.document.writeln('</body>');
		this.chromelessWW.document.writeln('</html>');
		this.chromelessWW.document.location.reload();
		this.chromelessWW.document.title = this.title;
		this.chromelessWW.execScript("focus();");
	}
	else
	{
		this.chromelessWW.document.title = this.title;
	}
}


function setTitle(texto,cor) {
	var titleSrc;
	titleSrc = "<table width=\"100%\"><tr><td id=\"titleTxt\" class=\"comandotitle\">&nbsp;&nbsp;" + texto + "</td></tr><tr><td id=\"titleColor\" bgcolor=\"" + cor + "\" height=\"5\"></td></tr></table>"
	return titleSrc;
}
