﻿/*JS-VERSION:2.4.0.0*/
/* matrix */

function setOver(elm){
	elm.style.backgroundColor='#cc0000';
	elm.style.color='#ffffff';
}

function setOut(elm){
	elm.style.backgroundColor='';
	elm.style.color='';
}

function setHi(elm){
	tds = document.getElementsByTagName('td');
	for(i=0;i<tds.length;i++){
		if(tds[i].className=='hi'){
			tds[i].className='';
		}
		if(tds[i].className=='special hi'){
			tds[i].className='special';
		}
		if(tds[i].className=='marker'){
			tds[i].className='';
		}
		if(tds[i].className=='first marker'){
			tds[i].className='first';
		}
	}
	
	if(elm.className == 'special'){
		elm.className = 'special hi';
	}
	else{
		elm.className = 'hi';		
	}
	elm.getElementsByTagName('input')[0].checked='checked';
	
	trMarker = elm.parentNode;
	tdCounter = 0;
	for(i=0;i<trMarker.childNodes.length;i++){
		if(trMarker.childNodes[i].tagName == "TD"){
			tdCounter++;
			if(trMarker.childNodes[i].className == 'hi' || trMarker.childNodes[i].className == 'special hi'){
				break;
			}
			if(trMarker.childNodes[i].className == 'first'){
				trMarker.childNodes[i].className = 'first marker';
			}
			else{
				if(trMarker.childNodes[i].className != 'special')
					trMarker.childNodes[i].className = 'marker';
			}
		}
	}
	
	trs = document.getElementsByTagName('tr');
	for(i=0;i<trs.length;i++){
		tmpTdCounter = 0;
		for(j=0;j<trs[i].childNodes.length;j++){
			if(trs[i].childNodes[j].tagName == 'TD'){
				tmpTdCounter++;
				if(tmpTdCounter == tdCounter){
					if(trs[i].childNodes[j].className == 'hi' || trs[i].childNodes[j].className == 'special hi'){
						i = trs.length;
						break;
					}
					else{
						if(trs[i].childNodes[j].className != 'special')
							trs[i].childNodes[j].className = 'marker';
					}
				}
				
			}
		}
	}
}

/* special offer */
function so_setHi(elm){
	for(i=0; i<elm.parentNode.parentNode.parentNode.childNodes.length; i++){
		if(elm.parentNode.parentNode.parentNode.childNodes[i].className == 'checked'){
			elm.parentNode.parentNode.parentNode.childNodes[i].className = ''
		}
	}
	elm.parentNode.parentNode.className = 'checked';
}

/* bookbyschedule flights */
function bf_setHi(elm){
	for(i=0; i<elm.parentNode.parentNode.parentNode.childNodes.length; i++){
		if(elm.parentNode.parentNode.parentNode.childNodes[i].className == 'checked'){
			elm.parentNode.parentNode.parentNode.childNodes[i].className = ''
		}
		if(elm.parentNode.parentNode.parentNode.childNodes[i].className == 'last checked'){
			elm.parentNode.parentNode.parentNode.childNodes[i].className = 'last'
		}
	}
	if (elm.parentNode.parentNode.className == 'last')
		elm.parentNode.parentNode.className = 'last checked';
	else
		elm.parentNode.parentNode.className = 'checked';
}

/* bookbyschedule tarife */
function bt_setHi(elm){
	for(i=0; i<elm.parentNode.parentNode.parentNode.childNodes.length; i++){
		if(elm.parentNode.parentNode.parentNode.childNodes[i].className == 'checked'){
			elm.parentNode.parentNode.parentNode.childNodes[i].className = ''
		}
	}
	elm.parentNode.parentNode.className = 'checked';
}
