//var $ = jQuery.noConflict();
;(function($) {if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);return;}
$.blockUI   = function(opts) { install(window, opts); };
$.unblockUI = function(opts) { remove(window, opts); };
$.fn.block = function(opts) {return this.each(function() {if ($.css(this,'position') == 'static') this.style.position = 'relative'; if ($.browser.msie) this.style.zoom = 1; install(this, opts);});};
$.fn.unblock = function(opts) {return this.each(function() {remove(this, opts);});};
$.blockUI.version = 2.11; 
$.blockUI.defaults = { message:  '<h1>Please wait...</h1>',css: {padding:0,margin:0,width:'30%',top:'40%',left:'35%',textAlign:'center',color:'#000',border:'3px solid #aaa',backgroundColor:'#fff',cursor:'wait'}, overlayCSS:  {backgroundColor:'#000',opacity:'0.6'}, baseZ: 100000,centerX: true,centerY: true, allowBodyStretch: true, constrainTabKey: true, fadeOut:  400,focusInput: true,applyPlatformOpacityRules: true,onUnblock: null,quirksmodeOffsetHack: 4};
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
var pageBlock = null;
var pageBlockEls = [];
function install(el, opts) {
    var full = (el == window);
    var msg = opts && opts.message !== undefined ? opts.message : undefined;
    opts = $.extend({}, $.blockUI.defaults, opts || {});
    opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
    var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
    msg = msg === undefined ? opts.message : msg;

    // remove the current block (if there is one)
    if (full && pageBlock) 
        remove(window, {fadeOut:0}); 
    
    // if an existing element is being used as the blocking content then we capture
    // its current place in the DOM (and current display style) so we can restore
    // it when we unblock
    if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
        var node = msg.jquery ? msg[0] : msg;
        var data = {};
        $(el).data('blockUI.history', data);
        data.el = node;
        data.parent = node.parentNode;
        data.display = node.style.display;
        data.position = node.style.position;
        data.parent.removeChild(node);
    }
    var z = opts.baseZ;
    var lyr1 = ($.browser.msie) ? $('<iframe class="blockUI" style="z-index:'+ z++ +';border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="javascript:false;"></iframe>')
                                : $('<div class="blockUI" style="display:none"></div>');
    var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ z++ +';cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
    var lyr3 = full ? $('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';position:fixed"></div>')
                    : $('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');

    // if we have a message, style it
    if (msg) 
        lyr3.css(css);

    // style the overlay
    if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) 
        lyr2.css(opts.overlayCSS);
    lyr2.css('position', full ? 'fixed' : 'absolute');
    
    // make iframe layer transparent in IE
    if ($.browser.msie) 
        lyr1.css('opacity','0.0');

    $([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
    
    // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
    var expr = $.browser.msie && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
    if (ie6 || expr) {
        // give body 100% height
        if (full && opts.allowBodyStretch && $.boxModel)
            $('html,body').css('height','100%');

        // fix ie6 issue when blocked element has a border width
        if ((ie6 || !$.boxModel) && !full) {
            var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
            var fixT = t ? '(0 - '+t+')' : 0;
            var fixL = l ? '(0 - '+l+')' : 0;
        }

        // simulate fixed position
        $.each([lyr1,lyr2,lyr3], function(i,o) {
            var s = o[0].style;
            s.position = 'absolute';
            if (i < 2) {
                full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
                     : s.setExpression('height','this.parentNode.offsetHeight + "px"');
                full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
                     : s.setExpression('width','this.parentNode.offsetWidth + "px"');
                if (fixL) s.setExpression('left', fixL);
                if (fixT) s.setExpression('top', fixT);
            }
            else if (opts.centerY) {
                if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
                s.marginTop = 0;
            }
        });
    }
    // show the message
    lyr3.append(msg).show();
    if (msg && (msg.jquery || msg.nodeType))$(msg).show();
    // bind key and mouse events
    bind(1, el, opts);
    if (full) {pageBlock = lyr3[0];pageBlockEls = $(':input:enabled:visible',pageBlock);if (opts.focusInput) setTimeout(focus, 20);}else center(lyr3[0], opts.centerX, opts.centerY);};

// remove the block
function remove(el, opts) {
    var full = el == window;
    var data = $(el).data('blockUI.history');
    opts = $.extend({}, $.blockUI.defaults, opts || {});
    bind(0, el, opts); // unbind events
    var els = full ? $('body').children().filter('.blockUI') : $('.blockUI', el);
    if (full)pageBlock = pageBlockEls = null;
    if (opts.fadeOut) {els.fadeOut(opts.fadeOut);setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);}else reset(els, data, opts, el);};

// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
    els.each(function(i,o) {
        // remove via DOM calls so we don't lose event handlers
        if (this.parentNode)this.parentNode.removeChild(this);});if (data && data.el) {data.el.style.display = data.display;data.el.style.position = data.position;data.parent.appendChild(data.el);$(data.el).removeData('blockUI.history');}if (typeof opts.onUnblock == 'function')opts.onUnblock(el,opts);};
// bind/unbind the handler
function bind(b, el, opts) {
    var full = el == window, $el = $(el);
    // don't bother unbinding if there is nothing to unbind
    if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))return;if (!full)$el.data('blockUI.isBlocked', b);
    // bind anchors and inputs for mouse and key events
    var events = 'mousedown mouseup keydown keypress';
    b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);

// former impl...
//    var $e = $('a,:input');
//    b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};

// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
    // allow tab navigation (conditionally)
    if (e.keyCode && e.keyCode == 9) {if (pageBlock && e.data.constrainTabKey) {var els = pageBlockEls;var fwd = !e.shiftKey && e.target == els[els.length-1];var back = e.shiftKey && e.target == els[0];if (fwd || back) {setTimeout(function(){focus(back)},10);return false;}}}
    // allow events within the message content
    if ($(e.target).parents('div.blockMsg').length > 0)return true;
    // allow events for content that is not being blocked
    return $(e.target).parents().children().filter('div.blockUI').length == 0;
};
function focus(back) {if (!pageBlockEls)return;var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];if (e)e.focus();};
function center(el, x, y) {
    var p = el.parentNode, s = el.style;
    var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
    var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
    if (x) s.left = l > 0 ? (l+'px') : '0';
    if (y) s.top  = t > 0 ? (t+'px') : '0';
};
function sz(el, p) {return parseInt($.css(el,p))||0;};})(jQuery);




(function( $ ) {$.dequeue = function( a , b ){return $(a).dequeue(b);}})( jQuery ); 
(function($){ var menu,shadow,trigger,content,hash,currentTarget;
	 var defaults={	 menuStyle:{listStyle:'none',padding:'1px',margin:'0px',backgroundColor:'#fff',border:'1px solid #999',width:'100px'},
		 itemStyle:{margin:'0px',color:'#000',display:'block',cursor:'default',padding:'3px',border:'1px solid #fff',backgroundColor:'transparent'},
		 itemHoverStyle:{border:'1px solid #0a246a',backgroundColor:'#b6bdd2'},
		 eventPosX:'pageX',
		 eventPosY:'pageY',
		 shadow:true,
		 onContextMenu:null,
		 onShowMenu:null};
		 $.fn.contextMenu=function(id,options){
			             if(!menu){
						 	        menu=$('<div id="jqContextMenu"></div>').hide().css({position:'absolute',zIndex:'32500'}).appendTo('body').bind('click',function(e){e.stopPropagation()})}
									if(!shadow){shadow=$('<div></div>').css({backgroundColor:'#000',position:'absolute',opacity:0.2,zIndex:499}).appendTo('body').hide()}hash=hash||[];hash.push({id:id,menuStyle:$.extend({},defaults.menuStyle,options.menuStyle||{}),itemStyle:$.extend({},defaults.itemStyle,options.itemStyle||{}),itemHoverStyle:$.extend({},defaults.itemHoverStyle,options.itemHoverStyle||{}),bindings:options.bindings||{},shadow:options.shadow||options.shadow===false?options.shadow:defaults.shadow,onContextMenu:options.onContextMenu||defaults.onContextMenu,onShowMenu:options.onShowMenu||defaults.onShowMenu,eventPosX:options.eventPosX||defaults.eventPosX,eventPosY:options.eventPosY||defaults.eventPosY});
									var index=hash.length-1;
									$(this).bind('contextmenu',function(e){var bShowContext=(!!hash[index].onContextMenu)?hash[index].onContextMenu(e):true;
									if(bShowContext)display(index,this,e,options);
									return false});
									return this};
									function display(index,trigger,e,options){var cur=hash[index];
									content=$('#'+cur.id).find('ul:first').clone(true);
									content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(function(){
										$(this).css(cur.itemHoverStyle)},function(){
										$(this).css(cur.itemStyle)}).find('img').css({verticalAlign:'middle',paddingRight:'2px'});
									menu.html(content);
									if(!!cur.onShowMenu)menu=cur.onShowMenu(e,menu);
									$.each(cur.bindings,function(id,func){
										$('#'+id,menu).bind('click',function(e){hide();
									func(trigger,currentTarget)})});
									menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();
									if(cur.shadow)shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();
									$(document).one('click',hide)}
									function hide(){
										menu.hide();
										shadow.hide()}
									$.contextMenu={defaults:function(userDefaults){
										$.each(userDefaults,
										function(i,val){
											if(typeof val=='object'&&defaults[i]){
												$.extend(defaults[i],val)}else defaults[i]=val}
														)
																					}
									}})(jQuery);
									
