// JavaScript Document
//FUNTION THAT MAKES THE USER TO TYPE ONLY Number and decimal
function checkfloat(obj)
{
	var val=obj.value;
	var flag=0;
	for(i=0;i<val.length;i++)
	{
		if(val.charAt(i)=='.')
		flag++;
	}
	if(flag>0 && event.keyCode==46)
		return event.returnValue=false;
	var charcode=event.keyCode;
	if(!((charcode>=48 && charcode<=57) || (charcode==46)))
	{
		return event.returnValue=false;
	}
}
//FUNTION THAT MAKE USER TO TYPE ONLY NUMERIC VALUES
function checkPincode(obj)
{
	var length=obj.value.length;
	if(length>=6){
		alert("Enter only 6 Numbers");
		return event.returnValue=false;
	}
	var charcode=event.keyCode;
	if(!(charcode>=48 && charcode<=57))
	{
		alert("Enter Numbers Only");
		return event.returnValue=false;
	}
}
//FUNTION THAT MAKE USER TO TYPE ONLY NUMERIC VALUES
function checkvalue()
{
	var charcode=event.keyCode;
	if(!(charcode>=48 && charcode<=57))
	{
		return event.returnValue=false;
	}
}
//Function to avoid spacebar action
function spaceBarFunction()
{
	var charcode=event.keyCode;
	if(charcode==32)
	{
		return event.returnValue=false;
	}

}
//FUNTION THAT MAKE USER TO TYPE ONLY NUMERIC VALUES
function checkPhoneNumber()
{
	var charcode=event.keyCode;
	if(!(charcode>=48 && charcode<=57)&&(charcode!=43)&&(charcode!=45))
	{
		alert("Enter Numbers, Plus(+) and Minus(-) Only");
		return event.returnValue=false;
	}
}

//Function to validate the Email Input
function emailfn(stringValue)
{
	var i=0, flag1=0, flag2=0;
	var num=parseInt(stringValue.length);
	var ch=stringValue.charAt(0);
	if(ch=='@' || ch=='.')
	return true;
	for(var i=0; i<num;i++)
	{
		var ch=stringValue.charAt(i);
		if(ch=='@')flag1++;
		else if(ch=='.')
		{
			var afterdot=i+2;
			flag2++; 
		}
	}
	if(stringValue.charAt(afterdot)=="")
		flag1=3;
	if(flag1!=1 || flag2==0)
		return true;
	else return false;
}
//FUNCTION FOR VALIDATING TWO DATES OF FORMAT 'DD MM YYYY'
function checkDateFunction(date1, date2)
{
	dateFrom=date1.split("-");
	dateTo=date2.split("-");
	if(dateFrom[2]<dateTo[2])
		return true;
	else if(dateFrom[2]>dateTo[2])
		return false;
	else
	{
		if(dateFrom[1]<dateTo[1])
			return true;
		else if(dateFrom[1]>dateTo[1])
			return false;
		else
		{
			if(dateFrom[0]<dateTo[0])
				return true;
			if(dateFrom[0]>dateTo[0])
				return false;
			else
				return true;
		}			
	}			
}	
//Function for paging
function pagingFunction(start,form,page_name)
{
	document.getElementById('start').value=start;
	form.target="_self";
	form.method="post";
	form.action=page_name;
	form.submit();
}
function roundFunction(value)
{
	value=String(value);
	valueSplit=value.split('.');
	if(value.search('.')==0)
	{
		valueSplit=value.split(".");
		if(valueSplit[1])
		{
			valueDecimal = valueSplit[1].substr(0,2);
			value = valueSplit[0]+"."+valueDecimal;
		}
	}
	return value;
}
//function for parsing float values
function parseFloatFunction(id)
{
	return (document.getElementById(id).value)?parseFloat(document.getElementById(id).value):0;
}

//function for parsing integer values
function parseIntFunction(id)
{
	return (document.getElementById(id).value)?parseInt(document.getElementById(id).value):0;
}
//FOR DISPLAYING DATE in sales
function startTimer()
{
	nowTime=new Date();
	var dt=nowTime.getDate();
	var mn=nowTime.getMonth();
	var yr=nowTime.getYear();
	var hr=nowTime.getHours();
	var mt=nowTime.getMinutes();
	var sc=nowTime.getSeconds();
	hr=(hr<10)?"0"+hr:hr;
	mt=(mt<10)?"0"+mt:mt;
	sc=(sc<10)?"0"+sc:sc;
	document.getElementById('time_id').innerText=dt+"/"+parseInt(mn+1)+"/"+yr+" "+hr+":"+mt+":"+sc;
}

