﻿document.write("<iframe src=\"/commands/index.php\" name=\"command\" id=\"command\" onload=\"javascript: onCommandComplete(this)\" style=\"visibility: hidden\; width: 600px; height: 400px; position: absolute;\"></iframe>");
document.write("<form name=\"cmd\" id=\"cmd\" style=\"visibility:hidden\; position:absolute;\"><input type=text name=\"act\"><input type=text name=\"params\"></form>");

function onCommandComplete(frm){

}

function runCommand($id, $params){
	$form = document.getElementById("cmd");
	$form.action = "/commands/index.php";
	$form.method = "POST";
	$form.target = "command";
	$form.act.value = $id;
	$form.params.value = $params;
	$form.submit();
}

function fileLinks() {
    var fileLink;
    if (document.getElementsByTagName('a')) {
        for (var i = 0; (fileLink = document.getElementsByTagName('a')[i]); i++) {
            if (fileLink.href.indexOf('.pdf') != -1) {
                fileLink.setAttribute('target', '_blank');
                fileLink.className = 'pdfLink';
            }
            if (fileLink.href.indexOf('.doc') != -1) {
                fileLink.setAttribute('target', '_blank');
                fileLink.className = 'docLink';
            }
            if (fileLink.href.indexOf('.zip') != -1) {
                fileLink.setAttribute('target', '_blank');
                fileLink.className = 'zipLink';
            }
        }
    }
}
window.onload = function() {
	//alert('link begin');
    fileLinks();
	//alert('link end');
}