$(function(){
  $('div.contextMenu').hide()});(
     function($){
         $.extend($.fn, {swapClass: function(c1, c2) {
                     var c1Elements = this.filter('.' + c1);this.filter('.' + c2).removeClass(c2).addClass(c1);
                     c1Elements.removeClass(c1).addClass(c2);return this;},
                     replaceClass: function(c1, c2) {return this.filter('.' + c1).removeClass(c1).addClass(c2).end();},
                     hoverClass: function(className) {className = className || "hover";return this.hover(function() {$(this).addClass(className);}, function() {$(this).removeClass(className);	});},
                     heightToggle: function(animated, callback) {animated ?this.animate({ height: "toggle" }, animated, callback) :this.each(function(){jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();if(callback)callback.apply(this, arguments);	});},heightHide: function(animated, callback) {if (animated) {this.animate({ height: "hide" }, animated, callback);} else {this.hide();if (callback)this.each(callback);	}},prepareBranches: function(settings) {if (!settings.prerendered) {this.filter(":last-child:not(ul)").addClass(CLASSES.last);this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();}return this.filter(":has(>ul)");},applyClasses: function(settings, toggler) {this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {toggler.apply($(this).next());}).add( $("a", this) ).hoverClass();if (!settings.prerendered) {this.filter(":has(>ul:hidden)")	.addClass(CLASSES.expandable) .replaceClass(CLASSES.last, CLASSES.lastExpandable);this.not(":has(>ul:hidden)") .addClass(CLASSES.collapsable)	.replaceClass(CLASSES.last, CLASSES.lastCollapsable);this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {var classes = "";$.each($(this).parent().attr("class").split(" "), function() {classes += this + "-hitarea ";});$(this).addClass( classes );});}this.find("div." + CLASSES.hitarea).click( toggler );},treeview: function(settings) {settings = $.extend({cookieId: "treeview"}, settings);if (settings.add) {	return this.trigger("add", [settings.add]);}if ( settings.toggle ) {var callback = settings.toggle;	settings.toggle = function() {return callback.apply($(this).parent()[0], arguments);};}function treeController(tree, control) {function handler(filter) {return function() {toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {return filter ? $(this).parent("." + filter).length : true;}) );return false;};}$("a:eq(0)", control).click( handler(CLASSES.collapsable) );$("a:eq(1)", control).click( handler(CLASSES.expandable) );	$("a:eq(2)", control).click( handler() );}function toggler() {$(this)	.parent() .find(">.hitarea") .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )	.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) .end() .swapClass( CLASSES.collapsable, CLASSES.expandable ) .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) .find( ">ul" ) .heightToggle( settings.animated, settings.toggle );	if ( settings.unique ) {$(this).parent() .siblings()	.find(">.hitarea")	.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )	.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )	.end()	.replaceClass( CLASSES.collapsable, CLASSES.expandable ) .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) .find( ">ul" ) .heightHide( settings.animated, settings.toggle );}}function serialize() {function binary(arg) {return arg ? 1 : 0;}var data = [];branches.each(function(i, e) {data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;});	

$.cookie(settings.cookieId, data.join("") );
}
function deserialize() {var stored = $.cookie(settings.cookieId);
if ( stored ) {var data = stored.split("");
branches.each(function(i, e) {$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();});}}
this.addClass("treeview");
var branches = this.find("li").prepareBranches(settings);
switch(settings.persist) {case "cookie":var toggleCallback = settings.toggle;	
settings.toggle = function() {serialize();
if (toggleCallback) {toggleCallback.apply(this, arguments);}};	
deserialize();break;	
case "location":var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); });if ( current.length ) {	current.addClass("selected").parents("ul, li").add( current.next() ).show();}break;}branches.applyClasses(settings, toggler);if ( settings.control ) {treeController(this, settings.control);	
$(settings.control).show();}return this.bind("add", function(event, branches) {$(branches).prev()	.removeClass(CLASSES.last) .removeClass(CLASSES.lastCollapsable) .removeClass(CLASSES.lastExpandable) .find(">.hitarea").removeClass(CLASSES.lastCollapsableHitarea) .removoClass(CLASSES.lastExpandableHitarea);$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);});}});	var CLASSES = $.fn.treeview.classes = {open: "open",closed: "closed",expandable: "expandable",expandableHitarea: "expandable-hitarea",lastExpandableHitarea: "lastExpandable-hitarea",collapsable: "collapsable",	collapsableHitarea: "collapsable-hitarea",lastCollapsableHitarea: "lastCollapsable-hitarea",lastCollapsable: "lastCollapsable",lastExpandable: "lastExpandable",last: "last",hitarea: "hitarea"};$.fn.Treeview = $.fn.treeview;})(jQuery);