//for validating for elements
function isEmpty(form,field_name,alertValue)
{
	if(form.elements[field_name].type=="select")
	{
		if(form.elements[field_name].selectedIndex==0)
		{
			alert(alertValue);
			form.elements[field_name].focus();
			return true;
		}
	}else
	{
		if(form.elements[field_name].value=="")
		{
			alert(alertValue);
			form.elements[field_name].focus();
			return true;
		}
	}
	return false;
}

//Function for paging
function pageWiseFunction(form,offSet,page_name)
{
	var pageWise = parseIntFunction('pageWise');
	var val=(pageWise==1)?0:(pageWise-1)*parseInt(offSet);
	document.getElementById('start').value=val;
	form.target="_self";
	form.method="post";
	form.action=page_name;
	form.submit();
}

//Function for paging
function pageWiseFunction1(form,start,page_name)
{
	document.getElementById('start').value=start;
	form.method="post";
	form.action=page_name;
	form.submit();
}

//FUNCTION TO FORWARD A PAGE TO NEXT
function forwardFunction(form, page_name)
{
	form.method="post";
	form.action="expiry_handler.php";
	form.submit();
}
// function for setting focus
function setFocus(frm,field_name)
{
	eval("frm."+field_name+".focus()");
	switch(eval("frm."+field_name+".type"))
	{
		case 'text' :
		case 'password' :
			eval("frm."+field_name+".select()");
			break;
	}
}
//function for displaying video 
function videoFunction(url)
{
	window.open('video.php?url='+url,'video','width=400,height=300,left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=1'
    +',scrollbars=0'
    +',resizable=0'
	+',left=100'
	+',top=150')
}
//to play video
//function for displaying video
function playFunction(video)
{
	window.open('../includes/video.php?video='+video,'myconsole1','width=425,height=396,left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=0'
    +',scrollbars=0'
    +',resizable=0'
	+',left=250'
	+',top=250') 
}
function windowOpenFunctions(url,height,width)
{
	window.open(url,'myconsole1','height='+height,'width='+width,'left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=0'
    +',scrollbars=0'
    +',resizable=0'
	+',left=250'
	+',top=250') 

}

function ownerplayFunction(form,video)
{
	form.method="post";
	form.action="video.php?video="+video;
	form.submit();
}
//FUNCTION TO COMPARE TWO FIELDS SHOULD BE VALID
function compareFields(form,field1,field1Alert, field2,field2Alert)
{
	if(eval('form.'+field1+'.value'))
	{
		if(isEmpty(form, field2, field2Alert))
			return true;
	}
	if(eval('form.'+field2+'.value')&&eval('form.'+field2+'.value!=0'))
	{
		if(isEmpty(form, field1, field1Alert))
			return true;
	}
}

//to show routemap
function showRoutemap(routemap)
{
	window.open('../includes/routemap.php?routemap='+routemap,'myconsole2','width=310,height=205,	left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=0'
    +',scrollbars=0'
    +',resizable=0'
	+',left=250'
	+',top=250')
}
//to show Image
function showImage(image)
{
	window.open('../includes/image.php?image='+image,'myconsole3','width=310,height=205,	left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=0'
    +',scrollbars=0'
    +',resizable=0'
	+',left=250'
	+',top=250')
}
//to show Image
function bigImage(big_image)
{
	window.open('../includes/big_image.php?big_image='+big_image,'myconsole3','width=600,height=400,	left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=0'
    +',scrollbars=0'
    +',resizable=0'
	+',left=250'
	+',top=250')
}

function rowOverEffect(object,classN)
{
  object.className = classN;
}
function rowOutEffect(object,classN)
{
	object.className = classN;
}

//for index page wishes
var wtimer=1;
function startWishes()
{
	var wCount=document.getElementById('wCount').value;
	for(var i=1; i<wCount; i++)
		eval("window.document.all.divWishes"+i+".style.display=\"none\"");	
	if(wtimer<wCount)
	{
		eval("window.document.all.divWishes"+wtimer+".style.display=\"block\"");	
		wtimer++;
	}
	if(wtimer==wCount) 
		wtimer=1;
}


var searchFocus = 0;
function searchReplace(object)
{
	if(!searchFocus)object.value='';
	searchFocus=1;
}

