/************************************************************************
*
* MXP ProgressBar
* Author: David Velayos García
*
************************************************************************/
MXPProgressBar.prototype.HTMLCode="";


/************************************************************************
* MXPProgressBar:Constructor
************************************************************************/
function MXPProgressBar(idBar,percent,color,writeToDocument,pathToImages)
{
  var anchoPorciento = (132-12)/100;
  var width=parseInt(anchoPorciento*percent);
	if (percent==100)
		 width=121;
  var DOCBARRA="";
  DOCBARRA+="<table id='"+idBar+"' width='134' height='23' border='0' cellpadding='0' cellspacing='0'>";
  DOCBARRA+="<tr>";
  DOCBARRA+="<td style='background-image: url("+pathToImages+"/progress_01.gif);' width='132' height='18'>";
  DOCBARRA+="<table summary='' style='margin-left: 4px;'>";
  DOCBARRA+="<tr>";
  DOCBARRA+="<td width="+width+" height=8 style='background-image: url("+pathToImages+"/"+color+".gif);'>";
	//DOCBARRA+=width+" = " + percent+"%";
  DOCBARRA+="</td>";
  DOCBARRA+="<td>";
  DOCBARRA+="</td>";
  DOCBARRA+="</tr>";
  DOCBARRA+="</table>";
  DOCBARRA+="</td>";
  DOCBARRA+="<td rowspan='2'>";
  DOCBARRA+="<img src='"+pathToImages+"/progress_02.gif' width='2' height='23' alt=''></td>";
  DOCBARRA+="</tr>";
  DOCBARRA+="<tr>";
  DOCBARRA+="<td>";
  DOCBARRA+="<img src='"+pathToImages+"/progress_03.gif' width='132' height='5' alt=''></td>";
  DOCBARRA+="</tr>";
  DOCBARRA+="</table>";
  if (writeToDocument)
		 document.write(DOCBARRA);
  else
		 this.HTMLCode = DOCBARRA;
}

/************************************************************************
*
* MXP Toolbar
* Author: David Velayos García
*
************************************************************************/
MXP_Toolbar.prototype.DOCToolbar="";
MXP_Toolbar.prototype.BaseButtonColor = "grey";
MXP_Toolbar.prototype.BaseButtonOverColor = "";
MXP_Toolbar.prototype.BaseButtonTextColorClass = "btn_MiVideoteca_white";
MXP_Toolbar.prototype.BaseButtonTextOverColorClass = "";

/************************************************************************
* MXP Toolbar:Constructor
************************************************************************/
function MXP_Toolbar(id,imagePath)
{
this.imagePath=imagePath;
this.DOCToolbar ="<table id='"+id+"' border='0' cellpadding='0' cellspacing='0'>";
this.DOCToolbar +="<tr heigh='26'>";
}

/************************************************************************
* MXP Toolbar:Align
************************************************************************/
MXP_Toolbar.prototype.Align = function (optTitle,opTitleAlign,id,imagePath,pAlign,className)
{
this.imagePath=imagePath;
this.DOCToolbar ="<table id='"+id+"' border='0' cellpadding='0' cellspacing='0' align='"+pAlign+"'>";
this.DOCToolbar +="<tr>";
if (optTitle!=null && optTitle!="") 
	 {
	 this.DOCToolbar +="<td align='"+opTitleAlign+"' width='100%' class='"+className+"'>"+optTitle+"</td>";
	 }
}

/************************************************************************
* MXP Toolbar:addButton
************************************************************************/
MXP_Toolbar.prototype.addButton = function(id,text,linkContent,colorOut,colorOver)
{
var DOCButton = "";
DOCButton +="		<td id='"+id+"_left_td' class='"+colorOut+"_left_td' width='7px' height='26px'>";
DOCButton +="		</td>";
DOCButton +="		<td id='"+id+"_center_td' class='"+colorOut+"_center_td' height='26px'>";
//alert ("<a href='#' class='NoUnderlined' onclick='"+linkContent+"' onmouseover='changeColorButton(\""+id+"\",\""+colorOver+"\")' onmouseout='changeColorButton(\""+id+"\",\""+colorOut+"\")'>");

DOCButton +="<a href='#' class='NoUnderlined' onclick='"+linkContent+"' onmouseover='changeColorButton(\""+id+"\",\""+colorOver+"\")' onmouseout='changeColorButton(\""+id+"\",\""+colorOut+"\")'>";
DOCButton +=text;
DOCButton +="</a>";
DOCButton +="		</td>";
DOCButton +="		<td id='"+id+"_right_td' class='"+colorOut+"_right_td' width='7px' height='26px'>";
DOCButton +="		</td>";
this.DOCToolbar +=DOCButton;
}


MXP_Toolbar.prototype.addQuickButton = function(id,linkContent,imageOut,imageOver,className)
{
var DOCButton = "";
DOCButton +="<td id='"+id+"_center_td'";
if (className!=null && className!="" && className!="undefined")
	 DOCButton += "class='"+className+"'";
DOCButton +=">";
DOCButton +="<a href='#' onclick='"+linkContent+"'>";
DOCButton +="<img border='0' src='"+imageOut+"' alt='' onmouseover='this.src=\""+imageOver+"\"' onmouseout='this.src=\""+imageOut+"\"'>";
DOCButton +="</a>";
DOCButton +="</td>";
this.DOCToolbar +=DOCButton;
}

MXP_Toolbar.prototype.addQuickButtonWithLink = function(id,linkContent,imageOut,imageOver,className)
{
var DOCButton = "";
DOCButton +="<td id='"+id+"_center_td' class='"+className+"'>";
DOCButton +="<a href='"+linkContent+"' class='NoUnderlined'>";
DOCButton +="<img border='0' align='bottom' src='"+imageOut+"' alt='' onmouseover='this.src=\""+imageOver+"\"' onmouseout='this.src=\""+imageOut+"\"'>";
DOCButton +="</a>";
DOCButton +="</td>";
this.DOCToolbar +=DOCButton;
}

/************************************************************************
* MXP Toolbar:EndToolbar
************************************************************************/
MXP_Toolbar.prototype.EndToolbar = function()
{
this.DOCToolbar +="</tr>";
this.DOCToolbar +="</table>";
} 


/************************************************************************
* MXP Toolbar:funciones accesorias
************************************************************************/
function changeColorButton(idButton,newClass)
{
 if (!isClassName(idButton+"_left_td",newClass+"_left_td"))
 {
 changeClass(idButton+"_left_td",newClass+"_left_td");
 changeClass(idButton+"_center_td",newClass+"_center_td");
 changeClass(idButton+"_right_td",newClass+"_right_td");
 }
}

function isClassName(menu,newClass)
{
	 if (document.getElementById) 
	 	if (document.getElementById(menu).className == newClass)
			 return true;
	 return false;
}

function changeClass(menu, newClass) { 
	 if (document.getElementById) { 
	 	document.getElementById(menu).className = newClass;
	 } 
} 

