  //alert("js001")

  var HYRCurrRow=1;
  var KOPCurrRow=1;
 
  var BestOrderTotSumMedl = 0;
  var BestOrderTotSumEjMedl = 0;
	var FraktInfo = "(frakt tillkommer)";

	var CurrFilmYear = "B1";
	var CurrLeftMenuItem = 0;
	var CurrCtlName = "";

	var LastOrderItem = " ";

//Tmp-variabler

  //alert("FÖRE ARRAY");
	var tmpYear = 2000
	var tmpMonth = 1 // 1-12
	var tmpDay = 1   // 1-31
	var HyraFromDate = "2000-01-01"
	var HyraTomDate = "2000-01-01"
	var rc = false

//Hyr-variabler

  var BestHyrAntal = new Array(1);
  var BestHyrVeckor = new Array(1);
	var BestHyrFromYear = new Array(1)
	var BestHyrFromMonth = new Array(1)
	var BestHyrFromDay = new Array(1)
	var BestHyrFromDate = new Array("2000-01-01")
	var BestHyrToYear = new Array(1)
	var BestHyrToMonth = new Array(1)
	var BestHyrToDay = new Array(1)
	var BestHyrToDate = new Array("2000-01-01")
  var BestHyrFilmNr =  new Array("12345");
  var BestHyrTitle = new Array("Title");

  var BestHyrRadSumMedl = new Array(0);
  var BestHyrRadSumEjMedl = new Array(0);
  var BestHyrAPrisMedl = new Array(0);
  var BestHyrAPrisEjMedl = new Array(0);

  var BestHyrTotSumMedl = 0;
  var BestHyrTotSumEjMedl = 0;
  var BestHyrAPrisMedlStd = 120;
  var BestHyrAPrisEjMedlStd = 150;

//Köp-variabler

  var BestKopAntal = new Array(1);
  var BestKopFilmNr =  new Array("12345");
  var BestKopTitle = new Array("Title");

  var BestKopRadSumMedl = new Array(0);
  var BestKopRadSumEjMedl = new Array(0);
  var BestKopAPrisMedl = new Array(0);
  var BestKopAPrisEjMedl = new Array(0);

  var BestKopTotSumMedl = 0;
  var BestKopTotSumEjMedl = 0;
  var BestKopAPrisMedlStd = 400;
  var BestKopAPrisEjMedlStd = 600;

  //alert("EFTER ARRAY");

function BestDenna(Typ,FilmID,FilmTitel,Pris,Pris2)
{

  if (Typ == "I")
  {
		//Visa Info-filen i nytt fönster
		//alert("FilmInfo/" + FilmID + "Info.html");
		AMF_InfoPopup = window.open ("../FilmInfo/" + FilmID + "Info.html", "InfoPopup", "resizable=1, scrollbars=1, height=400, width=400");
    AMF_InfoPopup.moveTo(100,100);
		AMF_InfoPopup.focus();
		//alert("Info-beställning för " + FilmID + ": " + FilmTitel + " är noterad.");
  }

	if (Typ == "H")
	{

		BestHyrFromDate[HYRCurrRow] = ""
		BestHyrToDate[HYRCurrRow] = ""
		BestHyrAntal[HYRCurrRow] = 1;
		BestHyrVeckor[HYRCurrRow] = 0;
		BestHyrFilmNr[HYRCurrRow] = FilmID;
		BestHyrTitle[HYRCurrRow] = FilmTitel;

		if (Pris == 0)
		{
			BestHyrAPrisMedl[HYRCurrRow] = BestHyrAPrisMedlStd
			BestHyrAPrisEjMedl[HYRCurrRow] = BestHyrAPrisEjMedlStd
		}
		else
		{
			BestHyrAPrisMedl[HYRCurrRow] = Pris
			BestHyrAPrisEjMedl[HYRCurrRow] = Pris
		}

		LastOrderItem = "Hyrfilm<BR><I>" + FilmID + "</I><BR><B>" + FilmTitel + "</B><BR>lagd till beställningen"

		top.RightFrame.location.reload(); //Show ordered film

		HYRCurrRow = HYRCurrRow + 1;
	}
	if (Typ == "K" || Typ == "E")
	{

		//var OnskatAntal = prompt("Ange önskat antal för " + FilmID + FilmTitel,"1");
		//OnskatAntal = parseInt(OnskatAntal,10)
		OnskatAntal = 1

		if (isNaN(OnskatAntal))
		{
			alert("Felaktigt antal angivet!");
			return;
		}
	 
		BestKopAntal[KOPCurrRow] = OnskatAntal;
		BestKopFilmNr[KOPCurrRow] = FilmID;
		BestKopTitle[KOPCurrRow] = FilmTitel;

		if (Pris == 0)
		{
			BestKopAPrisMedl[KOPCurrRow] = BestKopAPrisMedlStd
			BestKopAPrisEjMedl[KOPCurrRow] = BestKopAPrisEjMedlStd
		}
		else
		{
			BestKopAPrisMedl[KOPCurrRow] = Pris
			BestKopAPrisEjMedl[KOPCurrRow] = Pris
		}

		LastOrderItem = "Köpfilm<BR><I>" + FilmID + "</I><BR><B>" + FilmTitel + "</B><BR>lagd till beställningen"

		top.RightFrame.location.reload(); //Show ordered film


		KOPCurrRow = KOPCurrRow + 1;
	}
	if (Typ == "E")
	{
		//alert("Före top.MainFrame.reload();");  
		//top.MainFrame.location.reload();
		//alert("Efter top.MainFrame.reload();");
	}

}

