function writeIt() {
// getDate
var t;
var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// quadYear
function y2k(number){return (number < 1000) ? number + 1900 : number;}

// glueIt
today =  days[now.getDay()] + " " +
               months[now.getMonth()] + ", " +
                date + " " +
                (y2k(now.getYear())) ;

   if(document.all || document.getElementById){ // Browser Check
   t=today.toString();
       window.status=t;
   }else{
      self.status = today.toString(); // Default to status.
   }
}
function checkPostClassifieds(){
	document.forms[2].categoryId.value = trimSpaces(document.forms[2].categoryId.value);
	if(document.forms[2].categoryId.value.length <= 0) {
		alert("Please select the Category");
		document.forms[2].categoryId.focus();
		return false;
	}
	document.forms[2].classifiedTitle.value = trimSpaces(document.forms[2].classifiedTitle.value);
	if(document.forms[2].classifiedTitle.value.length <= 0) {
		alert("Please enter the Title for the Classified entry");
		document.forms[2].classifiedTitle.focus();
		return false;
	}
	document.forms[2].classifiedDescription.value = trimSpaces(document.forms[2].classifiedDescription.value);
	if(document.forms[2].classifiedDescription.value.length <= 0) {
		alert("Please enter the Description");
		document.forms[2].classifiedDescription.focus();
		return false;
	}
	document.forms[2].classifiedType.value = trimSpaces(document.forms[2].classifiedType.value);
	if(document.forms[2].classifiedType.value == 0) {
		alert("Please Select the Type");
		document.forms[2].classifiedType.focus();
		return false;
	}
	document.forms[2].classifiedPrice.value = trimSpaces(document.forms[2].classifiedPrice.value);
	if(document.forms[2].classifiedPrice.value.length > 0) {
		if(!checkAllowedChars(document.forms[2].classifiedPrice.value, "N.")) {
			alert("Only numeric values are permitted for the price");
			document.forms[2].classifiedPrice.select();
			return false;
		}
		classifiedPrice = parseInt(document.forms[2].classifiedPrice.value, 10);
		if(classifiedPrice <= 0) {
			alert("Only numeric values greater than zero is permitted for the price");
			document.forms[2].classifiedPrice.focus();
			return false;
		}
	}
	document.forms[2].contactPerson.value = trimSpaces(document.forms[2].contactPerson.value);
	if(document.forms[2].contactPerson.value.length <= 0) {
		alert("Please enter Contact Person");
		document.forms[2].contactPerson.focus();
		return false;
	}
	document.forms[2].contactAddress.value = trimSpaces(document.forms[2].contactAddress.value);
	if(document.forms[2].contactAddress.value.length <= 0) {
		alert("Please enter Contact Address ");
		document.forms[2].contactAddress.focus();
		return false;
	}
	document.forms[2].place.value = trimSpaces(document.forms[2].place.value);
	if(document.forms[2].place.value.length <= 0) {
		alert("Please select your District");
		document.forms[2].place.focus();
		return false;
	}
	document.forms[2].contactPhone.value = trimSpaces(document.forms[2].contactPhone.value);
	if(document.forms[2].contactPhone.value.length <= 0) {
		alert("Please enter Contact Phone ");
		document.forms[2].contactPhone.focus();
		return false;
	}
	 else{
		if(!checkAllowedChars(document.forms[2].contactPhone.value, "N-")) {
			alert("Only numeric values [0-9] & ' - '  are allowed for the Phone entry!");
			document.forms[2].contactPhone.select();
			return false;
		}
	}
	document.forms[2].contactMobile.value = trimSpaces(document.forms[2].contactMobile.value);
	if(document.forms[2].contactMobile.value.length > 0) {
		if(!checkAllowedChars(document.forms[2].contactMobile.value, "N-")) {
			alert("Only numeric values [0-9] & ' - '  are allowed for the Phone entry!");
			document.forms[2].contactMobile.select();
			return false;
		}
	}
	document.forms[2].contactEmail.value = trimSpaces(document.forms[2].contactEmail.value);
	if(document.forms[2].contactEmail.value.length <= 0) {
		alert("Please enter the Email");
		document.forms[2].contactEmail.focus();
		return false;
	}
	if(document.forms[2].contactEmail.value.length > 0){
	if(!(checkEmail(document.forms[2].contactEmail.value))){
			document.forms[2].contactEmail.select();
			return false;
			}
	}
	
	if(!document.forms[2].checkbox.checked) {
		alert("Please agree the Terms & Conditions");
		document.forms[2].checkbox.focus();
		return false;
	}
	document.forms[2].frmAction.value = "process";
	document.forms[2].submit();
}


function key_check(){
	if (window.event.keyCode == 13)
    {
			document.forms[0].search_key.value = trimSpaces(document.forms[0].search_key.value);
			if(document.forms[0].search_key.value.length <= 0) {
				alert("Enter Key for Search");
				document.forms[0].search_key.focus();return false;
			}
			document.forms[0].type.value = trimSpaces(document.forms[0].type.value);
			if(document.forms[0].type.value.length <= 0) {
				alert("Select A Type");
				document.forms[0].type.focus();
				return false;
			}
			else
			{
				document.forms[0].submit();
			}
	}
}
function checkSearch(){
	document.forms[0].search_key.value = trimSpaces(document.forms[0].search_key.value);
	if(document.forms[0].search_key.value.length <= 0) {
		alert("Enter Key for Search");
		document.forms[0].search_key.focus();
		return false;
	}
	document.forms[0].type.value = trimSpaces(document.forms[0].type.value);
	if(document.forms[0].type.value.length <= 0) {
		alert("Select A Type");
		document.forms[0].type.focus();
		return false;
	}
	document.forms[0].submit();
}


