function getList(loadID,Lines){
	if (loadID=='current'){xajax_top10current(); $('boxOfficeHeader').className='currentbo';}
	if (loadID=='new'){xajax_top10new(); $('boxOfficeHeader').className='newbo';}
	if (loadID=='future'){xajax_top10future(); $('boxOfficeHeader').className='futurebo';}
	myRun1 = new Run({elements:'top10table',style:{height:Lines*40},time:0.5,flow:Run.SMOOTH,onplay:function(){$('top10table').innerHTML='<div id="progress"><img src="images/interface/ajaxload.gif" alt="" width="16" height="16" />Yükleniyor...</div>'} });
}

function blinkError(){
	myRun2 = new Run({elements:'errorContainer',style:{backgroundColor:'#F4F4F4'},time:2});
}

function blinkElement($divname){
	myRun2 = new Run({elements:$divname,style:{backgroundColor:['#FFFFCC','#FFFFFF']},time:2});
}

function toggleOptional(optionalElement,optionSwitch,runTime){
	if(runTime){
		if ($(optionSwitch).checked){
			myRun3 = new Run({elements:optionalElement,style:{height:460,backgroundColor:['#FFCC00','#F4F4F4']},time:1,flow:Run.SMOOTH});
		} else {
			myRun3 = new Run({elements:optionalElement,style:{height:20},time:1,flow:Run.SMOOTH});
		}
	} else {
		if ($(optionSwitch).checked){
			$(optionalElement).style.height="460px";
		} else {
			$(optionalElement).style.height="20px";
		}
	}
}

formerElement=false;
//onclick="toggleEvent('venueInfoTime<?php echo $i;?>',1,true,44)"><img src="images/haber-icon.gif">
function toggleEvent(optionalElement,childNumber,runTime,totalEvents){	
	if (!runTime){
		if (totalEvents>2){
			$(optionalElement).style.height="1px";
		} else {
			if (childNumber>1){childHeight=70*childNumber;} else {childHeight=110;}
			$(optionalElement).style.height=(childHeight)+"px";
		}
	}
	if (runTime && optionalElement){ if (childNumber>1){childHeight=70*childNumber;} else {childHeight=110;} myRun4 = new Run({elements:optionalElement,style:{height:childHeight},time:0.5,flow:Run.SMOOTH});}
	if (runTime && formerElement && formerElement!=optionalElement){myRun4 = new Run({elements:formerElement,style:{height:1},time:0.5,flow:Run.SMOOTH});}
	if (runTime){formerElement=optionalElement;}
}

function togglePersonalVenue(optionalElement,childNumber,runTime,totalEvents){	
	if (!runTime){
		if (totalEvents>1){
			$(optionalElement).style.height="1px";
		} else {
			childHeight=120*childNumber;
			$(optionalElement).style.height=(childHeight)+"px";
		}
	}
	if (runTime && optionalElement){ if (childNumber>1){childHeight=120*childNumber;} else {childHeight=120;} myRun4 = new Run({elements:optionalElement,style:{height:childHeight},time:1,flow:Run.SMOOTH});}
	if (runTime && formerElement && formerElement!=optionalElement){myRun4 = new Run({elements:formerElement,style:{height:1},time:1,flow:Run.SMOOTH});}
	if (runTime){formerElement=optionalElement;}
}

function toggleProgressHelp(runTime){	
	if (!runTime){originalProgressHelp=$('saleProgressReminder').offsetHeight; $('saleProgressReminder').style.height="12px";statProgressHelp=false;}
	if (runTime){if(statProgressHelp){myRun5 = new Run({elements:'saleProgressReminder',style:{height:12},time:1,flow:Run.SMOOTH});statProgressHelp=false;} else {myRun5 = new Run({elements:'saleProgressReminder',style:{height:originalProgressHelp,backgroundColor:['#FFFFD5','#FFFFFF']},time:1,flow:Run.SMOOTH});statProgressHelp=true;}}
}

function initSeatMapScroller(maxX,maxY){
	selectedSeatsArray=new Array();
	viewW=580;
	viewH=400;
	seatW=(maxX+1)*20;
	seatH=(maxY+1)*20;
	thumW=110;
	thumH=Math.floor((110/seatW)*seatH);
	thuwW=Math.floor(viewW*thumW/seatW);
	thuwH=Math.floor(viewH*thumH/seatH);
	if (thuwW>thumW){thuwW=thumW;}
	if (thuwH>thumH){thuwH=thumH;}
	$('mapLegendThumb').style.height=thumH+"px";
	$('mapLegendThumb').style.width=thumW+"px";
	$('mapLegendThumbPointer').style.height=thuwH+"px";
	$('mapLegendThumbPointer').style.width=thuwW+"px";
	$('mapLegendThumbPointer').style.marginTop=Math.floor((thumH/seatH)*($('seatSelectMapContainer').scrollTop)+5)+"px";
	$('mapLegendThumbPointer').style.marginLeft=Math.floor((thumW/seatW)*($('seatSelectMapContainer').scrollLeft))+"px";
	$('seatSelectMapContainer').onscroll=updateSeatMapScroller;
}

