

function checkCon(frm){
	var temp;
	temp=trimSpaces(frm.strCnno.value);
	if(temp.length == 0){
		alert("Please specify the Consignment no.");
		frm.strCnno.focus();
		return false;
	}
	return true;
}

function checkComplaint(objFrm)
{
	bookDt = trimSpaces(objFrm.bookDt.value);
	custName = trimSpaces(objFrm.custName.value);
	if(custName.length<=0)
	{
		alert("Enter your name");
		objFrm.custName.focus();
		return false;
	}
	custEmail = trimSpaces(objFrm.custEmail.value);
	if(custEmail.length<=0)
	{
		alert("Enter your email address");
		objFrm.custEmail.focus();
		return false;
	}
	else if(! checkEmail(custEmail))
	{
		objFrm.custEmail.focus();
		return false;
	}
	airwayBill = trimSpaces(objFrm.airwayBill.value);
	if(airwayBill.length<=0)
	{
		alert("Enter the consignment/airway bill number");
		objFrm.airwayBill.focus();
		return false;
	}
	
	complaints = trimSpaces(objFrm.complaints.value);
	if(complaints.length<=0)
	{
		alert("Enter your complaint");
		objFrm.complaints.focus();
		return false;
	}
	
	objFrm.frmAction.value="yes";
	return true;
	
}

function checkFeedBack(objFrm)
{
	
	feedBack =trimSpaces(objFrm.feedback.value);
	if(feedback.length<=0)
	{
		alert("Please enter your valuable feedback");
		objFrm.feedback.focus();
		return false;
	}
	personName =trimSpaces(objFrm.naam.value);
	if(personName.length<=0)
	{
		alert("Please enter your name");
		objFrm.naam.focus();
		return false;
	}
	
	custEmail = trimSpaces(objFrm.email.value);
	if(custEmail.length<=0)
	{
		alert("Enter your email address");
		objFrm.email.focus();
		return false;
	}
	else if(! checkEmail(custEmail))
	{
		objFrm.email.focus();
		return false;
	}
	objFrm.frmAction.value="yes";
	return true;
}


	function checkUser(frmObj,modifier)
	{
		if(modifier=='add')
		{
			userId = trimSpaces(frmObj.userId.value);
			if(userId.length<=0)
			{
				alert("The member name must have atleast 4 characters");
				frmObj.userId.focus();
				return false;
			}
			else if(checkIfValueExists(frmObj,'checkFieldValues',userId))
			{
				alert("The username '" + userId + "' already exists");
				return false;
			}
		}	
		pass= trimSpaces(frmObj.pass.value);
		if(pass.length<=0)
		{
			alert("Enter the password");
			frmObj.pass.focus();
			return false;
		}
		else if(pass.length<4)
		{
			alert("The password must be atleast 4 characters long");
			frmObj.pass.focus();
			return false;
		} 
		confPass= trimSpaces(frmObj.confPass.value);
		if(confPass.length<=0)
		{
			alert("Retype the password");
			frmObj.confPass.focus();
			return false;
		}
		if(pass != confPass)
		{
			alert("The two passwords do not match");
			frmObj.confPass.focus();
			return false;
		}
		
		fName= trimSpaces(frmObj.fName.value);
		if(fName.length<=0)
		{
			alert("Please enter your first name");
			frmObj.fName.focus();
			return false;
		}
		
		lName= trimSpaces(frmObj.lName.value);
		if(lName.length<=0)
		{
			alert("Please enter your last name");
			frmObj.lName.focus();
			return false;
		}
			
		addr1 = trimSpaces(frmObj.addr1.value);
		if(addr1.length<=0)
		{
			alert("Please enter your House No. / Building information");
			frmObj.addr1.focus();
			return false;
		}
		
		addr2 = trimSpaces(frmObj.addr2.value);
		if(addr2.length<=0)
		{
			alert("Please enter your Street information");
			frmObj.addr2.focus();
			return false;
		}
		
		city= trimSpaces(frmObj.city.value);
		if(city.length<=0)
		{
			alert("Please enter your city");
			frmObj.city.focus();
			return false;
		}
		
		zip = trimSpaces(frmObj.zip.value);
		if(zip.length<=0)
		{
			alert("Please enter your Zip / Pincode");
			frmObj.zip.focus();
			return false;
		}

		country = trimSpaces(frmObj.country.value);
		if(country.length<=0)
		{
			alert("Please select the country");
			frmObj.country.focus();
			return false;
		}

		email= trimSpaces(frmObj.email.value);
		if(email.length<=0)
		{
			alert("Please enter your email address");
			frmObj.email.focus();
			return false;
		}
		else if(! checkEmail(email))
		{
			frmObj.email.focus();
			return false;
		}

		vReason= trimSpaces(frmObj.vReason.value);
		if(vReason.length<=0)
		{
			alert("Please enter the reason for registering with DTDC");
			frmObj.vReason.focus();
			return false;
		}
		occu= trimSpaces(frmObj.occu.value);
		if(occu=='Others' && trimSpaces(frmObj.occuOther.value.length)<=0)
		{
			alert("Please enter your job function");
			frmObj.occuOther.focus();
			return false;
		}
		dob=trimSpaces(frmObj.dob.value);
		if(dob.length<=0)
		{
			frmObj.dob.value= "01/01/1900";
		}
		frmObj.frmAction.value="yes";
		return true;
	}

