function writeDate() 
{
	var monthNames = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	var dayNames = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	var now = new Date();
	var amPm = (now.getHours() < 12) ? "am" : "pm";
	var hour = (now.getHours() > 12) ? (now.getHours() - 12) : (hour == 0) ? "12" : now.getHours();
	var min = (now.getMinutes() < 10) ? ("0" + now.getMinutes()) : (now.getMinutes());
	document.write (now.getDate()+" - "+monthNames[now.getMonth()] + " - " +now.getYear() );
}
function checkLogin() {
	document.forms[0].username.value = trimSpaces(document.forms[0].username.value);
	if(document.forms[0].username.value.length <= 0) {
		alert("Please enter the username");
		document.forms[0].username.focus();
		return false;
	}
	document.forms[0].password.value = trimSpaces(document.forms[0].password.value);
	if(document.forms[0].password.value.length <= 0) {
		alert("Please enter password");
		document.forms[0].password.focus();
		return false;
	}
}
function checkPassword() {
	document.forms[0].password.value = trimSpaces(document.forms[0].password.value);
	if(document.forms[0].password.value.length <= 0) {
		alert("Please enter the current password");
		document.forms[0].password.focus();
		return false;
	}
	document.forms[0].newPassword.value = trimSpaces(document.forms[0].newPassword.value);
	if(document.forms[0].newPassword.value.length <= 0) {
		alert("Please enter the new password");
		document.forms[0].newPassword.focus();
		return false;
	}
	document.forms[0].retypePassword.value = trimSpaces(document.forms[0].retypePassword.value);
	if(document.forms[0].newPassword.value != document.forms[0].retypePassword.value) {
		alert("Passwords does not match");
		document.forms[0].retypePassword.focus();
		return false;
	}
}
function checkPhotos(frmType) {
	category = trimSpaces(document.forms[0].category.value);
	caption = trimSpaces(document.forms[0].caption.value);
	icon = trimSpaces(document.forms[0].icon.value);
	photograph = trimSpaces(document.forms[0].photograph.value);
	description = trimSpaces(document.forms[0].description.value);
	
	if(category.length <= 0) {
		alert("Plese select a category");
		document.forms[0].category.focus();
		return false;
	}
	if(caption.length <= 0) {
		alert("Plese add a caption");
		document.forms[0].caption.focus();
		return false;
	}
	if(frmType != "modify") {
		if(icon.length <= 0) {
			alert("Plese select an icon image");
			document.forms[0].icon.focus();
			return false;
		}
		if(photograph.length <= 0) {
			alert("Plese select a photograph");
			document.forms[0].photograph.focus();
			return false;
		}
	}
	document.forms[0].frmAction.value = "update";
}
function showPhotoCategory(linkid) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 450;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("managePhotoCategory.php?linkid=" + linkid,"photoCategory","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function updatePhotoCategory(frmAction) {
	dataAvailable = document.forms[0].dataAvailable.value;
	
	anyContents = false;
	itemLength = document.forms[0].elements["photoCategorynew[]"].length;
	for(newItems = 0; newItems < itemLength; newItems ++) {
		itemValue = trimSpaces(document.forms[0].elements["photoCategorynew[]"][newItems].value);
		if(itemValue.length > 0) {
			anyContents = true;
		}
	}
	
	if(dataAvailable == 1) {
		itemLength = document.forms[0].elements["photoCategory[]"].length;
		if(itemLength > 0) {
			for(newItems = 0; newItems < itemLength; newItems ++) {
				itemValue = trimSpaces(document.forms[0].elements["photoCategory[]"][newItems].value);
				if(itemValue.length > 0) {
					anyContents = true;
				}
			}
		}
		else {
			itemValue = trimSpaces(document.forms[0].elements["photoCategory[]"].value);
			if(itemValue.length > 0) {
				anyContents = true;
			}
		}
	}
	
	if(!anyContents) {
		alert("Please enter at least one category");
		return;
	}
	
	if(frmAction == "delete") {
		anySelected = false;
		itemLength = document.forms[0].elements["photoCategoryid[]"].length;
		if(itemLength > 0) {
			for(newItems = 0; newItems < itemLength; newItems ++) {
				if(document.forms[0].elements["photoCategoryid[]"][newItems].checked) {
					anySelected = true;
				}
			}
		}
		else {
			if(document.forms[0].elements["photoCategoryid[]"].checked) {
				anySelected = true;
			}
		}
		if(anySelected) {
			if(!confirm("Do you really want to delete the selected categories and all photos in that category?")) {
				return;
			}
		}
		else {
			alert("Nothing selected for deletion");
			return;
		}
	}

	document.forms[0].frmAction.value = frmAction;
	document.forms[0].submit();
}
function showIcon(iconUrl) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 300;
	winHeight = 300;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("showIcon.php?iconUrl=" + iconUrl,"iconURL","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=0,resizable=0");
}
function showPhoto(photoUrl) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 600;
	winHeight = 500;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("showIcon.php?iconUrl=" + photoUrl,"photoURL","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function showPhoto1(photoUrl) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 600;
	winHeight = 500;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open(photoUrl,"photoURL","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function removePhoto(photoUrl, photoField) {
	if(photoUrl.length > 0) {
		if(confirm("Do you really want to delete this photo?")) {
			document.forms[0].frmAction.value = "removePhoto";
			document.forms[0].photoURL.value = photoUrl;
			document.forms[0].photoField.value = photoField;
			document.forms[0].submit();
		}
		else {
			return;
		}
	}
}
function checkPhotoModify(frmAction) {
	if(frmAction == "remove") {
		anySelected = false;
		itemLength = document.forms[0].elements["galleryid[]"].length;
		if(itemLength > 0) {
			for(photos = 0; photos < itemLength; photos ++) {
				if(document.forms[0].elements["galleryid[]"][photos].checked) {
					anySelected = true;
				}
			}
		}
		else {
			if(document.forms[0].elements["galleryid[]"].checked) {
				anySelected = true;
			}
		}
		if(anySelected) {
			if(!confirm("Do you really want to delete the selected photos?")) {
				return false;
			}
		}
		else {
			alert("Nothing selected for deletion");
			return false;
		}
	}
}
function closeWindow() {
	parent.window.opener.window.focus();
	parent.window.close();
}
function closeWindow1() {
	parent.window.opener.document.forms[0].submit();
	parent.window.opener.window.focus();
	parent.window.close();
	window.forms[0].submit();
}

//function to submit
function approve(status,frmName,elemName1,elemName2,elemName3,elemName4)
{
	 frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
		if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }	
	frmElement = eval("document." + frmName + "." + elemName3);
	frmElement.value =eval(elemName4 + ".document.body.innerHTML");
	if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }
		document.forms[0].frmAction.value=status;
	  document.forms[0].submit();

}

