// BrowserCheck Object
// provides most commonly needed browser checking variables
// 19990326

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b;
	this.v = parseInt(navigator.appVersion);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ns6 = (this.b=="ns" && navigator.userAgent.indexOf('Netscape6')>0);
	this.ie = (this.b=="ie" && this.v>=4 && !navigator.userAgent.indexOf('Mac'));
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0 && !navigator.userAgent.indexOf('Mac'));
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0);
	if (this.ie5) this.v = 5;
	this.min = (this.ns||this.ie);
	this.ie45Mac = (navigator.userAgent.indexOf('MSIE 4')>0 && navigator.userAgent.indexOf('Mac')>=0);
	//this.ie5Mac = (navigator.userAgent.indexOf('MSIE 5')>0 && navigator.userAgent.indexOf('Mac')>=0);
}

// automatically create the "is" object
is = new BrowserCheck();

////// test for frame

function frameTest(){
	if(top==self) {		
		var currURL = unescape(window.location);

		var xedStr = /\//i;
		if (is.min || is.ie5 || is.ie6) {
			newURL = currURL.replace(xedStr,'');
			newURL = escape(newURL);
			location.replace('index_frame.asp?pagina=' + newURL);
		}
	}
}

function frameTestBuscador(){
	var pos;
	
	if(top==self) {		
		var currURL = unescape(window.location);
		pos = currURL.indexOf("?")
				
		if (pos > 0) {
			currURL = "buscador.asp" + currURL.substr(pos);
		}
		else {
			currURL = "buscador.asp";
		}		
				
		var xedStr = /\//i;
		if (is.min || is.ie5 || is.ie6) {
			newURL = currURL.replace(xedStr,'');
			newURL = escape(newURL);
			location.replace('index_frame.asp?pagina=' + newURL);
		}
	}
}
