function desc12()
{
	var f;	
	var val = document.post_event;
	
	if (val.title.value=="")
		{
			alert("Please enter your title.\n");
			val.title.focus();
			return false;
		}
	else if (val.desc.value=="")
		{
			alert("Please enter event detail.\n"); 
			val.desc.focus();
			return false;
		}
	else if (val.file.value=="")
		{
			alert("Please select image.\n");
			val.file.focus();
			return false;
		}
	else if(val.from_date.value=="")
		{
			alert("Please select event start date.\n");
			val.from_date.focus();
			return false;
		}
	else if(val.to_date.value=="")
		{
			alert("Please select event end date.\n");
			val.to_date.focus();
			return false;
		}
	else if(!IsvalidDateAndTime(val.from_date.value,val.to_date.value,val.from_hr.value,val.from_min.value,val.from_ampm,val.to_hr.value,val.to_min.value,val.to_ampm.value))
		{
		alert("Date is not valid.");	
		val.to_date.focus();
		return false;			
		}
	else if(val.street.value=="")
	{
		alert("Please enter street.\n");
		val.street.focus();
		return false;
	}
	else if(val.city.value=="")
	{
		alert("Please enter street.\n");
		val.street.focus();
		return false;
	}
	else if(val.state.value=="")
	{
		alert("Please enter street.\n");
		val.state.focus();
		return false;
	}
	else if(val.country.value=="")
	{
		alert("Please select country.\n");
		val.street.focus();
		return false;
	}
	else if(val.zip.value=="")
	{
		alert("Please enter zip.\n");
		val.zip.focus();
		return false;
	}
	else if(!isAllNumerics(val.zip.value))
	{
		alert("Please enter numbers only.\n");
		val.zip.focus();
		return false;
	}
	else if(val.zip.value.length < 4)
	{
		alert("Please enter correct zipcode.\n");
		val.zip.focus();
		return false;
	}
	else
    {
	showLightBox('preview.php?width=640&height=400');
	}
}





function month_num(mon)
{
	if(mon=='January')		mm1=01;
	if(mon=='February') 	mm1=02;
	if(mon=='March')  		mm1=03;
	if(mon=='April')    	mm1=04;
	if(mon=='May')      	mm1=05;
	if(mon=='June')   		mm1=06;
	if(mon=='July')   		mm1=07;
	if(mon=='August')   	mm1=08;
	if(mon=='September')	mm1=09;
	if(mon=='October')   	mm1=10;
	if(mon=='November')   	mm1=11;
	if(mon=='December')   	mm1=12;
	return mm1;
}

