// Java SCript Document
var flag=0;
function timedRedirect(redirectTo, timeoutPeriod) {
	setTimeout("location.href = redirectTo;",timeoutPeriod);
}

function filt(){
document.getElementById("div_filter").style.display='block';
}

function doms(){
alert=("dccfr");
document.getElementById("domestic").style.display='block';
document.getElementById("international").style.display='none';

}
function ints(){
document.getElementById("domestic").style.display='none';
document.getElementById("international").style.display='block';
}

function returndate(div)
{
	if(div=='oneway')
	{	document.getElementById("return").disabled= 'true';
}
	else if(div=='roundtrip')
	{	document.getElementById("return").disabled= '';	}	
	else{}
}

function searchRail()
{
var a = document.getElementById("return").disabled;
if(a){window.open('search_loading.html','_self');}
else {window.open('search_loading_round.html','_self');}
}

function div_filter()
{	var a = document.getElementById('div_filter').style.display
	if(a=='block'){
		document.getElementById('div_filter').style.display = 'none';
				document.getElementById('arrow').style.background= 'url(images/arrow.png) no-repeat -12px 3px';
		flag=1;
	}
	else if(a=='none')	{
		document.getElementById('div_filter').style.display = 'block';
		document.getElementById('arrow').style.background= 'url(images/arrow.png) no-repeat 0px -24px';
		flag=0;
	}
}

function netFare()
{
	var a = document.getElementById('div_filter').style.display
	if(a=='block')	{
		document.getElementById('div_filter').style.display = 'none';
		document.getElementById('but').value = 'Show Net Fare';
	}
	else if(a=='none')	{
		document.getElementById('div_filter').style.display = 'block';
		document.getElementById('but').value = 'Hide Net Fare';		
	}
}

function show_hideDiv(div)
{
	var a = document.getElementById(div).style.display
	if(a=='block')
		document.getElementById(div).style.display = 'none';
	if(a=='none')
		document.getElementById(div).style.display = 'block';
}

function show_hideDiv1(div1,div2)
{
	var a = document.getElementById(div1).style.display
	if(a=='block')
		{
		document.getElementById(div1).style.display = 'none';
		document.getElementById(div2).style.display = 'block';
		}
	if(a=='none')
		{
		document.getElementById(div1).style.display = 'block';
		document.getElementById(div2).style.display = 'none';
		}
}

function show_hideDivModify(div,h)
{
	var a = document.getElementById(div).style.display
	if(a=='block'){
		document.getElementById(div).style.display = 'none';
		h.style.background = 'url(../images/arrowsmall.png) no-repeat 0px 9px'
	}
	if(a=='none'){
		document.getElementById(div).style.display = 'block';
		h.style.background = 'url(../images/arrowsmalldown.png) no-repeat -1px 10px'
	}
}

function checkAll(field){
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}	
		
function uncheckAll(field){
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function payNow(li)
{
for(i=1;i<=4;i++){
// 	document.getElementById("pay"+i).style.display = 'none';  by lavi
	document.getElementById("li"+i).className = "";
	}
	//document.getElementById("pay"+div).style.display = 'block'; by lavi
	li.className = "currunt";
}

function goto(url){
	window.open(url,'_self');
}

function redirectTo(url,action){
		window.open(url,action);
}


function Expand_collaps(div,h)
{
	var a = document.getElementById(div).style.display
	if(a=='block'){
		document.getElementById(div).style.display = 'none';
		h.className = 'detailAnchor';
	}
	if(a=='none'){
		document.getElementById(div).style.display = 'block';
		h.className = 'detailAnchoractive';
	}
}


function Expand_collaps_lavi(h) {
var div=document.getElementById(h.id+"1");
var a = div.style.display;
    if (a == 'block') {
        div.style.display = 'none';
        h.className = 'detailAnchor';
    }
    if (a == 'none') {
        div.style.display = 'block';
        h.className = 'detailAnchoractive';
    }
}


function checkLogin(but)
{
	if(but.value == 'Continue')
	goto('step3.html');
	if(but.value == 'Validate')
	show_hideDiv('varify')
}


function show_hideBus(div,x,pn,nn)
{
	var a = document.getElementById(div).style.display
	if(a=='block')
		{
			document.getElementById(div).style.display = 'none';
			document.getElementById(x).value=nn	;
		}
	if(a=='none')
	{
		document.getElementById(div).style.display = 'block';
			document.getElementById(x).value=pn;
	}
				//alert(x)
}

function sortDetail(z,id){
	var bg = z.className;
	var i=1;
	if(bg=='unorder')
	{
	while(document.getElementById(id+i)){
			document.getElementById(id+i).className = 'default';
			i++;
		}
	z.className = 'order';
	}
	
	if(bg=='order')
	{
	while(document.getElementById(id+i)){
			document.getElementById(id+i).className = 'default';
			i++;
		}
	z.className = 'unorder';
	}
	else{
		while(document.getElementById(id+i)){
			document.getElementById(id+i).className = 'default';
			i++;
		}
		z.className = 'order';
	}
	
}