function openwinr(url,w,h){
	if(w>screen.width) w=screen.width-20;
	if(h>screen.height) h=screen.height-80;
	l=(screen.width-w)/2;
	t=(screen.height-h)/2;
	feat="width="+w+",height="+h+",top="+t+",left="+l+",statusbar=no,scrollbars=yes,menubar=no,resizable=yes";
	w1=window.open(url,'',feat);
}

function aviso(turl){
	openwinr(turl,500,450);
}

function fflash(tsrc,w,h,version,vars,bg){
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
	document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+"' ");
	document.write("WIDTH='"+ w + "' HEIGHT='"+ h + "' id='iflash' ALIGN='center'> ");
	document.write("<PARAM NAME=movie VALUE='" + tsrc + "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> ");
	document.write("<param name='FlashVars' value='"+ vars +"'> ");
	document.write("<param name='allowScriptAccess' value='sameDomain'>");
	document.write("<PARAM NAME=bgcolor VALUE="+bg+"> <EMBED src='" + tsrc + "' quality=high ");
	document.write("bgcolor="+bg+" WIDTH='"+ w + "' HEIGHT='"+ h + "' NAME='iflash' ALIGN='center' ");
	document.write("TYPE='application/x-shockwave-flash' menu='false' ");
	document.write("PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' flashvars='" + vars + "' allowScriptAccess='sameDomain'></EMBED></OBJECT>");
}

function fflasht(tsrc,w,h,version,vars){
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
	document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+"' ");
	document.write("WIDTH='"+ w + "' HEIGHT='"+ h + "' id='iflash' ALIGN='center'> ");
	document.write("<PARAM NAME=movie VALUE='" + tsrc + "'> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> ");
	document.write("<param name='FlashVars' value='"+ vars +"'> ");
	document.write("<param name='wmode' value='transparent'> ");
	document.write("<param name='allowScriptAccess' value='sameDomain'>");
	document.write("<EMBED src='" + tsrc + "' quality=high ");
	document.write("WIDTH='"+ w + "' HEIGHT='"+ h + "' NAME='iflash' wmode='transparent' ALIGN='center' ");
	document.write("TYPE='application/x-shockwave-flash' menu='false' ");
	document.write("PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' flashvars='" + vars + "' allowScriptAccess='sameDomain'></EMBED></OBJECT>");
}

function changebg(normal){
	if(normal){
		bg="url(img/bg.jpg) repeat-x center top";
		bgcab="url(img/topy.gif) no-repeat center top";
	}
	else{
		bg="url(img/bg_disabled.jpg) repeat-x center top";
		bgcab="url(img/topy_disabled.gif) no-repeat center top";
	}
	if (document.getElementById){
		document.getElementById('body').style.background= bg;
		document.getElementById('tmain').style.background= bgcab;
	}
	else{
		if(document.layers){
			document.layers['body'].style.background= bg;
			document.layers['tmain'].style.background= bgcab;
		}
	}

}

var nscroll=0;
var cscroll=0;
var tscroll=0;

function fscroll(){
	cscroll+=(nscroll-cscroll)/10;
	window.scrollTo(0,cscroll);
	if(Math.abs(Math.round(nscroll-cscroll))>2)	tscroll=setTimeout("fscroll()",50);
	else nscroll=cscroll;
}

function fgoscroll(param){
	nscroll=param;
	cscroll=document.body.scrollTop;
	fscroll();
}

function scrolar(param){
	alto=screen.height;
	posicion=document.body.scrollTop;
	if (param==1){
		if (posicion>300){
			fgoscroll(200);
		}
	}
	if (param==2){
		if (alto<800){
			if (posicion<350){
				fgoscroll(350);
			}
		}
		else if (alto>800 && alto<900){
			if (posicion<100){
				fgoscroll(100);
			}
		}
	}
	if (param==3){
		if (alto<800){
			if (posicion<820){
				fgoscroll(820);
			}
			if (posicion>820){
				fgoscroll(820);
			}
		}
		else if (alto>800 && alto<900){
			if (posicion<550){
				fgoscroll(550);
			}
		}
	}
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function handle(delta) {
	clearTimeout(tscroll);
}

/** Event handler for mouse wheel event.
 */
function wheel(event){
        var delta = 0;
        if (!event) /* For IE. */
                event = window.event;
        if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
        /** If delta is nonzero, handle it.
         * Basically, delta is now positive if wheel was scrolled up,
         * and negative, if wheel was scrolled down.
         */
        if (delta)
                handle(delta);
        /** Prevent default actions caused by mouse wheel.
         * That might be ugly, but we handle scrolls somehow
         * anyway, so don't bother here..
         */
        //if (event.preventDefault)
                //event.preventDefault();
				//event.returnValue = false;
}

/** Initialization code. 
 * If you use your own event management code, change it as required.
 */
if (window.addEventListener)
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;