function checkLogin(frmObj)
{
	userName=trimSpaces(frmObj.userName.value);
	if(userName.length<=0)
	{
		alert("Please enter the username");
		frmObj.userName.focus();
		return false;
	} 
	userPassword=trimSpaces(frmObj.userPassword.value);
	if(userPassword.length<=0)
	{
		alert("Please enter the password");
		frmObj.userPassword.focus();
		return false;
	}
	//return true;
	frmObj.submit();
}

function checkSearch(frmObj)
{
	
	searchString=trimSpaces(frmObj.searchString.value);
	
	if(searchString.length<=0)
	{
		alert("Please enter the search string");
		frmObj.searchString.focus();
		return false;
	}
	frmObj.submit();
}

//---------------------
function SetToToday(Which,frmName){
 // document.write(eval("document." + frmName + "." + Which + "Day"));
  DaysObject = eval("document." + frmName + "." + Which + "Day");
  MonthObject = eval("document." + frmName + "." + Which + "Month");
  YearObject = eval("document." + frmName + "." + Which + "Year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which,frmName);

  DaysObject[NowDay-1].selected = true;
}
function ChangeOptionDays(Which,frmName)
{
  //alert("document." + frmName + "." + Which + "Day");
  DaysObject = eval("document." + frmName + "." + Which + "Day");
  MonthObject = eval("document." + frmName + "." + Which + "Month");
  YearObject = eval("document." + frmName + "." + Which + "Year");

  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
NowHour=Now.getHours();
NowMinute=Now.getMinutes();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

//function to write option years plus x
function WriteYearOptions(YearsAhead)
{
  line = "";
  var yValue;
  for (i=0; i<YearsAhead; i++)
  {
  	yValue = NowYear + i;
    line += "<OPTION value = "+yValue+">";
    line += yValue;
  }
  return line;
}

//function to write option years minus x
function WriteBackYear(YearsBack)
{
  line = "";
  var yValue;
  for (i=0; i<=YearsBack; i++)
  {
  	yValue = NowYear  - i;
    line += "<OPTION value = "+yValue+">";
    line += yValue;
  }
  return line;
}
function SetToToday(Which,frmName)
{
 // document.write(eval("document." + frmName + "." + Which + "Day"));
  DaysObject = eval("document." + frmName + "." + Which + "Day");
  MonthObject = eval("document." + frmName + "." + Which + "Month");
  YearObject = eval("document." + frmName + "." + Which + "Year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which,frmName);

  DaysObject[NowDay-1].selected = true;
}

function printVersion(id){
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;

	sTop = (sHeight - 650) / 2;
	sLeft = (sWidth - 650) / 2;
	
	//window.open("printBookingDetails.asp?pageid=" + id, "print", "width=650,height=600,top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=1,status=0,scrollbars=1,resizable=1");
	//window.open("parentFrame.asp?pageid=" + id, "print", "width=650,height=400,top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=1,status=0,scrollbars=1,resizable=1");
	window.open("printPage.asp?pageid=" + id, "print", "width=800,height=800,top=" + sTop + ",left=" + sLeft + ",toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,location=no");
	
	
	return;
}

function printdemoVersion(id){
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;

	sTop = (sHeight - 650) / 2;
	sLeft = (sWidth - 650) / 2;
	
	//window.open("printBookingDetails.asp?pageid=" + id, "print", "width=650,height=600,top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=1,status=0,scrollbars=1,resizable=1");
	//window.open("parentFrame.asp?pageid=" + id, "print", "width=650,height=400,top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=1,status=0,scrollbars=1,resizable=1");
	window.open("printdemoPage.asp?pageid=" + id, "print", "width=800,height=800,top=" + sTop + ",left=" + sLeft + ",toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,location=no");
	
	
	return;
}



	function activatemenu(id, blndblarrow, imagePrefix) {
		td = eval("td"+id);
		td.style.background = "#5A7B94";
		//arrow = eval("arrow"+id);
		//arrow.src = imagePrefix + "images/arrow2.gif";
		/*if(blndblarrow) {
			dblarrow = eval("dblarrow"+id);
			dblarrow.src = imagePrefix + "images/dblarrow2.gif";
		}*/
		//idMenu = eval("idMenu"+id);
		//idMenu.className = "leftMenuLink2";
		
	}
	
	function deactivatemenu(id, blndblarrow, imagePrefix) {
		td = eval("td"+id);
		td.style.background = "#94B5C6";
		//arrow = eval("arrow"+id);
		//arrow.src = imagePrefix + "images/arrow1.gif"
		/*if(blndblarrow) {
			dblarrow = eval("dblarrow"+id);
			dblarrow.src = imagePrefix + "images/dblarrow1.gif";
		}*/
		//idMenu = eval("idMenu"+id);
		//idMenu.className = "leftMenuLink";
	}
