/*
	This function will set the depart or return location automatically
*/

var Default      = 0;
var KL_KLCC      = 1;
var KL_MontKiara = 2;
var Singapure    = 3;

function setlocation(ObjSource, ObjDestination, ObjDestination2, setddl) {
	if(setddl == ObjSource) {
		if(ObjSource.selectedIndex == KL_KLCC || ObjSource.selectedIndex == KL_MontKiara) {
			ObjDestination.selectedIndex = Singapure;
			
			if (ObjDestination2 != null) {
				if (ObjDestination2.selectedIndex == Singapure ||
						ObjDestination2.selectedIndex == Default) {
					ObjDestination2.selectedIndex = ObjSource.selectedIndex;
				}
			}
			
		} else if(ObjSource.selectedIndex == Singapure) {
			if (ObjDestination.selectedIndex == Singapure ||
					ObjDestination.selectedIndex == Default) {
				ObjDestination.selectedIndex = KL_MontKiara;
			}
			if (ObjDestination2 != null) { ObjDestination2.selectedIndex = Singapure; }
		}
	}
	
	if(setddl == ObjDestination) {
		if (ObjDestination.selectedIndex == KL_KLCC ||
				ObjDestination.selectedIndex == KL_MontKiara) {
			ObjSource.selectedIndex = Singapure;
			if (ObjDestination2 != null) { ObjDestination2.selectedIndex = Singapure; }
		} else if(ObjDestination.selectedIndex == Singapure) {
			if (ObjSource.selectedIndex == Default ||
					ObjSource.selectedIndex == Singapure) {
				ObjSource.selectedIndex = KL_MontKiara
			}
			
			if (ObjDestination2 != null) {
				if (ObjDestination2.selectedIndex == Default ||
						ObjDestination2.selectedIndex == Singapure) {
					ObjDestination2.selectedIndex = ObjSource.selectedIndex;
				}
			}
		}
	}
	
	if(setddl == ObjDestination2) {
		if (ObjDestination2.selectedIndex == KL_KLCC ||
				ObjDestination2.selectedIndex == KL_MontKiara) {
			if (!(ObjSource.selectedIndex == KL_KLCC ||
						ObjSource.selectedIndex == KL_MontKiara)) {
				ObjSource.selectedIndex = ObjDestination2.selectedIndex;
			}
			
			if (ObjDestination.selectedIndex != Singapure) {
				ObjDestination.selectedIndex = Singapure;
			}
			
		} else if(ObjDestination2.selectedIndex == Singapure) {
			if (ObjDestination.selectedIndex == Singapure ||
					ObjDestination.selectedIndex == Default) {
				ObjDestination.selectedIndex = KL_MontKiara;
			}
			ObjSource.selectedIndex = Singapure;
		}
	}
}
