/*dnncore.js*/
//General
//for example: instead of each module writing out script found in moduleMaxMin_OnClick have the functionality cached
//

var DNN_COL_DELIMITER = String.fromCharCode(16);
var DNN_ROW_DELIMITER = String.fromCharCode(15);
var __dnn_m_bPageLoaded = false;

window.onload = __dnn_Page_OnLoad;

function __dnn_ClientAPIEnabled()
{
	return typeof(dnn) != 'undefined';
}


function __dnn_Page_OnLoad()
{
	if (__dnn_ClientAPIEnabled())
	{
		var sLoadHandlers = dnn.getVar('__dnn_pageload');
		if (sLoadHandlers != null)
			eval(sLoadHandlers);
		
		dnn.dom.attachEvent(window, 'onscroll', __dnn_bodyscroll);
	}
	__dnn_m_bPageLoaded = true;
}

function __dnn_KeyDown(iKeyCode, sFunc, e)
{
	if (e == null)
		e = window.event;

	if (e.keyCode == iKeyCode)
	{
		eval(unescape(sFunc));
		return false;
	}
}

function __dnn_bodyscroll() 
{
	var oF=document.forms[0];	
	if (__dnn_ClientAPIEnabled() && __dnn_m_bPageLoaded)
		oF.ScrollTop.value=document.documentElement.scrollTop ? document.documentElement.scrollTop : dnn.dom.getByTagName("body")[0].scrollTop;
}

function __dnn_setScrollTop(iTop)
{
	if (__dnn_ClientAPIEnabled())
	{
		if (iTop == null)
			iTop = document.forms[0].ScrollTop.value;
	
		var sID = dnn.getVar('ScrollToControl');
		if (sID != null && sID.length > 0)
		{
			var oCtl = dnn.dom.getById(sID);
			if (oCtl != null)
			{
				iTop = dnn.dom.positioning.elementTop(oCtl);
				dnn.setVar('ScrollToControl', '');
			}
		}
		window.scrollTo(0, iTop);
	}
}

//Focus logic
function __dnn_SetInitialFocus(sID)
{
	var oCtl = dnn.dom.getById(sID);	
	if (oCtl != null && __dnn_CanReceiveFocus(oCtl))
		oCtl.focus();
}	

function __dnn_CanReceiveFocus(e)
{
	//probably should call getComputedStyle for classes that cause item to be hidden
	if (e.style.display != 'none' && e.tabIndex > -1 && e.disabled == false && e.style.visible != 'hidden')
	{
		var eParent = e.parentElement;
		while (eParent != null && eParent.tagName != 'BODY')
		{
			if (eParent.style.display == 'none' || eParent.disabled || eParent.style.visible == 'hidden')
				return false;
			eParent = eParent.parentElement;
		}
		return true;
	}
	else
		return false;
}

//Max/Min Script
function __dnn_ContainerMaxMin_OnClick(oLnk, sContentID)
{
	var oContent = dnn.dom.getById(sContentID);
	if (oContent != null)
	{
		var oBtn = oLnk.childNodes[0];
		var sContainerID = oLnk.getAttribute('containerid');
		var sCookieID = oLnk.getAttribute('cookieid');
		var sCurrentFile = oBtn.src.toLowerCase().substr(oBtn.src.lastIndexOf('/'));
		var sMaxFile;
		var sMaxIcon;
		var sMinIcon;

		if (dnn.getVar('min_icon_' + sContainerID))
			sMinIcon = dnn.getVar('min_icon_' + sContainerID);
		else
			sMinIcon = dnn.getVar('min_icon');

		if (dnn.getVar('max_icon_' + sContainerID))
			sMaxIcon = dnn.getVar('max_icon_' + sContainerID);
		else
			sMaxIcon = dnn.getVar('max_icon');

		sMaxFile = sMaxIcon.toLowerCase().substr(sMaxIcon.lastIndexOf('/'));

		var iNum = 5;
		if (oLnk.getAttribute('animf') != null)
			iNum = new Number(oLnk.getAttribute('animf'));
			
		if (sCurrentFile == sMaxFile)
		{
			oBtn.src = sMinIcon;				
			//oContent.style.display = '';
			dnn.dom.expandElement(oContent, iNum);
			oBtn.title = dnn.getVar('min_text');
			if (sCookieID != null)
			{
				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
					dnn.dom.setCookie(sCookieID, 'true', 365);
				else
					dnn.dom.deleteCookie(sCookieID);
			}
			else
				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'true');
		}
		else
		{
			oBtn.src = sMaxIcon;				
			//oContent.style.display = 'none';
			dnn.dom.collapseElement(oContent, iNum);
			oBtn.title = dnn.getVar('max_text');
			if (sCookieID != null)
			{
				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
					dnn.dom.deleteCookie(sCookieID);
				else
					dnn.dom.setCookie(sCookieID, 'false', 365);				
			}
			else
				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'false');			
		}
		
		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