function delMemApplication() {
	
	if(confirm("Are you sure to delete this entry?")) {
		document.forms[0].frmAction.value = 'delete';
		return true
	}else { return false;}
}

// function to validate contests
function chkContests(actType,frmName,elemName1,elemName2)
{
	contest_name = trimSpaces(document.forms[0].contest_name.value);
	image = trimSpaces(document.forms[0].contest_image.value);
	//desc = trimSpaces(document.forms[0].pageContents.value);
	 
	if(contest_name.length <= 0)
	{
		alert("Please select the contest name");
		document.forms[0].contest_name.focus();
		return false;
	}
	if (actType == "Add")
	{
		if(image.length <= 0)
		{
			alert("Please select the image");
			document.forms[0].contest_image.focus();
			return false;
		}
		ext = image.substring(image.lastIndexOf(".") + 1 );
		ext = ext.toUpperCase();
		if (ext == "GIF" || ext == "JPG" || ext == "JPEG" || ext == "BMP" || ext == "TIFF" || ext == "ICO")
		{
			imageValid = true;
		}
		else
		{
			alert("Please select a valid image");
			document.forms[0].contest_image.focus();
			return false;
		}	
	}

	if(document.forms[0].expiry_date.value == "")
	{
		alert("Please select the expiry date");
		document.forms[0].expiry_date.focus();
		return false;
	}
	frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
	if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }
	document.forms[0].frmAction.value = actType;
	document.forms[0].submit();
}