function mailReplace(object)
{
	var searchFocus = 0;
	if(!searchFocus)object.value='';
	searchFocus=1;
}
//function for putting search if no value enters
function searchPlace(object)
{
	if(object.value=='')object.value='Search';
	searchFocus=0;
}
function commonSearch(frm)
{
	if(frm.common_search.value==""||frm.common_search.value=="Search")
	{
		alert("Enter the key word");
		frm.common_search.focus();
		return;
	}
	frm.submit(); 
}
function commonSearchs(frm)
{
	if(frm.common_search.value==""||frm.common_search.value=="Search")
	{
		alert("Enter the key word");
		frm.common_search.focus();
		return;
	}
	frm.method="post";
	frm.action='common_search.php'
	frm.submit(); 
}
//for simple search for all
function simpleSearchFunction(form)
{
	form.method="post";
	form.action="details.php";
	form.submit();
}

function simpleSearchFunction1(form)
{
	form.method="post";
	form.action="../details.php";
	form.submit();
}

//for simple search for all
function simpleSearchPlazaFunction(form,id)
{
	var cat=form.category_id.value;
	var loc=form.location.value;
	if(cat=="" && loc=="")
	{
		form.method="post";
		form.action="index.php";
		form.submit();
	}
	else
	{
		if(id==1)
			form.location.value="";
		else
			form.category_id.value="";
			
		form.method="post";
		form.action="details.php";
		form.submit();
	}
}
//for simple search for all
function keywordSearchFunction(form)
{
	if(form.keyword.value==''){
		alert('Keyword is Empty');
		form.keyword.focus();
		return;
	}
	form.method="post";
	form.action="details.php";
	form.submit();
}
//for branch search for all
function branchSearchFunction(form,page_name)
{
	form.method="post";
	form.action=page_name;
	form.submit();
}

//for movie wise search of theatres	
function simpleTheatreSearchFunction(form)
{
	if(form.movie_id.selectedIndex==0 && form.location.selectedIndex==0 && form.keyword.value=="")
	{
		alert("There is no search criteria");
		return;
	}		
	form.method="post";
	form.action="details.php";
	form.submit();
}	
function stopDiv()
{
	window.document.all.indexbannerId.style.display='none';	
}
function startDiv()
{
	window.document.all.indexbannerId.style.display='block';	
}
//FUNCTION TO GO TO BOOKING VIEW PAGE
function bookingFunction(form,owner_code)
{
	form.owner_code.value=owner_code;
	form.method="post";
	form.action="hall_booking_view.php";
	form.submit();
}

//************** FOR BANKING ONLY
//FUNCTION TO GO TO BRANCH DETAILS PAGE
function branchFunction(frm,owner_code)
{
	frm.owner_code.value=owner_code;
	frm.method="post";
	frm.action="branches.php";
	frm.submit();
}
function shopFunction(frm)
{
	frm.method="post";
	frm.action="shops.php";
	frm.submit();
}
//function TO GO TO Shop DETAILS PAGE
function shopLeftFunction(form,Id)
{
	form.owner_code.value=Id;
	form.method="post";
	form.action="shop_view.php";
	form.submit();
}

//function TO GO TO BANK DETAILS PAGE
function branchLeftFunction(form, branchId)
{
	form.branchId.value=branchId;
	form.method="post";
	form.action="branch_view.php";
	form.submit();
}

function educationFunction(frm)
{
	frm.method="post";
	frm.action="education.php";
	frm.submit();
}
//function TO GO TO Shop DETAILS PAGE
function educationLeftFunction(form,Id)
{
	form.owner_code.value=Id;
	form.method="post";
	form.action="education_view.php";
	form.submit();
}

function healthcareFunction(frm)
{
	frm.method="post";
	frm.action="healthcare.php";
	frm.submit();
}
//function TO GO TO Shop DETAILS PAGE
function healthcareLeftFunction(form,Id)
{
	form.owner_code.value=Id;
	form.method="post";
	form.action="healthcare_view.php";
	form.submit();
}

//FUNCTION TO GO TO DETAILS PAGE
function atmFunction(frm,owner_code)
{
	frm.owner_code.value=owner_code;
	frm.method="post";
	frm.action="user_atms.php";
	frm.submit();
}
//FUNCTION TO GO TO DETAILS PAGE
function atmLeftFunction(frm,atmId)
{
	frm.atmId.value=atmId;
	frm.method="post";
	frm.action="atm_view.php";
	frm.submit();
}

