// Chromeless window v1.06 (C) GJ & Zip, 2k3

if (document.all) {
	doc = "document.all";
	sty = ".style";
	htm = "";
}

else if (document.layers) {
	doc = "document";
	sty = "";
	htm = ".document";
}

function positionLayers() {
	abcObj = eval(doc + '["abcLyr"]' + sty);
	abcObj.left = 5;
}

function uplift() {
	var x_pos1 = parseInt(abcObj.top);
	var x_pos2 = parseInt(abcObj.top);
    if (x_pos1 > 179) {
		abcObj.top = x_pos1-2;
		setTimeout("uplift()", 1);
	}
}

function downlift() {
	var x_pos1 = parseInt(abcObj.top);
	var x_pos2 = parseInt(abcObj.top);
    if (x_pos1 < 266) {
		abcObj.top = x_pos1+2;
		setTimeout("downlift()", 1);
	}
}

function resetLayers() {
	abcObj.left=2;
}

function clickIE() {
	if (document.all) {
		alert(message);
		return false;
	}
}

function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {
			alert(message);
			return false;
		}
	}
}

if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
}

else {
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}

document.oncontextmenu=new Function("return false")

function openchromeless(theURL, ttl, wname, W, H) {
	if ( navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4 ) {
		isie=true
		if (navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5, navigator.appVersion.indexOf("MSIE ")+8) >= 5.0) isv55=true
		else isv55=false
	}
	else isie=false

	if ( navigator.userAgent.toLowerCase().indexOf("win")!=-1 ) iswin=true
    else iswin=false

	if (W == "max") {
		var W = screen.availWidth;
		var windowX = 0;
	} else {
		var windowW = W;
		var windowX = Math.ceil( (window.screen.width  - windowW) / 2 );
		if (W > screen.availWidth) windowX = 0
	}

	if (H == "max") {
		var H = screen.availHeight;
		var windowY = 0;
	} else {
		var windowH = H;
		var windowY = Math.ceil( (window.screen.height - windowH) / 2 );
		if (H > (screen.availHeight - 50)) windowY = 0
	}

	if (isie) { H=H+3; W=W+2; }
	s = ",width="+ W +",height="+ H ;

	if (isie && iswin) {

var chromeTIThtml = '\n' +
'<html>'+ '\n'+
'<head>'+ '\n'+
'<style type="text/css">'+ '\n'+
'#txtTITLE  { position: absolute; left:   0px; top: 0px; width:  100%;  height: 0px; z-index: 1; clip:rect(0,100%,17,0); }'+ '\n'+
'#crtMOVE   { position: absolute; left:   0px; top: 0px; left: 0px; z-index: 2; }'+ '\n'+
'</style>'+ '\n'+
'<script language="javascript">'+ '\n'+
'document.onselectstart = new Function("return false;")'+ '\n'+
'document.ondragstart   = new Function("return false;")'+ '\n'+
'document.oncontextmenu = new Function("return false;")'+ '\n'+
'document.onmousemove   = moveWIN'+ '\n'+
'var winSTATUS = "up";'+ '\n'+
'var ofx=0;'+ '\n'+
'var ofy=0;'+ '\n'+
'var px=0;'+ '\n'+
'var py=0;'+ '\n'+
'function moveWIN() {'+ '\n'+
'       if ( winSTATUS == "down") {'+ '\n'+
'               ofx =  event.x'+ '\n'+
'               ofy =  event.y'+ '\n'+
'               winSTATUS = "drag"'+ '\n'+
'       }'+ '\n'+
'       else if ( winSTATUS == "drag") {'+ '\n'+
'               px = event.screenX - ofx;'+ '\n'+
'               py = event.screenY - ofy;'+ '\n'+
'               top.window.x=px;'+ '\n'+
'               top.window.y=py;'+ '\n'+
'               top.window.moveTo(px , py);'+ '\n'+
'       } else {'+ '\n'+
'               winStatus = "up"'+ '\n'+
'       }'+ '\n'+
'}'+ '\n'+
'</script>'+ '\n'+
'<style>'+ '\n'+
'BODY { font-family:Arial; font-size:10pt; OVERFLOW-X:hidden; }'+ '\n'+
'td { border-color: #336699; border-width: 0; border-style: outset; }'+ '\n'+
'table {border-style: outset; border-color: #336699;border-width: 0;font-family:Arial ; font-size:10pt; font-weight:bold; background-color: #333355}'+ '\n'+
'.xtable {border-style: outset; border-color: #555555; border-width: 0;font-family:Arial ; font-size:10pt; font-weight:bold; background-color: #555555}'+ '\n'+
'</style>'+ '\n'+
'</head>'+ '\n'+
'<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">'+ '\n'+
'<div id=crtMOVE><img onmousedown="winSTATUS=\'down\';moveWIN()" onmouseup="winSTATUS=\'up\';moveWIN()" border=0 src="http://www.rapedot.com/images/dot.gif" width=2048 height=15></div>'+ '\n'+
'<div id=txtTITLE><table height="15" width="100%" cellspacing=0 cellpadding=0 border=0 align="left"><tr><td align=center valign="top" style="border-style: outset; border-color: #336699; border-width: 1; font-family: Arial; font-size: 10pt; font-weight:bold; background-color: #222244"><font face=arial size=1 color=#ff0000>' + ttl + '</td></tr></table></div>'+ '\n'+
'</body>'+ '\n'+
'</html>'+ '\n'

var chromeFRMhtml = '' +
'<HTML>'+ '\n'+
'<HEAD>'+ '\n'+
'<TITLE>' + ttl + '</TITLE>'+ '\n'+
'</HEAD>'+ '\n'+
'<script>'+ '\n'+
'top.mainloaded = false'+ '\n'+
'function generatetitle() {'+ '\n'+
'       if( window.frames["frmTIT"] ) {'+ '\n'+
'               frmTIT.document.open();'+ '\n'+
'               frmTIT.document.write( "'+ quitasaltolinea(chromeTIThtml) +'" );'+ '\n'+
'               frmTIT.document.close();'+ '\n'+
'       } else {'+ '\n'+
'               setTimeout("generatetitle()",20)'+ '\n'+
'       }'+ '\n'+
'}'+ '\n'+
'top.window.h='+H+ '\n'+
'top.window.w='+W+ '\n'+
'top.window.x='+windowX+ '\n'+
'top.window.y='+windowY+ '\n'+
'generatetitle()'+ '\n'+
'</script>'+ '\n'+
'       <frameset onload="top.mainloaded=true" onfocus="top.window.moveTo(top.window.x,top.window.y)" border=0 framespacing=0 frameborder=0 rows="15,100%">'+ '\n'+
'               <frame name=frmTIT src="about:blank" scrolling=no noresize>'+ '\n'+
'               <frame name=main   src="'+theURL+'" scrolling=no noresize>'+ '\n'+
'       </frameset>'+ '\n'+
'</HTML>'

		splashWin = window.open( "" , wname, "fullscreen=1,toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=0,resizable=0"+s);

		if (!(navigator.userAgent.toLowerCase().indexOf("mozilla/5")!=-1)) {
			splashWin.resizeTo( Math.ceil( W ), Math.ceil( H ) );
		}

		splashWin.moveTo  ( Math.ceil( windowX ) , Math.ceil( windowY ) );

		splashWin.document.open();
		splashWin.document.write( chromeFRMhtml );
		splashWin.document.close();
	}

	else {
		splashWin = window.open(theURL, wname, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0"+s, true);
	}

	splashWin.focus();

	return splashWin
}

function quitasaltolinea(txt) {
	var salida = txt.toString()
	var re     = /\//g;
	var salida = salida.replace(re, "\\\/");
	var re     = /\"/g;
	var salida = salida.replace(re, "\\\"");
	var re     = /\n/g;
	var salida = salida.replace(re, "\\n");

	return salida
}
