//system const
/* 
var defaultDate = '12-12-2001';
var defaultTime = '13.30';
var defaultAmount = 2;
*/
var maxAmount = 10;
//var curHallID = 0;

//hall const
/*
var hallX = 0;
var hallY = 45;
var hallHeight = 250;
var hallWidth = 590;
var hallBorder = 2;
var hallColor = '#000000';

//seat const 
var sHeight = 15;
var sWidth = 15;
var sBorder = 0;
*/

//---------------------------------------- custom functions --------------------------------

function showPriceScheme(){
	var S = new String('');
	S += '<table border="1" cellpadding="3" cellspacing="0" bgcolor="#0000FF" class="MainBG" width="100%">';
	S += '<tr>';
	for (var i = 0; i < aK.length; i++){
		if (i == 0){
			S += '<td class="MainBG">Billettype</td><td width="3">&nbsp;</td>';
		}
		S += '<td class="MainBG">' + aK[i].name + '</td><td width="3">&nbsp;</td>';
	}
	S += '</tr><tr>';
	for (var i = 0; i < aK.length; i++){
		if (i == 0){
			S += '<td class="MainBG">Antal</td><td width="3">&nbsp;</td>';
		}
		S += '<td class="MainBG">';
		S += '<select name="t' + aK[i].priceID + '" class="FormElements" onchange="doCalculation();">';
		for (var j = 0; j <= maxAmount; j++){
			 S += '<option value="' + j + ' ">' + j;
		}
		S += '</select></td><td width="3">&nbsp;</td>';
	}
	S += '</tr></table>';
	document.open();
	document.writeln(S);
	document.close();
}


function showHall(){
	var S = new String('');
	
	S += '<table border="0" class="highlightBG" cellspacing="0" cellpadding="0">' +
		 '<tr><td>' +
		 '<table border="0" class="highlightBG" cellspacing="0" cellpadding="3">' +
		 '<tr><td class="LightFont">Klik på et sæde i salen for at vælge det område du ønsker at sidde i.</td></tr>' +
		 '</table></td></tr>' +
		 
		 '<tr><td height="' + hallHeight + '" width="' + hallWidth + '">' +
		 '<img src="/Images/transparent_dot.gif"></td></tr>';
	S += '<tr><td height="20" class="mainBG">&nbsp;</td></tr>';	 
	S += '</table>\n';
	
	S += '<div id="speedscreen" style="position: absolute; top: ' + (hallY - 20) + 'px; left: ' + (hallX  + (hallWidth/4)) + 'px;">' +
		 '<table border="0" bgcolor="#000000"><tr><td height="10" width="' + (hallWidth/2) + '">' +
		 '<img src="/Images/transparent_dot.gif"></td></tr>';
	S += '</table></div>\n';

	//S += showArray();
	document.writeln(S);
	showArray();
	
	//return S;
}


function showArray(){
	//var S = new String('');
	for (var i = 0; i < aS.length; i++){
	//for (var i = 0; i < 2; i++){

		var S = new String('');
		
		var TT = new String('');
		TT += 'Række: ' + aS[i].row;
		TT += ' - ' + 'sæde: ' + aS[i].col;
	
		var TO = new String('');
		TO += 'Række: ' + aS[i].row;
		TO += ' - ' + 'sæde: ' + aS[i].col;

		var Left = (hallX + (aS[i].x) - (sWidth / 2));
		var Top = (hallY + (aS[i].y) - (sHeight / 2));
		
		S += '<div id="' + aS[i].name + '" style="position: absolute; left: ' +
			 Left + 'px; top: ' + Top + 'px;">\n';
		
		S += '<table border=0 cellpadding=0 cellspacing=' + sBorder + ' bgcolor="#FF0000"' +
			 'title="' + TT +'" onmouseover="updateInfo(' + i + ');" onmouseout="updateInfo(-1);">\n' +
		     '<tr><td id="t' + aS[i].name + '" height=' + sHeight + ' width=' + sWidth +
			 //' bgcolor="' + aA[aS[i].area].color + '" ' +
			 ' bgcolor="#FF0000" ' +
			 'onclick="setArea(' + Left + ', ' + Top + ', ' + aS[i].area + ');">' +
			 '<img src="/Images/transparent_dot.gif"' +
			 ' height="1" width="1" border="0"' +
			 '</td></tr></table>\n';
		
		S += '</div>\n';
		//alert(S);
		document.writeln(S);
	}	
	//return S;
}
 
 
function showChoosenSeat(x, y){
	var S = new String();
	S += '<div id="choosenseat" style="position: absolute; left: ' +
		 x + 'px; top: ' + y + 'px; z-index: ' + (aS.length + 100)+ ';">\n';
		
	S += '<table border=0 cellpadding=0 cellspacing=' + sBorder + 
		 ' title="valgte område">\n' +
	     '<tr><td height=' + sHeight + ' width=' + sWidth +
		 //'><img src="choosenseat_black.gif"' +
		 //'><img src="choosenseat_white.gif"' +
		 '><img src="/Images/black_dot.gif"' +
		 ' height="' + sHeight +'" width="' + sWidth + '" border="0"' +
		 'Valgte område</td></tr></table>\n';

	S += '</div>\n';
	
	return S;
}


function showHallInfo(){
	var S = new String('');
	
	//S += '<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mainbg">';

	S += '<table border="0" cellpadding="0" cellspacing="0" class="highlightbg" width="100%">';
	S += '<tr><td class="pricescheme" height="' + HEADLINE_HEIGHT + '">&nbsp;Type/område</td>';
	for (var i = 0; i < aK.length; i++){
		S += '<td width="1" class="pricescheme">&nbsp;</td>' +
		'<td class="pricescheme" align="right">&nbsp;' + aK[i].name + '&nbsp;</td>';
	}
	S += '</tr>';

	for (var i = 0; i < aA.length; i++){
		S += '<tr><td class="pricescheme"i height="18">&nbsp;' + aA[i].name + '</td>';
		for (var j = 0; j < aK.length; j++){
			var p = findPrice(parseInt(aA[i].pgrpid), parseInt(aK[j].priceID));
			if (p == -1)
				tP = '&nbsp;';
			else tP = FloatToMoney(p);
			S += '<td width="1" class="pricescheme">&nbsp;</td>' +
			'<td align="right" class="priceschemedata">' +
			'&nbsp;' + tP + '&nbsp;</td>';
		}
		S += '</tr>';
	}
	S += '</table>';
	//S += '</td></tr></table>';	

	return S;
}


function updateInfo(objIndex){
}

function doMouseMove(evt){
}

function setMouseDown(evt){
}

function setMouseUp(evt){
}

  
// --------------------------------- init functions -------------------------------