//to check whether delete 
function checkContestID(elementName) 
{
	rowSelected = false;
	if(document.forms[0].elements[elementName].length > 0) {
		for(itemCount = 0; itemCount < document.forms[0].elements[elementName].length; itemCount++) {
			if(document.forms[0].elements[elementName][itemCount].checked) {
				rowSelected = true;
			}
		}
	}
	else {
		if(document.forms[0].elements[elementName].checked) {
			rowSelected = true;
		}
	}
	
		
	if(!rowSelected) {
		alert("No items selected for delete");
		return false;
	}
	else 
	{

		if(!confirm("Do you really want to delete these item(s)?"))
		{
			return false;
		}

	}
	document.forms[0].frmAction.value = "Delete";
	document.forms[0].submit();
}

function chkDeleteContest()
{
	if(confirm("Do you really want to delete this item?"))
	{
		document.forms[0].frmAction.value = "Delete";
		document.forms[0].submit();
	}
}

function chkQuestion(frmAction)
{
	question = trimSpaces(document.forms[0].question.value);
	option1 = trimSpaces(document.forms[0].option1.value);
	option2 = trimSpaces(document.forms[0].option2.value);
	option3 = trimSpaces(document.forms[0].option3.value);
	option4 = trimSpaces(document.forms[0].option4.value);
	answer = trimSpaces(document.forms[0].answer.value);
	
	if (document.forms[0].contest_id.value == "")
	{
		alert("There are no contest to add questions. Please add contest first");
		return false;
	}
	if (question.length <= 0)
	{
		alert("Please enter the question");
		document.forms[0].question.focus();
		return false;
	}
	if (option1.length <= 0)
	{
		alert("Please enter the option 1");
		document.forms[0].option1.focus();
		return false;
	}
	if (option2.length <= 0)
	{
		alert("Please enter the option 2");
		document.forms[0].option2.focus();
		return false;
	}
	if (option3.length <= 0)
	{
		alert("Please enter the option 3");
		document.forms[0].option3.focus();
		return false;
	}
	if (option4.length <= 0)
	{
		alert("Please enter the option 4");
		document.forms[0].option4.focus();
		return false;
	}
	if (answer.length <= 0)
	{
		alert("Please enter the answer");
		document.forms[0].answer.focus();
		return false;
	}
	
	document.forms[0].frmAction.value = frmAction;

}

//function to send mail
function sendParticipant(elementName) 
{
	rowSelected = false;
	if(document.forms[0].elements[elementName].length > 0) {
		for(itemCount = 0; itemCount < document.forms[0].elements[elementName].length; itemCount++) {
			if(document.forms[0].elements[elementName][itemCount].checked) {
				rowSelected = true;
			}
		}
	}
	else {
		if(document.forms[0].elements[elementName].checked) {
			rowSelected = true;
		}
	}
	
		
	if(!rowSelected) {
		alert("No items selected for send mail");
		return false;
	}

	document.forms[0].action = "mailToParticipants.php";
	document.forms[0].submit();
}

function SendToMail()
{
	document.forms[0].action = "mailToParticipants.php";
	document.forms[0].submit();
}