function ChangeAntal(TypNo, RowIndex, CurrAntal, CurrKey)
{
	var i = 0;

	//alert("TypNo=" + TypNo + ", RowIndex=" + RowIndex + ", CurrAntal=" + CurrAntal + ", CurrKey=" + CurrKey);
	if (TypNo == 4) //RADERA HYR-RAD
	{
		//Raden ska tas bort, dvs flytta upp nedanförliggande rader
		i = RowIndex;
		while (i < HYRCurrRow)
		{
			BestHyrAntal[i] = BestHyrAntal[i+1]
			BestHyrVeckor[i] = BestHyrVeckor[i+1]
			BestHyrFilmNr[i] = BestHyrFilmNr[i+1]
			BestHyrTitle[i] = BestHyrTitle[i+1]
			BestHyrRadSumMedl[i] = BestHyrRadSumMedl[i+1]
			BestHyrRadSumEjMedl[i] = BestHyrRadSumEjMedl[i+1]
			BestHyrAPrisMedl[i] = BestHyrAPrisMedl[i+1]
			BestHyrAPrisEjMedl[i] = BestHyrAPrisEjMedl[i+1]
			BestHyrFromYear[i] = BestHyrFromYear[i+1];
			BestHyrFromMonth[i] = BestHyrFromMonth[i+1];
			BestHyrFromDay[i] = BestHyrFromDay[i+1];
			BestHyrFromDate[i] = BestHyrFromDate[i+1];
			BestHyrToYear[i] = BestHyrToYear[i+1];
			BestHyrToMonth[i] = BestHyrToMonth[i+1];
			BestHyrToDay[i] = BestHyrToDay[i+1];
			BestHyrToDate[i] = BestHyrToDate[i+1];
				
			i = i + 1
		}
		HYRCurrRow = HYRCurrRow - 1

		top.MainFrame.location.reload();
		//top.MainFrame.location.reload();

	}

	if (TypNo == 5) //RADERA KÖP-RAD
	{
		//Raden ska tas bort, dvs flytta upp nedanförliggande rader
		i = RowIndex;
		while (i < KOPCurrRow)
		{
			BestKopAntal[i] = BestKopAntal[i+1]
			BestKopFilmNr[i] = BestKopFilmNr[i+1]
			BestKopTitle[i] = BestKopTitle[i+1]
			BestKopRadSumMedl[i] = BestKopRadSumMedl[i+1]
			BestKopRadSumEjMedl[i] = BestKopRadSumEjMedl[i+1]
			BestKopAPrisMedl[i] = BestKopAPrisMedl[i+1]
			BestKopAPrisEjMedl[i] = BestKopAPrisEjMedl[i+1]
			
			i = i + 1
		}
		KOPCurrRow = KOPCurrRow - 1

		top.MainFrame.location.reload();
		//top.MainFrame.location.reload();

	}

	if (CurrKey == 13 || (TypNo == 1 && CurrKey == 0 && CurrAntal != BestHyrFromDate[RowIndex]) || (TypNo == 3 && CurrKey == 0 && CurrAntal != BestHyrToDate[RowIndex]) || (TypNo == 2 && CurrKey == 0 && CurrAntal != BestKopAntal[RowIndex])) //ENTER/TAB-key pressed
	{
		if (TypNo == 1 || TypNo == 3) //HYR From-datum (1) HYR Tom-datum (3)
		{
			//VALIDATE ENTERED DATE


			if (TypNo == 1)
			{
				//Ändring av From-datum
				if (validatedate(CurrAntal) == false)
				{
					//invalid date entered
					BestHyrFromYear[RowIndex] = 0;
					BestHyrFromMonth[RowIndex] = 0;
					BestHyrFromDay[RowIndex] = 0;
					BestHyrFromDate[RowIndex] = "";
					BestHyrVeckor[RowIndex] = 0;
					return;
				}

				BestHyrFromYear[RowIndex] = tmpYear;
				BestHyrFromMonth[RowIndex] = tmpMonth;
				BestHyrFromDay[RowIndex] = tmpDay;
				BestHyrFromDate[RowIndex] = HyraFromDate;
		
				//alert("ymd: "+tmpYear+", "+tmpMonth+", "+tmpDay);

			}
			else //TypNo == 3
			{
				//Ändring av Tom-datum
				if (validatedate(CurrAntal) == false)
				{
					//invalid date entered
					BestHyrToYear[RowIndex] = 0;
					BestHyrToMonth[RowIndex] = 0;
					BestHyrToDay[RowIndex] = 0;
					BestHyrToDate[RowIndex] = "";
					BestHyrVeckor[RowIndex] = 0;
					return;
				}

				BestHyrToYear[RowIndex] = tmpYear;
				BestHyrToMonth[RowIndex] = tmpMonth;
				BestHyrToDay[RowIndex] = tmpDay;
				BestHyrToDate[RowIndex] = HyraTomDate;

			}

			//ompute weeks for the current row
			ComputeWeeks(RowIndex);

			//Copy down date to first non-empty field below, and compute weeks
			i = RowIndex + 1;
			while (i < HYRCurrRow)
			{
				if (TypNo == 1)
				{
					//From-date
					if (BestHyrFromDate[i] == "")
					{
						BestHyrFromDate[i] = BestHyrFromDate[RowIndex];

						validatedate(BestHyrFromDate[i]);
		
						BestHyrFromYear[i] = tmpYear;
						BestHyrFromMonth[i] = tmpMonth;
						BestHyrFromDay[i] = tmpDay;
				
						ComputeWeeks(i);
					}
					else break;
				}
				if (TypNo == 3)
				{
					//From-date
					if (BestHyrToDate[i] == "")
					{
						BestHyrToDate[i] = BestHyrToDate[RowIndex];

						validatedate(BestHyrToDate[i]);
		
						BestHyrToYear[i] = tmpYear;
						BestHyrToMonth[i] = tmpMonth;
						BestHyrToDay[i] = tmpDay;

						ComputeWeeks(i);
					}
					else break;
				}
				i = i + 1;
			}

		}
		if (TypNo == 2) //KÖP
		{
			//Ändring av Köp-antal
			rc = false;
			OnskAnt = CurrAntal;
		
			while (rc == false) 
			{
				if (isNaN(OnskAnt))
				{
					OnskAnt = prompt("Önskat antal filmer måste vara ett tal! V v korrigera!",OnskAnt);
				}
				else
				{
					BestKopAntal[RowIndex] = OnskAnt;
					rc = true;
				}
			}
		}

		//set ctrl to set focus on, if needed
		CurrCtlName = "";

		if (TypNo == 1)
		{
			//focus on HyrTom-field
			CurrCtlName = "BestR_H_Tom_"+RowIndex;
			//alert("CurrCtlName="+CurrCtlName)
			top.MainFrame.OrderForm[CurrCtlName].focus();
		}
		if (TypNo == 3  && RowIndex < HYRCurrRow - 1)
		{
			//focus on HyrTom-field
			CurrCtlName = "BestR_H_From_"+(RowIndex+1);
			//alert("CurrCtlName="+CurrCtlName)
			top.MainFrame.OrderForm[CurrCtlName].focus();
		}
		if (TypNo == 2 && RowIndex < KOPCurrRow - 1)
		{
			//focus on KöpAntal-field
			CurrCtlName = "BestR_K_Antal_"+(RowIndex+1);
			//alert("CurrCtlName="+CurrCtlName)
			top.MainFrame.OrderForm[CurrCtlName].focus();
		}

		// Reload frame
		top.MainFrame.location.reload();
	}
}
function ComputeWeeks(RowIndex)
{
	//alert("From-ymd: "+BestHyrFromYear[RowIndex]+", "+BestHyrFromMonth[RowIndex]+", "+BestHyrFromDay[RowIndex]);
	//alert("Tom-ymd: "+BestHyrToYear[RowIndex]+", "+BestHyrToMonth[RowIndex]+", "+BestHyrToDay[RowIndex]);

	if (BestHyrFromDate[RowIndex] != "" && BestHyrToDate[RowIndex] != "")
	{
		//Compute AntalVeckor
		var StartDatum = new Date(BestHyrFromYear[RowIndex],BestHyrFromMonth[RowIndex] - 1,BestHyrFromDay[RowIndex]);
		var EndDatum = new Date(BestHyrToYear[RowIndex],BestHyrToMonth[RowIndex] - 1,BestHyrToDay[RowIndex]);

		if (EndDatum < StartDatum)
		{
			alert ("Tom-datum är tidigare än From-datum! Ingen uthyrning sker.");
			BestHyrVeckor[RowIndex] = 0;
		}
		else
		{
			//alert("Startdatum="+StartDatum+", Slutdatum="+EndDatum);
			//alert("Diff="+(EndDatum - StartDatum));
			BestHyrVeckor[RowIndex] = Math.ceil((EndDatum - StartDatum + 86400000) / (24 * 3600 * 1000 * 7)); //86400000 mSek=24 hours
		}
	}
	else
	{
		//alert("S-E-testen gav noll")
		BestHyrVeckor[RowIndex] = 0;
	}
}
function validatedate(EnteredDate)
{
	HyraFromDate = EnteredDate;
	HyraTomDate = EnteredDate;

	//alert("EnteredDate="+EnteredDate)

	rc = false;

	while (rc == false) 
	{
		if (HyraFromDate == "") return; //exit if user don't enter anything
		rc = validateSWEDate(HyraFromDate);
		if (rc == false) HyraFromDate = prompt("Felaktigt datum: " + HyraFromDate + ", ska vara åååå-mm-dd, var vänlig korrigera!",HyraFromDate);
		HyraTomDate = HyraFromDate;
	}
}