function isValidEmail(emailStr)
{
	if(emailStr=="")
		{
				//alert("Please enter email id.");
				return true;
				
		}
			/* The following pattern is used to check if the entered e-mail address
			   fits the user@domain format.  It also is used to separate the username
			   from the domain. */
			var emailPat=/^(.+)@(.+)$/
			/* The following string represents the pattern for matching all special
			   characters.  We don't want to allow special characters in the address. 
			   These characters include ( ) < > @ , ; : \ " . [ ]    */
			//var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
			var specialChars="\\(\\)<>@,`';:~!#$%^&*+=|{}?\\\\\\\"\\.\\[\\]"
			
			/* The following string represents the range of characters allowed in a 
			   username or domainname.  It really states which chars aren't allowed. */
			var validChars="\[^\\s" + specialChars + "\]"
			/* The following pattern applies if the "user" is a quoted string (in
			   which case, there are no rules about which characters are allowed
			   and which aren't; anything goes).  E.g. "sg cricket"@disney.com
			   is a legal e-mail address. */
			var quotedUser="(\"[^\"]*\")"
			/* The following pattern applies for domains that are IP addresses,
			   rather than symbolic names.  E.g. sg@[123.124.233.4] is a legal
			   e-mail address. NOTE: The square brackets are required. */
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
			/* The following string represents an atom (basically a series of
			   non-special characters.) */
			var atom=validChars + '+'
			/* The following string represents one word in the typical username.
			   For example, in sg.sg@somewhere.com, sg and sg are words.
			   Basically, a word is either an atom or quoted string. */
			var word="(" + atom + "|" + quotedUser + ")"
			// The following pattern describes the structure of the user
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
			/* The following pattern describes the structure of a normal symbolic
			   domain, as opposed to ipDomainPat, shown above. */
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


			/* Finally, let's start trying to figure out if the supplied address is
			   valid. */

			/* Begin with the coarse pattern to simply break up user@domain into
			   different pieces that are easy to analyze. */
			var matchArray=emailStr.match(emailPat)
			if (matchArray==null) {
			  /* Too many/few @'s or something; basically, this address doesn't
			     even fit the general mould of a valid e-mail address. */
				alert("Email address seem to be invalid(check @ and .'s)")
				document.group_info_form.email.focus();
				return false
			}
			var user=matchArray[1]
			var domain=matchArray[2]

			// See if "user" is valid 
			if (user.match(userPat)==null) {
			    // user is not valid
			    alert("The username doesn't seem to be valid.")
				document.group_info_form.email.focus();
			    return false
			}

			/* if the e-mail address is at an IP address (as opposed to a symbolic
			   host name) make sure the IP address is valid. */
			var IPArray=domain.match(ipDomainPat)
			if (IPArray!=null) {
			    // this is an IP address
				  for (var i=1;i<=4;i++) {
				    if (IPArray[i]>255) {
				        alert("Destination IP address is invalid!")
						document.group_info_form.email.focus();
					return false
				    }
			    }
			    return true
			}

			// Domain is symbolic name
			var domainArray=domain.match(domainPat)
			if (domainArray==null) {
			alert("The domain name doesn't seem to be valid.")
			document.group_info_form.email.focus();
			    return false
			}

			
			var atomPat=new RegExp(atom,"g")
			var domArr=domain.match(atomPat)
			var len=domArr.length
			if (domArr[domArr.length-1].length<2 || 
			    domArr[domArr.length-1].length>5) {
			   // the address must end in a two letter or three letter word.
			   alert("The address must end in a three-letter domain, or two letter country.")
			   document.group_info_form.email.focus();
			   return false
			}

			// Make sure there's a host name preceding the domain.
			if (len<2) {
			   var errStr="This address is missing a hostname!"
			   alert(errStr)
			   return false

			}

			// If we've gotten this far, everything's valid!
			return true;
}
function isAllCharacters(objValue)
{
		var characters="' -abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ."
		var tmp
		var lTag
		lTag = 0
		temp = (objValue.length)
		for (var i=0;i<temp;i++)
		{
			tmp=objValue.substring(i,i+1)
			if (characters.indexOf(tmp)==-1)
			{
				lTag = 1
			}
		}
		if(lTag == 1)
			return false
		else
			return true
}


function isAllNumerics(objValue)
{
	var characters="0123456789."
	var tmp
	var lTag
	lTag = 0
	temp = (objValue.length)
	//alert(objValue);
	for (var i=0;i<temp;i++)
	{
		tmp=objValue.substring(i,i+1)
		if (characters.indexOf(tmp)==-1)
		{
			lTag = 1
		}
	}
	if(lTag == 1)
		return false
	else
	  if(objValue<=0)
	   {
		return false
	   }else{ 	
		return true
	  }
}
function isValidDate(dateStr) 
{ 
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;//January is 0!
var yyyy = today.getFullYear();
date_noe_1 = mm +"/"+ dd +"/"+ yyyy;
//alert(date_noe_1);
/*if(date_noe_1>dateStr)
{ 
alert("Please enter future date only");
return false;
}
*/
//alert(dd);
//alert(mm);
//alert(yyyy);

// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("Date is not in a valid format.")
return false;
}

month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];


if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!")
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
return false;
   }
}
return true;  // date is valid
}



function numbersonly(e,a)
{	// var docf=document.frmRegister.d;

	var unicode=e.charCode? e.charCode : e.keyCode
	
	if (unicode!=8)
	{ 
		if (unicode<48||unicode>57) //if not a number
		{
			return false ;//disable key press
		}
	}
}
	