function checkMail()
{
	email = trimSpaces(document.forms[0].email.value);
	from = trimSpaces(document.forms[0].from.value);
	subject = trimSpaces(document.forms[0].subject.value);
	comments = trimSpaces(document.forms[0].comments.value);
	
	if(email.length <= 0)
	{
		alert("Please enter the email IDs");
		document.forms[0].email.focus();
		return false;
	}
	if(!checkEmail(email))
	{
		document.forms[0].email.select();
		return false;
	}
	if(from.length <= 0)
	{
		alert("Please enter the from email ID");
		document.forms[0].from.focus();
		return false;
	}
	if(!checkEmail(from))
	{
		document.forms[0].from.select();
		return false;
	}
	if(subject.length <= 0)
	{
		alert("Please enter the subject");
		document.forms[0].subject.focus();
		return false;
	}
	if(comments.length <= 0)
	{
		alert("Please enter the comments");
		document.forms[0].comments.focus();
		return false;
	}
	document.forms[0].frmAction.value= "Update";
}


function checkContribute(toDo) 
{
		rowSelected = false;
		if(document.forms[0].elements["newsid[]"].length > 0) {
			for(itemCount = 0; itemCount < document.forms[0].elements["newsid[]"].length; itemCount++) {
				if(document.forms[0].elements["newsid[]"][itemCount].checked) {
					rowSelected = true;
				}
			}
		}
		else {
			if(document.forms[0].elements["newsid[]"].checked) {
				rowSelected = true;
			}
		}
		if(!rowSelected) {
			alert("No item selected for " + toDo);
			return false;
		}
		else if(toDo=="remove"){
			if(!confirm("Do you really want to delete these items?")) {
				return false;
			}
		}

	document.forms[0].toDo.value = toDo;
	if(toDo=="modify")
	{
	document.forms[0].action="editNews.php";
	}
	document.forms[0].submit();
}

function checkEvents(toDo) 
{

	rowSelected = false;
	if(document.forms[0].elements["event_id[]"].length > 0) 
	{
		for(itemCount = 0; itemCount < document.forms[0].elements["event_id[]"].length; itemCount++) 
		{
			if(document.forms[0].elements["event_id[]"][itemCount].checked) 
			{
				rowSelected = true;
			}
		}
	}
	else 
	{
		if(document.forms[0].elements["event_id[]"].checked) 
		{
			rowSelected = true;
		}
	}
	
	if(!rowSelected)
	{
		alert("No item selected for " + toDo );
		return false;
	}
	else if(toDo=="Delete")
	{
		if(!confirm("Do you really want to delete these items?")) 
		{
			return false;
		}
	}
	document.forms[0].frmAction.value = toDo;
	document.forms[0].submit();
}
// function to validate addEvents.php

function chkEvents(toDo)
{
	firstName = trimSpaces(document.forms[0].firstName.value);
	lastName = trimSpaces(document.forms[0].lastName.value);
	areacode = trimSpaces(document.forms[0].areacode.value); 
	phone = trimSpaces(document.forms[0].phone.value); 
	subscriberEmail = trimSpaces(document.forms[0].subscriberEmail.value);
	fromDate = trimSpaces(document.forms[0].fromDate.value);
	toDate = trimSpaces(document.forms[0].toDate.value);
	eventInfo = trimSpaces(document.forms[0].eventInfo.value);
	
	if(firstName.length <= 0)
	{
		alert("Please enter first name");
		document.forms[0].firstName.focus();
		return false;
	}
	if(firstName.length <= 0)
	{
		alert("Please enter your first name");
		document.forms[0].firstName.focus();
		return false;
	}
	if(lastName.length <= 0)
	{
		alert("Please enter your last name");
		document.forms[0].lastName.focus();
		return false;
	}
	if(areacode.length <= 0)
	{
		alert("Please enter your area code");
		document.forms[0].areacode.focus();
		return false;
	}
	if(phone.length <= 0)
	{
		alert("Please enter your phone");
		document.forms[0].phone.focus();
		return false;
	}
	if(subscriberEmail.length <= 0)
	{
		alert("Please enter your email ID");
		document.forms[0].subscriberEmail.focus();
		return false;
	}
	if(!checkEmail(document.forms[0].subscriberEmail.value))
	{
		document.forms[0].subscriberEmail.select();
		return false;
	}
	if(fromDate.length <= 0)
	{
		alert("Please enter from date");
		document.forms[0].fromDate.focus();
		return false;
	}
	if(toDate.length <= 0)
	{
		alert("Please enter to date");
		document.forms[0].toDate.focus();
		return false;
	}
	if(eventInfo.length <= 0)
	{
		alert("Please enter to event name");
		document.forms[0].eventInfo.focus();
		return false;
	}

	document.forms[0].frmAction.value = toDo;
	
}
function displayUpload(frmObject) {
	if(frmObject.checked) {
		showI.style.display='block';
	}
	else {
		showI.style.display='none';
	}
	return;
}