/**
* @author Leandro
*/
var path="";
var dirImg="";
var urlApp="";
var urlDat="";
var mail="";
var client="";
var office="";
var depart="";
var grouper="";
var user="";
var nuser="";
var admin="";
var ifondo="";
var menus=new Array;
var menuu=new Array;
var news=new Array;
var global="";
var portal
var aWin=new Array;
var zva;
var informacion='information.asp';
var navegador=navigator.appName ;
function menuPorlets(t,c,o,g,u,p,d){
$.get(informacion, {t:'menuPorlet',c:c,o:o,g:g,u:u,p:'menuPorlet'},
  function(data){
  if (data>''){ 	  
	var el=data.split('<;>');
  	var col= parseInt(el[0]); 
  	var colw= el[5].split(','); 
  	if (col>0) { 
  	$.get(informacion, {t:t,c:c,o:o,g:g,u:u,p:p},
  	function(data){
     $('#zMsg').html("Cargando/ Loaging marco general ...").show();
     	var elementos = data.split('<.>');
        var hd = '<div id="portletheader"><span id="portletcontrols"><img id="" border="0" src="'+"images/proccessing.png"+'" width="18" height="18" style="cursor:pointer;">' +
               '<img border="0" src="'+"images/tag.png"+'" width="18" height="18" style="cursor:pointer;"><img border="0" src="'+"images/unlock.png"+'" width="18" height="18" style="cursor:pointer;"></span></div>'
		hcc = '<table cellSpacing=0 width="100%" border=0;><tbody><tr id="portletcolumns">';
		fcc = '</tr></tbody></table>';
  		document.getElementById('Fondo').innerHTML=hd + hcc +fcc;
		var columnas = el[5].split(',');
		for (var i = 0; i < columnas.length; ++i) {
 		    var etd= document.createElement('td'); etd.id="pcol"+(i+1);
			if (i!=1) etd.style.width= columnas[i] + 'px';
    	  document.getElementById("portletcolumns").appendChild(etd); 
    	  $("#pcol"+i).contextMenu('ContextMenu1', {
    		  bindings: {'mNew': function(t) {adminAccion(t,'p')},
                 'mDelete': function(t) {$(t).remove();}, 
                 'mSave': function(t) {adminAccion(t,'p')},
                 'mEdit': function(t) {adminAccion(t,'p')}}
		   });
			};
   
			for (var i = 0; i < elementos.length; ++i) {try{
			  var porta = elementos[i].split('<;>');
    		  if (porta[0]>''){ 
   				ele = document.createElement('div'); ele.style.width='100%';ele.className="portlet";
				ele.id='P'+porta[0];
				ele.itlink=porta[2];
				ele.itarget=porta[3];
				ele.ilink=porta[4];
				ele.ititle=porta[0];
				ele.ilogo=porta[1];
				ele.iconte="";
				ele.exe=porta;
    		    document.getElementById('pcol'+porta[4]).appendChild(ele);        
    		    var portal=document.getElementById('P'+porta[0])
    		    var conte=porta[6]; 
				if (porta[2].toLowerCase()=='im'){conte='<div width=100% >'+porta[6]+'</div>'}
				else {var conte =conte.replace(/{/g, "\'").replace(/~/g, '"')};
		        if (columnas[parseInt(porta[3])]!=1)portal.innerHTML='<div class="portlet_topper" style="width:100%;"><img border="0" id="img'+ele.id+'" src="' + dirImg + porta[1] + '" width="16" height="16" align="left" style="cursor:pointer;">&nbsp;&nbsp;' + porta[0] + '</div>' + '<div class="portlet_content"  id="'+ele.id+'portlet_content'+'">' + conte + '</div></div>';		
				else '<div class="portlet_topper"><img border="0" src="' + dirImg + porta[1] + '" width="16" height="16">&nbsp;&nbsp;' + porta[0] + '</div>' + '<div class="portlet_content" id="'+ele.id+'portlet_content'+'">' + conte + '</div></div>';				
//				alert(porta[0]+'\n'+porta[1]+'\n'+porta[2]+'\n'+porta[3]+'\n'+porta[4]+'\n'+porta[5]+'\n'+porta[6]+'\n'+porta[7]);
				}}catch(e){e.description};
		
			};
			$('.portlet').bind('dblclick', function(){exe(this.exe)});
		      $('.portlet').contextMenu('ContextMenu1', {
		        bindings: {'mNew': function(t) {adminAccion(t,'p')},
		                   'mDelete': function(t) {$(t).remove();}, 
		                   'mSave': function(t) {adminAccion(t,'p')},
		                   'mEdit': function(t) {adminAccion(t,'p')}}});
 
			  $('a.toggle').click(function(){$(this).parent('div').next('div').toggle();return false;});
		      $('a#portletall_invert').click(function(){$('div.portlet_content').toggle();return false;});
			  $('a#portletall_expand').click(function(){alert('1');return false;});
			  $('a#portletall_collapse').click(function(){alert('2');return false;});
			  $('a#portletall_open').click(function(){$('div.portlet:hidden').show();
								 $('a#all_open:visible').hide();
								 $('a#all_close:hidden').show();
								return false;});
			  $('a#portletall_close').click(function(){
				$('div.portlet:visible').hide();
				$('a#portletall_close:visible').hide();
				$('a#portletall_open:hidden').show();
				return false;});
		      $('#portletcolumns td').Sortable({accept: 'portlet',helperclass: 'sort_placeholder',opacity: 0.7,tolerance: 'intersect'});


			  $('#portletcolumns td').Sortable({accept: 'portlet',helperclass: 'sort_placeholder',opacity: 0.7,tolerance: 'intersect'});
                $.contextMenu.defaults({menuStyle : {border : "2px solid #00f"},shadow: false});

	     	$('#zMsg').hide();
   }); 
}}});
}		


function cambiaro(celda){celda.style.backgroundImage="url('Images/window_top.png')";celda.style.cursor="pointer";}
function cambiaru(celda){celda.style.backgroundImage="";}

function banner(t,c,o,g,u,p,d){
$.get(informacion, {t:t,c:c,o:o,g:g,u:u,p:p},
  function(data){
     $('#zMsg').html("Cargando/ Loaging marco general ...").show();
     	var elementos = data.split('<.>');
        for (var i=0;i<elementos.length-1;++i){ 
            var elemento = elementos[i].split('<;>');
            if (elemento[6]<' '){$("#banner").html("<img src='"+elemento[1]+"' alt='' >");}
            else {$("#banner").html(elemento[6])};
        }; 
     	$('#zMsg').hide()});

   
};

function loadApps(t,c,o,g,u,p,d){
$.get(informacion, {t:t,c:c,o:o,g:g,u:u,p:p},
  function(data){
     $('#zMsg').html("Cargando/ Loaging marco general ...").show();
     	var elementos = data.split('<.>');
        for (var i=0;i<elementos.length-1;++i){ 
            var elemento = elementos[i].split('<;>');
            menus[i]= elemento;
            document.getElementById(d).innerHTML=document.getElementById(d).innerHTML+'<a class="menuET-item" href="javascript:exe(menus['+i+']);" data="1" conte="2"><img src="'+elemento[1]+'" alt="'+elemento[5]+'" /><span>'+elemento[0]+'</span></a>' 
        }; 
        $(document).ready(function(){$('#menuar').Fisheye({maxWidth: 50,items: 'a',itemsText: 'span',container: '.menuET-container',itemWidth: 30,proximity: 90,halign : 'center'})});
     	$('#zMsg').hide()});
};
function loadMenus(t,c,o,g,u,p,d){
$.get(informacion, {t:t,c:c,o:o,g:g,u:u,p:p},
  function(data){
     $('#zMsg').html("Cargando/ Loaging marco general ...").show();
     	var elementos = data.split('<.>');
        var menu='<table id="opciones_menu" border=1 width=100% style="border-collapse: collapse"><tr class="title"><td align="center">Opciones</td></tr>';
        for (var i=0;i<elementos.length-1;++i){ 
            var elemento = elementos[i].split('<;>');
            menus['10'+i]= elemento;
            menu=menu+'<tr><td class="option"><a href="javascript:$(\'#menuGal\').toggle(); exe(menus[10'+i+']);"><img src="'+elemento[1]+'" width=30 height=30 style="border: none; margin: 0px 0px 0px;"/>'+elemento[0]+'</a></td></tr>' ;
        }; 
        
	document.getElementById(d).innerHTML=menu+'</table>';

     	$('#zMsg').hide()});
};

function exe(d){
   d[0]=d[0].replace(/ /g, "");
   d[2]=d[2].replace(/^(\s|\&nbsp;)*|(\s|\&nbsp;)*$/g,"");
//alert(d);
   if (d[3].toLowerCase()=='w') windows(d[0], d[3],d[0],d[1],d[2],d[6],100,100,100,100,d[4]);
   if (d[3].toLowerCase()=='m') modal(d[0], d[3],d[0],d[1],d[2],d[6],100,100,100,100,d[4]);
   if (d[3]<=' ')               win(d[0], d[3],d[0],d[1],d[2],d[6],'','','','',d[4]);
   if (d[3].toLowerCase()=='f') win(d[0], d[3],d[0],d[1],d[2],d[6],'','','','',d[4]);
   if (d[3].toLowerCase()=='i') win(d[0], d[3],d[0],d[1],d[2],d[6],'','','','',d[4]);
};

function windows(id, target,title,icon,url,conte,x,y,w,h,m){
    if (url>"" && url.toLowerCase().indexOf('http')<0)url='http://'+url;
	if (url>''){ventana=window.open (url,id);ventana.focus();}
	else {ventana= window.open ("", "title","location=1,status=1");ventana.document.write(conte);ventana.focus();}};

function modal(id, target,title,icon,url,conte,x,y,w,h,m){
    if (url>"" && url.toLowerCase().indexOf('http')<0)url='http://'+url;
	if (url>'')   {ventana=window.open (url,id,"modal=yes");ventana.focus();}
	else {ventana= window.open ("", "title","location=1,status=1, modal=yes");ventana.document.write(conte);ventana.focus();}};

function win(id,target,title,icon,url,conte,x,y,w,h,m){
 var contenido="";
// alert('Id: '+id+'\n target: '+target+'\n title: '+title+'\n icon: '+icon+'\n URL: '+url+'\n Cont: '+conte.substr(1,40)+'\n x: '+x+'\n y:'+y+'\n w: '+w+'\n h: '+h+'\n m: '+m);
 if (m=='func'){url=informacion+'?t='+url+'&did=url'};
 if (conte>''){contenido=conte};
// if (url>"" && url.toLowerCase().indexOf('http')<0)url='http://'+url;
 if (document.getElementById(id)) {
                try {$("#" + id).setZIndex(32500);} catch(e){};
 			    $("#" + id).show();}
 else { 	   								

      
    nvo = $(".dialog");
    nv = nvo.length;  
    if (isNaN(nv))nv=0;    
    for (var i=nv; i>=0;--i){
            if(nvo[i])nvo[i].style.zIndex=(32500-(100*(i+1)));
            
            
            };
    
   	if (!w) w = $("#Fondo")[0].clientWidth-(40*((nv+1)));
   	if (!x) x = (($("#Fondo")[0].clientWidth-w)/2);
   	if (!h) {h = $("#Fondo")[0].clientHeight-((document.getElementById('menuTop').offsetTop+document.getElementById('menuTop').offsetHeight));}
   	if (!y) y = (document.getElementById('menuTop').offsetTop+document.getElementById('menuTop').offsetHeight)+(nv*20);

    win1 = new Window(id, {className: "alphacube", title: nv+'.'+title,url:url, width:w, height:h,left:x,top:y,showEffectOptions: {duration:3}}); 
    win1.setZIndex(32500);
  /*  win1.getContent().innerHTML = "<h1>Left:"+'25'+"</h1>"+
                                  "<h1>Top:"+y+"</h1>"+
                                  "<h1>Width:"+w+"</h1>"+
                                  "<h1>Height:"+h+"</h1>"+
                                  "<h1>Url:"+url+"</h1>";
*/
    win1.show();
    win1.setDestroyOnClose();

};
 }; 

function iFrameCargado(a, conte){};

function adminAccion(e,a){
	var id  = 'Win'+e.id;
	var destino = $("#Fondo");
	var title   = e.ititle || e.getAttribute("ititle")||"";
	var logo    = e.ilogo || e.getAttribute("ilogo")||"";
    var url     = 'localhost/sw/portal.htm' ;
    var x       =''; 
	var y       =''; 
    var w       = 800;
	var h       =500;
	var m       = "";
    var ac      = e.itlink ||	e.getAttribute("itlink")||"";
	if (document.getElementById(e.id + 'portlet_content')){
		var conte = document.getElementById(e.id + 'portlet_content').innerHTML
	}
	else 
		var conte = e.getAttribute("iconte"); 

    win(id,destino,title,logo,url,'',x,y,w,h,m.toUpperCase());
    $.blockUI({ message: $('#'+id),css:{left:$('#'+id).offsetLeft+'px',top:$('#'+id).offsetTop+'px'}}); 
    $('#zMsg').hide();
    
};


function inicio(){
	$(document).ready(function() {
		$("#Fondo").height(document.documentElement.clientHeight-document.getElementById("Fondo").offsetTop-30);
		$("#zMsg").html("Cargando/ Loaging marco general ...").show();
		$("#zMsg").html("").show();banner("banner","","","","","banner", "banner"); 
        loadApps("menuET","","","","","menuET", "menuET-container");
        loadMenus("menuGL","","","","","menuGL", "menuGal");
        menuPorlets("menuPorlets","","","","","menuPorlets", "");
$("#img1start").bind("mouseover", function(e) {this.src='images/buttonD5.gif';});
$("#img1start").bind("mouseout", function(e) {this.src='images/buttonD3.gif';});
$("#img1start").bind("click", function(e) {$("#menuGal").toggle();});
$("#menuGal").bind("click", function(e) {$("#menuGal").toggle();});
$("body").bind("resize", function(e) {$("#taskMenu").style.bottom=0;});

     $('#banner').contextMenu('ContextMenuBanner', {
                bindings: {'mNew': function(t) {alert('me llama '+t.id+'\nAction was New');window.open('http://localhost/sw/portal.htm', 'A adir portLet')},
                           'mDelete': function(t) {$(t).remove();}, 
                           'mSave': function(t) {alert('me llama '+t.id+'\nAction was Save');window.open('http://localhost/sw/portal.htm', 'Salvar portLet')},
                           'mEdit': function(t) {alert('me llama '+t.id+'\nAction was Edit');window.open('http://localhost/sw/portal.htm', 'Editar portLet')}}});



    $('#taskMenu').contextMenu('ContextAplica', {
                bindings: {'mNew': function(t) {alert('me llama '+t.id+'\nAction was New');window.open('http://localhost/sw/portal.htm', 'A adir portLet')},
                           'mDelete': function(t) {$(t).remove();}, 
                           'mSave': function(t) {alert('me llama '+t.id+'\nAction was Save');window.open('http://localhost/sw/portal.htm', 'Salvar portLet')},
                           'mEdit': function(t) {alert('me llama '+t.id+'\nAction was Edit');window.open('http://localhost/sw/portal.htm', 'Editar portLet')}}});


    $('#menuTop').contextMenu('ContextMenud', {
                bindings: {'mNew': function(t) {alert('me llama '+t.id+'\nAction was New');window.open('http://localhost/sw/portal.htm', 'A adir portLet')},
                           'mDelete': function(t) {$(t).remove();}, 
                           'mSave': function(t) {alert('me llama '+t.id+'\nAction was Save');window.open('http://localhost/sw/portal.htm', 'Salvar portLet')},
                           'mEdit': function(t) {alert('me llama '+t.id+'\nAction was Edit');window.open('http://localhost/sw/portal.htm', 'Editar portLet')}}});


    var menus = document.createElement('div');menus.style.display='none';
    menus.innerHTML='<div class="contextMenu" id="ContextMenu1"><ul><li id="mNew"><img src="images/new.gif" />New portlet</li><li id="mDelete"><img src="images/note_delete.gif" />Delete portlet</li><li id="mEdit"><img src="images/note.gif" />Edit portlet</li><li id="mSave"><img src="images/save.gif" />Save porlert</li></ul></div>'+
    +'<div class="contextMenu" id="ContextAplica"><ul><li id="mNew"><img src="images/note_new.gif" />New Instalation</li><li id="mEdit"><img src="images/note.gif" />Edit instalation</li></ul></div>'
    +'<div class="contextMenu" id="ContextGal"><ul><li id="mNew"><img src="images/note_new.gif" />New option</li><li id="mDelete"><img src="images/note_delete.gif" />Delete option</li><li id="mEdit"><img src="images/note.gif" />Edit option</li><li id="mSave"><img src="images/save.gif" />Save option</li></ul></div>'
    +'<div class="contextMenu" id="ContextMenud"><ul><li id="mNew"><img src="images/note_new.gif" />New option</li><li id="mDelete"><img src="images/note_delete.gif" />Delete option</li><li id="mEdit"><img src="images/note.gif" />Edit option</li><li id="mSave"><img src="images/save.gif" />Save option</li></ul></div>'
    +'<div class="contextMenu" id="ContextMenuBanner"><ul><li id="mNew"><img src="images/note_new.gif" />Edit banner</li></ul></div>';
    document.body.appendChild(menus);


})
};