function getkey(e)
{
  //alert("KEY");
  if (top.MainFrame.event)
  {
    //alert("WINEV");
    return top.MainFrame.event.keyCode;
  }
  else
  {
    if (e)
    {
      //alert("E");
      return e.which;
    }
    else
    {
      //alert("NULL");
      return null;
    }
  }
}
function SetFocusToCurrentCtl()
{
	if (top.CurrCtlName != "")
	{
		//alert("Före 'focus', CurrCtlName="+top.CurrCtlName);
		//alert("CurrCtlName value="+top.MainFrame.OrderForm[top.CurrCtlName].value);
		top.MainFrame.OrderForm[top.CurrCtlName].select();
		top.MainFrame.OrderForm[top.CurrCtlName].focus();
		//alert("Efter 'focus', CurrCtlName="+top.CurrCtlName);
		top.CurrCtlName = "";
	}
}
function Testa()
{
  alert("document write from default.js: TEST");
  top.MainFrame.document.write("TEST");
}

function ClearCurrentOrder()
{
  HYRCurrRow = 1;
  KOPCurrRow = 1;

  //alert("Före top.MainFrame.reload()");
  top.MainFrame.location.reload(); 
  //alert("Efter top.MainFrame.reload()");

 }
function SendOrderByEMail()
{
	top.MainFrame.document.OrderForm.submit();
}
function ShowCurrentOrder()
{

  BestOrderTotSumMedl = 0;
  BestOrderTotSumEjMedl = 0;

  //alert("I SHOW") 
  //alert("I SHOW, HYRCurrRow= " + HYRCurrRow);

//=============Visar HYR-tabellen, med antal, veckor etc============


  if (HYRCurrRow == 1)
  {
    // Inget HYR beställt
    // 2009-01-08: Hyralternativet bortaget
    // top.MainFrame.document.write("Inga hyr-filmer är beställda! Beställ genom att klicka på Filmkatalog eller Erbjudanden till vänster.<BR>");
  }
  else
  {
		top.MainFrame.document.write("<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 STYLE='font-size: 11pt'>");
	
		top.MainFrame.document.write("<CAPTION><B>Hyr-film-beställning</B></CAPTION>")
	
		top.MainFrame.document.write("<TR><TD>From-datum</TD><TD>Tom-datum</TD><TD>FilmNr</TD><TD>Titel</TD><TD>Pris Medlem</TD><TD>Pris Ej Medlem</TD><TD>&nbsp;</TD></TR>");
	
		var i = 1;
	
		BestHyrTotSumMedl = 0;
		BestHyrTotSumEjMedl = 0;
	
		while (i < HYRCurrRow)
		{
	
			BestHyrRadSumMedl[i] = BestHyrAntal[i] * BestHyrVeckor[i] * BestHyrAPrisMedl[i];
			BestHyrRadSumEjMedl[i] = BestHyrAntal[i] * BestHyrVeckor[i]  * BestHyrAPrisEjMedl[i];
			BestHyrTotSumMedl = BestHyrTotSumMedl + BestHyrRadSumMedl[i];
			BestHyrTotSumEjMedl = BestHyrTotSumEjMedl + BestHyrRadSumEjMedl[i];
	
			BestOrderTotSumMedl = BestOrderTotSumMedl + BestHyrRadSumMedl[i];
			BestOrderTotSumEjMedl = BestOrderTotSumEjMedl + BestHyrRadSumEjMedl[i];
	
			//alert("<TD><INPUT style='text-align:right' type='text' name='BestR_H_From_" + i + "' size='8' value='" + BestHyrFromDate[i] + "' onBlur='top.ChangeAntal(1," + i + ",this.value,0)' onKeyPress='top.ChangeAntal(1," + i + ",this.value,top.getkey(event))'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_H_From_" + i + "' size='8' value='" + BestHyrFromDate[i] + "' onBlur='top.ChangeAntal(1," + i + ",this.value,0)' onKeyPress='top.ChangeAntal(1," + i + ",this.value,top.getkey(event))'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_H_Tom_" + i + "' size='8' value='" + BestHyrToDate[i] + "' onBlur='top.ChangeAntal(3," + i + ",this.value,0)' onKeyPress='top.ChangeAntal(3," + i + ",this.value,top.getkey(event))'></TD>");
			top.MainFrame.document.write("<TD><INPUT type='text' name='BestR_H_FilmNr_" + i + "' size='4' value='" + BestHyrFilmNr[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT type='text' name='BestR_H_Titel_" + i + "' size='40' value=\"" + BestHyrTitle[i] + "\" READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_H_RadPrisMedl_" + i + "' size='5' value='" + BestHyrRadSumMedl[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_H_RadPrisEjMedl_" + i + "' size='5' value='" + BestHyrRadSumEjMedl[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:center' type='button' name='BestR_H_Radera_" + i + "' size='4' value='radera' onClick='top.ChangeAntal(4," + i + ",0,0)'></TD></TR>");
			
			i = i + 1;
		}
		top.MainFrame.document.write("<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>Summa</TD>")
		top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_H_SummaPrisMedl" + "' size='5' value='" + BestHyrTotSumMedl + "' READONLY style='background-color: transparent'></TD>");
		top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_H_SummaPrisEjMedl" + "' size='5' value='" + BestHyrTotSumEjMedl + "' READONLY style='background-color: transparent'></TD>");
	
		top.MainFrame.document.write("</TR></TABLE><BR>");
	}

//=============Fortsätt här med att visa KÖP-tabellen, med antal etc============
  if (KOPCurrRow == 1)
  {
    // Inget KÖP beställt
    top.MainFrame.document.write("Inga köp-filmer är beställda! Beställ genom att klicka på Filmkatalog eller Erbjudanden till vänster.<BR><BR>");
  }
  else
  {
		top.MainFrame.document.write("<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 STYLE='font-size: 11pt'>");
	
		top.MainFrame.document.write("<CAPTION><B>Köp-film-beställning</B></CAPTION>")
	
		top.MainFrame.document.write("<TR><TD>Antal filmer</TD><TD>FilmNr</TD><TD>Titel</TD><TD>Pris Medlem</TD><TD>Pris Ej Medlem</TD><TD>&nbsp;</TD></TR>");
	
		var i = 1;
	
		BestKopTotSumMedl = 0;
		BestKopTotSumEjMedl = 0;
	
		while (i < KOPCurrRow)
		{
	
			BestKopRadSumMedl[i] = BestKopAntal[i] * BestKopAPrisMedl[i];
			BestKopRadSumEjMedl[i] = BestKopAntal[i] * BestKopAPrisEjMedl[i];
			BestKopTotSumMedl = BestKopTotSumMedl + BestKopRadSumMedl[i];
			BestKopTotSumEjMedl = BestKopTotSumEjMedl + BestKopRadSumEjMedl[i];
	
			BestOrderTotSumMedl = BestOrderTotSumMedl + BestKopRadSumMedl[i];
			BestOrderTotSumEjMedl = BestOrderTotSumEjMedl + BestKopRadSumEjMedl[i];
	
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_K_Antal_" + i + "' size='21' value='" + BestKopAntal[i] + "' onBlur='top.ChangeAntal(2," + i + ",this.value,0)' onKeyPress='top.ChangeAntal(2," + i + ",this.value,top.getkey(event))'></TD>");
			top.MainFrame.document.write("<TD><INPUT type='text' name='BestR_K_FilmNr_" + i + "' size='4' value='" + BestKopFilmNr[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT type='text' name='BestR_K_Titel_" + i + "' size='40' value=\"" + BestKopTitle[i] + "\" READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_K_RadPrisMedl_" + i + "' size='5' value='" + BestKopRadSumMedl[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestR_K_RadPrisEjMedl_" + i + "' size='5' value='" + BestKopRadSumEjMedl[i] + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:center' type='button' name='BestR_K_Radera_" + i + "' size='4' value='radera' onClick='top.ChangeAntal(5," + i + ",0,0)'></TD></TR>");

			i = i + 1;
		}
		
			top.MainFrame.document.write("<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>Summa</TD>")
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_K_SummaPrisMedl" + "' size='5' value='" + BestKopTotSumMedl + "' READONLY style='background-color: transparent'></TD>");
			top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_K_SummaPrisEjMedl" + "' size='5' value='" + BestKopTotSumEjMedl + "' READONLY style='background-color: transparent'></TD>");
		
			top.MainFrame.document.write("</TR></TABLE><BR>");
  }


//=============Skriv ut Beställnings-summa============================

  if (BestOrderTotSumMedl > 0 || BestOrderTotSumEjMedl > 0)
  {

    top.MainFrame.document.write("<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1 STYLE='font-size: 11pt'>");
  
    top.MainFrame.document.write("<TR><TD style='width: 470px'>&nbsp;</TD><TD>Pris Medlem</TD><TD>Pris Ej Medlem</TD></TR>");

    top.MainFrame.document.write("<TD>Beställnings-summa " + FraktInfo + "</TD>")
    top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_O_SummaPrisMedl" + "' size='5' value='" + BestOrderTotSumMedl + "' READONLY style='background-color: transparent'></TD>");
    top.MainFrame.document.write("<TD><INPUT style='text-align:right' type='text' name='BestH_O_SummaPrisEjMedl" + "' size='5' value='" + BestOrderTotSumEjMedl + "' READONLY style='background-color: transparent'></TD>");
    top.MainFrame.document.write("<TD><INPUT style='text-align:center' type='button' name='BestR_H_Radera" + "' size='4' value='radera' onClick='top.ClearCurrentOrder()'></TD>");

    top.MainFrame.document.write("</TR></TABLE><BR>");

  }


//=============Skriv ut Beställnings-fot============================

	top.MainFrame.document.write("</P><P STYLE='text-align: left'><TABLE>");
		//alert(FraktInfo);
		if (FraktInfo == "(frakt tillkommer)")
		{
			top.MainFrame.document.write("<TR><TD>Filmen/-erna skickas</TD><TD><INPUT type='radio' name='BestH_L_SkickaHamta' value='S' checked onclick='top.SetTextInfo(1, 1)'></TD></TR>");
			top.MainFrame.document.write("<TR><TD>Filmen/-erna hämtas</TD><TD><INPUT type='radio' name='BestH_L_SkickaHamta' value='H' onclick='top.SetTextInfo(1, 2)'></TD></TR>");
		}
		else
		{
			top.MainFrame.document.write("<TR><TD>Filmen/-erna skickas</TD><TD><INPUT type='radio' name='BestH_L_SkickaHamta' value='S' onclick='top.SetTextInfo(1, 1)'></TD></TR>");
			top.MainFrame.document.write("<TR><TD>Filmen/-erna hämtas</TD><TD><INPUT type='radio' name='BestH_L_SkickaHamta' value='H' checked onclick='top.SetTextInfo(1, 2)'></TD></TR>");
		}
		top.MainFrame.document.write("<TR><TD colspan=2><B>Leveransadress:</B></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Organisation:</TD><TD><INPUT type='text' name='BestH_A_Organisation' size='50'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Postadress:</TD><TD><INPUT type='text' name='BestH_A_Postadress' size='50'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Postnr:</TD><TD><INPUT type='text' name='BestH_A_PostNr' size='10'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Ort:</TD><TD><INPUT type='text' name='BestH_A_Ort' size='50'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>E-post-adress:</TD><TD><INPUT type='text' name='BestH_A_EPost' size='50'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Telefon dagtid:</TD><TD><INPUT type='text' name='BestH_A_Telefon' size='50'></TD></TR>");
		top.MainFrame.document.write("<TR><TD>Ansvarig beställare:</TD><TD><INPUT type='text' name='BestH_A_Ansvarig' size='50'></TD></TR>");
	top.MainFrame.document.write("</TABLE></P>");

}

function ShowBroVer()
{

	return;

	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	
	var fullVersion = parseFloat(nVer);
	var majorVersion = parseInt(nVer);
	
	// In Internet Explorer, the true version is after "MSIE"
	
	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
	 fullVersion = parseFloat(nAgt.substring(verOffset+5,nAgt.length));
	 majorVersion = parseInt(''+fullVersion);
	}
	
	// In Opera, the true version is after "Opera"
	
	if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
	 fullVersion = parseFloat(nAgt.substring(verOffset+6,nAgt.length));
	 majorVersion = parseInt(''+fullVersion);
	}
	
	top.TopFrame.document.write('Full version = '+fullVersion+', Major version = ' + majorVersion +'<br>');

}
function validateSWEDate( strValue )
{
/************************************************
DESCRIPTION: Validates that a string contains only
    valid dates with 2 digit month, 2 digit day,
    4 digit year. Date separator must be -
    Uses combination of regular expressions and
    string parsing to validate date.
    Ex. yyyy-mm-dd
PARAMETERS:
   strValue - String to be tested for validity

RETURNS:
   True if valid, otherwise false. If True then TmpYear, tmpMonth (1-12), tmpDay (1-31) is set

REMARKS:
   Avoids some of the limitations of the Date.parse()
   method such as the date separator character.
*************************************************/
  var objRegExp = /^\d{4}(\-)\d{2}\1\d{2}$/

  //check to see if in correct format
  if(!objRegExp.test(strValue))
	{
		//alert("Felaktig datumsträng!");
    return false; //doesn't match pattern, bad date
	}
  else{
    var strSeparator = strValue.substring(4,5) //find date separator
    var arrayDate = strValue.split(strSeparator); //split date into year, month, day
		//alert("arrayDate: "+arrayDate[0]+" "+arrayDate[1]+" "+arrayDate[2])
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
                        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
    var intDay = parseInt(arrayDate[2],10);

    //check if month value and day value agree
    if(arrayLookup[arrayDate[1]] != null) {
			//alert("Lookup="+arrayLookup[arrayDate[1]]+", intDay="+intDay+", typeof="+typeof(arrayLookup[arrayDate[1]]));
      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
			{
				tmpYear = parseInt(arrayDate[0],10);
				tmpMonth = parseInt(arrayDate[1],10);
				tmpDay = intDay;
				//alert("NoFeb: "+tmpYear+" "+tmpMonth+" "+tmpDay);
        return true; //found in lookup table, good date
			}
    }
		if (arrayDate[1] == "02") //otherwise bad month
		{
			//check for February
			//alert("Year before parseint="+arrayDate[0])
			var intYear = parseInt(arrayDate[0],10);
			//alert("Year after paresint="+intYear)
			var intMonth = parseInt(arrayDate[1],10);
			if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0)
			{
				tmpYear = intYear;
				tmpMonth = intMonth;
				tmpDay = intDay;
				//alert("Feb: "+tmpYear+" "+tmpMonth+" "+tmpDay);
				return true; //Feb. had valid number of days
			}
		}
  }
	//alert("in check: bad date!")
  return false; //any other values, bad date
}
function SetTextInfo( InfoNr, InfoVal )
{
	switch(InfoNr)
	{
		case 1:
			switch (InfoVal)
			{
				case 1:
					FraktInfo = "(frakt tillkommer)";
					break;
				case 2:
					FraktInfo = "";
					break;
			}
	}

	top.MainFrame.location.reload();

}