function __dnn_Help_OnClick(sHelpID)
{
	var oHelp = dnn.dom.getById(sHelpID);
	if (oHelp != null)
	{
		if (oHelp.style.display == 'none')
			oHelp.style.display = '';
		else
			oHelp.style.display = 'none';

		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

function __dnn_SectionMaxMin(oBtn, sContentID)
{
	var oContent = dnn.dom.getById(sContentID);
	if (oContent != null)
	{
		var sMaxIcon = oBtn.getAttribute('max_icon');
		var sMinIcon = oBtn.getAttribute('min_icon');
		if (oContent.style.display == 'none')
		{
			oBtn.src = sMinIcon;				
			oContent.style.display = '';
			dnn.setVar(oBtn.id + ':exp', 1);
		}
		else
		{
			oBtn.src = sMaxIcon;				
			oContent.style.display = 'none';
			dnn.setVar(oBtn.id + ':exp', 0);
		}
		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

//Drag N Drop
function __dnn_enableDragDrop()
{
	var aryConts = dnn.getVar('__dnn_dragDrop').split(";");	
	var aryTitles;

	for (var i=0; i < aryConts.length; i++)
	{
		aryTitles = aryConts[i].split(" ");
		if (aryTitles[0].length > 0)
		{			
			var oCtr = dnn.dom.getById(aryTitles[0]);
			var oTitle = dnn.dom.getById(aryTitles[1]);
			if (oCtr != null && oTitle != null)
			{
				oCtr.setAttribute('moduleid', aryTitles[2]);
				dnn.dom.positioning.enableDragAndDrop(oCtr, oTitle, '__dnn_dragComplete()', '__dnn_dragOver()');
			}	
		}
	}
}

var __dnn_oPrevSelPane;
var __dnn_oPrevSelModule;
var __dnn_dragEventCount=0;
function __dnn_dragOver()
{
	__dnn_dragEventCount++;
	if (__dnn_dragEventCount % 75 != 0)	//only calculate position every 75 events
		return;
	
	var oCont = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);

	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
		
	if (__dnn_oPrevSelPane != null)	//reset previous pane's border
		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;

	if (oPane != null)
	{		
		__dnn_oPrevSelPane = oPane;
		oPane.pane.style.border = '4px double ' + DNN_HIGHLIGHT_COLOR;
		var iIndex = __dnn_getPaneControlIndex(oCont, oPane);

		var oPrevCtl;
		var oNextCtl;
		for (var i=0; i<oPane.controls.length; i++)
		{
			if (iIndex > i && oPane.controls[i].id != oCont.id)
				oPrevCtl = oPane.controls[i];
			if (iIndex <= i && oPane.controls[i].id != oCont.id)
			{
				oNextCtl = oPane.controls[i];
				break;
			}
		}			
		
		if (__dnn_oPrevSelModule != null)
			dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
			

		if (oNextCtl != null)
		{
			__dnn_oPrevSelModule = oNextCtl;
			dnn.dom.getNonTextNode(oNextCtl.control).style.borderTop = '5px groove ' + DNN_HIGHLIGHT_COLOR;
		}
		else if (oPrevCtl != null)
		{
			__dnn_oPrevSelModule = oPrevCtl;
			dnn.dom.getNonTextNode(oPrevCtl.control).style.borderBottom = '5px groove ' + DNN_HIGHLIGHT_COLOR;
		}
	}
}

function __dnn_dragComplete()
{
	var oCtl = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);
	var sModuleID = oCtl.getAttribute('moduleid');
	
	if (__dnn_oPrevSelPane != null)
		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;

	if (__dnn_oPrevSelModule != null)
		dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
		
	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
	var iIndex;
	if (oPane == null)
	{
		var oPanes = __dnn_Panes();
		for (var i=0; i<oPanes.length; i++)
		{
			if (oPanes[i].id == oCtl.parentNode.id)
				oPane = oPanes[i];
		}
	}	
	if (oPane != null)
	{
		iIndex = __dnn_getPaneControlIndex(oCtl, oPane);
		__dnn_MoveToPane(oPane, oCtl, iIndex);

		dnn.callPostBack('MoveToPane', 'moduleid=' + sModuleID, 'pane=' + oPane.paneName, 'order=' + iIndex * 2); 
	}
}

function __dnn_MoveToPane(oPane, oCtl, iIndex)
{

	if (oPane != null)
	{
		var aryCtls = new Array();
		for (var i=iIndex; i<oPane.controls.length; i++)
		{
			if (oPane.controls[i].control.id != oCtl.id)
				aryCtls[aryCtls.length] = oPane.controls[i].control;

			dnn.dom.removeChild(oPane.controls[i].control);
		}
		dnn.dom.appendChild(oPane.pane, oCtl);
		oCtl.style.top=0;
		oCtl.style.left=0;
		oCtl.style.position = 'relative';
		for (var i=0; i<aryCtls.length; i++)
		{
			dnn.dom.appendChild(oPane.pane, aryCtls[i]);
		}
		__dnn_RefreshPanes();
	}
	else
	{
		oCtl.style.top=0;
		oCtl.style.left=0;
		oCtl.style.position = 'relative';
	}
}

function __dnn_RefreshPanes()
{
	var aryPanes = dnn.getVar('__dnn_Panes').split(';');
	var aryPaneNames = dnn.getVar('__dnn_PaneNames').split(';');
	__dnn_m_aryPanes = new Array();
	for (var i=0; i<aryPanes.length; i++)
	{
		if (aryPanes[i].length > 0)
			__dnn_m_aryPanes[__dnn_m_aryPanes.length] = new __dnn_Pane(dnn.dom.getById(aryPanes[i]), aryPaneNames[i]);
	}
}

var __dnn_m_aryPanes;
var __dnn_m_aryModules;
function __dnn_Panes()
{
	if (__dnn_m_aryPanes == null)
	{
		__dnn_m_aryPanes = new Array();
		__dnn_RefreshPanes();
	}
	return __dnn_m_aryPanes;
}

function __dnn_Modules(sModuleID)
{
	if (__dnn_m_aryModules == null)
		__dnn_RefreshPanes();
	
	return __dnn_m_aryModules[sModuleID];
}

function __dnn_getMostSelectedPane(oContent)
{
	var oCDims = new dnn.dom.positioning.dims(oContent);
	var iTopScore=0;
	var iScore;
	var oTopPane;
	for (var i=0; i<__dnn_Panes().length; i++)
	{
		var oPane = __dnn_Panes()[i];
		var oPDims = new dnn.dom.positioning.dims(oPane.pane);
		iScore = dnn.dom.positioning.elementOverlapScore(oPDims, oCDims);
		
		if (iScore > iTopScore)
		{
			iTopScore = iScore;
			oTopPane = oPane;
		}
	}
	return oTopPane;
}

function __dnn_getPaneControlIndex(oContent, oPane)
{
	if (oPane == null)
		return;
	var oCDims = new dnn.dom.positioning.dims(oContent);
	var oCtl;
	if (oPane.controls.length == 0)
		return 0;
	for (var i=0; i<oPane.controls.length; i++)
	{
		oCtl = oPane.controls[i];
		var oIDims = new dnn.dom.positioning.dims(oCtl.control);
		if (oCDims.t < oIDims.t)
			return oCtl.index;
	}
	if (oCtl != null)
		return oCtl.index+1;
	else
		return 0;
}

//Objects
function __dnn_Pane(ctl, sPaneName)
{
	this.pane = ctl;
	this.id = ctl.id;
	this.controls = new Array();
	this.origBorder = ctl.style.border;
	this.paneName = sPaneName;
	
	var iIndex = 0;
	var strModuleOrder='';
	for (var i=0; i<ctl.childNodes.length; i++)
	{
		var oNode = ctl.childNodes[i];
		if (dnn.dom.isNonTextNode(oNode))	
		{
			if (__dnn_m_aryModules == null)
				__dnn_m_aryModules = new Array();

			//if (oNode.tagName == 'A' && oNode.childNodes.length > 0)
			//	oNode = oNode.childNodes[0];	//DNN now embeds anchor tag 
				
			var sModuleID = oNode.getAttribute('moduleid');
			if (sModuleID != null && sModuleID.length > 0)
			{
				strModuleOrder += sModuleID + '~';
				this.controls[this.controls.length] = new __dnn_PaneControl(oNode, iIndex);
				__dnn_m_aryModules[sModuleID] = oNode.id;
				iIndex+=1;
			}
		}
	}
	this.moduleOrder = strModuleOrder;

}

function __dnn_PaneControl(ctl, iIndex)
{
	this.control = ctl;
	this.id = ctl.id;
	this.index = iIndex;
	this.origBorder = ctl.style.border;
	
}
////by yossi
//function showPlayerObject(divName,src) {
//	var d=document.getElementById(divName);
//	var obj='<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" type="video/x-ms-wma" id="itemPlayer" width="100%" height="288" style="backgroung-color:black;" standby="Loading Microsoft Windows Media Player components..." bgcolor="black" border=0 Onmousedown="WallaCheckAds();"><param name="BufferingTime" value="8"><param name="AllowChangeDisplaySize" value="true"><param name="AutoRewind" value=1><param name="ControlType" value=1><param name="showFrame" value="true" /><param name="EnableContextMenu" value="false"><param name="stretchToFit" value="true"><param name="uiMode" value="none"><param name="windowlessVideo" value="false"/><param id="itemPlayerUrl" name="url" value='+src+'><embed type="application/x-mplayer2" name="itemPlayer" src="'+src+'"pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" Height="100%" Width="288" AutoStart="1" ShowControls="0" StretchToFit="1"></embed></object>';
//	d.innerHTML=obj;
//	alert('ok');
//}

/*
function __dnn_TableRowReorder(ctl, bUp, sKey)
{
	var oTR;
	var oPTR;
	var oP = ctl.parentNode;

	while (oP != null)
	{
		if  (oP.tagName.toLowerCase() == 'tr')
		{
			oTR = oP;
			break;
		}		
		oP = oP.parentNode;
	}
	if (oTR != null)
	{
		oPTR = oTR.parentNode;
		var iIndex = oTR.rowIndex;
		if (oTR.getAttribute('origidx') == '-1')
			__dnn_TableRowSetOrigIndex(oPTR);

		var iNextIdx;
		if (bUp)
			iNextIdx = __dnn_TableRowGetPrevNodeIdx(oPTR, iIndex-1);
		else
			iNextIdx = __dnn_TableRowGetNextNodeIdx(oPTR, iIndex+1);
		if (iNextIdx > -1)
		{
			dnn.dom.removeChild(oTR);
			if (oPTR.childNodes.length > iNextIdx)
				oPTR.insertBefore(oTR, oPTR.childNodes(iNextIdx));
			else
				oPTR.appendChild(oTR);
			
			dnn.setVar(sKey,__dnn_GetTableRowOrder(oPTR));
		}
		return true;//handled
	}
}

function __dnn_TableRowGetNextNodeIdx(oParent, iStartIndex)
{
	for (var i=iStartIndex; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
			return i;
	}
	return -1;
}

function __dnn_TableRowGetPrevNodeIdx(oParent, iStartIndex)
{
	for (var i=iStartIndex; i>=0; i--)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
			return i;
	}
	return -1;
}

function __dnn_TableRowSetOrigIndex(oParent)
{
	var iIdx=0;
	for (var i=0; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
		{
			oCtl.setAttribute('origidx', iIdx.toString());
			iIdx++;
		}
	}
}

function __dnn_GetTableRowOrder(oParent)
{
	var sIdx;
	var sRet='';
	for (var i=0; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		sIdx = oCtl.getAttribute('origidx');
		if (sIdx)
			sRet+= (sRet.length>0 ? ',':'') + sIdx;
	}
	return sRet;
}
*/
/*Tuanix.Utils.js*/
// Obtener posicion de objetos

///////////////////////////////
function GalleryImage(title,imgUrl)
{
    this.title=title;
    this.imgUrl=imgUrl;
 
}


function isFlashInstaled()
{
  return DetectFlashVer(6, 0, 0);
}

function isIex()
{
  var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  return isIE;
}


/////////////////////////////

function SelectFixedDDL(val,txt,txtValue,txtText,spanText)
{
  var v=document.getElementById(txtValue);
  v.value=val;
  var t=document.getElementById(txtText);
  t.value=txt;
  var span=document.getElementById(spanText);
  span.innerHTML=txt;
}
function PrintBanner(divName,width,height,wmode,src,spec,xparams,muzilavars,altenativeBlockHtml) {
	var d=document.getElementById(divName);
	if(!muzilavars)
	{
	   muzilavars='';
	}
	if(isFlashInstaled())
	    d.innerHTML='<OBJECT '+spec+' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0	 WIDTH='+width+' HEIGHT='+height+'><PARAM NAME=movie VALUE="'+src+'"><PARAM NAME=wmode value='+wmode+'><PARAM NAME=quality VALUE=high><PARAM NAME=AllowScriptAccess VALUE=always>'+xparams+'<EMBED src="'+src+'" quality=high WIDTH='+width+' HEIGHT='+height+'  '+muzilavars+' AllowScriptAccess=always TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash  type=application/x-shockwave-flash></EMBED></OBJECT>';
	else
	{
	   if (!altenativeBlockHtml)
	     altenativeBlockHtml='<BR>This content From <a href="http://www.tuanix.com">Tuanix.com</a> requires the Adobe Flash Player.<a href=http://www.adobe.com/go/getflash/>Get it here</a>';
	   d.innerHTML= altenativeBlockHtml;
	}
	   
	
}
function PrintBannerSSL(divName,width,height,wmode,src,spec,xparams,muzilavars,altenativeBlockHtml) {
	var d=document.getElementById(divName);
	if(!muzilavars)
	{
	   muzilavars='';
	}
	if(isFlashInstaled())
	   d.innerHTML='<OBJECT '+spec+' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0	 WIDTH='+width+' HEIGHT='+height+'><PARAM NAME=movie VALUE="'+src+'"><PARAM NAME=wmode value='+wmode+'><PARAM NAME=quality VALUE=high><PARAM NAME=AllowScriptAccess VALUE=always>'+xparams+'<EMBED src="'+src+'" quality=high WIDTH='+width+' HEIGHT='+height+' WMODE='+wmode+' '+muzilavars+' AllowScriptAccess=always TYPE=application/x-shockwave-flash PLUGINSPAGE=https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash  type=application/x-shockwave-flash></EMBED></OBJECT>';
    else
	  {
	   if (!altenativeBlockHtml)
	     altenativeBlockHtml='<BR>This content From <a href="http://www.tuanix.com">Tuanix.com</a> requires the Adobe Flash Player.<a href=http://www.adobe.com/go/getflash/>Get it here</a>';
	   d.innerHTML= altenativeBlockHtml;
	}   
}


getTopPos = function(obj)
{		
  var returnValue = obj.offsetTop;
  while((obj = obj.offsetParent) != null){
  	if(obj.tagName!='HTML')returnValue += obj.offsetTop;
  }
  return returnValue;
}

getLeftPos = function(obj)
{
  var returnValue = obj.offsetLeft;
  while((obj = obj.offsetParent) != null){
  	if(obj.tagName!='HTML')returnValue += obj.offsetLeft;
  }
  return returnValue;
}

//Search 
search = function() {
    var text = document.getElementsByName('search_text');
    var search = document.getElementsByName('search_module');

    where = 'A00';
    for (i=0;i<search.length;i++){
        if (search[i].checked==true)
            where = search[i].value;
    }
    
    if(where == "Goo")
		extWin = window.open('http://www.google.com/search?hl=en&q=' + text[0].value.replace(/[ ]/g,'+'),'','left=20,top=20,width=500,height=500,toolbar=0,resizable=1');
	else if(where == "Yah")
		extWin = window.open('http://search.yahoo.com/search?p=' + text[0].value.replace(/[ ]/g,'+'),'', 'left=40,top=40,width=500,height=500,toolbar=0,resizable=1');
     else
       	window.location.href='%NAVIGATE:'+ where + ',6%' + text[0].value.replace(/[ ]/g,'+');
}

//-----------------------------------------------------------------------------
//TabbedFormatter
makeactive = function(tab) { 
	document.getElementById("tab1").className = ""; 				
	document.getElementById("tab2").className = ""; 				
	document.getElementById("tab3").className = ""; 
	document.getElementById("tab"+tab).className = "active"; 
	document.getElementById("content1").className = "content inactive"; 			
	document.getElementById("content2").className = "content inactive"; 			
	document.getElementById("content3").className = "content inactive"; 
	document.getElementById("content"+tab).className = "content active";
} 

//-----------------------------------------------------------------------------
// IE FIX -- Dario

function writeFlash (i, d, w, h, ai, at, q, m){
    var s = '<object id="' + i + '" data="' + d + '" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" >';
    s += '<param name="movie" value="' + d + '" /><param name="quality" value="' + q + '" /><param name="wmode" value="' + m + '" />';
    if (ai && ai.length > 0)
    {
        s += '<img src="' + ai + '" width="' + w + '" height="' + h + '" alt="' + at + '" />';
    }
    s += '<embed src="' + d + '" quality="' + q + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>';
    s += "</object>";
    document.write(s);
}

function writeFlashExt (i, d, w, h, ai, at, q, m, t){
    var s = '<object id="' + i + '" data="' + d + '" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" >';
    s += '<param name="movie" value="' + d + '" /><param name="quality" value="' + q + '" /><param name="wmode" value="' + m + '" /><param name="salign" value="' + t + '" />';
    if (ai && ai.length > 0)
    {
        s += '<img src="' + ai + '" width="' + w + '" height="' + h + '" alt="' + at + '" />';
    }
    s += '<embed src="' + d + '" quality="' + q + '" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>';
    s += "</object>";
    document.write(s);
}

//-----------------------------------------------------------------------------

confirmDelete = function() {
  if(confirm("Esta Seguro que desea eliminar este item?")) {
    return true;
  }
  return false;
}


/*CENTRAR POPUP*/
function obtener_ancho()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientWidth);
}
else
{
return window.outerWidth;
}
}
function obtener_alto()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientHeight);
} 
else
{
return(window.outerHeight);
}
}
var popup = new Object()
function CenterPopup(URL, width, height)
{
var X = obtener_ancho() / 2
var Y = obtener_alto() / 2
popup = window.open(URL, 'PopUp', 'scrollbars=no ' , 'width=' + width + ',' + 'height=' + height + ',' + 'top=' + (window.screenTop + (Y - (height/2))) + ',' +
'left=' + (window.screenLeft + (X - (width/2))) 
)
popup.focus()
}
/*FIN CENTRAR POPUP*/ 
/*START IMPRIMIR*/
function imprimir() {
if (window.print)
window.print()
else
alert("Disculpe, su navegador no soporta esta opción.");
}
/*END IMPRIMIR*/
/**********NOta POPUP*************/
/***********POPUP****************************/
function obtener_ancho_Nota()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientWidth);
}
else
{
return window.outerWidth;
}
}

