var PBBorderWidth;
var PBResolution;
var PBColor;
var PBProgress;

function AddProgressBar(resolution,color,progress,borderwidth)
	{

	if (parent.Page==0) return;
	if (Reset==1) return;
	PBBorderWidth=borderwidth;
	PBResolution=resolution;
	PBColor=color;
	//alert(parent.PageStructureCount);
	//try{
	//   progress=parent.GetPageIndex(parent.Page)/parent.PageStructureCount*100;
	//   }catch(e){}
	PBProgress=progress;

	//STypeByByIndex="ProgressBar";
	//SCList[SCount]= new ProgressBar();
	ProgressBarHeading();
	ProgressBarMiddle();
	ProgressBarBottom();
	}



function ProgressBarHeading()
	{
	//document.write("<p align=",SSAlign,">");
	//document.write("&nbsp;");
	document.write("<div align=left>");
	document.write("<table width=",90,"% border=0 height=5>");
	document.write("<font size=-1 face=",SSIFontName, " color=",PBColor,">Survey progression</font>");
	document.write("<tr align=center height=5>");

	}
function  ProgressBarMiddle()
	{
	var lw=0;

	if (parent.LangCount>1)lw=20;
	var w=100/PBResolution;
	if (parent.Progress<1)
	PBProgress=Math.round(PBProgress);
	else
	PBProgress=parent.Progress;

	document.write("<td width=",PBProgress,"% bgcolor=",PBColor," border=0 ></td>");

	document.write("<td width=",80-lw-PBProgress,"% border=0 ></td>");
	if (parent.HidePageNum==1)
	document.write("<td width=",20,"% border=0 nowrap><font size=-1 face=",SSIFontName, " color=",PBColor,">",String(parseInt(PBProgress)),"%  </font></td>");
	else
	document.write("<td width=",20,"% border=0 nowrap><font size=-1 face=",SSIFontName, " color=",PBColor,">",String(parseInt(PBProgress)),"% - Page ",Page," </font></td>");

	if (parent.LangCount>1)
		{
		document.write("<td width=",20,"% border=0 nowrap>");
	document.write("Language:<select id='select_lang' name='select_lang' onchange=change_lang();>");
	//document.write("<option value=1  > Chose a language");
	for (var ii=1;ii<=parent.LangCount;ii++)
		{
		s="";
		//alert(parent.LangPool[ii]+" = "+parent.LANG
		if (parent.LangPool[ii]==parent.LANG)
			{
			//alert("ZZ");
			s="selected" ;
			}
		if (parent.LangPool[ii]=="")
		document.write("<option value='",ii,"' ",s," >","Default");
		else
                document.write("<option value='",ii,"' ",s," >",parent.LangPool[ii].capitalize());

                }
	document.write("</td>");
		}


	}

String.prototype.capitalize = function(){ //v1.0
         return this.replace(/\w+/g, function(a){
             return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
         });
   };


function ProgressBarBottom()
	{
	document.write("</tr>");
	document.write("</table>");
	document.write("</div><hr>");

	//document.write("&nbsp;");
	//document.write("</p>");
  }

  // comment commentcommentcommentcommentcommentcomme