//function to delete photos
function delPhoto(photo,icon)
{
	if(confirm("Are you sure to delete selected photo and its icon?"))
	{
		document.forms[0].frmAction.value = "DeleteImage";
		document.forms[0].selPhoto.value = photo;
		document.forms[0].selIcon.value = icon;
		document.forms[0].submit();
	}	
}

function showCity(country) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 450;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("addCity.php?country=" +country,"city","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function showMArticle(linkid) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 450;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("addMArticle.php?linkid="+linkid,"Category","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function addBusinessCategories() {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 450;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("addBusinessCategories.php","Category","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}
function addCategories(category_type) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 450;
	winHeight = 400;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	window.open("addCategories.php?category_type="+category_type,"Category","width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
}

// to validate addCity.php
function checkCity(frmAction) {
	dataAvailable = document.forms[0].dataAvailable.value;
	
	anyContents = false;
	itemLength = document.forms[0].elements["city_new[]"].length;
	for(newItems = 0; newItems < itemLength; newItems ++) {
		itemValue = trimSpaces(document.forms[0].elements["city_new[]"][newItems].value);
		if(itemValue.length > 0) {
			anyContents = true;
		}
	}
	
	if(dataAvailable == 1) {
		itemLength = document.forms[0].elements["city[]"].length;
		if(itemLength > 0) {
			for(newItems = 0; newItems < itemLength; newItems ++) {
				itemValue = trimSpaces(document.forms[0].elements["city[]"][newItems].value);
				if(itemValue.length > 0) {
					anyContents = true;
				}
			}
		}
		else {
			itemValue = trimSpaces(document.forms[0].elements["city[]"].value);
			if(itemValue.length > 0) {
				anyContents = true;
			}
		}
	}
	
	if(!anyContents) {
		alert("Please enter at least one city");
		return;
	}
	
	if(frmAction == "delete") {
		anySelected = false;
		itemLength = document.forms[0].elements["city_id[]"].length;
		if(itemLength > 0) {
			for(newItems = 0; newItems < itemLength; newItems ++) {
				if(document.forms[0].elements["city_id[]"][newItems].checked) {
					anySelected = true;
				}
			}
		}
		else {
			if(document.forms[0].elements["city_id[]"].checked) {
				anySelected = true;
			}
		}
		if(anySelected) {
			if(!confirm("Do you really want to delete the selected cities?")) {
				return;
			}
		}
		else {
			alert("Nothing selected for deletion");
			return;
		}
	}

	document.forms[0].frmAction.value = frmAction;
	document.forms[0].submit();
}

function changeMultiple(num)
{
	for(i=1; i<=num; i++)
	{
		document.getElementById("movie"+i).style.display="block";
	}		
	for(i=i;i<=25;i++)
	{
		document.getElementById("movie"+i).style.display="none";
	}
}

//
function checkMovies(frmAction,frmName,elemName1,elemName2) 
{
	movie_name = trimSpaces(document.forms[0].movie_name.value);
	language = trimSpaces(document.forms[0].language.value);
	director = trimSpaces(document.forms[0].director.value);
	starring = trimSpaces(document.forms[0].starring.value);
	//pageContents = trimSpaces(document.forms[0].pageContents.value);
	mm = trimSpaces(document.forms[0].mm.value);
	dd = trimSpaces(document.forms[0].dd.value);
	yy = trimSpaces(document.forms[0].yy.value);
	if(movie_name.length<=0)
	{
		alert("Please Enter the Name of the movie");
		document.forms[0].movie_name.focus();
		return false;
	}
		
	if(mm.length<=0 || mm>12)
	{
		alert("Invalid month!");
		document.forms[0].mm.focus();
		return false;
	}
		
	if(dd.length<=0 || dd>31)
	{
		alert("Invalid day!");
		document.forms[0].dd.focus();
		return false;
	}
		
	if(yy.length<=0 || yy<2003)
	{
		alert("Invalid year!");
		document.forms[0].yy.focus();
		return false;
	}
		
	if (language.length<=0)
	{
		alert("Please Enter the language of the movie");
		document.forms[0].language.focus();
		return false;
	}
	if (director.length<=0)
	{
		alert("Please Enter the director of the movie");
		document.forms[0].director.focus();
		return false;
	}
	if (starring.length<=0)
	{
		alert("Please Fill this Cell");
		document.forms[0].starring.focus();
		return false;
	}
	frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
	if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }
	
	document.forms[0].frmAction.value = frmAction ;
}

//function to validate modifyMovies.php
function checkModifyMovies(elementName,frmAction) 
{

	rowSelected = false;
	if(document.forms[0].elements[elementName].length > 0) {
		for(itemCount = 0; itemCount < document.forms[0].elements[elementName].length; itemCount++) {
			if(document.forms[0].elements[elementName][itemCount].checked) {
				rowSelected = true;
			}
		}
	}
	else {
		if(document.forms[0].elements[elementName].checked) {
			rowSelected = true;
		}
	}
	
		
	if(!rowSelected) {
		alert("No items selected for " + frmAction);
		return false;
	}
	else 
	{

		if(frmAction == "Delete")
		{
			if(!confirm("Do you really want to delete these item(s)?"))
			{
				return false;
			}
		}

	}
	document.forms[0].frmAction.value = frmAction ;
	document.forms[0].submit();
}

function checkEditMovie(toDo)
{
	rowSelected = false;
	if(document.forms[0].elements["movie_id[]"].length > 0) 
	{
		for(itemCount = 0; itemCount < document.forms[0].elements["movie_id[]"].length; itemCount++) 
		{
			if(document.forms[0].elements["movie_id[]"][itemCount].checked) 
			{
				rowSelected = true;
			}
		}
	}
	else 
	{
		if(document.forms[0].elements["movie_id[]"].checked) 
		{
			rowSelected = true;
		}
	}
	
	if(!rowSelected)
	{
		alert("No item selected for " + toDo );
		return false;
	}
	else if(toDo=="Delete")
	{
		if(!confirm("Do you really want to delete these items?")) 
		{
			return false;
		}
	}
	document.forms[0].submit();
}

function checkTheatre(toDo)
{
theatre_name=trimSpaces(document.forms[0].theatre_name.value);
address=trimSpaces(document.forms[0].address.value);
no_of_screens=trimSpaces(document.forms[0].no_of_screens.value);
email=trimSpaces(document.forms[0].email.value);
if(theatre_name.length<=0)
	{
	alert("Please Enter the Theatre Name");
	document.forms[0].theatre_name.focus();
	return false;
	}
if(address.length<=0)
	{
	alert("Please Enter the Theatre address");
	document.forms[0].address.focus();
	return false;
	}
if(no_of_screens.length<=0)
	{
	alert("Please Enter the no of screens in the Theatre");
	document.forms[0].no_of_screens.focus();
	return false;
	}
if(email.length<=0)
	{
	alert("Please Enter email");
	document.forms[0].email.focus();
	return false;
	}
	document.forms(0).frmAction.value=toDo;
}


function checkTheatreMovie(toDo)
{
movie_timing=trimSpaces(document.forms[0].movie_timing.value);
ticket_charges=trimSpaces(document.forms[0].ticket_charges.value);
name_of_contact=trimSpaces(document.forms[0].name_of_contact.value);
phone=trimSpaces(document.forms[0].phone.value);
d_date=trimSpaces(document.forms[0].d_date.value);
if(movie_timing.length<=0)
   {
   alert("Please Enter the movie timings");
   document.forms[0].movie_timing.focus();
   return false;
   }
/*if(ticket_charges.length<=0)
   {
   alert("Please Enter the ticket charges");
   document.forms[0].ticket_charges.focus();
   return false;
   }
if(name_of_contact.length<=0)
   {
   alert("Please Enter the Name of Contact Person");
   document.forms[0].name_of_contact.focus();
   return false;
   }
if(phone.length<=0)
   {
   alert("Please Enter the phone");
   document.forms[0].phone.focus();
   return false;
   }*/
if(d_date.length<=0)
   {
   alert("Please Enter the deactivate date");
   document.forms[0].d_date.click();
   return false;
   }
   document.forms[0].frmAction.value="Add";
}
function checkClassifieds(string,frmName,elemName1,elemName2)
{
	company_name=trimSpaces(document.forms[0].company_name.value);
	//pageContents=trimSpaces(document.forms[0].pageContents.value);
	contact_person=trimSpaces(document.forms[0].contact_person.value);
	contact_phone=trimSpaces(document.forms[0].contact_phone.value);
	contact_email=trimSpaces(document.forms[0].contact_email.value);
	contact_website=trimSpaces(document.forms[0].contact_website.value);
	if(company_name.length<=0)
	{
	alert("Please Enter the " + string);
	document.forms[0].company_name.focus();
	return false;
	}
	frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
	if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }
	if(contact_person.length<=0)
	{
	alert("Please Enter the Name of the contact person");
	document.forms[0].contact_person.focus();
	return false;
	}
	if(contact_phone.length<=0)
	{
	alert("Please Enter the contact phone");
	document.forms[0].contact_phone.focus();
	return false;
	}
/*	if(contact_email.length<=0)
	{
	alert("Please Enter the contact email");
	document.forms[0].contact_email.focus();
	return false;
	}
	else
	{
		if(!checkEmail(document.forms[0].contact_email.value))
			{
				document.forms[0].contact_email.focus();
				return false;
			}
	}

	if(contact_website.length<=0)
	{
	alert("Please Enter the contact website");
	document.forms[0].contact_website.focus();
	return false;
	}
*/	document.forms[0].frmAction.value="update";
}
function showEventPicture(imgURL, imgType) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	if(imgType == "photo") {
		winWidth = 600;
		winHeight = 300;
	}
	else {
		winWidth = 200;
		winHeight = 200;
	}
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;

	window.open("showeventPicture.php?imgURL=" + imgURL, "photograph", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
	return;
}


function openCustWindow(href,winWidth,winHeight) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;

	window.open(href, "News", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
	return;
}
function goNews(frmName,elemName1,elemName2)
{
   
frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
	if(trimSpaces(frmElement.value).length<=0)
	  {
	  alert("Please make sure all fields are filled!");
	  return false;
	  }
document.contentManager.frmAction.value='update';
 document.contentManager.submit();
}
function goSelect(frmName,elemName1,elemName2)
{
   
  frmObject = eval("document." + frmName);
	frmElement = eval("document." + frmName + "." + elemName1);
	frmElement.value =eval(elemName2 + ".document.body.innerHTML");
	 document.contentManager.selectAction.value="Select";
   document.contentManager.submit();
}