function obtener_alto_Nota()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientHeight);
}
else
{
return(window.outerHeight);
}
}
function PopUpNota(URL,width,height)
{
 var width= width;
 var height= height;
 var X = obtener_ancho_Nota() / 2;
 var Y = obtener_alto_Nota() / 2;
 window.open(URL, 'PopUp', 'scrollbars=yes ' + 'width=' + width + ',' + 'height=' + height + ',' + 'top=' + (window.screenTop + (Y - (height/2))) + ',' + 'left=' + (window.screenLeft + (X - (width/2)) ) );

 return false;
}

 function OnTransperentLoad(event) {
        var msie=false;
        var ua = navigator.userAgent;
        if (ua.indexOf("MSIE")!=-1) 
        {
           if (ua.indexOf("MSIE 7.0")!=-1) 
             msie=false;
           else
             msie = true;  
        } 
            
	    img = (event.srcElement) ? event.srcElement : event.target;
	    if(!msie)
		    return;
	    var imgID = (img.id) ? "id='" + img.id + "' " : ""
	    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	    var imgStyle = "display:inline-block;" + img.style.cssText 
	    if (img.align == "left") imgStyle = "float:left;" + imgStyle
	    if (img.align == "right") imgStyle = "float:right;" + imgStyle
	    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	    var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + img.src + "\', sizingMethod='crop');\"></span>" 
	    img.outerHTML = strNewHTML
 }

/*AC_OETags.js*/
// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


