    
// CE912ADBE3324e6aA8B0E204481C2D6E represents the panel that containes the whole controls, iframes, images, etc.
// C9100EEA8B7E4a9fB3CD67811BE31648 represents the inner iframe contained.

var InnerModalDialogHeight = 450;
var InnerModalDialogWidth = 850;
var InnerModalDialogHeaderOffset = -70;
var InnerModalDialogMaySwitchFullScreen = false;
var InnerModalDialogCustom = false;

function OpenCustomInnerModalDialog(url, height, width, headerOffset, maySwitchFullScreen)
{
    InnerModalDialogCustom = true;
    InnerModalDialogHeight = height;
    InnerModalDialogWidth = width;
    InnerModalDialogHeaderOffset = headerOffset;
    InnerModalDialogMaySwitchFullScreen = maySwitchFullScreen;
    
    OpenInnerModalDialog(url);
    InnerModalDialogCustom = false;
}

function OpenInnerModalDialog(url)
{
    if(!InnerModalDialogCustom)
    {
        InnerModalDialogHeight = 450;
        InnerModalDialogWidth = 850;
        InnerModalDialogHeaderOffset = -70;
    }
    BrowserDetect.init();
    if(BrowserDetect.browser=="Safari" || BrowserDetect.browser=="Firefox")
    {
       openurl(url,'popup','450','840');
       return;
    }

    ShowInnerModalDialog();
    
    frame = document.getElementById(C9100EEA8B7E4a9fB3CD67811BE31648);
    if (frame)
    {
       frame.src = url;
    }
}

function OpenInnerModalDialogTendencias(url)
{
    if(!InnerModalDialogCustom)
    {
        InnerModalDialogHeight = 600;
        InnerModalDialogWidth = 800;
        InnerModalDialogHeaderOffset = -70;
    }
    BrowserDetect.init();
    if(BrowserDetect.browser=="Safari" || BrowserDetect.browser=="Firefox")
    {
       openurl(url,'popup','450','840');
       return;
    }

    ShowInnerModalDialog();
    
    frame = document.getElementById(C9100EEA8B7E4a9fB3CD67811BE31648);
    if (frame)
    {
       frame.src = url;
    }
}

function ShowInnerModalDialog()
{
    try { ShowWaitingMovie(); } catch(e) {} // Tries to use the loader splash if there already included on page.
    var panel = document.getElementById(CE912ADBE3324e6aA8B0E204481C2D6E);
    
    //panel.style.width = document.body.clientWidth /100 * 80;
    panel.style.width = InnerModalDialogWidth;
    //panel.style.height = document.body.clientHeight /100 * 80;
    panel.style.height = InnerModalDialogHeight;
    panel.style.display = '';
    panel.style.top = (document.body.clientHeight - panel.style.height.replace('px','')) /2;
    panel.style.left = (document.body.clientWidth - panel.style.width.replace('px','')) /2;
    panel.style.zindex = 100;
 
    // Handle browser scrolling.   
    SetInnerModalDialogPosition();
    document.body.onscroll = ScrollDialogHandler;
}

function HideInnerModalDialog()
{
    try { HideWaitingMovie(); } catch(e) {} // Tries to use the loader splash if there already included on page.
    var panel = document.getElementById(CE912ADBE3324e6aA8B0E204481C2D6E);
    panel.style.display='none';
    panel.style.zindex = 100;
    
    frame = document.getElementById(C9100EEA8B7E4a9fB3CD67811BE31648);
    if (frame)
    {
        frame.src = "about:blank";
    }
}

function ScrollDialogHandler(e)
{
    SetInnerModalDialogPosition();
}

function SetInnerModalDialogPosition()
{
    try
    {
        var panel = document.getElementById(CE912ADBE3324e6aA8B0E204481C2D6E);
        panel.style.top = ((document.body.clientHeight - panel.style.height.replace('px','')) /2) + document.body.scrollTop - InnerModalDialogHeaderOffset;
        panel.style.left = ((document.body.clientWidth - panel.style.width.replace('px','')) /2) + document.body.scrollLeft;
        ScrollHandler(e);
    }
    catch(e) 
    {
        // nothing to do...
    }
}

function SwitchFullScreenInnerDialog()
{
    if(InnerModalDialogMaySwitchFullScreen)
    {
        var fr = document.getElementById(C9100EEA8B7E4a9fB3CD67811BE31648);
        var panel = document.getElementById(CE912ADBE3324e6aA8B0E204481C2D6E);
        panel.style.width = document.body.clientWidth;
        panel.style.height = document.body.clientHeight;
        panel.style.top = 0;
        panel.style.left = 0;
    }
    else
    {
        ShowInnerModalDialog();
    }
}


var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