function safeSubmit(submitButtonName,submitFormName,isBuyButton){
	if(isBuyButton){$(submitButtonName).className="nicebigbuttonbuygray";}
	$(submitButtonName).disabled=true;
	$(submitButtonName).value="Lütfen Bekleyiniz...";
	$(submitFormName).submit();
}

function formSubmit(submitFormName){
	$(submitFormName).submit();
}

function hideFormElement (submitFormElement){
	$(submitFormElement).style.display='none';
}

function updateSeatMapScroller(){
	if (thuwH+Math.floor((thumH/seatH)*($('seatSelectMapContainer').scrollTop))<=thumH){
		$('mapLegendThumbPointer').style.marginTop=Math.floor((thumH/seatH)*($('seatSelectMapContainer').scrollTop)+5)+"px";
	} else {
		$('mapLegendThumbPointer').style.marginTop=(thumH-thuwH+5)+"px";
	}
	if (thuwW+Math.floor((thumW/seatW)*($('seatSelectMapContainer').scrollLeft))<=thumW){
		$('mapLegendThumbPointer').style.marginLeft=Math.floor((thumW/seatW)*($('seatSelectMapContainer').scrollLeft))+"px";
	} else {
		$('mapLegendThumbPointer').style.marginLeft=(thumW-thuwW)+"px";
	}
}

function selectSeat(seatId,serverId,showtimeId){
	var remCheck=false;
	for(i=0;i<selectedSeatsArray.length;i++){
		if(selectedSeatsArray[i]==seatId){
			selectedSeatsArray.splice(i,1);
			remCheck=true;
			$('s'+seatId).className='as';
			var preHTML=$('s'+seatId).innerHTML;
			$('s'+seatId).innerHTML='<img src="images/icons/sp.gif" alt="progress" width="10" heigth="10">';
			$('selectedSeatSubmit').className="nicebigbuttonbuygray";
			$('selectedSeatSubmit').disabled=true;
			$('selectedSeatSubmit').value="Bekleyiniz...";
			xajax_deSelectUserSeat(seatId,serverId,showtimeId,preHTML);
		}
	}
	if (selectedSeatsArray.length<9){
		if(!remCheck){
		selectedSeatsArray[selectedSeatsArray.length]=seatId;
		$('s'+seatId).className='as';
		var preHTML=$('s'+seatId).innerHTML;
		$('s'+seatId).innerHTML='<img src="images/icons/sp.gif" alt="progress" width="10" heigth="10">';
		$('selectedSeatSubmit').className="nicebigbuttonbuygray";
		$('selectedSeatSubmit').disabled=true;
		$('selectedSeatSubmit').value="Bekleyiniz...";
		xajax_selectUserSeat(seatId,serverId,showtimeId,preHTML);
		}
		if (selectedSeatsArray.length){
		$('selectedSeatCount').innerHTML='<strong>'+selectedSeatsArray.length+'</strong> adet koltuk seçtiniz.';
		$('selectedSeatField').value=selectedSeatsArray.join(';');
		} else {
		$('selectedSeatCount').innerHTML='&nbsp;';
		}
	} else {
	alert("Bu salondan en fazla 9 adet koltuk satın alabilirsiniz.");
	}
}

function buySeat(){
	if (selectedSeatsArray.length>0){
	$('selectedSeatForm').submit();
	$('selectedSeatSubmit').className="nicebigbuttonbuygray";
	$('selectedSeatSubmit').disabled=true;
	$('selectedSeatSubmit').value="Lütfen Bekleyiniz...";
	} else {
	alert("Devam etmeden önce koltuk seçmeniz gereklidir.");
	}	
}

function reCalculateSeatPrice(boxList,servicePrice){
	var seatArray=boxList.split('-');
	var totalPrice=servicePrice*seatArray.length;
	for (i=0;i<seatArray.length;i++){
	totalPrice=totalPrice+parseInt($('s'+seatArray[i]).options[$('s'+seatArray[i]).selectedIndex].value.split('-')[1]);
	}
	$('buyTicketCalcSum').innerHTML='<strong>'+(totalPrice/100).toFixed(2)+' YTL</strong>';
}

function confirmUserAction(userMessage,confirmUrl){
	if (confirm(userMessage)){window.location.href=confirmUrl;}
}

function openURL(Url){
	window.location.href=Url;
}