function checkPostadd(){
	document.postAdd.name.value = trimSpaces(document.postAdd.name.value);
	if(document.postAdd.name.value <=0){
		alert("Please enter your Name");
		document.postAdd.name.focus();
		return false;
	}
	document.postAdd.filetype.value = trimSpaces(document.postAdd.filetype.value);
	if(document.postAdd.filetype.value <=0){
		alert("Please specify the type of Advetisement");
		document.postAdd.filetype.focus();
		return false;
	}
	document.postAdd.email.value = trimSpaces(document.postAdd.email.value);
	if(document.postAdd.email.value <=0){
		alert("Please enter the Email");
		document.postAdd.email.focus();
		return false;
	}
	if(document.postAdd.email.value.length > 0){
	if(!(checkEmail(document.postAdd.email.value))){
			document.postAdd.email.select();
			return false;
			}
	}
}
function checkPostcont(){
		document.postCont.name.value = trimSpaces(document.postCont.name.value);
	if(document.postCont.name.value <=0){
		alert("Please enter your Name");
		document.postCont.name.focus();
		return false;
	}
		document.postCont.email.value = trimSpaces(document.postCont.email.value);
	if(document.postCont.email.value <=0){
		alert("Please enter the Email");
		document.postCont.email.focus();
		return false;
	}
	if(document.postCont.email.value.length > 0){
	if(!(checkEmail(document.postCont.email.value))){
			document.postCont.email.select();
			return false;
			}
	}
	 document.postCont.suggestion.value = trimSpaces(document.postCont.suggestion.value);
	if(document.postCont.suggestion.value <=0){
		alert("Please enter your Suggestion");
		document.postCont.suggestion.focus();
		return false;
	} 
}
function checkPostMail(){
		document.sentmail.message.value = trimSpaces(document.sentmail.message.value);
	if(document.sentmail.message.value <=0){
		alert("Please enter your Message");
		document.sentmail.message.focus();
		return false;
	} 
	document.sentmail.name.value = trimSpaces(document.sentmail.name.value);
	if(document.sentmail.name.value.length <= 0) {
		alert("Please enter your Name");
		document.sentmail.name.focus();
		return false;
	}
	document.sentmail.place.value = trimSpaces(document.sentmail.place.value);
	if(document.sentmail.place.value.length <= 0) {
		alert("Please select your District");
		document.sentmail.place.focus();
		return false;
	}
	document.sentmail.contactEmail.value = trimSpaces(document.sentmail.contactEmail.value);
	if(document.sentmail.contactEmail.value <=0){
		alert("Please enter the Email");
		document.sentmail.contactEmail.focus();
		return false;
	}
	if(document.sentmail.contactEmail.value.length > 0){
	if(!(checkEmail(document.sentmail.contactEmail.value))){
			document.sentmail.contactEmail.select();
			return false;
			}
	}
	if(!document.sentmail.checkbox.checked) {
		alert("Please agree the Terms & Conditions");
		document.sentmail.checkbox.focus();
		return false;
	}
	
}
function openTest() {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	winWidth = 500;
	winHeight = 550;
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	window.open("php/contest.php","WinPrizes", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=1,scrollbars=0,resizable=0");

return;
}
function contest() {
	//alert();
	if(!((document.question.question1[0].checked) || (document.question.question1[1].checked)|| (document.question.question1[2].checked)|| (document.question.question1[3].checked))) {
	alert("Please Answer The First Question");
	document.question.focus();
	return false;
	}
	if(!((document.question.question2[0].checked) || (document.question.question2[1].checked)|| (document.question.question2[2].checked)|| (document.question.question2[3].checked))) {
	alert("Please Answer The Second Question");
	document.question.focus();
	return false;
	}
	if(!((document.question.question3[0].checked) || (document.question.question3[1].checked)|| (document.question.question3[2].checked)|| (document.question.question3[3].checked))) {
	alert("Please Answer The Third Question");
	document.question.focus();
	return false;
	}
	document.question.name.value = trimSpaces(document.question.name.value);
	if(document.question.name.value.length <= 0) {
		alert("Please enter your Name");
		document.question.name.focus();
		return false;
	}
	document.question.phone.value = trimSpaces(document.question.phone.value);
	if(document.question.phone.value.length <= 0) {
		alert("Please enter your Phone");
		document.question.phone.focus();
		return false;
	}
	else{
		if(!checkAllowedChars(document.question.phone.value, "N-")) {
			alert("Only numeric values [0-9] & ' - '  are allowed for the Phone entry!");
			document.question.phone.select();
			return false;
		}
	}
	document.question.email.value = trimSpaces(document.question.email.value);
	if(document.question.email.value.length <= 0) {
		alert("Please enter your Email");
		document.question.email.focus();
		return false;
	}
	if(document.question.email.value.length > 0){
	if(!(checkEmail(document.question.email.value))){
			document.question.email.select();
			return false;
			}
	}
}