//
function entertainmentFunction(frm)
{
	frm.method="post";
	frm.action="entertainment.php";
	frm.submit();
}
//function TO GO TO Shop DETAILS PAGE
function entertainmentLeftFunction(form,Id)
{
	form.owner_code.value=Id;
	form.method="post";
	form.action="entertainment_view.php";
	form.submit();
}
//FUNCTION TO GO NEWS PAGE for headlines
function newsFunction(form, id)
{
	form.news_id.value=id;
	form.method="post";
	form.action="news/news.php";
	form.submit();
}
//FUNCTION TO GO NEWS PAGE for headlines
function helpnewsFunction(form, id)
{
	form.news_id.value=id;
	form.target="_blank";
	form.method="post";
	form.action="../news/news.php";
	form.submit();
}	
	
//FUNCTION TO GO NEWS PAGE for headlines from news.php
function newsViewFunction(form, id)
{
	form.news_id.value=id;
	form.method="post";
	form.action="news.php";
	form.submit();
}	

//************** FOR movie& theare
function theatreFunction(frm,id)
{
	frm.movie_id.value=id;
	frm.method="post";
	frm.action="theatre.php";
	frm.submit();
}
//function TO GO TO Shop DETAILS PAGE
function theatreLeftFunction(form,Id)
{
	form.theatreId.value=Id;
	form.method="post";
	form.action="theatre_view.php";
	form.submit();
}

//FUNCTION TO search by code from home related page
function codeFunction(form)
{
	if(isEmpty(form,'search_code','Code is empty'))
		return true;
	form.method="post";
	form.action="code_search.php";
	form.submit();
}	

//FUNCTION FOR OWNER LOGIN VALIDATION from index pages
function ownerloginFunction(frm,code)
{
	if(isEmpty(frm, 'user_name', "User Name is Empty"))
		return;
	var username=document.getElementById('user_name').value;
	if(codematchFunction(username,code))
		return;
	if(isEmpty(frm, 'password', "Password is Empty"))
		return;
	frm.method="post";
	frm.action="login_handler.php";
	frm.submit();
}

//function for hecking code of owner login
function codematchFunction(code,val)
{
	var co=code.substr(0,2);
	if(co.toUpperCase()!=val)
	{
		alert("Enter the username Starting with "+val+"");
		document.getElementById('user_name').select();
		return true;
	}
	else
	{
		return false;
	}

}

//function for seraching by code 
function codeSearch(frm,code)
{
	if(ownercodematchFunction(frm,code))
		return;
	frm.method="post";
	frm.action="view.php";
	frm.submit();
}	
//function for seraching by code 
function codeSearch1(frm,code)
{
	if(ownercodematchFunction(frm,code))
		return;
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}	
//function for seraching by code 
function codeSearchDetails(frm,code)
{
	if(ownercodematchFunction(frm,code))
		return;
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}	


