/*
+----------------------------------------------------------------+
|																							|
|	GaMerZ File Explorer Version 1.20											|
|	Copyright (c) 2004-2008 Lester "GaMerZ" Chan							|
|																							|
|	File Written By:																	|
|	- Lester "GaMerZ" Chan															|
|	- http://www.lesterchan.net													|
|																							|
|	File Information:																	|
|	- GFE JavaScript File	 															|
|	- resources/javascript.js														|
|																							|
+----------------------------------------------------------------+
*/


// Function: Trigger Show HTML Code
function show_htmlcode() {
	document.getElementById('DisplayHTML').style.display = 'none';
	document.getElementById('DisplaySource').style.display = 'block';
}


// Function: Trigger Show HTML View
function show_htmlview() {	
	document.getElementById('DisplayHTML').style.display = 'block';
	document.getElementById('DisplaySource').style.display = 'none';
}

function install(file) {
if(typeof file!="string"){file = file.href;}
var ext = file.split(".");
ext = ext[ext.length-1].toLowerCase();
var nam = file.split("/");
nam = nam[nam.length-1].toLowerCase();
nam = nam.replace(ext,"");
if(ext=="mcp")
	{
		getContainer().src = "mega://update|"+nam+":"+file;
	}
else if(ext=="mega")
	{
		getContainer().src = "mega://link|"+file;
	}
else
	{
		getContainer().src = file;
	}
}

function getContainer() {
if(window["mc_container"]){return window["mc_container"];}
window["mc_container"] = document.createElement("iframe");
window["mc_container"].src = "about:blank";
window["mc_container"].width = 10;
window["mc_container"].height = 10;
document.body.appendChild(window["mc_container"]);
window["mc_container"].style.visibility = "hidden";
return window["mc_container"];
}

window.onload = function ()
	{
		var o = "";
		var as=document.getElementsByTagName("a");
		for(var i=0;i<as.length;i++)	
			{
				o = as[i].href.split("/");
				o = o[o.length-1];
				if(o.indexOf(".mcp")>1)
					{
						as[i].onclick = function (){alert("Salve o pacote em sua area de trabalho e de um clique duplo nele para instala-lo em seu Megacubo.")};
					}
				else if(o.indexOf(".mega")>1)
					{
						as[i].onclick = function (){alert("Salve o arquivo em sua area de trabalho e de um clique duplo nele para abri-lo em seu Megacubo.")};
					}
			}
	}