function IsDateGreaterCurrent(fromdate, hr, mi)
{
	var temp=fromdate.split("-");
	var	doe_frm_dd = temp[2];
	var	doe_frm_mm = temp[1]-1;
	var	doe_frm_yyyy = temp[0];
	//alert(temp)

	var today= new Date();
	var	doe_to_dd = today.getDate();
	var	doe_to_mm = today.getMonth();
	var	doe_to_yyyy = today.getFullYear();
	var doe_to_hr = today.getHours();
	var doe_to_min = today.getMinutes();
	
/*	alert(doe_to_dd+"currentdate")
	alert(doe_to_mm+"currentmonth")
	alert(doe_to_yyyy+"currentyear")
*/	if (doe_to_dd < 10)
	{
		doe_to_dd = '0'+doe_to_dd;
	}
	if (doe_to_mm < 10)
	{
		doe_to_mm = '0'+doe_to_mm;
	}

	
	   var date1 = new Date(doe_frm_yyyy , doe_frm_mm, doe_frm_dd, hr, mi);
	   var date2 = new Date(doe_to_yyyy , doe_to_mm, doe_to_dd,doe_to_hr,doe_to_min);
	   //alert(date1)
	   //alert(date2)
	   if(date2 > date1)
	   {
		   //alert("you are right")
			return false;
	   }
		else
		{
			return true;	
		}
}



function IsvalidDateAndTime(startd,endd,hstart,mstart,zone,hend,mend,endzone)
{	

	if(!IsDateGreaterCurrent(startd,hstart,mstart))
	{
		//alert("start date");
		return false;	
	}
	if(!IsDateGreaterCurrent(endd,hend,mend))
	{
		//alert("end date");
		return false;	
	}
	var temp=startd.split("-");
	var	doe_frm_dd = parseInt(temp[2]);
	var	doe_frm_mm = parseInt(temp[1]);
	var	doe_frm_yyyy = parseInt(temp[0]);
	//alert(doe_frm_dd);
	//alert(temp);
	var temp_end=endd.split("-");
	var	doe_frm_dd_end = parseInt(temp_end[2]);
	var	doe_frm_mm_end = parseInt(temp_end[1]);
	var	doe_frm_yyyy_end = parseInt(temp_end[0]);
	hstart	= parseInt(hstart);
	mstart 	= parseInt(mstart);
	hend 	= parseInt(hend);
	mend 	= parseInt(mend);	
	
	if(doe_frm_yyyy_end<doe_frm_yyyy)
	{
		//alert("year greater");
		return false;
	}
	else
	{
		if(doe_frm_yyyy_end>=doe_frm_yyyy)
		{
			if(doe_frm_mm_end<doe_frm_mm)
			{
				//alert("month greater")
				return false;
			}
			else
			{
				if(doe_frm_mm_end>=doe_frm_mm)
				{
					if(doe_frm_mm_end==doe_frm_mm)
					{
						//alert("mon equal");
						if(parseInt(doe_frm_dd_end)==parseInt(doe_frm_dd))
						{
							//alert("date is same");
							if(endzone=="AM" && zone=="PM")
							{
								//alert("zone gretater");
								return false;	
							}
							else
							{
								if(hend<hstart)
								{
									//alert("hour greater");
									return false;
								}
								else
								{
									if(hend==hstart)
									{
										//alert("hour equal");
										if(mend<=mstart && toString(endzone)==toString(zone))
										{
											//alert("minute greater");
											return false;	
										}
										else
										{
											if(toString(endzone)==toString(zone) && mend>mstart)
											{
												return true ;	
											}
										}
									}
									else if(hend>hstart)
									{
										return true;
									}
								}
							}
						}
						else if(parseInt(doe_frm_dd_end)>parseInt(doe_frm_dd))
						{
							//alert("date is correct when mon is same");
							return true;
						}
					}
					else if(doe_frm_mm_end>doe_frm_mm)
					{
						//alert("month true");
						return true;
					}
				}
			}
		}
	}
}

/*    else if(val.price.value=="")
	{
		alert("Please enter price.\n");
		val.price.focus();
		return false;
	}
	else if(!isAllNumerics(val.price.value))
	{
		alert("Please enter numbers only.\n");
		val.price.focus();
		return false;
	}*/