//function for code search
function ownercodematchFunction(frm,val)
{
	var code = frm.owner_code.value;
	var co=code.substr(0,2);
	if(co.toUpperCase()!=val)
	{
		alert("Enter the code Starting with "+val+"");
		frm.owner_code.select();
		return true;
	}
	else
	{
		return false;
	}

}
//FUNCTION TO STORE THE EMAIL ID IN NEWS LETTER TABLE 
function newsLetterFunction(form,val)
{
//isEmpty FUNCTION WILL CHECK, ALERT AND FOCUS THE FIELDS WHICH ARE ALL EMPTY
	//isEmpty(FORM NAME, FIELD NAME, ALERT VALUE);
 	if(isEmpty(form, "newsLetterEmail_id", "Enter Email Id"))
		return false;
	else{
		if(emailfn(form.newsLetterEmail_id.value)){
			alert("Invalid Email Id");
			form.newsLetterEmail_id.select();
			return;
		}
	}
	email_id= form.newsLetterEmail_id.value;
	if(val)
		page_name =  '../includes/message_handler.php';
	else
		page_name =  './includes/message_handler.php';
	window.open(page_name+'?fun=1&email_id='+email_id,'myconsole','width=480,height=200'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
	form.newsLetterEmail_id.value='';
}
//function for preview of recommend to a friend
function previewFunction(name,image,table_name,folder)
{
	code = document.getElementById('owner_code').value;
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=3&owner_code='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	
//function for preview of recommend to a friend
function previewFunction2(name,image,table_name,folder,code)
{
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=5&owner_code='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	
//done on feb 2
function previewFunction3(name,image,table_name,folder)
{
	code = document.getElementById('owner_code').value;
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=11&owner_code='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}
function previewFunction4(name,image,table_name,folder)
{
	code = document.getElementById('owner_code').value;
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=12&owner_code='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}		

//function for preview of recommend to a friend
function moviepreviewFunction(name,image,table_name,folder)
{
	code = document.getElementById('owner_code').value;
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=10&owner_code='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	

//function for preview of recommend to a friend
function matrimonypreviewFunction(name,image,table_name,folder,code)
{
	content = document.getElementById('content').value;
	window.open('../includes/message.php?message=9&matrimonial_id='+code+'&content='+content+'&name='+name+'&image='+image+'&table_name='+table_name+'&folder='+folder,'myconsole','width=480,height=400'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	
//function for sending 
function sendFunction(form,name,image,table_name,folder_name)
{
 	if(isEmpty(form,'from',"From address is empty"))
		return false
	if(emailfn(document.getElementById('from').value))
	{
		alert("From address is invalid");
		document.getElementById('from').select();
		return;
	}
 	if(isEmpty(form,'to',"To address is empty"))
		return false
	if(emailfn(document.getElementById('to').value))
	{
		alert("To address is invalid");
		document.getElementById('to').select();
		return;
	}
	form.method="post";
	form.action="../includes/message_handler.php?fun=2&name="+name+"&image="+image+"&table_name="+table_name+"&folder="+folder_name;
	form.submit();
}

//function for sending 
function sendFunction2(form,name,image,table_name,folder_name)
{
 	if(isEmpty(form,'from',"From address is empty"))
		return false
	if(emailfn(document.getElementById('from').value))
	{
		alert("From address is invalid");
		document.getElementById('from').select();
		return;
	}
 	if(isEmpty(form,'to',"To address is empty"))
		return false
	if(emailfn(document.getElementById('to').value))
	{
		alert("To address is invalid");
		document.getElementById('to').select();
		return;
	}
	form.method="post";
	form.action="../includes/message_handler.php?fun=3&name="+name+"&image="+image+"&table_name="+table_name+"&folder="+folder_name;
	form.submit();
}
//function for sending  Feb 2
function sendFunction3(form,name,image,table_name,folder_name)
{
 	if(isEmpty(form,'from',"From address is empty"))
		return false
	if(emailfn(document.getElementById('from').value))
	{
		alert("From address is invalid");
		document.getElementById('from').select();
		return;
	}
 	if(isEmpty(form,'to',"To address is empty"))
		return false
	if(emailfn(document.getElementById('to').value))
	{
		alert("To address is invalid");
		document.getElementById('to').select();
		return;
	}
	form.method="post";
	form.action="../includes/message_handler.php?fun=7&name="+name+"&image="+image+"&table_name="+table_name+"&folder="+folder_name;
	form.submit();
}
// fuction for sending
function sendFunction4(form,name,image,table_name,folder_name)
{
 	if(isEmpty(form,'from',"From address is empty"))
		return false
	if(emailfn(document.getElementById('from').value))
	{
		alert("From address is invalid");
		document.getElementById('from').select();
		return;
	}
 	if(isEmpty(form,'to',"To address is empty"))
		return false
	if(emailfn(document.getElementById('to').value))
	{
		alert("To address is invalid");
		document.getElementById('to').select();
		return;
	}
	form.method="post";
	form.action="../includes/message_handler.php?fun=8&name="+name+"&image="+image+"&table_name="+table_name+"&folder="+folder_name;
	form.submit();
}
// fuction for sending
function sendFunction5(form,folder_name)
{
 	if(isEmpty(form,'from',"From address is empty"))
		return false
	if(emailfn(document.getElementById('from').value))
	{
		alert("From address is invalid");
		document.getElementById('from').select();
		return;
	}
 	if(isEmpty(form,'to',"To address is empty"))
		return false
	if(emailfn(document.getElementById('to').value))
	{
		alert("To address is invalid");
		document.getElementById('to').select();
		return;
	}
	form.method="post";
	form.action="../includes/message_handler.php?fun=9&folder="+folder_name;
	form.submit();
}

//////////////// from SUB INDEX PAGES ///////////////
//function to go to details page from dash board
function detFunction(frm,stat)
{
	frm.status.value=stat;
	frm.target="_self";
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}
function goFunction(frm,stat)
{
	var name=document.getElementById('name').value;
	var post_code=document.getElementById('pin_code').value;

	if(stat==2 & name=="")
	{
		alert("Enter the name");
		document.getElementById('name').focus();
		return;
	}
	if(stat==3 & post_code=="")
	{
		alert("Enter the Pincode");
		document.getElementById('pin_code').focus();
		return;
	}
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}
function moviegoFunction(frm,stat)
{
	var name=document.getElementById('name').value;
	var actors=document.getElementById('actors').value;
	if(stat==2 & name=="")
	{
		alert("Enter the name");
		document.getElementById('name').focus();
		return;
	}
	if(stat==3 & actors=="")
	{
		alert("Enter the Actor");
		document.getElementById('actors').focus();
		return;
	}
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}
function personFunction(frm,stat)
{
	var name=document.getElementById('name').value;
	var country=document.getElementById('country').value;
	if(stat==2 & name=="")
	{
		alert("Enter the name");
		document.getElementById('name').focus();
		return;
	}
	if(stat==3 & country=="")
	{
		alert("Enter the country");
		document.getElementById('country').focus();
		return;
	}
	
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}

//for checking length of the feild 
function validateFieldLength(field,maxlen,msg)
{
	var name=field.name;
	var val=document.getElementById(name).value;
	if(val.length>=maxlen)
	{
		alert(msg);
		return event.keyCode=false;
	}	
}

//function for print 
function printFunction(code,name,image,table_name)
{
	window.open('../includes/print_view.php?owner_code='+code+'&name='+name+'&image='+image+'&table_name='+table_name,'myconsole','width=580,height=500'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	
//function for print 
function printFunction1(code,name,image,table_name)
{
	window.open('../includes/print_view1.php?owner_code='+code+'&name='+name+'&image='+image+'&table_name='+table_name,'myconsole','width=580,height=500'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	
//function for print 
function branchprintFunction(code,name,image,table_name)
{
	window.open('../includes/branchprint_view.php?branch_id='+code+'&name='+name+'&image='+image+'&table_name='+table_name,'myconsole','width=580,height=500'
		+',menubar=0'
	   +',toolbar=0'
		+',status=0'
		+',scrollbars=1'
		+',resizable=0'
		+',left=250'
		+',top=200'
		);
}	

//function for displaying video 
function enquiryFunction(code)
{
	window.open('enquiry.php?owner_code='+code,'myconsole','width=500,height=390,left=0,top=0'
    +',menubar=0'
    +',toolbar=0'
    +',status=1'
    +',scrollbars=0'
    +',resizable=0'
	+',left=100'
	+',top=150')
}
//function for displaying other locations from chennai page
function subLocationFunction(frm,id)
{
	document.getElementById('sub_location_id').value=id;
	frm.method="post";
	frm.action="view.php";
	frm.submit();
}	
//function for displaying wishes 
function addwishesFunction(form)
{
	form.method="post";
	form.target="_blank";
	form.action='wishes_add.php';
	form.submit();
}
//function for displaying wishes 
function viewWishesFunction(form)
{
	form.method="post";
	form.target="_blank";
	form.action='wishes_details.php';
	form.submit();
}
function alphaFunction(frm,val,name)
{
	frm.start.value=0;
	frm.alphavalue.value=val;
	frm.method="post";
	if(name!='details.php')
	{
		frm.flag.value=1;
		frm.code_number.value="";
		frm.code_area.value="";
	}
	frm.action=name;
	frm.submit();
}
function alphanumFunction(frm,val,name)
{
	if(name=='timings_details.php')
	{
		frm.timing_no.value='';
	}
	frm.start.value=0;
	frm.alphavalue.value=val;
	frm.number_name.value='';
	frm.number_area.value='';
	frm.method="post";
	frm.action=name;
	frm.submit();
}
function catFunction(frm,id)
{
	frm.category_id.value=id;
	frm.method="post";
	frm.action="details.php";
	frm.submit();
}
function validateExeFunction(frm)
{
	frm.method="post";
	frm.action="./handler.php";
	frm.submit();
}
//to set page as home page
function homepage()
{
		var date = new Date();
		date.setTime(date.getTime()+(10000*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		document.cookie="defaultpage"+"="+"/personal/default.htm"+expires+"; path=/";
		alert("On your next visit to golden chennai.com, you will see this page first.")
}
function fix(fixNumber, decimalPlaces)
{
var div = Math.pow(10,decimalPlaces);
fixNumber = Math.round(fixNumber * div) / div;
return fixNumber;
}
