﻿// JavaScript Document
var cooo1;
jQuery(function(){
	cooo1 = new reFocus();
	cooo1.create("from1",0);
	cooo1.create("to1",0);
	cooo1.create("tstop",0);
	
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1);
	if(isIE){
		cooo1.listDB[0].Obj.div.style.marginTop="1px";
		cooo1.listDB[1].Obj.div.style.marginTop="1px";
		cooo1.listDB[2].Obj.div.style.marginTop="1px";
		
		cooo1.listDB[0].Obj.div.style.marginLeft="1px";
		cooo1.listDB[1].Obj.div.style.marginLeft="1px";
		cooo1.listDB[2].Obj.div.style.marginLeft="1px";
	}
	cooo1.listDB[0].Obj.iframe.style.width="150px";
	cooo1.listDB[1].Obj.iframe.style.width="150px";
	cooo1.listDB[2].Obj.iframe.style.width="250px";
});

String.prototype.trim=function(){
  return this.replace(/(^\s*)|(\s*$)/g,"");
}

function chkform1(){
	var obj1=document.getElementById("from1");
	var obj2=document.getElementById("to1");
	if(obj1.value.trim()=="" && obj2.value.trim()==""){
		alert("Please enter your start and destination first!");
		obj1.focus();
		return false;
	}else if(obj1.value.trim()==""){
		document.getElementById("tstop").value=obj2.value;
		document.getElementById("form3").submit();
		return false;
	}else if(obj2.value.trim()==""){
		document.getElementById("tstop").value=obj1.value;
		document.getElementById("form3").submit();
		return false;
	}
	return true;
}
function chkform2(){
	var obj1=document.getElementById("tstop");
	if(obj1.value.trim()==""){
		alert("Please enter a city first!");
		obj1.focus();
		return false;
	}
	return true;
}
function chkform3(){
	var obj1=document.getElementById("trainno1");
	if(obj1.value.trim()==""){
		alert("Please enter a train no. first!");
		obj1.focus();
		return false;
	}
	return true;
}