
/*************************************************REUSABLE FUNCTIONS STARTS********************************************************/
/***********HELP : STARTS**************
FUNCTION NAME : Trim -> To trim the values entered in text box(it will call the LTrim and RTrim functions inside automatically.
FUNCTION NAME : CharAndSpace -> This function will allow only character and space not digits(use for city, relation textbox).
FUNCTION NAME : DigitsAndDot -> This function will allow only Digits and Dot not characters(use for price textbox).
FUNCTION NAME : DigitsOnly -> This function will allow only Digits and not characters even dot also.
FUNCTION NAME : telephoneno -> This function will allow only Digits, +, and -(for eg. telephone no: IN +91  2221113456  Call ).
FUNCTION NAME : GetMonthDays -> This function will will return number of days in the current month.
FUNCTION NAME : GetDays -> This function will will returns the diff betn two dates for month 1=jan,12=Dec
FUNCTION NAME : isNumeric,isInteger -> This function will Checks the number is integer or not.
FUNCTION NAME : daysInFebruary -> This function will checks the posted date is valid or not.
FUNCTION NAME : isDate -> This function will Checks the febraury month.
FUNCTION NAME : closewindow -> This function will Close the window.
FUNCTION NAME : checkimage -> This function will checks the entered image is in .jpg,.gif,.jpeg,.png formot or not.
FUNCTION NAME : backToMain -> This function will redirect to specifie file.
FUNCTION NAME : ageValidate -> This function will to checks age the user's age.
FUNCTION NAME : ValidateDateAfter -> This function will to checks the date after some days.
FUNCTION NAME : SameOrAfterDate -> This function will to checks the date or after some days.
FUNCTION NAME : NotFutureDate -> This function will to checks whether the date is future date or not.
FUNCTION NAME : checkEmail -> This function will to checks for valid email-id.
FUNCTION NAME : selectall -> This function will check and uncheck the checkbox.
FUNCTION NAME : atleastone -> This function will Ask conformation before doing ant task like make active, inactive,delete operations.

/***********HELP : ENDS**************/
var alertname = "Golf course America";

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

window.onLoad="MM_preloadImages('images/home_up.jpg','images/company_up.jpg','images/tech_up.jpg','images/prod_up.jpg','images/partner_up.jpg','images/news_up.jpg','images/forums_up.jpg','images/investor_up.jpg')"


//General funtion to prevent the JS error...
function xerr()
{
     return(true);
}
onerror=xerr;

//  Trim functions...
function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
		return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
		return "";
	}
	else{
		return TRIM_VALUE;
	}
} //End Function

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;

} //End Function

function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While

	return strTemp;
} //End Function

//Function for field name that only allowed Character and Space not Digits...
function CharAndSpace(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChar = "0123456789~`!@#$%^&*()_+|\\=-][{}:';?><,./'";
		var ValidChars = ValidChar+'"';
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) != -1)
			{
				return  false;
			}
		}
		return true;
	}
}

//Function for field name that only allowed Digits and Dot...
function DigitsAndDot(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChars = "0123456789.";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
		return true;
	}
}

//Function for field name that only allowed Digits...
function DigitsOnly(FieldName)
{
	if(FieldName.value != '')
	{
		var ValidChars = "0123456789";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
	}
}

//Function for field name that only allowed Digits, +, and -(for eg. telephone no: IN +91  2221113456  Call )...
function telephoneno(FieldName)
{
	if(FieldName.value != "")
	{
		var ValidChars = "0123456789-+  ";
		for (j = 0; j < FieldName.value.length; j++)
		{
			var Char = FieldName.value.charAt(j);
			if (ValidChars.indexOf(Char) == -1)
			{
				return  false;
			}
		}
		return true;
	}
}

/* the function GetMonthDays will return number of days in the current month. */
function GetMonthDays()
{
	DateObj = new Date();
	var CurYear=DateObj.getMonth();
	var FebDays=28;

	if(CurYear%4==1)
	{
		FebDays=29;
	}

	days= new Array(31,FebDays,31,30,31,30,31,31,30,31,30,31);
	return days;
}

//returns the diff betn two dates for month 1=jan,12=Dec
function GetDays(toyear, tomonth, today, fromyear, frommonth, fromday)
{
	DDate= new Date(toyear,tomonth-1,today);
	NDate=	new Date(fromyear,frommonth-1,fromday);

	var Days = new String((NDate-DDate)/86400000);

	return Math.floor(Days);
}

//Check the number is integer or not...
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.-";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function IsNumberDot(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function Onlydigits(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function Onlydigitsquotes(sText)
{
   var ValidChars = "0123456789\'\"";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function charsonly(sText)
{
   var ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function charsonlyforsearch(sText)
{
   var ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&-/.' ";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function Onlychars(sText)
{
   var ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++)
   {
      Char = sText.charAt(i);
      if(ValidChars.indexOf(Char) == -1)
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
function isURL(urlStr) {
		if (urlStr.indexOf(" ") != -1) {
		alert("Spaces are not allowed in a URL");
		return false;
		}

		if (urlStr == "" || urlStr == null) {
		return true;
		}

		urlStr=urlStr.toLowerCase();

		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var atom=validChars + '+';
		var urlPat=/^http:\/\/(\w*)\.([\-\+a-z0-9]*)\.(\w*)/;
		var matchArray=urlStr.match(urlPat);
		if (matchArray==null) {
			alert("Please enter a correct url from youtube");
		return false;
		}

		var user=matchArray[2];
		var domain=matchArray[3];

		for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert('Please enter a correct url from youtube.');
		//alert("This domain contains invalid characters.");
		return false;
		}
		}

		for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i) > 127) {
			alert('Please enter a correct url from youtube.');
//		alert("This domain name contains invalid characters.");
		return false;
		}
		}

		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;

		for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat) == -1) {
			alert('Please enter a correct url from youtube.');
//			alert("The domain name does not seem to be valid.");
		return false;
		}
		}

		return true;
}


//Check the febraury month...
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
	return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
/*    var leapmonth = (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
if(leapmonth == '28' || leapmonth == '29'){
alert('Please select up to '+leapmonth+' for this month' );
}
return false;*/
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   }
   return this;
}

//check the posted date is valid or not...
function isDate(dtStr)
{
	var daysInotifymonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
			alert('The date format should be : mm/dd/yyyy.');
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
			alert('Please enter a valid month.');
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInotifymonth[month]){
			alert('Please enter a valid day.');
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minotifyyear || year>maxYear){
			alert("Please enter a valid 4 digit year between "+minotifyyear+" and "+maxYear+".");
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			alert('Please enter a valid date.');
		return false;
	}
return true;
}

//Close the window
function closewindow()
{
	window.close();
}

//Function to check the entered image is in .jpg,.gif,.jpeg,.png formot or not...
function checkimage(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'jpg') & (imageextention != 'JPG') & (imageextention != 'gif') & (imageextention != 'jpeg') & (imageextention != 'JPEG') & (imageextention != 'png'))
		{

			alert("Please Upload Proper Image. \nAcceptable image format: \n.gif, .jpeg, .jpg, .png.");

			return false;
		}
	}
	return true;
}

//Function to check the entered image is in .jpg,.gif,.jpeg,.png formot or not...
function checkfile(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename	= imagename.split(".");
		imagenamelen   	= splitimagename.length;
		imageextention	= splitimagename[imagenamelen-1];

                if((imageextention != 'jpg') & (imageextention != 'JPG') & (imageextention != 'gif') & (imageextention != 'jpeg') & (imageextention != 'png') & (imageextention != 'pdf') & (imageextention != 'doc') & (imageextention != 'txt') & (imageextention != 'mp3'))
		{
			alert('Please Upload Proper Image.\nAccept image format:\n.gif\n.jpeg\n.jpg\n.png\n.pdf\n.doc\n.txt\.mp3.');
			return false;
		}
	}
	return true;
}

//Common function to redirect....
function backToMain(frm)
{
	with(frm)
	{
		document.location	=	module_name.value;
	}
}

//This function is using for to check age the user's age */
function ageValidate()
{
	var d= new Date();
	var cyear = d.getFullYear();

	var chkage = 0;

	with(document.complateapp)
	{
		if(isDate(month.value+"/"+day.value+"/"+year.value))
		{
			chkage = displayage(year.value, month.value, day.value);//cyear - main_age.value; //Age validation
			//alert(chkage);
			//if((year.value != chkage) && ((year.value < (chkage - 1)) || (year.value > (chkage + 1))))
			if(main_age.value != chkage && age_valid_status.value != 1)
			{
			alert("The Age calculated from the Date of Birth just entered doesn't match that entered when asking for a quotation.");
				age_valid_status.value = 1;
				day.focus();
				return false;
			}
		}
		else
		{
			day.focus();
			return false;
		}
	}
}

//The function ValidateDateAfter() checks the cancellation date.
function ValidateDateAfter(year, month, day, startyear, startmonth, startday)
{
	if( parseInt(year.value) < parseInt(startyear.value))
	{
		//alert(year.value+" "+startyear.value);
		return false;
	}        //        End of if year.
	else if(parseInt(year.value) == parseInt(startyear.value))
	{
		//alert(month.value+" "+startmonth.value);

		if(parseInt(month.value) < parseInt(startmonth.value))
		{
			//alert(month.value+" "+startmonth.value);
			return false;
		}        //        End of if month.
		else if(parseInt(month.value) == parseInt(startmonth.value))
		{
			if(parseInt(day.value) < parseInt(startday.value))
			{
				//alert(day.value+" "+startday.value);
				return false;
			}        //        End of if day.
			else
			{return true;}
		}        //        End of if month.
		else
		{return true;}
	}        //        End of else if month.
	else
	{
		return true;
	}        //        End of else.
}       //        End of function.

//The function SameOrAfterDate() checks the authorization date and notification date.
function SameOrAfterDate(authyear, authmonth, authday, notifyyear, notifymonth, notifyday)
{

	//        Check for authorization date.
	if( parseInt(authyear.value) > parseInt(notifyyear.value))
	{
		//alert("Date of notification must be a date after the Policy Start Date.");
		return true;
	}        //        End of if year.
	else if(parseInt(authyear.value) == parseInt(notifyyear.value))
	{
		//alert("compare"+month.value+" "+startmonth.value);

		if(parseInt(authmonth.value) > parseInt(notifymonth.value))
		{
			//alert("Date of notification must be a date after the Policy Start Date.");
			return true;
		}        //        End of if month.
		else if(parseInt(authmonth.value) == parseInt(notifymonth.value))
		{
			if(parseInt(authday.value) >= parseInt(notifyday.value))
			{
				//alert("Date of notification must be a date after the Policy Start Date.");
				return true;
			}        //        End of if day.
			else
			{return false;}
		}        //        End of if month.
		else
		{return false;}
	}        //        End of else if month.
	else
	{
		return false;
	}        //        End of else.
}       //        End of function.

//The function NotFutureDate(...) checks if the entered date is not a future date.
function NotFutureDate(year, month, day)
{
	/*alert(year);
		alert(month);
			alert(day);*/
	// Get Current Date in variables.
	dateobj = new Date();
	yearobj = dateobj.getFullYear();
	monthobj= dateobj.getMonth()+1;
	dayobj  = dateobj.getDate();

	// Compare if entered year is a future year.
	if(year > parseInt(yearobj))
	{
		return false;
	}
	else if(year == parseInt(yearobj)) // if current year.
	{
		// Compare if entered month is a future month.
		if(month > parseInt(monthobj))
		{
			return false;
		}
		else if(month == parseInt(monthobj)) // current month.
		{
			// Compare if entered date is not a future date.
			if(day >= parseInt(dayobj))
			{
				return false;
			}
			else { return true; }
		}
		else { return true; }
	}
	else { return true; }
}

//check email validation
function checkEmail(email)
{
	
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
			alert('Invalid E-Mail address! please re-enter.');
		return false;
	}else{
			alert('Please enter E-Mail address.');
		return false;
	}
}

//check Email validation
function CheckEmail(email)
{
	if(email != "") {
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
		alert("Invalid E-Mail address! please re-enter.")
		return false;
	} else {
		alert("Please enter E-Mail address.")
		return false;
	}
}
//Function to open popup...
function openpopup(url,popup_name,height,width,other_properties)
{
	var left		= parseInt((screen.width-350)/2);
	var top			= parseInt((screen.height-300)/2)
	var win_options = 'height='+height+',width='+width+',resizable=no,'
	+ 'scrollbars=1,left=' + left + ',top=' + top;
	window.open(url,popup_name,win_options);
}

//Function to check and uncheck the checkbox...
function selectall(ids,frmname)
{
	var id=ids
	var fname= frmname
	var f1=document.fname.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}

	}
}

//Ask conformation before doing ant task like make active, inactive,delete operations...
function atleastone(frm)
{
	with(frm)
	{
		var count = check.length;
		var i;
		for(i=0; i<count; i++)
		{
			if(check[i].checked)
			{
				var confirmation = confirm("-Do you want to do this operation?");
				if(confirmation) { return true; } else { return false; }
			}
		}
			alert('Please select atleast one.');
		return false;
	}
}

//AJAX General Function...Check the browser compactibility...
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

//check email ids to your friends
function checkEmailsent(email)
{
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
			alert('Invalid E-Mail address! Please re-enter.');
		return false;
	}else{
			alert('Please enter your friend E-Mail address.');
		return false;
	}
}

//check email ids to of admin...
function checkEmailadmin(email)
{
	if(email != ""){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{
			return true;
		}
			alert('Invalid E-Mail address! Please re-enter.');
		return false;
	}else{
			alert('Please enter E-Mail address');
		return false;
	}
}

//By clicking on Active, Inactive, Delete button...
function anyone(frm,message)
{
	with(frm)
	{
		var count = check.length;
		var i;
		for(i=0; i < count; i++)
		{
			if(check[i].checked)
			{
				var confirmation = confirm("-Do you wish to invite this friend(s)?");
				if(confirmation) { return true; } else { return false; }
			}
		}
		alert("Please select atleast one "+message+".");
		return false;
	}
}

//To select all colums in user management...
function SelectAllUsers(ids)
{
	var id=ids;
	var f1=document.frmusers.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}

//To select all colums in users management...
function SelectAllInUser(ids)
{
	var id=ids;
	var f1=document.viewuser.check;
	if(id==1)
	{
			for(i=0;i<=f1.length;i++)
			{
			   f1[i].checked=true;
			}
	}
	else
	{
			for(i=0;i<=f1.length;i++)
			{
				f1[i].checked=false;
			}
	}
}

//check all function
var checked = false;
function CheckAll(page)
{
	/*if(page == "staff")
	{
		var frm=document.staff;
	}else if(page == "searchresumes")
	{
		var frm=document.rsearchresults;
	}
	if(page == "candidates")
	{
		var frm=document.managecandidates;
	}
	if(page == "viewevents")
	{
		var frm=document.viewaddevents;
	}*/
	if(page =="inbox")
	{
		var frm = document.viewuser;
	}
	if (checked == false)
	{
		checked = true
	}
	else
	{
		checked = false
	}
	for (var i = 0; i < frm.elements.length; i++)
	{
		frm.elements[i].checked = checked;
	}
}

//To select all colums...
function SelectAllAgentProp(ids)
{
	var id=ids;
	var f1=document.frmaddprop.check;
	if(id==1)
	{
		for(i=0;i<=f1.length;i++)
		{
			f1[i].checked=true;
		}
	}
	else
	{
		for(i=0;i<=f1.length;i++)
		{
			f1[i].checked=false;
		}
	}
}

function atleastOnecheckbox(con,msg)
{
	if(msg == "message")
		frm = document.viewuser;
	var j = 0;
	with(frm)
	{
		var i;
		for (var i = 0; i < frm.elements.length; i++)
		{
			if(frm.elements[i].type == 'checkbox')
			{
				if(frm.elements[i].checked == true)
				{
					j++;
				}
			}
		}
		if(j == 0)
		{
			alert("Please select at least one "+msg+".");
			return false;
		}
		else
		{
			if(con == "delete" && msg=="message")
			{
				if(confirm("-Are you sure you want to delete?"))
				{
					frm.method = "post";
					frm.action="mymessages.php";
					frm.submit();
				}
				else
				{
					return false;
				}
			}
			//return true;
		}
	}
}



function mymessagespage()
{
	document.viewmailcontent.method = "post";
	document.viewmailcontent.action="mymessages.php";
	document.viewmailcontent.submit();
}

function deletethis(frm)
{
	with(frm)
	{
		var confimation = confirm("-Are you sure you wish to delete this message?")
		if(confimation) { //return true;
		var idval = document.viewmailcontent.id.value;

		frm.method = "post";
		document.location.href="viewmailcontent.php?id="+idval+"&delete=true";
		}
		else { return false;	}
	}
}

function contactjs_datevalidations()
{
	frm = document.contactvendor;
	if(frm.subject.value == "")
	{
		alert("Please enter subject.");
		frm.subject.focus();
		return false;
	}
	return true;
}

//Validate admin Login system...
function validateAdminLogin(frm)
{
	with(frm)
	{
		if(Trim(username.value) == '')
		{
			alert("Please enter your username.");
			username.focus();
			return false;
		}
		if(Trim(password.value) == '')
		{
			alert("Please enter your password.");
			password.focus();
			return false;
		}
	}
	return false;
}

//Validate admin change password...
function chpassadminValidate(frm)
{
	with(frm)
	{
		if(Trim(opwd.value) == '')
		{
				alert("Please enter your old password.");
			opwd.focus();
			return false;
		}
		if(Trim(npwd.value) == '')
		{
			alert("Please enter your new password.");
			npwd.focus();
			return false;
		}
		if(Trim(rpwd.value) == '')
		{
			alert("Please re-enter your new password.");
			rpwd.focus();
			return false;
		}
		if(Trim(npwd.value) != Trim(rpwd.value))
		{
			alert("Incorrect new password.");
			rpwd.value='';
			rpwd.focus();
			return false;
		}
	}
	return true;
}
function mapsubmit()
{
	if(document.frmmapsearch.coursename.value=="" && document.frmmapsearch.cityzipcode.value=="") {
		Ext.MessageBox.alert(alertname, "-Please enter the keyword for Search.");
		//alert("Please enter the keyword for Search.");
		return false;
	} else {
		document.frmmapsearch.method = "post";
		document.frmmapsearch.action="indexmap_result.php";
		document.frmmapsearch.submit();
	}
}

/*function mapmembersubmit() {
	if(document.frmmapsearch.coursename.value=="" && document.frmmapsearch.cityzipcode.value=="") {
		Ext.MessageBox.alert(alertname, "-Please enter the keyword for Search.");
		return false;
	} else {
		document.frmmapsearch.action="indexmap_result.php";
		return true;
	}
}*/
function mapmembersearch(frm) {
	if(Trim(frm.coursename.value)=="" && Trim(frm.city.value)=="" && frm.state.value=="0" && Trim(frm.design.value)=="" && (Trim(frm.zipcode.value)=="" || Trim(frm.zipcode.value)=="Zip Code" )) {
		alert("Please enter the keyword for Search.");
		return false;
	}
	else if(!charsonlyforsearch(frm.coursename.value) || !charsonlyforsearch(frm.city.value) || !charsonlyforsearch(frm.design.value)) {
		alert("Please enter the alpha numeric values for Search.");
		return false;
	} else if(Trim(frm.zipcode.value)!="Zip Code" && !Onlydigits(frm.zipcode.value)) {
		alert("Please enter the numeric values for Zipcode.");
		return false;
	} else {/*
			var efficientString = " "

			if(Trim(frm.coursename.value)!=""){
				efficientString += " \n Course name - "+frm.coursename.value
			}
			if(Trim(frm.city.value)!=""){
				efficientString += ",\n City - "+frm.city.value
			}
			if(Trim(frm.state.value)!="0"){
				efficientString += ",\n State - "+frm.state.value
			}
			if(Trim(frm.access.value)!="0"){
				if(Trim(frm.access.value)=='1'){
				efficientString += ",\n Type - Military"
				}
				else if(Trim(frm.access.value)=='2'){
				efficientString += ",\n Type - Private"
				}
				else if(Trim(frm.access.value)=='3'){
				efficientString += ",\n Type - Public"
				}
				else if(Trim(frm.access.value)=='4'){
				efficientString += ",\n Type - Resort"
				}
				else if(Trim(frm.access.value)=='5'){
				efficientString += ",\n Type - Semi-Private"
				}

			}
			if(Trim(frm.design.value)!=""){
				efficientString += ",\n Designer - "+frm.design.value
			}
			if(Trim(frm.mile.value)!="0"){
				efficientString += ",\n within - "+frm.mile.value+" miles"
			}
			if(Trim(frm.zipcode.value)!="Zip Code"){
				efficientString += ",\n Zip code - "+frm.zipcode.value
			}
		var r=confirm("You are searching "+ efficientString);
		if (r==true)  {
		return true;
		}else{
		return false;
			}

*/
	return true
	}
}
function submitimage()
{
	frm = document.frmlogin;
	if(frm.username.value != '' && frm.password.value != '')
	{
		frm.method = "post";
		frm.action="loginchk.php";
		frm.submit();
		return false;
	}
	else
	{
		if(!checkEmail(frm.username.value))
		{
			frm.username.focus();
			return false;
		}
		if(Trim(frm.password.value) == '')
		{
			alert("Please enter password.");
			frm.password.focus();
			return false;
		}
		if(frm.password.value.length < 6)
		{
			alert("Password field should be minimum six characters.");
			frm.password.focus();
			return false;
		}
	}
}

function validateupdate(frm)
{
	with(frm)
	{
		//alert("hai");
		if(Trim(fname.value) == "")
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter your first name.");
				});
			fname.focus();
			return false;
		}

		if(Trim(lname.value) == "")
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter your last name.");
				});
			lname.focus();
			return false;
		}

		if(Trim(country.value) == "")
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please select your country.");
				});
			country.focus();
			return false;
		}

		if(gender.value == "")
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please select gender.");
				});
			gender.focus();
			return false;
		}

		if(year.value % 4==0)
		{
			if(month.value== "02")
			{
				if((date.value == "30") || (date.value == "31"))
				{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter valid date.");
				});
					date.focus();
					return false
				}
			}
			else if((month.value== "04") || (month.value== "06") || (month.value== "09") || (month.value== "11"))
			{
				if(date.value == "31")
				{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter valid date.");
				});
					date.focus();
					return false;
				}
			}
		}else
		{
		if(month.value== "02")
		{
			if((date.value == "29") || (date.value == "30") || (date.value == "31"))
			{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter valid date.");
				});
				date.focus();
				return false
			}
		}else if((month.value== "04") || (month.value== "06") || (month.value== "09") || (month.value== "11"))
		{
			if(date.value == "31")
			{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter valid date.");
				});
				date.focus();
				return false;
			}
		}
	}

	}
	return true;
}

function hideemail(val)
{
	//alert("hhh");
	document.getElementById(val).value="";
}

function hidemessage(val)
{
	//alert("hhh");
	document.getElementById(val).value="";
}

//validate for invite friends
function validateinvite(frm)
{
	with(frm)
	{
		if(Trim(tomail.value) == '')
		{
			alert("Please enter Mail address.");
			tomail.focus();
			return false;
		}
	}
	return true;
}
function checkEmailAll(maillist) {
	var falseflag=false;
	mailarr=maillist.split(",");
	for(i=0;i<mailarr.length;i++) {
		if(mailarr[i] == document.getElementById("usermailid").value) {
			alert("Don't enter the own email id .");
			falseflag=true;
			break;
		}
		if(mailarr[i].length>50) {
			alert("Every email Id  have only 50 chars .");
			falseflag=true;
			break;
		}
		if(!checkEmail(mailarr[i])) {
			falseflag=true;
			break;
		}
	}
	if(falseflag==true) {
		return false;
	} else if(falseflag==false) {
		return true;
	}
}
function validateinviteall(frm)
{

	with(frm)
	{
		if(Trim(tomail.value) == '')
		{
			alert("Please enter Email address.");
			tomail.focus();
			return false;
		}
		if(usermailid.value == Trim(tomail.value))
		{
				alert("Don't enter the own email id.");
			return false;
		}

		if(!checkEmailAll(tomail.value))
		{
			return false;
		}
		if(Trim(message.value) == '')
		{
			alert("Please enter Message.");
			message.focus();
			return false;
		}
	}
	return true;
}

function validateuploadphoto(frm)
{
	with(frm)
	{
		if(upload_image.value != '')
		{
			if(!checkimage('frmuserphoto','upload_image'))
			{
				return false;
			}
		}
	}
return true;
}

function validateaddeditgc(frm)
{
	with(frm)
	{
		if(Trim(coursename.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the coursename.");
				});
			coursename.focus();
			return false;
		}
		if(Trim(address1.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the address1.");
				});
			address1.focus();
			return false;
		}
		if(Trim(address2.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the address2.");
				});

			address2.focus();
			return false;
		}
		if(Trim(latitude.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please select the location on map.");
				});
			latitude.focus();
			return false;
		}
		if(Trim(landmark.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the landmark.");
				});
			landmark.focus();
			return false;
		}
		if(Trim(city.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the city.");
				});
			city.focus();
			return false;
		}
		if(Trim(zipcode.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the zipcode.");
				});
			zipcode.focus();
			return false;
		}
		else if(!IsNumeric(zipcode.value))
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Zipcode should be only numeric.");
				});
			zipcode.focus();
			return false;
		}
		if(Trim(fees.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the fees.");
				});
			fees.focus();
			return false;
		}
		if(date_opened.value == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please select the date of opened.");
				});
			date_opened.focus();
			return false;
		}
		if(holes.value == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the holes.");
				});
			holes.focus();
			return false;
		}
		else if(!IsNumeric(holes.value))
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Holes should be only numeric.");
				});
			holes.focus();
			return false;
		}
		if(length.value == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the lenght.");
				});
			length.focus();
			return false;
		}
		else if(!IsNumeric(length.value))
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Length should be only numeric.");
				});
			length.focus();
			return false;
		}
	}
	return true;
}

//Function to check the entered video files is in .flv formot or not...
function checkvideo(formname,fieldname)
{
	if(eval("document."+formname+"."+fieldname+".value") != '')
	{
		imagename=eval("document."+formname+"."+fieldname+".value");
		splitimagename = imagename.split(".");
		imagenamelen = splitimagename.length;
		imageextention = splitimagename[imagenamelen-1];

		if(imageextention != 'flv')
		{
			alert("-Please Upload Proper Video file.\nAccept Video file format:\n.flv.");
			return false;
		}
	}
	return true;
}

function validatevideofile11(frm)
{
	with(frm)
	{
		if(Trim(title.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, "-Please enter the Title.");
			});
			title.focus();
			return false;
		}
		else if(!charsonly(title.value)) {
				Ext.MessageBox.alert(alertname, '-Title field  accepts only alphanumeric  values.');
			title.focus();
			return false;
		}
		if(Trim(description.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the Description.");
				});
			description.focus();
			return false;
		}
		if(Trim(embedcode.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the Description.");
				});
			embedcode.focus();
			return false;
		}
		if(Trim(tags.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the tags.");
				});
			tags.focus();
			return false;
		}
		if(videofiles.value == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please select the file.");
				});
			videofiles.focus();
			return false;
		}

		if(videofiles.value != '')
		{
			if(!checkvideo('myvideo','videofiles'))
			{
				return false;
			}
		}
	}
	loading('File uploading...', 4000);
	return true;
}


function validatevideofile(frm)
{
	with(frm)
	{
		if(Trim(title.value) == '')
		{
			alert("-Please enter the Title.");
			title.focus();
			return false;
		}
		if(Trim(description.value) == '')
		{
			alert("-Please enter the Description.");
			description.focus();
			return false;
		}
		if(Trim(embedcode.value) == '')
		{
			alert("-Please enter the url from youtube.");
			embedcode.focus();
			return false;
		}
		if(embedcode.value != '')
		{
			if(!isURL(embedcode.value))
			{
			embedcode.focus();
			return false;
			}
		}
		if(Trim(tags.value) == '')
		{
		alert("-Please enter the tags.");
		tags.focus();
		return false;
		}
/*		if(videofiles.value == '')
		{
			alert("-Please select the file.");
			videofiles.focus();
			return false;
		}
		if(videofiles.value != '')
		{
			if(!checkvideo('myvideo','videofiles'))
			{
				return false;
			}
		}*/
	}
	loading('File uploading...', 4000);
	return true;
}



function validatevideocomment(frm)
{
	with(frm)
	{
		if(Trim(comment.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the comment.");
				});
			comment.focus();
			return false;
		}
	}
	return true;
}

//validate creategroups
function validatecreategroup(frm)
{
	with(frm)
	{
		if(Trim(groupname.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Group name.');
			});
			groupname.focus();
			return false;
		}
		if(access.value == '0')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please select the Access.');
			});
			access.focus();
			return false;
		}
		if(Trim(zipcode.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Zipcode.');
			});
			zipcode.focus();
			return false;
		}
		if(Trim(desc.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Description.');
			});
			desc.focus();
			return false;
		}
		if(groupimage.value != '')
		{
			if(!checkimage('creategroup','groupimage'))
			{
				return false;
			}
		}
	}
	return true;
}

function validategalleryform(frm)
{
	with(frm)
	{
		if(Trim(galleryname.value) == '')
		{
				Ext.onReady(function(){
				Ext.MessageBox.alert(alertname, "-Please enter the Gallery name.");
				});
			galleryname.focus();
			return false;
		}
		if(coverimage.value != '')
		{
			if(!checkimage('gallery','coverimage'))
			{
				return false;
			}
		}
	}
	return true;
}

//validate stories
function validatecreatestory(frm)
{
	with(frm)
	{
		if(coursename.value == '0')
		{
			alert('Please select the Course name.');
			coursename.focus();
			return false;
		}
		if(Trim(storytitle.value) == '')
		{
			alert('Please enter the Story title.');

			storytitle.focus();
			return false;
		}
		if(FCKeditorAPI.GetInstance('storycontent').GetXHTML() == '')
		{
			alert('Please enter the Story.');
			return false;
		}
	}
	return true;
}

//validate createforum
function validatecreateforum(frm)
{
	with(frm)
	{
		if(Trim(topic.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Forum topic.');
			});
			topic.focus();
			return false;
		}
		if(category.value == '0')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please select the Forum category.');
			});
			category.focus();
			return false;
		}
		if(Trim(detail.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Forum Detail.');
			});
			detail.focus();
			return false;
		}
	}
	return true;
}

//validate forum answer
function validateforumanswer(divid)
{
	frm=document.frmaddcmd;
	with(frm)
	{
		if(Trim(a_answer.value)=='')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Comments.');
			});
			a_answer.focus();
			return false;
		} else {
			AddComments(document.getElementById("a_answer").value,document.getElementById("id").value,divid);
		}
	}
}
//validate forum topic..
function chk_CreateTopic(divid) {
	frm=document.frmcreatetopic;
	if(Trim(frm.txt_topic.value)=="") {
			alert('Please enter the topic');
		frm.txt_topic.focus();
	}
	else if(!charsonly(frm.txt_topic.value)) {
			alert('Topic field is accepts only alphabets & numbers only.');
		frm.txt_topic.focus();
	}
	else if(frm.sel_category.value=="") {
			alert('Please select the category');
		frm.sel_category.focus();
	}
	else if(Trim(frm.txta_detail.value)=="") {
			alert('Please enter the detail');
		frm.txta_detail.focus();
	}
	else {
		CreateTopic(frm.txt_topic.value,frm.sel_category.value,frm.txta_detail.value,divid);
	}
}
function chk_commentcourse(){
	frm=document.frmcomments;
	if(Trim(frm.usercomments.value)=="") {
		alert('Please enter the Comments.');
		frm.usercomments.focus();
		return false;
	} else {
		return true;
	}
}
function chk_commentcourseinside(){
	frm=document.frmcommentss;
	if(Trim(frm.usercommentss.value)=="") {
			alert('Please enter the Detail');
		frm.usercommentss.focus();
		return false;
	} else {
		return true;
	}
}
function chk_joinagame(){
		frm=document.frmjoinagame;
		Joinagame(frm.joinuserid.value,frm.joineventid.value);
}
function loading(mseg,interval){

	        Ext.MessageBox.show({
           msg: mseg,
		   //'Saving your data, please wait...',
           progressText: 'Saving...',
           width:300,
           wait:true,
           waitConfig: {interval:200},
           //icon:'ext-mb-download', //custom class in msg-box.html
           animEl: 'mb7'
       });

      setTimeout(function(){
            //This simulates a long-running operation like a database save or XHR call.
            //In real code, this would be in a callback function.
            Ext.MessageBox.hide();
           // Ext.example.msg('Done', 'Your fake data was saved!');
        }, interval);
	}

function chk_addfavcourse(){
	//alert('njjnj');
		frm=document.frmaddfavourite;
		//alert(frm.addfavid.value);
		addfavcourse(frm.addfavid.value);
}
function chk_tagged_form(){
		frm=document.frmtaggedform;
		deltagcourse(frm.tagfavid.value);
}
function showhide(id1,id2)
{
	var showhideid1 = eval(document.getElementById(id1));
	var showhideid2 = document.getElementById(id2);
	showhideid1.style.display = "none";
	showhideid2.style.display = "block";
}
function showdivbuttons(){
	document.getElementById('showupdate').style.display = "block";
	document.getElementById('editupdate').style.display = "none";
}
function setVisibledisplaydiv(disptab,nontab) {
	document.getElementById(disptab).style.display="block";
	document.getElementById(nontab).style.display="none";
}
function hidedivbuttons(){

	document.getElementById('editupdate').style.display = "block";
	document.getElementById('showupdate').style.display = "none";
	}
function showhide1(id1,id2)
{
	var showhideid1 = document.getElementById(id1);
	var showhideid2 = document.getElementById(id2);
	showhideid1.style.display = "none";
	showhideid2.style.display = "none";
}
function showhide2(id1,id2)
{
	var showhideid1 = document.getElementById(id1);
	var showhideid2 = document.getElementById(id2);
	showhideid1.style.display = "none";
	showhideid2.style.display = "none";
}

function validatemanageprofile(frm)
{
	with(frm)
	{
		if(Trim(firstname.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the first name.');
			});
			firstname.focus();
			return false;
		}
		if(Trim(lastname.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Last name.');
			});
			lastname.focus();
			return false;
		}
		if(Trim(zipcode.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Zip code.');
			});
			zipcode.focus();
			return false;
		}
		if(Trim(state.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the State/County');
			});
			state.focus();
			return false;
		}
		if(Trim(city.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the City.');
			});
			city.focus();
			return false;
		}
		if(Trim(golfertype.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Golfer type.');
			});
			golfertype.focus();
			return false;
		}
		if(Trim(handicap.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Handicap.');
			});
			handicap.focus();
			return false;
		}
		if(!IsNumeric(handicap.value))
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Handicap should be only numeric.');
			});
			handicap.focus();
			return false;
		}

		if(Trim(average.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Average.');
			});
			average.focus();
			return false;
		}
		if(!IsNumeric(average.value))
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Average should be only numeric.');
			});
			average.focus();
			return false;
		}
		if(age.value == '0')
			{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please select the Age.');
			});
			age.focus();
			return false;
		}
		if(Trim(height.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Height.');
			});
			height.focus();
			return false;
		}
		if(Trim(website.value) == '')
		{
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Website.');
			});
			website.focus();
			return false;
		}
		if(userphoto.value != '')
		{
			if(!checkimage('manage_profile','userphoto'))
			{
				return false;
			}
		}
	}
	return true;
}
function chk_ValideditProfile(frm)
{
	with(frm)
	{
		if(Trim(firstname.value)=="") {
			alert('Please enter the first name.');
			firstname.focus();
			return false;
		}
		else if(!Onlychars(firstname.value)) {
			alert('first Name accepts only alphabets.');
			firstname.focus();
			return false;
		}
	    else if(Trim(lastname.value)=="") {
			alert('Please enter the last name.');
			lastname.focus();
			return false;
		}
		else if(!Onlychars(lastname.value)) {
			alert('Last Name accepts only alphabets.');
			lastname.focus();
			return false;
		}
		else if(Trim(address.value)=="") {
			alert('Please enter the address.');
			address.focus();
			return false;
		}
		else if(Trim(city.value)=="") {
			alert('Please enter the city.');
			city.focus();
			return false;
		}
		else if(!Onlychars(city.value)) {
			alert('City accepts only alphabets.');
			city.focus();
			return false;
		}
		else if(state.value=="0") {
			alert('Please select the state.');
			state.focus();
			return false;
		}
		else if(zipcode.value=="") {
			alert('Please enter the zip code.');
			zipcode.focus();
			return false;
		}
		else if(!Onlydigits(zipcode.value)) {
			alert('Zip Code accepts only numbers.');
			zipcode.focus();
			return false;
		}
		else if(Trim(golftype.value)=="") {
			alert('Please enter the Golfer Type.');
			golftype.focus();
			return false;
		}
		else if(!charsonly(golftype.value)) {
			alert('Golfer type field is accepts only alphabets & numbers only.');
			golftype.focus();
			return false;
		}
/*		else if(handicap.value=="") {
			alert('Please enter the Handicap.');
			handicap.focus();
			return false;
		}
		else if(!Onlydigits(handicap.value)) {
			alert('Handicap field accepts only numbers.');
			handicap.focus();
			return false;
		}
		else if(average.value=="") {
			alert('Please enter the Average.');
			average.focus();
			return false;
		}

		else if(!IsNumberDot(average.value)) {
			alert('Please enter valid Average.');
			average.focus();
			return false;
		}
		else if(sentencesplit.length > 2) {
			alert('Please enter valid  Average.');
			average.focus();
			return false;
		}*/
		else if(age.value=="0") {
			alert('Please select the Age.');
			age.focus();
			return false;
		}
		else if(height.value=="") {
			alert('Please enter the Height.');
			height.focus();
			return false;
		}
		else if(!Onlydigitsquotes(height.value)) {
			alert('Height field accepts only numbers, single quotes and double quotes.');
			height.focus();
			return false;
		}
		else if(Trim(homecourse.value)=="0") {
			alert('Please enter the home course.');
			homecourse.focus();
			return false;
		}
	}
	return true;
}
function chk_ValidProfile(frm)
{
	if(Trim(document.getElementById('firstname').value)=="") {
		alert('Please enter the first name.');
		document.getElementById('firstname').focus();
	}
	else if(!Onlychars(document.getElementById('firstname').value)) {
		alert('first Name accepts only alphabets.');
		document.getElementById('firstname').focus();
	}
	else if(Trim(document.getElementById('lastname').value)=="") {
		alert('Please enter the last name.');
		document.getElementById('lastname').focus();
	}
	else if(!Onlychars(document.getElementById('lastname').value)) {
		alert('Last Name accepts only alphabets.');
		document.getElementById('lastname').focus();
	}
	else if(document.getElementById('zipcode').value=="") {
		alert('Please enter the zip code.');
		document.getElementById('zipcode').focus();
	}
	else if(!Onlydigits(document.getElementById('zipcode').value)) {
		alert('Zip Code accepts only numbers.');
		document.getElementById('zipcode').focus();
	}
	else if(Trim(document.getElementById('address').value)=="") {
		alert('Please enter the address.');
		document.getElementById('address').focus();
	}
	else if(Trim(document.getElementById('city').value)=="") {
		alert('Please enter the city.');
		document.getElementById('city').focus();
	}
	else if(!Onlychars(document.getElementById('city').value)) {
		alert('City accepts only alphabets.');
		document.getElementById('city').focus();
	}
	else if(document.getElementById('state').value=="0") {
		alert('Please select the state.');
		document.getElementById('state').focus();
	}
	else if(Trim(document.getElementById('golftype').value)=="") {
		alert('Please enter the Golfer Type.');
		document.getElementById('golftype').focus();
	}
	else if(!charsonly(document.getElementById('golftype').value)) {
		alert('Golfer type field is accepts only alphabets & numbers only.');
		document.getElementById('golftype').focus();
	}
	else if(document.getElementById('age').value=="0") {
		alert('Please select the Age.');
		document.getElementById('age').focus();
	}
	else if(document.getElementById('height').value=="") {
		alert('Please enter the Height.');
		document.getElementById('height').focus();
	}
	else if(!Onlydigitsquotes(document.getElementById('height').value)) {
		alert('Height field accepts only numbers, single quotes and double quotes.');
		document.getElementById('height').focus();
	}
	else if(document.getElementById('homecourse').value=="") {
		alert('Please select the Homecourse.');
		document.getElementById('homecourse').focus();
	}
	else {
		editprofile('firstname','lastname','address','city','state','zipcode','golftype', 'gender', 'age', 'height', 'homecourse', 'editprofile', 'ajax_edit_profile.php');
		showhide('update','edit');
	}
}
function Changephototab(disptab,nontab)
{
	document.getElementById(disptab).style.display="block";
	document.getElementById(nontab).style.display="none";
}
function validateuploadmyphoto1(frm)
{
var btn = valButton(frm.selectchoice);
	if (btn == null)
	{
	alert('Please select the anyone');
	return false;
	}else{
			jquery_validateuploadmyphoto1();
			return true;
	}
}
function validateuploadmyphoto2(frm)
{
	if(document.frmuserphoto2.upload_myimage_file.value=="")
	{

		alert('Please select the image.');
		return false;
	} else {
		if(!checkimage('frmuserphoto2','upload_myimage_file'))	{
			//document.frmuserphoto.upload_myimage_file.value="";
			return false;
		} else {
			jquery_validateuploadmyphoto2();
			return true;
		}
	}
}
function validateuploadmyphotochoice(frm)
{

/*	if(!RadioValidate(frm,'uploadchoice')) {
			alert('Please select the choice.');
		return false;
	}
		alert(frm.uploadchoice.checked.value);
	setVisible('uploadmyphotochoice',true);
	setVisible('uploadmyphoto',true);*/
var btn = valButton(frm.uploadchoice);
	if (btn == null)
	{
	alert('Please select the anyone')
	}else{
		if(btn == 'fromourgallery'){
		setVisible('uploadmyphotochoice',true);
		setVisible('uploadmyphoto1',true);
		}else{
		setVisible('uploadmyphotochoice',true);
		setVisible('uploadmyphoto2',true);
		}
	}

}


function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}



function validatewriteonwall()
{
	if(document.frmwriteonwalls.txt_commentswall.value=="")
	{

		alert('Please enter the message.');
		return false;
	}else if(document.frmwriteonwalls.txt_commentswall.value=="Write something...")
	{
		return false;
	}
	else{   loadingPanel.show();
			return true;
		}
}
function validatecommentswriteonwall(valid)
{
	//alert(valid);
	if(document.getElementById('txt_usercommentsonwall_'+valid).value=="")
	{
		alert('Please enter the comments.');
		document.getElementById('txt_usercommentsonwall_'+valid).focus();
		return false;
	}
	else if(document.getElementById('txt_usercommentsonwall_'+valid).value=="Comments...")
	{
		return false;
	}
	else
	{
			//alert(document.getElementById('txt_usercommentsonwall').value);alert(document.getElementById('dividvalue').value);
			loadingPanel.show();
			commentswriteonwall(document.getElementById('txt_usercommentsonwall_'+valid).value,document.getElementById('dividvalue_'+valid).value);
			return true;
	}
}
function delbuttonfn(wallid, userid){
	//alert(userid);
	var r=confirm("Are you sure you want to delete this wall?");
	if (r==true)  {
		delfunforwall(wallid, userid)
	}
	}
function delcommentsforwall(wallid, commentid){
	//alert(wallid);
	//alert(commentid);
	var r=confirm("Are you sure you want to delete this comment?");
	if (r==true)  {
		delfunforCommentsofWall(wallid, commentid)
	}
	}
function chk_Validgame(frm) {
	if(Trim(document.getElementById('txt_clubname').value)=="") {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Club Name.');
			});
		document.getElementById('txt_clubname').focus();
	}
	else if(!charsonly(document.getElementById('txt_clubname').value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Characters in Club Name.');
			});
		document.getElementById('txt_clubname').focus();
	}
	else if(document.getElementById('txt_score').value=="") {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Score.');
			});
		document.getElementById('txt_score').focus();
	}
	else if(!Onlydigits(document.getElementById('txt_score').value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Valid Score.');
			});
		document.getElementById('txt_score').focus();
	}
	else if(document.getElementById('txt_distance').value=="") {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Distance Driven.');
			});
		document.getElementById('txt_distance').focus();
	}
	else if(!Onlydigits(document.getElementById('txt_distance').value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Valid Distance driven.');
			});
		document.getElementById('txt_distance').focus();
	}
	else if(document.getElementById('txt_round').value=="") {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Putts per Round.');
			});
		document.getElementById('txt_round').focus();
	}
	else if(!Onlydigits(document.getElementById('txt_round').value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Valid Putts per Round.');
			});
		document.getElementById('txt_round').focus();
	}
	else if(document.getElementById('txt_hole').value=="") {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter the Putts per Hole.');
			});
		document.getElementById('txt_hole').focus();
	}
	else if(!Onlydigits(document.getElementById('txt_hole').value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Valid Putts per Hole.');
			});
		document.getElementById('txt_hole').focus();
	} else {
		insert_gametrack(document.getElementById('txt_clubname').value,document.getElementById('txt_score').value,document.getElementById('txt_distance').value,document.getElementById('txt_round').value,document.getElementById('txt_hole').value,'gametrack');
	}
}
function chk_EmailFn(frm,divid) {
	if(frm.emailid.value!="" || frm.emailid.value=="") {
		document.getElementById(divid).innerHTML="<img src='ajaxfiles/loading.gif' border='0'> Checking your Username.";
		document.getElementById(divid).style.display="block";
		//alert(frm.emailid.value);
		//alert(divid);
		chk_Email(frm.emailid.value,divid);
	}
}
function chk_SendMessage(dvid) {
	//alert('hi');
	frm=document.frmsendmessage;
	if(frm.txt_subject.value=="") {
			alert('Please enter the Subject');
		frm.txt_subject.focus();
	}
	else if(frm.txta_message.value=="") {
			alert('Please enter the Message');
		frm.txta_message.focus();
	}
	else {
		var subval=frm.txt_subject.value;
		var msgval=frm.txta_message.value;
		frm.txta_message.value="";
		frm.txt_subject.value="";
		sendMessage(frm.hid_uid.value,subval,msgval,dvid);
	}
}
function chk_UploadGallry() {
	frm=document.frmuploadgalary;
	if(Trim(frm.txt_galname.value)=="") {
		alert('Please enter the Gallery Name');
		return false;
		frm.txt_galname.focus();
	} else if(!charsonly(frm.txt_galname.value)) {
		alert('Please enter Characters only.');
		frm.txt_galname.focus();
	} else {
		//alert(frm.txt_galname.value);
		//alert(frm.hid_gid.value);
		//alert(frm.txt_galname.value);
		chk_EditGallery(frm.txt_galname.value,'','gallery','add',frm.hid_gid.value);
		return false;
	}
}
function setVisiblemsgdiv(disptab,nontab) {
	document.getElementById(disptab).style.visibility="visible";
	document.getElementById(nontab).style.visibility="hidden";
}
function setInVisible(inid) {
	document.getElementById(inid).style.visibility="hidden";
}
function chk_SearchOption() {
	frm=document.formsearch;
	if(Trim(frm.txt_grpsearch.value)=="" || Trim(frm.txt_grpsearch.value)=="Search Groups") {
		alert('Please enter the Search Value');
		return false;
	}
	frm.action="grpsearch.php";
	frm.target="_parent";
	frm.submit();
}

function chk_SearchOptionevent() {
	frm=document.formsearchevent;
	if(Trim(frm.txt_grpsearch.value)=="" || Trim(frm.txt_grpsearch.value)=="Search Events") {
		alert('Please enter the Search Value');
		return false;
	}
	frm.action="myeventsall.php";
	frm.target="_parent";
	frm.submit();
}

function chk_Searchvideo() {

window.location.href='myvideos.php?search='+document.getElementById('txt_vidsearch').value;
}

function chk_grpSearchOption(frm) {
	if(Trim(frm.txt_grpsearch.value)=="") {
		alert('Please enter the Search Value');
		return false;
	}
	frm.submit();
}
function validate_group(frm) {
	with(frm) {
		if(rightcon.value == '') {
			alert('Please add atleast one of the mailid.');
			return false;
		}
	}
	return true;
}
function validategrouppopup() {
	frm=document.frmcreategroup;
	if(Trim(frm.txt_grpname.value)=="") {
		alert('Please enter the Group Name.');
		frm.txt_grpname.focus();
		return false;
	}
	else if(!charsonly(frm.txt_grpname.value)) {
		alert('Please enter alphanumeric only.');
		frm.txt_grpname.focus();
		return false;
	}
	else if(frm.sel_grptype.value=="") {
		alert('Please Select a Course name.');
		frm.sel_grptype.focus();
		return false;
	}
	else if(!RadioValidate(frm,'type')) {
			alert('Please select the type.');
		return false;
	}
	else if(Trim(frm.txta_desc.value)=="") {
		alert('Please enter the Description.');
		frm.txta_desc.focus();
		return false;
	}
	else if(frm.txt_grpimg.value!='')	{
		if(!checkimage('frmcreategroup','txt_grpimg'))	{
			return false;
		}
	}
	return true;
}

function makenull(frm)
{
	with(frm)
	{
		upload_myimage_file.value=null;
		return false;
	}
	return true;
}

function hidDiv(inid) {
	document.getElementById(inid).style.display="none";
}

function setVisibleUpGal() {
	document.getElementById('uploadgalary').style.visibility="visible";
	document.getElementById('div_editmsg').style.display="none";
	document.getElementById('mode').value="";
	document.getElementById('hid_gid').value="";
	document.getElementById('txt_galname').value="";
}

function setVisiblegrpdiv() {
	//parent.loadingPanel.show();
	document.getElementById('creategroup').style.visibility="visible";
	document.getElementById('div_editmsg').style.display="none";
	document.getElementById('grpid').value="";
	document.getElementById('mode').value="";
	document.getElementById('txt_grpname').value="";
	document.getElementById('txt_zip').value="";
	document.getElementById('txta_desc').value="";
}

function setVisiblegrpdivall() {
	document.getElementById('creategroup').style.left="35%";
	document.getElementById('creategroup').style.top="220px";
	document.getElementById('creategroup').style.visibility="visible";
	document.getElementById('div_editmsg').style.display="none";
	document.getElementById('grpid').value="";
	document.getElementById('mode').value="";
	document.getElementById('txt_grpname').value="";
	document.getElementById('txt_zip').value="";
	document.getElementById('txta_desc').value="";
}
function change_parent_url(url) {
	document.location=url;
}
function chk_SendInvite(dvid) {
	frm=document.frmsendinvite;
	if(frm.txta_message.value=="") {
			alert('Please enter the message');
		frm.txta_message.focus();
	}
	else {
		var msgval=frm.txta_message.value;
		frm.txta_message.value="";
		sendInvitation(frm.hid_uid.value,msgval,dvid);
	}
}
//validate add events
function validateaddevents(frm) {
	with(frm) {
		if(Trim(eventtitle.value) == '') {
			alert('Please select the event title.');
			eventtitle.focus();
			return false;
		}
		if(!charsonly(eventtitle.value)) {
			alert('Event Title field accepts only alphanumeric characters only.');
			eventtitle.focus();
			return false;
		}
		if(Trim(eventdescription.value) == '') {
			alert('Please enter the event description.');
			eventdescription.focus();
			return false;
		}
		if(!RadioValidate(frm,'eventtype')) {
				alert('Please select the type.');
			return false;
		}		
		if(Trim(coursename.value) == 0) {
			alert('Please select the course name.');
			coursename.focus();
			return false;
		}
		if(Trim(starttimehr.value) == '') {
			alert('Please choose the start time hour.');
			starttimehr.focus();
			return false;
		}
		if(Trim(starttimemin.value) == '') {
			alert('Please choose the start time min.');
			starttimemin.focus();
			return false;
		}
		if(Trim(endtimehr.value) == '') {
			alert('Please enter the end time.');
			endtimehr.focus();
			return false;
		}
		if(Trim(endtimemin.value) == '') {
			alert('Please enter the end time.');
			endtimemin.focus();
			return false;
		}
		if(Trim(starttimehr.value) == Trim(endtimehr.value) && Trim(starttimemin.value) == Trim(endtimemin.value)) {
			alert('Please select the different time.');
			endtimehr.focus();
			return false;
		}
		if(Trim(starttimehr.value) == Trim(endtimehr.value) && Trim(starttimemin.value) >= Trim(endtimemin.value)) {
			alert('End min should be greater than start min.');
			endtimehr.focus();
			return false;
		}
		if(Trim(starttimehr.value) > Trim(endtimehr.value)) {
			alert('End time should be greater than start time.');
			endtimehr.focus();
			return false;
		}
		var month = StartDateMonth.value;
		var date = StartDateDay.value;
		var year = StartDateYear.value;
		if(NotFutureDate(year, month, date)) {
			alert('Please select the future dates.');
			return false;
		}
	}
	return true;
}

function countSelecboxvalue(name) {
   var selbox=0;
   var selval="";
	obj = document.getElementById(name);
	for(i = 0; i<obj.length; i++) {
	   if (obj[i].selected == true && obj[i].value!="") {
			selbox=selbox+1;
			selval +=obj[i].value+",";
	   }
	}
	return selval.substr(0,(selval.length)-1);
}
function validateEventInvite(sesid,query) {
	frm=document.frmeventinvite;
	if(countSelecboxvalue('sel_friendlist')=="") {
		alert('Please select the friend(s)');
		return false;
	}
	else if(frm.sel_eventlist.value=='')	{
		alert('Please select the Event');
		return false;
	} else {
		chk_EventInvite(countSelecboxvalue('sel_friendlist'),frm.sel_eventlist.value,sesid,query);
		return false;
	}
}
function validateEventInvitecourse(sesid,query) {
	frm=document.frmeventinvite;
	if(countSelecboxvalue('sel_friendlist')=="") {
		alert('Please select the friend(s)');
		return false;
	}
	else if(frm.sel_eventlist.value=='')	{
		alert('Please select the Event');
		return false;
	} else {
		chk_EventInvitecourse(countSelecboxvalue('sel_friendlist'),frm.sel_eventlist.value,sesid,query);
		return false;
	}
}
function setVisibleeventdiv(disptab,nontab) {
	geteventList('div_eventlist');
	document.getElementById(disptab).style.visibility="visible";
	document.getElementById(nontab).style.visibility="hidden";
}
function validateusrEventInvite() {
	frm=document.frmeventinvite;
	if(frm.sel_eventlist.value=='')	{
		alert('Please select the Event');
		return false;
	} else {
		return true;
	}
}
//validate add events
function validatejoingame(frm) {
	with(frm) {
		if(sel_eventlist.value == '')
		{
			alert('Please select the Event.');
			sel_eventlist.focus();
			return false;
		}
	}
	return true;
}
function Change_UpdateTxt(chktxt,option) {
	if(option=="focus") {
		if(Trim(document.getElementById('txt_addupdate').value)=="What are you doing?") {
			document.getElementById('txt_addupdate').value="";
			document.getElementById('div_postupdate').style.visibility="visible";
			document.getElementById('div_userupdate').style.display="none";
			document.getElementById('div_defupdate').style.display="block";
		}
	}
	if(option=="outfocus") {
		if(Trim(document.getElementById('txt_addupdate').value)=="") {
			document.getElementById('txt_addupdate').value="What are you doing?";
			document.getElementById('div_postupdate').style.visibility="hidden";
			document.getElementById('div_userupdate').style.display="block";
			document.getElementById('div_defupdate').style.display="none";
		}
	}
}
function setVisibleAddEventDiv(divid) {
	document.getElementById(divid).style.visibility="visible";
}
function chk_GetCourseName(divid) {

	coursevalue=document.frm_courselist.sel_coursename.value;
	var tempcourse = new Array();
	tempcourse = coursevalue.split('#::#');

	document.getElementById(divid).style.visibility="visible";
	document.getElementById('div_GetCourse').style.visibility="hidden";
	document.frmaddevents.coursename.value=tempcourse[1];
	document.frmaddevents.hid_courseid.value=tempcourse[0];
	document.frmaddevents.starttimehr.value="";
	document.frmaddevents.eventtitle.value="";
	document.frmaddevents.eventdescription.value="";
	document.frmaddevents.starttimemin.value="";
	document.frmaddevents.endtimehr.value="";
	document.frmaddevents.endtimemin.value="";
	document.frmaddevents.evnt_mode.value="";
	document.frmaddevents.hid_edit.value="";
	return false;
}
function ddrivetipa(divval) {
	document.getElementById('dhtmltooltipa').style.visibility="visible";
	document.getElementById('dhtmltooltipa').innerHTML=divval;
}
function ddrivetipa_index(divval) {
	parent.document.getElementById('dhtmltooltipa').style.visibility="visible";
	parent.document.getElementById('dhtmltooltipa').innerHTML=divval;
}
function setInVisibledhtmltip_index() {
	parent.document.getElementById('dhtmltooltipa').style.visibility="hidden";
}
function setInVisibledhtmltip() {
	document.getElementById('dhtmltooltipa').style.visibility="hidden";
}
function chk_GetZipCode(frm) {
	with(frm)
	{
		if(Trim(txt_zip.value)=="" && Trim(txt_city.value)==""  && Trim(txt_course.value)=="") {
			alert("Please enter the Zip code / city / coursename.");
			return false;
		}
		if(Trim(txt_zip.value)!="" && Trim(txt_city.value)!=""&& Trim(txt_course.value)!="") {
			alert("Please enter any one of Zip code / city / coursename.");
			return false;
		}
		if(!Onlydigits(txt_zip.value)) {
			alert("Please enter Valid Zip code.");
			return false;
		}
	}
	return true;
}
function Chk_JoinGroup(gpid,gpname) {
	document.getElementById('chk_addGrp').innerHTML='<p align="center">Do you want to join "'+gpname+'"?<br><input type="submit" class="formbutton_gray" value="Add"  onclick="javascript:return Chk_Joingrp('+gpid+');" >&nbsp;&nbsp;&nbsp;<input type="button"  class="formbutton_gray"  value="Cancel"  onclick="javascript:setInVisible(\'chk_addGrp\'); return false;"></p>';
	setVisibleAddEventDiv('chk_addGrp');
}
function Chk_Joingrp(grpid) {

	document.getElementById('hid_joingep').value=grpid;
alert(document.getElementById('hid_joingep').value);
}
function Chk_JoinGroupnew(gpid,gpname) {
	document.getElementById('chk_addGrpnew').innerHTML='<p align="center">Do you want to join "'+gpname+'"?<br><input type="submit" class="formbutton_gray" value="Add"  onclick="javascript:return Chk_Joingrpnew('+gpid+');" >&nbsp;&nbsp;&nbsp;<input type="button"  class="formbutton_gray"  value="Cancel"  onclick="javascript:setInVisible(\'chk_addGrpnew\'); return false;"></p>';
	setVisibleAddEventDiv('chk_addGrpnew');
}
function Chk_Joingrpnew(grpid) {

	document.getElementById('hid_joingep').value=grpid;

}
//validate upload gallery
function validateinsidegallery(frm)
{
	with(frm)
	{
		if((image1.value =="" || imgtitle1.value=="") && (image2.value =="" || imgtitle2.value=="") && (image3.value =="" || imgtitle3.value==""))
		{
			alert('Please upload atleast One photo with title.');
			return false;
		}
		else
		{
			if(image1.value!="")
			{
				if(!checkimage('frmphoto','image1'))
				{
					return false;
				}
				if(Trim(imgtitle1.value)=="")
				{
					alert('Please enter the title1.');
					imgtitle1.focus();
					return false;
				}
				if(!charsonly(imgtitle1.value)) {
					alert('Title 1  accepts only alphanumeric values.');
					imgtitle1.focus();
					return false;
				}

			}
			if(image2.value!="")
			{
				if(!checkimage('frmphoto','image2'))
				{
					return false;
				}
				if(Trim(imgtitle2.value)=="") {
					alert('Please enter the title2.');
					imgtitle1.focus();
					return false;
				}
				if(!charsonly(imgtitle2.value)) {
					alert('Title2  accepts only alphanumeric values.');
					imgtitle2.focus();
					return false;
				}

			}
			if(image3.value!="")
			{
				if(!checkimage('frmphoto','image3'))
				{
					return false;
				}
				if(Trim(imgtitle3.value)=="")
				{
					alert('Please enter the title3.');
					imgtitle3.focus();
					return false;
				}
				if(!charsonly(imgtitle3.value)) {
					alert('Title3  accepts only alphanumeric values.');
					imgtitle3.focus();
					return false;
				}
			}
		}
	}
	return true;
}
//validate upload gallery
function validateaddgallery(frm)
{
	with(frm)
	{
		if(Trim(gal_name.value)=="")
		{
			alert('Please enter the galllery name.');
			gal_name.focus();
			return false;
		}
		if(!charsonly(gal_name.value)) {
			alert('Please enter alphanumerics.');
			gal_name.focus();
			return false;
		}
		if((image1.value =="" || imgtitle1.value=="") && (image2.value =="" || imgtitle2.value=="") && (image3.value ==""  || imgtitle3.value=="")) {
			alert('Please upload atleast One photo with title.');
			return false;
		}
		else
		{
			if(image1.value!="") {
				if(!checkimage('addfirstphoto','image1')) {
					return false;
				}
				if(Trim(imgtitle1.value)=="")
				{
					alert('Please enter the title1.');
					imgtitle1.focus();
					return false;
				}
				if(!charsonly(imgtitle1.value)) {
					alert('Title1 accepts only alphanumeric values');
					imgtitle1.focus();
					return false;
				}

			}
			if(image2.value!="")
			{
				if(!checkimage('addfirstphoto','image2'))
				{
					return false;
				}
				if(Trim(imgtitle2.value)=="")
				{
					alert('Please enter the title2.');
					imgtitle2.focus();
				}
				if(!charsonly(imgtitle2.value)) {
					alert('Title2 accepts only alphanumeric values');
					imgtitle2.focus();
					return false;
				}

			}
			if(image3.value!="")
			{
				if(!checkimage('addfirstphoto','image3'))
				{
					return false;
				}
				if(Trim(imgtitle3.value)=="")
				{
					alert('Please enter the title3.');
					imgtitle3.focus();
				}
				if(!charsonly(imgtitle3.value)) {
					alert('Title3 accepts only alphanumeric values');
					imgtitle3.focus();
					return false;
				}
			}
		}
	}
	return true;
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
function chk_RequestId(selid) {
	document.getElementById('hid_acceptid').value=selid;
}

function chk_RequesteventId(eventid, inviteuserid) {
	//alert(eventid);	alert(inviteuserid);
	document.getElementById('hid_accepteventid').value=eventid;
	document.getElementById('hid_invuserid').value=inviteuserid;
}

function delfunction(value){
var r=confirm("Are you sure you want to delete this photo?");
if (r==true)
  {
  //location.href="managegallery.php?del="+value;
  location.href="myhome.php?del="+value+"&delete=yes";
  }
else
  {

  }
}


function delstories(value){
var r=confirm("Are you sure you want to delete this story?");
if (r==true)
  {
  //location.href="managegallery.php?del="+value;
  location.href="createstories.php?del="+value;
  }
else
  {

  }
}

function delfavtag(id){
	var r=confirm("Are you sure you want to delete this course from tag?");
	if (r==true)  {
		deltagcourse(id)
	}
}
function delvideos(value){
//	alert(value);
	var r=confirm("Are you sure you want to delete this video?");
	if (r==true) {
	 	location.href="myvideos.php?id=all&delvid="+value;
	}
}

function delvideosown(value){
	//alert(value);
	var r=confirm("Are you sure you want to delete this video?");
	if (r==true) {
	 location.href="videosown.php?id=all&delvid="+value;
	}
}
function loginalert(aword)
{
	alert("Please login to "+aword);
	parent.window.location.href="index.php";
}
function chk_TeeName(objid,option) {
	if(option=="in") {
		if(document.getElementById(objid).value=="Tee Name")
			document.getElementById(objid).value="";
	}
	if(option=="out") {
		if(document.getElementById(objid).value=="")
			document.getElementById(objid).value="Tee Name";
	}
}
function chk_Teeselection(obj) {
	if(obj.value=="Other") {
		document.getElementById('div_teeselname').style.display="block";
	} else {
		document.getElementById('div_teeselname').style.display="none";
	}
}
function chk_Playerselection(obj) {
	if(document.getElementById('playersplayed_'+obj).value=="Other") {
		document.getElementById('div_playselname_'+obj).style.display="block";
	} else {
		document.getElementById('div_playselname_'+obj).style.display="none";
	}
}
function Calculate_TotYardage(comid,obj) {
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Number only.');
			});
			obj.value="";
		}
	}
	if(document.getElementById("txt_hole1_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole1_"+comid).value);
	if(document.getElementById("txt_hole2_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole2_"+comid).value);
	if(document.getElementById("txt_hole3_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole3_"+comid).value);
	if(document.getElementById("txt_hole4_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole4_"+comid).value);
	if(document.getElementById("txt_hole5_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole5_"+comid).value);
	if(document.getElementById("txt_hole6_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole6_"+comid).value);
	if(document.getElementById("txt_hole7_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole7_"+comid).value);
	if(document.getElementById("txt_hole8_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole8_"+comid).value);
	if(document.getElementById("txt_hole9_"+comid).value!="")
		inval +=parseInt(document.getElementById("txt_hole9_"+comid).value);

	if(document.getElementById("txt_hole10_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole10_"+comid).value);
	if(document.getElementById("txt_hole11_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole11_"+comid).value);
	if(document.getElementById("txt_hole12_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole12_"+comid).value);
	if(document.getElementById("txt_hole13_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole13_"+comid).value);
	if(document.getElementById("txt_hole14_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole14_"+comid).value);
	if(document.getElementById("txt_hole15_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole15_"+comid).value);
	if(document.getElementById("txt_hole16_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole16_"+comid).value);
	if(document.getElementById("txt_hole17_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole17_"+comid).value);
	if(document.getElementById("txt_hole18_"+comid).value!="")
		outval +=parseInt(document.getElementById("txt_hole18_"+comid).value);

	document.getElementById('txt_in_'+comid).value=inval;
	document.getElementById('txt_out_'+comid).value=outval;
	document.getElementById('txt_tot_'+comid).value=parseInt(outval)+parseInt(inval);
}
function Calculate_TotPar(obj) {
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Number only.');
			});
			obj.value="";
		}
	}
	if(document.getElementById("txt_par1").value!="")
		inval +=parseInt(document.getElementById("txt_par1").value);
	if(document.getElementById("txt_par2").value!="")
		inval +=parseInt(document.getElementById("txt_par2").value);
	if(document.getElementById("txt_par3").value!="")
		inval +=parseInt(document.getElementById("txt_par3").value);
	if(document.getElementById("txt_par4").value!="")
		inval +=parseInt(document.getElementById("txt_par4").value);
	if(document.getElementById("txt_par5").value!="")
		inval +=parseInt(document.getElementById("txt_par5").value);
	if(document.getElementById("txt_par6").value!="")
		inval +=parseInt(document.getElementById("txt_par6").value);
	if(document.getElementById("txt_par7").value!="")
		inval +=parseInt(document.getElementById("txt_par7").value);
	if(document.getElementById("txt_par8").value!="")
		inval +=parseInt(document.getElementById("txt_par8").value);
	if(document.getElementById("txt_par9").value!="")
		inval +=parseInt(document.getElementById("txt_par9").value);

	if(document.getElementById("txt_par10").value!="")
		outval +=parseInt(document.getElementById("txt_par10").value);
	if(document.getElementById("txt_par11").value!="")
		outval +=parseInt(document.getElementById("txt_par11").value);
	if(document.getElementById("txt_par12").value!="")
		outval +=parseInt(document.getElementById("txt_par12").value);
	if(document.getElementById("txt_par13").value!="")
		outval +=parseInt(document.getElementById("txt_par13").value);
	if(document.getElementById("txt_par14").value!="")
		outval +=parseInt(document.getElementById("txt_par14").value);
	if(document.getElementById("txt_par15").value!="")
		outval +=parseInt(document.getElementById("txt_par15").value);
	if(document.getElementById("txt_par16").value!="")
		outval +=parseInt(document.getElementById("txt_par16").value);
	if(document.getElementById("txt_par17").value!="")
		outval +=parseInt(document.getElementById("txt_par17").value);
	if(document.getElementById("txt_par18").value!="")
		outval +=parseInt(document.getElementById("txt_par18").value);

	document.getElementById('txt_inpar').value=inval;
	document.getElementById('txt_outpar').value=outval;
	document.getElementById('txt_totpar').value=parseInt(outval)+parseInt(inval);
}
function Calculate_Tothandi(obj) {
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			Ext.onReady(function(){
			Ext.MessageBox.alert(alertname, '-Please enter Number only.');
			});
			obj.value="";
		}
	}
	if(document.getElementById("txt_handi1").value!="")
		inval +=parseInt(document.getElementById("txt_handi1").value);
	if(document.getElementById("txt_handi2").value!="")
		inval +=parseInt(document.getElementById("txt_handi2").value);
	if(document.getElementById("txt_handi3").value!="")
		inval +=parseInt(document.getElementById("txt_handi3").value);
	if(document.getElementById("txt_handi4").value!="")
		inval +=parseInt(document.getElementById("txt_handi4").value);
	if(document.getElementById("txt_handi5").value!="")
		inval +=parseInt(document.getElementById("txt_handi5").value);
	if(document.getElementById("txt_handi6").value!="")
		inval +=parseInt(document.getElementById("txt_handi6").value);
	if(document.getElementById("txt_handi7").value!="")
		inval +=parseInt(document.getElementById("txt_handi7").value);
	if(document.getElementById("txt_handi8").value!="")
		inval +=parseInt(document.getElementById("txt_handi8").value);
	if(document.getElementById("txt_handi9").value!="")
		inval +=parseInt(document.getElementById("txt_handi9").value);

	if(document.getElementById("txt_handi10").value!="")
		outval +=parseInt(document.getElementById("txt_handi10").value);
	if(document.getElementById("txt_handi11").value!="")
		outval +=parseInt(document.getElementById("txt_handi11").value);
	if(document.getElementById("txt_handi12").value!="")
		outval +=parseInt(document.getElementById("txt_handi12").value);
	if(document.getElementById("txt_handi13").value!="")
		outval +=parseInt(document.getElementById("txt_handi13").value);
	if(document.getElementById("txt_handi14").value!="")
		outval +=parseInt(document.getElementById("txt_handi14").value);
	if(document.getElementById("txt_handi15").value!="")
		outval +=parseInt(document.getElementById("txt_handi15").value);
	if(document.getElementById("txt_handi16").value!="")
		outval +=parseInt(document.getElementById("txt_handi16").value);
	if(document.getElementById("txt_handi17").value!="")
		outval +=parseInt(document.getElementById("txt_handi17").value);
	if(document.getElementById("txt_handi18").value!="")
		outval +=parseInt(document.getElementById("txt_handi18").value);

	document.getElementById('txt_inhandi').value=inval;
	document.getElementById('txt_outhandi').value=outval;
	document.getElementById('txt_tothandi').value=parseInt(outval)+parseInt(inval);
}

function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	//var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		//alert( myMsg );
			Ext.MessageBox.alert(alertname, 'Caps Lock is On.<br>To prevent entering your password incorrectly,<br>you should press Caps Lock to turn it off.');

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
			Ext.MessageBox.alert(alertname, 'Caps Lock is On.<br>To prevent entering your password incorrectly,<br>you should press Caps Lock to turn it off.');

	}
}
function paging_other(formobj,n) {
	document.getElementById('PageNo').value=n;
	alert('1');
	document.frmmapsearch.action='indexmap_result.php';
	alert('2');
	document.frmmapsearch.submit();
	alert('3');
}

//function for courses
/*function opencoursestates(){

	var urls = "coursestates.php";
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=700px,height=500px,center=1,resize=0,scrolling=1')
}*/
//function to open new popup for courseview...
function opencoursewindow(value1, value2){
	var urls = value1+"-"+value2+".html";
	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=900px,height=600px,center=1,resize=0,scrolling=1')
}
//function for open video
function openvideo(id){

	var urls = "showvideo.php?id="+id;
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=500px,height=500px,center=1,resize=0,scrolling=1')
}

//function to add photos for golf courses
function addgolfphotos(id){
//alert(id);
	var urls = "uploadgolfphoto.php?gcid="+id;
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=450px,height=350px,center=1,resize=0,scrolling=1')
}
//function to add photos for golf courses
function addgolfvideos(id){
//alert(id);
	var urls = "uploadgolfvideos.php?gcid="+id;
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=450px,height=350px,center=1,resize=0,scrolling=1')
}
//function to add photos for golf courses
/*function viewscorecard(id){
//alert(id);
	var urls = "addscore.php?cid="+id;
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=800px,height=400px,center=1,resize=0,scrolling=1')
}*/

//function to upload video...
function uploadvideo(){

	var urls = "myvideofile.php";
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=450px,height=370px,center=1,resize=0,scrolling=1')
}
function chk_TeeNameVal(objid) {
	if(yararray.length>0) {
		for(i=0;i<yararray.length;i++) {
			if(document.getElementById(objid).value==yararray[i]) {
				alert('This tee name scorecard already available for this golf course.');
				document.getElementById(objid).value="";
				return false;
			}
		}
	}
}
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode;
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
	input.value = input.value.slice(0, len);
		try {
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
		catch(er){

		}
	}
	function containsElement(arr, ele) {
	var found = false, index = 0;
	while(!found && index < arr.length)
	if(arr[index] == ele)
	found = true;
	else
	index++;
	return found;
	}
	function getIndex(input) {
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
	if (input.form[i] == input)index = i;
	else i++;
	return index;
	}
	return true;
}

function addTotalnew(obj,option) {
	var len=18;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
				}
				document.getElementById('div_out_score').innerHTML=outval;
				document.getElementById('div_in_score').innerHTML=inval;
				document.getElementById("total_score_value_hidd").value=parseInt(outval)+parseInt(inval);
				if(document.getElementById("total_score_value_hidd").value==0){
				document.getElementById('div_tot_score').innerHTML='<span class="addredtee"><input type="text" name="txt_tot_score" id="txt_tot_score" maxlength="5" class="scoretxtbox" onKeyUp=\'return return readonlyautokeyscore(this);\' value="Total Score"  style="width:25px" onFocus="getvalue(\'Total Score\',this);" onBlur="putvaluenew(\'Total Score\',this);" /></span>';
				}else{
				document.getElementById('div_tot_score').innerHTML=parseInt(outval)+parseInt(inval);
					}
			}

		}

	}
	return false
}
function addTotalnewedit(obj,option) {
	var len=18;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
				}
				document.getElementById('div_out_score').innerHTML=outval;
				document.getElementById('div_in_score').innerHTML=inval;
				//document.getElementById("total_score_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_scoresess").value=parseInt(outval)+parseInt(inval);
/*				if(document.getElementById("total_score_value_hidd").value==0){
				document.getElementById('div_tot_score').innerHTML='<span class="addredtee"><input type="text" name="txt_tot_score" id="txt_tot_score" maxlength="5" class="scoretxtbox" onKeyUp=\'return return readonlyautokeyscore(this);\' value="Total Score"  style="width:75px" onFocus="getvalue(\'Total Score\',this);" onBlur="putvaluenew(\'Total Score\',this);" /></span>';
				}else{*/
				//document.getElementById('div_tot_score').innerHTML=parseInt(outval)+parseInt(inval);
				//	}
			}
			if(document.getElementById('txt_hole'+i+'_score').value=="" || document.getElementById('txt_hole'+i+'_score').value==0) {
				document.getElementById("total_score_value_hidd").value=0;
			}

		}

	}
	if(option=="put") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_put').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
				}
				document.getElementById('div_out_put').innerHTML=outval;
				document.getElementById('div_in_put').innerHTML=inval;
				//document.getElementById("total_put_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_putsess").value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_put').value=="" || document.getElementById('txt_hole'+i+'_put').value==0) {
				document.getElementById("total_put_value_hidd").value=0;
			}
		}

	}
	if(option=="fair") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_fair').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
				}
				document.getElementById('div_out_fair').innerHTML=outval;
				document.getElementById('div_in_fair').innerHTML=inval;
				//document.getElementById("total_fair_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_fairsess").value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_fair').value=="" || document.getElementById('txt_hole'+i+'_fair').value==0) {
				document.getElementById("total_fair_value_hidd").value=0;
			}
		}

	}
	if(option=="gir") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_gir').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
				}
				document.getElementById('div_out_gir').innerHTML=outval;
				document.getElementById('div_in_gir').innerHTML=inval;
				//document.getElementById("total_gir_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_girsess").value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_gir').value=="" || document.getElementById('txt_hole'+i+'_gir').value==0) {

				document.getElementById("total_gir_value_hidd").value=0;
			}
		}

	}
	if(option=="sandy") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_sandy').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
				}
				document.getElementById('div_out_sandy').innerHTML=outval;
				document.getElementById('div_in_sandy').innerHTML=inval;
				//document.getElementById("total_sandy_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_sandysess").value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_sandy').value=="" || document.getElementById('txt_hole'+i+'_sandy').value==0) {

				document.getElementById("total_sandy_value_hidd").value=0;
			}
		}

	}
	if(option=="scramble") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_scramble').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
				}
				document.getElementById('div_out_scramble').innerHTML=outval;
				document.getElementById('div_in_scramble').innerHTML=inval;
				//document.getElementById("total_scramble_value_hidd").value=parseInt(outval)+parseInt(inval);
				document.getElementById("total_scramblesess").value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_scramble').value=="" || document.getElementById('txt_hole'+i+'_scramble').value==0) {

				document.getElementById("total_scramble_value_hidd").value=0;
			}
		}

	}
	return false
}

function addTotalnewall(obj,option,did) {
	var len=18;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
				}
				document.getElementById('div_out_score_'+did).innerHTML=outval;
				document.getElementById('div_in_score_'+did).innerHTML=inval;
				document.getElementById('total_score_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				if(document.getElementById('total_score_value_hidd_'+did).value==0){
					document.getElementById('div_tot_score_'+did).innerHTML="<span class='addredtee'><input type='text' name='txt_tot_score' id='txt_tot_score' maxlength='5' class='scoretxtbox' onKeyUp='return readonlyautokeyscoreall(this,"+did+");' value='Total Score'  style='width:25px' onFocus='getvalue(\"Total Score\",this);' onBlur='putvaluenewall('Total Score',this,"+did+");' /></span>";
				}else{
				document.getElementById('div_tot_score_'+did).innerHTML=parseInt(outval)+parseInt(inval);
					}
			}

		}

	}
	return false
}

function addTotalnewalledit(obj,option,did) {
	var len=18;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
				}
				document.getElementById('div_out_score_'+did).innerHTML=outval;
				document.getElementById('div_in_score_'+did).innerHTML=inval;
				//document.getElementById('total_score_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_scoreall_'+did).value=parseInt(outval)+parseInt(inval);
/*				if(document.getElementById('total_score_value_hidd_'+did).value==0){
					document.getElementById('div_tot_score_'+did).innerHTML="<span class='addredtee'><input type='text' name='txt_tot_score' id='txt_tot_score' maxlength='5' class='scoretxtbox' onKeyUp='return readonlyautokeyscoreall(this,"+did+");' value='Total Score'  style='width:75px' onFocus='getvalue(\"Total Score\",this);' onBlur='putvaluenewall('Total Score',this,"+did+");' /></span>";
			}else{*/
			//	document.getElementById('div_tot_score_'+did).innerHTML=parseInt(outval)+parseInt(inval);
				//	}
			}
			if(document.getElementById('txt_hole'+i+'_score_'+did).value=="" || document.getElementById('txt_hole'+i+'_score_'+did).value==0) {
				document.getElementById('total_score_value_hidd_'+did).value=0;
			}

		}

	}
	if(option=="put") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_put_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_put_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_put_'+did).value);
				}
				document.getElementById('div_out_put_'+did).innerHTML=outval;
				document.getElementById('div_in_put_'+did).innerHTML=inval;
				//document.getElementById('total_put_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_putall_'+did).value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_put_'+did).value=="" || document.getElementById('txt_hole'+i+'_put_'+did).value==0) {

				document.getElementById('total_put_value_hidd_'+did).value=0;
			}
		}
	}

	if(option=="fair") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_fair_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_fair_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_fair_'+did).value);
				}
				document.getElementById('div_out_fair_'+did).innerHTML=outval;
				document.getElementById('div_in_fair_'+did).innerHTML=inval;
				//document.getElementById('total_fair_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_fairall_'+did).value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_fair_'+did).value=="" || document.getElementById('txt_hole'+i+'_fair_'+did).value==0) {

				document.getElementById('total_fair_value_hidd_'+did).value=0;
			}
		}
	}

	if(option=="gir") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_gir_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_gir_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_gir_'+did).value);
				}
				document.getElementById('div_out_gir_'+did).innerHTML=outval;
				document.getElementById('div_in_gir_'+did).innerHTML=inval;
				//document.getElementById('total_gir_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_girall_'+did).value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_gir_'+did).value=="" || document.getElementById('txt_hole'+i+'_gir_'+did).value==0) {

				document.getElementById('total_gir_value_hidd_'+did).value=0;
			}
		}
	}

	if(option=="sandy") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_sandy_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_sandy_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_sandy_'+did).value);
				}
				document.getElementById('div_out_sandy_'+did).innerHTML=outval;
				document.getElementById('div_in_sandy_'+did).innerHTML=inval;
				//document.getElementById('total_sandy_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_sandyall_'+did).value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_sandy_'+did).value=="" || document.getElementById('txt_hole'+i+'_sandy_'+did).value==0) {

				document.getElementById('total_sandy_value_hidd_'+did).value=0;
			}
		}
	}

	if(option=="scramble") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_scramble_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_scramble_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_scramble_'+did).value);
				}
				document.getElementById('div_out_scramble_'+did).innerHTML=outval;
				document.getElementById('div_in_scramble_'+did).innerHTML=inval;
				//document.getElementById('total_scramble_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				document.getElementById('total_scrambleall_'+did).value=parseInt(outval)+parseInt(inval);
			}
			if(document.getElementById('txt_hole'+i+'_scramble_'+did).value=="" || document.getElementById('txt_hole'+i+'_scramble_'+did).value==0) {

				document.getElementById('total_scramble_value_hidd_'+did).value=0;
			}
		}
	}
	return false
}
function addTotalyar(obj,option) {
	var len=document.getElementById('sel_holes').value;
//	alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="length") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_yar').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_yar').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_yar').value);
				}
			}
		}

		document.getElementById('div_out_length').innerHTML=outval;
		document.getElementById('div_in_length').innerHTML=inval;
		document.getElementById('div_tot_length').innerHTML=parseInt(outval)+parseInt(inval);
	}
}
function checknumber(obj) {
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";

		}
	}
}

function addTotal(obj,option) {
	var len=document.getElementById('sel_holes').value;

	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="length") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_len').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				}
			}
		}
		document.getElementById('div_out_length').innerHTML=outval;
		document.getElementById('div_in_length').innerHTML=inval;
		document.getElementById('div_tot_length').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="adlength") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_len').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				}
			}
		}
		document.getElementById('div_out_length').innerHTML=outval;
		document.getElementById('div_in_length').innerHTML=inval;
		document.getElementById('div_tot_length').innerHTML=parseInt(outval)+parseInt(inval);
		document.getElementById("totalyardage").value=parseInt(outval)+parseInt(inval);
	}

	if(option=="par") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_par').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				}
			}
		}
		document.getElementById('div_out_par').innerHTML=outval;
		document.getElementById('div_in_par').innerHTML=inval;
		document.getElementById('div_tot_par').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="adpar") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_par').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				}
			}
		}
		document.getElementById('div_out_par').innerHTML=outval;
		document.getElementById('div_in_par').innerHTML=inval;
		document.getElementById('div_tot_par').innerHTML=parseInt(outval)+parseInt(inval);
		document.getElementById("totalpar").value=parseInt(outval)+parseInt(inval);
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score').value);
				}
			}
		}

		document.getElementById('div_out_score').innerHTML=outval;
		document.getElementById('div_in_score').innerHTML=inval;
		document.getElementById('div_tot_score').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="put") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_put').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
				}
			}
		}
		document.getElementById('div_out_put').innerHTML=outval;
		document.getElementById('div_in_put').innerHTML=inval;
		document.getElementById('div_tot_put').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="fair") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_fair').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
				}
			}
		}
		document.getElementById('div_out_fair').innerHTML=outval;
		document.getElementById('div_in_fair').innerHTML=inval;
		document.getElementById('div_tot_fair').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="gir") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_gir').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
				}
			}
		}
		document.getElementById('div_out_gir').innerHTML=outval;
		document.getElementById('div_in_gir').innerHTML=inval;
		document.getElementById('div_tot_gir').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="sandy") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_sandy').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
				}
			}
		}
		document.getElementById('div_out_sandy').innerHTML=outval;
		document.getElementById('div_in_sandy').innerHTML=inval;
		document.getElementById('div_tot_sandy').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="scramble") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_scramble').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
				}
			}
		}
		document.getElementById('div_out_scramble').innerHTML=outval;
		document.getElementById('div_in_scramble').innerHTML=inval;
		document.getElementById('div_tot_scramble').innerHTML=parseInt(outval)+parseInt(inval);
	}
	return false;
}

function addPlayerScores(obj,option) {
	var len=document.getElementById('sel_holes').value;
	var nofoplayers=document.getElementById('nofoplayers').value;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="length") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_len').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_len').value);
				}
			}
		}
		document.getElementById('div_out_length').innerHTML=outval;
		document.getElementById('div_in_length').innerHTML=inval;
		document.getElementById('div_tot_length').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="par") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_par').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_par').value);
				}
			}
		}
		document.getElementById('div_out_par').innerHTML=outval;
		document.getElementById('div_in_par').innerHTML=inval;
		document.getElementById('div_tot_par').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="score") {

		for(j=1; j<=nofoplayers;j++) {
			for(i=1;i<=len;i++) {
				if(document.getElementById('txt_hole'+i+'_score_'+j).value!="") {
					if(i<=9) {

						outval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+j).value);

						//alert(outval);
					} else {

						inval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+j).value);
					}
				}
			}
		document.getElementById('div_out_score_'+j).innerHTML=outval;
		document.getElementById('div_in_score_'+j).innerHTML=inval;
		document.getElementById('div_tot_score_'+j).innerHTML=parseInt(outval)+parseInt(inval);
		}
	}
	if(option=="put") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_put').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_put').value);
				}
			}
		}
		document.getElementById('div_out_put').innerHTML=outval;
		document.getElementById('div_in_put').innerHTML=inval;
		document.getElementById('div_tot_put').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="fair") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_fair').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_fair').value);
				}
			}
		}
		document.getElementById('div_out_fair').innerHTML=outval;
		document.getElementById('div_in_fair').innerHTML=inval;
		document.getElementById('div_tot_fair').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="gir") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_gir').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_gir').value);
				}
			}
		}
		document.getElementById('div_out_gir').innerHTML=outval;
		document.getElementById('div_in_gir').innerHTML=inval;
		document.getElementById('div_tot_gir').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="sandy") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_sandy').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_sandy').value);
				}
			}
		}
		document.getElementById('div_out_sandy').innerHTML=outval;
		document.getElementById('div_in_sandy').innerHTML=inval;
		document.getElementById('div_tot_sandy').innerHTML=parseInt(outval)+parseInt(inval);
	}
	if(option=="scramble") {
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_scramble').value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_scramble').value);
				}
			}
		}
		document.getElementById('div_out_scramble').innerHTML=outval;
		document.getElementById('div_in_scramble').innerHTML=inval;
		document.getElementById('div_tot_scramble').innerHTML=parseInt(outval)+parseInt(inval);
	}
	return false;
}

function chk_AddScore(frm) {
	var len=document.getElementById('sel_holes').value;
	var holeflag=false;
	var parflag=false;
	var parincflag=false;
	var handiflag=false;
	var slopeflag=false;
	var rateflag=false;
/*	 if(frm.mode.value!="edit") {
		if(frm.sel_tee.value=="") {
			alert('Please select tee value.');
			return false;
		} else if(frm.sel_tee.value=="Other" && frm.txt_teename.value=="") {
			alert('Please enter tee value.');
			return false;
		}
	}else if(frm.mode.value!="edit") {
		if(yararray.length>0) {
			for(i=0;i<yararray.length;i++) {
				if(document.getElementById('sel_tee').value==yararray[i]) {
					alert('This tee name scorecard already available for this golf course.');
					document.getElementById('sel_tee').value="";
					return false;
				}
			}
		}
	}*/
	if(frm.txt_teename.value=="") {
		alert("Please enter the tee name.");
		frm.txt_teename.focus();
		return false;
	}
	if(frm.txt_slope.value=="") {
		alert("Please enter the slope value.");
		frm.txt_slope.focus();
		return false;
	} else if(!Onlydigits(frm.txt_slope.value)) {
		alert('Please enter valid slope value.');
		frm.txt_slope.focus();
		return false;
	}
	if(frm.txt_rate.value=="") {
		alert('Please enter the rating value.');
		frm.txt_rate.focus();
		return false;
	} else if(!DigitsAndDot(frm.txt_rate)) {
		alert('Please enter valid rating value.');
		frm.txt_rate.focus();
		return false;
	}
	for(i=1;i<=len;i++) {
		if(document.getElementById('txt_hole'+i+'_len').value=="") {
			holeflag=true;
			break;
		}
	}
	if(holeflag==true) {
		alert('Please enter length for all holes.');
		return false;
	}
	for(j=1;j<=len;j++) {
		if(document.getElementById('txt_hole'+j+'_par').value=="") {
			parflag=true;
			break;
		} else {
			if(document.getElementById('txt_hole'+j+'_par').value!=3 && document.getElementById('txt_hole'+j+'_par').value!=4 && document.getElementById('txt_hole'+j+'_par').value!=5) {
				parincflag=true;
				break;
			}
		}
	}
	if(parflag==true) {
		alert('Please enter par value for all holes.');
		return false;
	}
	if(parincflag==true) {
		alert('Please enter valid par value - must be 3,4 or 5.');
		return false;
	}
	for(k=1;k<=len;k++) {
		if(document.getElementById('txt_hole'+k+'_handi').value=="") {
			handiflag=true;
			break;
		}
	}
	if(handiflag==true) {
		alert('Please enter handicap value for all holes.');
		return false;
	}
}
function change_Holes(obj) {
	if(parseInt(obj.value)==18) {
		document.getElementById('div_secondhalsf').style.display='block';
	}
	if(parseInt(obj.value)==9) {

		document.getElementById('div_secondhalsf').style.display='none';
	}
}

function starvote(frm){
	if(!RadioValidate(frm,'rad_green')) {
			alert('Please rate the Fairway/Green Condition.');
		return false;
	}
	if(!RadioValidate(frm,'rad_fairway')) {
			alert('Please rate the Design Variety.');
		return false;
	}
	if(!RadioValidate(frm,'rad_diff')) {
			alert('Please rate the Scoreability.');
		return false;
	}
	if(!RadioValidate(frm,'rad_design')) {
			alert('Please rate the Memorability.');
		return false;
	}
	if(!RadioValidate(frm,'rad_beauty')) {
			alert('Please rate the Raw Beauty.');
		return false;
	}
	if(!RadioValidate(frm,'rad_operation')) {
			alert('Please rate the Clubhouse-LockerRoom-Overall Operations.');
		return false;
	}
	if(document.getElementById('txta_review').value=='') {
			alert('Please enter the Review.');
		return false;
	}
	return true;
}
function validateformselecttees(frm){

		if(frm.rad_tee.value=="") {
				alert('Please select the tees.');
			return false;
		}
		if(frm.noofplayers.value=="" || frm.noofplayers.value==0) {
			alert('Please enter no of player played.');
			return false;
		}
		return true;

}
function RadioValidate(frmname,objid) {
	var btn = frmname[objid];
	var valid=false;
	for (var x = 0;x <btn.length; x++) {
		if(btn[x].checked==true) {
			valid=true;
			break;
		}
	}
	return valid;
}
function Radiouncheck(frmname,objid) {
	var btn = frmname[objid];
	var valid=false;
	for (var x = 0;x <btn.length; x++) {
		btn[x].checked=false;
	}
	return valid;
}
function chk_AddMyScore(frm) {
	var len=document.getElementById('sel_holes').value;
	var holeflag=false;
	var parflag=false;
	var parincflag=false;
	var handiflag=false;
	var slopeflag=false;
	var rateflag=false;
	var scoreflag=false;
	var scoreincflag=false;
	var putflag=false;
	var putincflag=false;
	var totalscore=0;
	var sloperate=0;
	var courserate=0;
	var adjugsa=0;
	var	addsign="";
	var diffstand=0;
	var handidiff=0;
	var rethandiff=0;

	if(frm.mode.value=="" || frm.tee.value=="new") {
		if(frm.sel_tee.value=="") {
			alert('Please select tee value.');
			return false;
		}
		if(frm.txt_slope.value=="") {
			alert('Please enter the slope value.');
			return false;
		} else if(!Onlydigits(frm.txt_slope.value)) {
			alert('Please enter valid slope value.');
			return false;
		}
		if(frm.txt_rate.value=="") {
			alert('Please enter the rating value.');
			return false;
		} else if(!DigitsAndDot(frm.txt_rate)) {
			alert('Please enter valid rating value.');
			return false;
		}
		for(i=1;i<=len;i++) {
			if(document.getElementById('txt_hole'+i+'_len').value=="") {
				holeflag=true;
				break;
			}
		}
		if(holeflag==true) {
			alert('Please enter length for all holes.');
			return false;
		}
		for(j=1;j<=len;j++) {
			if(document.getElementById('txt_hole'+j+'_par').value=="") {
				parflag=true;
				break;
			} else {
				if(document.getElementById('txt_hole'+j+'_par').value!=3 && document.getElementById('txt_hole'+j+'_par').value!=4 && document.getElementById('txt_hole'+j+'_par').value!=5) {
					parincflag=true;
					break;
				}
			}
		}
		if(parflag==true) {
			alert('Please enter par value for all holes.');
			return false;
		}
		if(parincflag==true) {
			alert('Please enter valid par value - must be 3,4 or 5.');
			return false;
		}
		for(k=1;k<=len;k++) {
			if(document.getElementById('txt_hole'+k+'_handi').value=="") {
				handiflag=true;
				break;
			}
		}
		if(handiflag==true) {
			alert('Please enter handicap value for all holes.');
			return false;
		}
		sloperate=parseFloat(document.getElementById('txt_slope').value);
		courserate=parseFloat(document.getElementById('txt_rate').value);
	} else {
		sloperate=parseFloat(document.getElementById('hid_sloperate').value);
		courserate=parseFloat(document.getElementById('hid_courserate').value);
	}
	for(l=1;l<=len;l++) {
		if(document.getElementById('txt_hole'+l+'_score').value=="" || document.getElementById('txt_hole'+l+'_score').value==0) {
			scoreflag=true;
			break;
		} else {
			if(document.getElementById('txt_hole'+l+'_score').value!=1 && document.getElementById('txt_hole'+l+'_score').value!=2 && document.getElementById('txt_hole'+l+'_score').value!=3 && document.getElementById('txt_hole'+l+'_score').value!=4 && document.getElementById('txt_hole'+l+'_score').value!=5 && document.getElementById('txt_hole'+l+'_score').value!=6 && document.getElementById('txt_hole'+l+'_score').value!=7 && document.getElementById('txt_hole'+l+'_score').value!=8 && document.getElementById('txt_hole'+l+'_score').value!=9) {
				scoreincflag=true;
				break;
			} else {
				totalscore +=parseInt(document.getElementById('txt_hole'+l+'_score').value);
			}
		}

	}
	if(scoreflag==true) {
		alert('Please enter score value for all holes.');
		return false;
	}
	if(scoreincflag==true) {
		alert('Please enter valid score value - must be less than 10.');
		return false;
	}
	for(m=1;m<=len;m++) {
		/*if(document.getElementById('txt_hole'+m+'_put').value=="") {
			putflag=true;
			break;
		} else {*/
		if(document.getElementById('txt_hole'+m+'_put').value!="" && document.getElementById('txt_hole'+m+'_put').value!=0) {
			if(document.getElementById('txt_hole'+m+'_put').value!=1 && document.getElementById('txt_hole'+m+'_put').value!=2 && document.getElementById('txt_hole'+m+'_put').value!=3 && document.getElementById('txt_hole'+m+'_put').value!=4) {
				putincflag=true;
				break;
			}
		}
		//}
	}
	/*if(putflag==true) {
		alert('Please enter put value for all holes.');
		return false;
	}*/
	if(putincflag==true) {
		alert('Please enter valid put value - must be less than 5.');
		return false;
	}
	document.getElementById('hid_totscore').value=totalscore;
	frm.action="addmyscore.php";

	/*if(totalscore>courserate) {
		adjugsa=totalscore-courserate;
		addsign="";
	} else {
		adjugsa=courserate-totalscore;
		addsign="-";
	}
	document.getElementById('hid_totscore').value=totalscore;
	diffstand=adjugsa*113;
	handidiff=(diffstand/sloperate).toFixed(2);
	rethandiff=addsign+handidiff;
	if(confirm("Your handicap differential value is: "+rethandiff)) {
		frm.action="addmyscore.php";
	} else {
		return false;
	}*/
}
function chk_deletemyscore(delid) {
	if(confirm("Do you want to delete this scorecard?")) {
		//alert(delid);
		delscorecard(delid,'');
	}
}
function chk_deletemyscore_otherscreate(delid) {
			//alert(delid);
	if(confirm("Do you want to delete this scorecard?")) {
			//alert(delid);
		delscorecard_otherscreate(delid,'');
	}
}
function chk_deletemyscoreall(delid){
	if(confirm("Do you want to delete this scorecard?")) {
		delscorecard(delid,'all');
	}

}
function chk_deletemyscoreall_otherscreate(delid){

	if(confirm("Do you want to delete this scorecard?")) {
		delscorecard_otherscreate(delid,'all');

	}

}
function loadmyscorediv() {
	parent.document.getElementById('iframe_gallery2').src="viewmyscore.php";
	//window.location.href='viewmyscore.php';
	//parent.$("#countrydivcontainer").load("viewmyscore.php");
}
function closediv() {
	parent.document.getElementById('EmailBox').style.display='none';
	parent.document.getElementById('interVeil').style.visibility="hidden";
}
function ajax_paging(formobj,n){
	formobj.PageNo.value = n;
	AjaxPaging(n,formobj.category.value);
	return false;
}

function chk_Char(objid) {
	//alert('fgdfg');
	document.getElementById(objid).onkeypress=function(e){
	var e=window.event || e
	var keyunicode=e.charCode || e.keyCode
	//Allow alphabetical keys, plus BACKSPACE and SPACE and TAB
	return (keyunicode>=65 && keyunicode<=122 || keyunicode==8 || keyunicode==9 || keyunicode==46 ||  keyunicode==37 || keyunicode==39)? true : false
	}
}

function chk_password(e) {

	var e=window.event || e
	var keyunicode=e.charCode || e.keyCode
	//Allow alphabetical keys, plus BACKSPACE and SPACE and TAB
	return (keyunicode>=65 && keyunicode<=122 || keyunicode>=48 &&  keyunicode<=57 || keyunicode==8 || keyunicode==9 || keyunicode==46 || keyunicode==37 || keyunicode==39 || keyunicode==13)? true : false
}

function validateregister(frm)
{
	
	with(frm)
	{
		if(Trim(fname.value)=='')
		{
			alert("Please enter the first name");
			fname.focus();
			return false;
		}
		if(Trim(lname.value)=='' )
		{
			alert("Please enter the last name");
			lname.focus();
			return false;
		}
		if(Trim(emailid.value) == "")
		{
			alert("Please enter the email.");
			emailid.focus();
			return false;
		}
		
		if(!CheckEmail(emailid.value))
		{
			return false;
		}
		if(Trim(pwd.value) == "")
		{
			alert("Please enter the password.");
			pwd.focus();
			return false;
		}
		if(pwd.value.length < 4)
		{
			alert("Password field should be minimum four characters.");
			pwd.focus();
			return false;
		}
		if(Trim(zipcode.value) == "")
		{
			alert("Please enter the zipcode.");
			zipcode.focus();
			return false;
		}
		if(!IsNumeric(zipcode.value))
		{
			alert("Please enter numeric values.");
			zipcode.focus();
			return false;
		}
		if((zipcode.value.length < 5))
		{
			alert("Please enter minimum five characters.");
			zipcode.focus();
			return false;
		}

	}
	return true;
}

function validatechangepassword(frm){

	with(frm){

		if(Trim(cpasswd.value)=='')
		{
			alert("Please enter the current password");
			cpasswd.focus();
			return false;
		}
		if(cpasswd.value.length < 4)
		{
			alert("Password field should be minimum four characters.");
			cpasswd.focus();
			return false;
		}
		if(Trim(npasswd.value)=='')
		{
			alert("Please enter the new password");
			npasswd.focus();
			return false;
		}
		if(npasswd.value.length < 4)
		{
			alert("Password field should be minimum four characters.");
			npasswd.focus();
			return false;
		}
		if(Trim(cnpasswd.value)=='')
		{
			alert("Please enter the confirm password");
			cnpasswd.focus();
			return false;
		}
		if(cnpasswd.value.length < 4)
		{
			alert("Password field should be minimum four characters.");
			cnpasswd.focus();
			return false;
		}
		if(Trim(npasswd.value)!=Trim(cnpasswd.value))
		{
			alert('Password mismatch');
			cnpasswd.focus();
			return false;
		}
	}
	return true;
}

// To validate addgolfcourses....
function validategolfcourses(frm)
{
	with(frm)
	{
		if(Trim(fname.value)=='')
		{
			alert("Please enter the first name");
			fname.focus();
			return false;
		}
		if(Trim(lname.value)=='')
		{
			alert("Please enter the last name");
			lname.focus();
			return false;
		}
		if(Trim(emailid.value) == "")
		{
			alert("Please enter the email.");
			emailid.focus();
			return false;
		}
		if(!CheckEmail(emailid.value))
		{
			return false;
		}
		if(Trim(city.value)=='' || (!isNaN(city.value)))
		{
			alert("Please enter the city.");
			city.focus();
			return false;
		}
		if(Trim(state.value)=='' || (!isNaN(state.value)))
		{
			alert("Please enter the state.");
			state.focus();
			return false;
		}
		if(Trim(zipcode.value) == "")
		{
			alert("Please enter the zipcode.");
			zipcode.focus();
			return false;
		}
		if(!IsNumeric(zipcode.value))
		{
			alert("Zipcode field should be numeric.");
			zipcode.focus();
			return false;
		}
		if((zipcode.value.length < 5))
		{
			alert("Zipcode field should be minimum five characters .");
			zipcode.focus();
			return false;
		}
		if(Trim(phone.value) == "")
		{
			alert("Please enter the phone number.");
			phone.focus();
			return false;
		}
		if(!IsNumeric(phone.value))
		{
			alert("Phone Number field should be numeric .");
			phone.focus();
			return false;
		}
		if((phone.value.length < 10))
		{
			alert("Phone Number field should be minimum ten characters .");
			phone.focus();
			return false;
		}
		if(Trim(gcname.value)=='' || (!isNaN(gcname.value)))
		{
			alert("Please enter the golf course");
			gcname.focus();
			return false;
		}
	}
	return true;

}


function validateloginchk(frm)
{
	with(frm)
	{
		if(Trim(username.value) =='')
		{
			alert("Please enter email id");
			username.focus();
			return false;
		}
		if(!CheckEmail(username.value))
		{
			username.focus();
			return false;
		}
		if(Trim(password.value) =='')
		{
			alert("Please enter password");
			password.focus();
			return false;
		}
		if(password.value.length < 4)
		{
			alert("Password field should be minimum four characters.");
			password.focus();
			return false;
		}
	}
	return true;
}

function chk_AddCourse(frm) {
	with(frm)
	{
		if(Trim(txt_coursename.value) =='')
		{
			alert("Please enter Course Name");
			txt_coursename.focus();
			return false;
		}
		if(Trim(txt_address.value) =='')
		{
			alert("Please enter Address");
			txt_address.focus();
			return false;
		}
		if(Trim(txt_city.value) =='')
		{
			alert("Please enter City");
			txt_city.focus();
			return false;
		}
		if(Trim(sel_state.value) =='')
		{
			alert("Please enter State");
			sel_state.focus();
			return false;
		}
		if(Trim(txt_zip.value) =='')
		{
			alert("Please enter Zip code");
			txt_zip.focus();
			return false;
		}
		if(Trim(sel_coursetype.value) =='') {
			alert("Please select Course Type");
			sel_coursetype.focus();
			return false;
		}

		//chk Course availablity.
		if(document.getElementById('gcid').value=="") {
			chk_GolfCourse(txt_coursename.value,sel_state.value,txt_zip.value);
		} else {
			document.addcourse.submit();
		}
	}
}
function putvalue(txtval,obj) {
	if(obj.value=='') {
		obj.value=txtval;
	}
}
function getvalue(txtval,obj) {

	if(obj.value==txtval) {
		obj.value='';
	}

}
function readonlyautokeyscore(obj) {
		var len=document.getElementById('sel_holes').value;
		for(i=1;i<=len;i++) {
			document.getElementById('txt_hole'+i+'_score').disabled=true;
		}
		document.getElementById('total_score_value_hidd').value=document.getElementById('txt_tot_score').value;

}
function readonlyautokeyscoreall(obj,did) {

		var len=document.getElementById('sel_holes').value;
		for(i=1;i<=len;i++) {
			document.getElementById('txt_hole'+i+'_score_'+did).disabled=true;
		}
		document.getElementById('total_score_value_hidd_'+did).value=document.getElementById('txt_tot_score_'+did).value;		

}
function putvaluenew(txtval,obj) {
		var len=document.getElementById('sel_holes').value;
	if(obj.value=='') {
		obj.value=txtval;
		for(i=1;i<=len;i++) {
			document.getElementById('txt_hole'+i+'_score').disabled=false;
		}
	}

}
function putvaluenewall(txtval,obj,did) {
		var len=document.getElementById('sel_holes').value;
	if(obj.value=='') {
		obj.value=txtval;
		for(i=1;i<=len;i++) {
			document.getElementById('txt_hole'+i+'_score_'+did).disabled=false;
		}
	}
}
function showhideuserdetails(showhideuserdetailsid,expandid)
{
	var showhideid = document.getElementById(showhideuserdetailsid);
	var style = showhideid.style.display;

	if (style=='none')	{
		showhideid.style.display = "block";
		document.getElementById(expandid).innerHTML='<a href="#" onclick="javascript:showhideuserdetails(\''+showhideuserdetailsid+'\',\''+expandid+'\');return false;"> <img src="images/up_arrow.png" border="0" /></a>&nbsp;';
	} else {
		showhideid.style.display = "none";
		document.getElementById(expandid).innerHTML='<a href="#" onclick="javascript:showhideuserdetails(\''+showhideuserdetailsid+'\',\''+expandid+'\');return false;"> <img src="images/down_arrow.png" border="0" /></a>&nbsp;';
	}
}

function chk_addCmd(frm) {
	if(frm.txta_cmd.value=="") {
		alert('Please enter the comments.');
		return false;
	}
	return true;
}



/*Browser Height JS*/

function setHeight(){
var y, myHeight;

// for all except Explorer
if (self.innerHeight) {
y = self.innerHeight;
myHeight =  y-310 + 'px';

// Explorer 6 Strict Mode
}
else if (document.documentElement
&& document.documentElement.clientHeight) {
y = document.documentElement.clientHeight;
myHeight = y-310 + 'px';

// other Explorers
} else if (document.body) {
y = document.body.clientHeight;
myHeight = y-310;
}
document.getElementById('setmyheight').style.height=myHeight;
}
function chk_AddScoreTee(frm) {
	var len=18;
	var holeflag=false;
	var parflag=false;
	var parincflag=false;
	var handiflag=false;
	var slopeflag=false;
	var rateflag=false;
	if(frm.txt_slope.value=="") {
		alert("Please enter the slope value.");
		return false;
	} else if(!Onlydigits(frm.txt_slope.value)) {
		alert('Please enter valid slope value.');
		return false;
	}
	if(frm.txt_rate.value=="") {
		alert('Please enter the rating value.');
		return false;
	} else if(!DigitsAndDot(frm.txt_rate)) {
		alert('Please enter valid rating value.');
		return false;
	}
	for(i=1;i<=len;i++) {
		if(document.getElementById('txt_hole'+i+'_len').value=="") {
			holeflag=true;
			break;
		}
	}
	if(holeflag==true) {
		alert('Please enter length for all holes.');
		return false;
	}
	for(j=1;j<=len;j++) {
		if(document.getElementById('txt_hole'+j+'_par').value=="") {
			parflag=true;
			break;
		} else {
			if(document.getElementById('txt_hole'+j+'_par').value!=3 && document.getElementById('txt_hole'+j+'_par').value!=4 && document.getElementById('txt_hole'+j+'_par').value!=5) {
				parincflag=true;
				break;
			}
		}
	}
	if(parflag==true) {
		alert('Please enter par value for all holes.');
		return false;
	}
	if(parincflag==true) {
		alert('Please enter valid par value - must be 3,4 or 5.');
		return false;
	}
	for(k=1;k<=len;k++) {
		if(document.getElementById('txt_hole'+k+'_handi').value=="") {
			handiflag=true;
			break;
		}
	}
	if(handiflag==true) {
		alert('Please enter handicap value for all holes.');
		return false;
	}/**/
}
function chk_teeAdd(frm) {
	with(frm) {
		if(Trim(txt_teename.value)=="") {
			alert('Please enter Tee name.');
			txt_teename.focus();
			return false;
		}
		if(Trim(txt_slope.value)=="") {
			alert('Please enter Slope Rating.');
			txt_slope.focus();
			return false;
		} else if(!Onlydigits(txt_slope.value)) {
			alert('Please enter valid Slope Rating.');
			txt_slope.focus();
			return false;
		}
		if(Trim(txt_rating.value)=="") {
			alert('Please enter Course Rating.');
			txt_rating.focus();
			return false;
		} else if(!DigitsAndDot(txt_rating)) {
			alert('Please enter valid Course Rating.');
			txt_rating.focus();
			return false;
		}
		if(Trim(txt_yardage.value)=="") {
			alert('Please enter Yardage.');
			txt_yardage.focus();
			return false;
		} else if(!Onlydigits(txt_yardage.value)) {
			alert('Please enter valid Yardage.');
			txt_yardage.focus();
			return false;
		}
		if(Trim(txt_par.value)=="") {
			alert('Please enter Par.');
			txt_par.focus();
			return false;
		} else if(!Onlydigits(txt_par.value)) {
			alert('Please enter valid Par.');
			txt_par.focus();
			return false;
		}
	}
}
function validateformofaddplayersnew(frm){
	with(frm) {
		
        var tot = document.getElementById("nofoplayers").value;

			if(Trim(document.getElementById("playeddate").value)=="") {
				alert('Please choose the Date.');
				document.getElementById("playeddate").focus();
				return false;
			}	
			if(isNaN(document.getElementById("div_tot_score").innerHTML)==false)
			{
				for (var i=1; i<=18; i++)
				{
					if(Trim(document.getElementById("txt_hole"+i+"_score").value)=="") {
						alert('Please enter your scores for all 18 holes.\n At this time we are not supporting 9-hole game scores.');
						document.getElementById("txt_hole"+i+"_score").focus();
						return false;
					} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score").value)) {
						alert('Please enter valid score values.');
						document.getElementById("txt_hole"+i+"_score").focus();
						return false;
					}
				}	
			}
			if(document.getElementById("nofoplayers").value!='' || document.getElementById("nofoplayers").value!=0)
			{
				var noofothers = document.getElementById("nofoplayers").value;
				for (var j=1; j<=noofothers; j++)
				{ 
					if(document.getElementById("playersplayed_"+j).value!=0){
						if(document.getElementById("playersplayed_"+j).value=="Other")
						{
							if(Trim(document.getElementById("txt_playname_"+j).value)=="") {
								alert('Please enter the player name.');
								document.getElementById("txt_playname_"+j).focus();
								return false;
							}
							if(document.getElementById("total_score_value_hidd_"+j).value==0){
								if(!Onlydigits(document.getElementById("txt_tot_score_"+j).value)) {
								alert('To create a new scorecard for your game,Please enter at least one score for a player.\nYou only have two options when entering a score for a round.  \nEither enter the Total Score, or enter a number in EVERY SINGLE BOX from the 18 holes');
									document.getElementById("txt_tot_score_"+j).focus();
								return false;
								}
							}							
							for (var i=1; i<=18; i++)
							{
								if(Trim(document.getElementById("txt_hole"+i+"_score_"+j).value)=="") {
									alert('Please enter your scores for all 18 holes.\n At this time we are not supporting 9-hole game scores.');
									document.getElementById("txt_hole"+i+"_score_"+j).focus();
									return false;
								} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score_"+j).value)) {
									alert('Please enter valid score values.');
									document.getElementById("txt_hole"+i+"_score_"+j).focus();
									return false;
								}
							}							
						}else{
							if(document.getElementById("total_score_value_hidd_"+j).value==0){
								if(!Onlydigits(document.getElementById("txt_tot_score_"+j).value)) {
								alert('To create a new scorecard for your game,Please enter at least one score for a player.\nYou only have two options when entering a score for a round.  \nEither enter the Total Score, or enter a number in EVERY SINGLE BOX from the 18 holes');
									document.getElementById("txt_tot_score_"+j).focus();
								return false;
								}
							}								
							if(isNaN(document.getElementById("div_tot_score_"+j).innerHTML)==false)
							{	
								for (var i=1; i<=18; i++)
								{
									if(Trim(document.getElementById("txt_hole"+i+"_score_"+j).value)=="") {
										alert('Please enter your scores for all 18 holes.\n At this time we are not supporting 9-hole game scores.');
										document.getElementById("txt_hole"+i+"_score_"+j).focus();
										return false;
									} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score_"+j).value)) {
										alert('Please enter valid score values.');
										document.getElementById("txt_hole"+i+"_score_"+j).focus();
										return false;
									}
								}							
							}
					}

					}
	
				}
			}			
			
			if(document.getElementById("total_score_value_hidd").value==0){
				if(!Onlydigits(document.getElementById("txt_tot_score").value)) {
				alert('To create a new scorecard for your game,Please enter at least one score for a player.\nYou only have two options when entering a score for a round.  \nEither enter the Total Score, or enter a number in EVERY SINGLE BOX from the 18 holes');
				txt_tot_score.focus();
				return false;
				}
				if(Trim(document.getElementById("txt_tot_score").value)=="" || Trim(document.getElementById("txt_tot_score").value)=="Total Score") {
				alert('Please enter the Total Score.');
				document.getElementById("txt_tot_score").focus();
				return false;
				}
		    }
	

	}
	return true;
}
/*function validateformofaddplayers(frm){
	with(frm) {
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_yar").value)=="") {
				alert('Please enter the yardage values.');
				document.getElementById("txt_hole"+i+"_yar").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_yar").value)) {
				alert('Please enter valid yardage values.');
				document.getElementById("txt_hole"+i+"_yar").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_handi").value)=="") {
				alert('Please enter the handicap values.');
				document.getElementById("txt_hole"+i+"_handi").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_handi").value)) {
				alert('Please enter valid handicap values.');
				document.getElementById("txt_hole"+i+"_handi").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_par").value)=="") {
				alert('Please enter the par values.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_par").value)) {
				alert('Please enter valid par value - must be 3,4 or 5.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			}else if(Trim(document.getElementById("txt_hole"+i+"_par").value)!=3 && Trim(document.getElementById("txt_hole"+i+"_par").value)!=4 && Trim(document.getElementById("txt_hole"+i+"_par").value)!=5) {
				alert('Please enter valid par value - must be 3,4 or 5.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_score").value)=="") {
				alert('Please enter the score values.');
				document.getElementById("txt_hole"+i+"_score").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score").value)) {
				alert('Please enter valid score values.');
				document.getElementById("txt_hole"+i+"_score").focus();
				return false;
			}
		}

		if(document.getElementById("nofoplayers").value!='' || document.getElementById("nofoplayers").value!=0)
		{
			var noofothers = document.getElementById("nofoplayers").value;
			for (var j=1; j<=noofothers; j++)
			{
				//if(document.getElementById("playersplayed_"+j).value!=0){
					if(document.getElementById("playersplayed_"+j).value=="Other")
					{
						if(Trim(document.getElementById("txt_playname_"+j).value)=="") {
							alert('Please enter the player name.');
							document.getElementById("txt_playname_"+j).focus();
							return false;
						}
					}

				//}

			}
		}



	}
	return true;
}*/


function validateformofaddplayersedit(frm){
	with(frm) {
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_yar").value)=="") {
				alert('Please enter the yardage values.');
				document.getElementById("txt_hole"+i+"_yar").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_yar").value)) {
				alert('Please enter valid yardage values.');
				document.getElementById("txt_hole"+i+"_yar").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_handi").value)=="") {
				alert('Please enter the handicap values.');
				document.getElementById("txt_hole"+i+"_handi").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_handi").value)) {
				alert('Please enter valid handicap values.');
				document.getElementById("txt_hole"+i+"_handi").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_par").value)=="") {
				alert('Please enter the par values.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_par").value)) {
				alert('Please enter valid par value - must be 3,4 or 5.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			}else if(Trim(document.getElementById("txt_hole"+i+"_par").value)!=3 && Trim(document.getElementById("txt_hole"+i+"_par").value)!=4 && Trim(document.getElementById("txt_hole"+i+"_par").value)!=5) {
				alert('Please enter valid par value - must be 3,4 or 5.');
				document.getElementById("txt_hole"+i+"_par").focus();
				return false;
			}
		}
		for (var i=1; i<=9; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_score").value)=="") {
				alert('Please enter the score values.');
				document.getElementById("txt_hole"+i+"_score").focus();
				return false;
			} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score").value)) {
				alert('Please enter valid score values.');
				document.getElementById("txt_hole"+i+"_score").focus();
				return false;
			}
		}
/*		if(document.getElementById("nofoplayers").value!='' || document.getElementById("nofoplayers").value!=0)
		{
			var noofothers = document.getElementById("nofoplayers").value;
			for (var j=1; j<=noofothers; j++)
			{
				if(document.getElementById("playersplayed_"+j).value!=0){
					if(document.getElementById("playersplayed_"+j).value=="Other")
					{
						if(Trim(document.getElementById("txt_playname_"+j).value)=="") {
							alert('Please enter the player name.');
							document.getElementById("txt_playname_"+j).focus();
							return false;
						}
					}
					for (var i=1; i<=9; i++)
					{
						if(Trim(document.getElementById("txt_hole"+i+"_score_"+j).value)=="") {
							alert('Please enter the score values.');
							document.getElementById("txt_hole"+i+"_score_"+j).focus();
							return false;
						} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score_"+j).value)) {
							alert('Please enter valid score values.');
							document.getElementById("txt_hole"+i+"_score_"+j).focus();
							return false;
						}
					}

				}

			}
		}*/



	}
	return true;
}
function validateeditjoinescorecard(frm){

	with(frm) {

//validation session score start
		var indscore = 0; var sestotscore;
		if(document.getElementById("txt_hole1_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole1_score").value)
			}
		if(document.getElementById("txt_hole2_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole2_score").value)
			}
		if(document.getElementById("txt_hole3_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole3_score").value)
			}
		if(document.getElementById("txt_hole4_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole4_score").value)
			}
		if(document.getElementById("txt_hole5_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole5_score").value)
			}
		if(document.getElementById("txt_hole6_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole6_score").value)
			}
		if(document.getElementById("txt_hole7_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole7_score").value)
			}
		if(document.getElementById("txt_hole8_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole8_score").value)
			}
		if(document.getElementById("txt_hole9_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole9_score").value)
			}
		if(document.getElementById("txt_hole10_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole10_score").value)
			}
		if(document.getElementById("txt_hole11_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole11_score").value)
			}
		if(document.getElementById("txt_hole12_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole12_score").value)
			}
		if(document.getElementById("txt_hole13_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole13_score").value)
			}
		if(document.getElementById("txt_hole14_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole14_score").value)
			}
		if(document.getElementById("txt_hole15_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole15_score").value)
			}
		if(document.getElementById("txt_hole16_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole16_score").value)
			}
		if(document.getElementById("txt_hole17_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole17_score").value)
			}
		if(document.getElementById("txt_hole18_score").value!=''){
			indscore += parseInt(document.getElementById("txt_hole18_score").value)
			}
		if(document.getElementById("total_scoresess").value==''){
				sestotscore = 0;
		}else{
				sestotscore = parseInt(document.getElementById("total_scoresess").value);
		}
//validation session score end
//validation session put start
		var indput = 0; var sestotput;
		if(document.getElementById("txt_hole1_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole1_put").value)
			}
		if(document.getElementById("txt_hole2_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole2_put").value)
			}
		if(document.getElementById("txt_hole3_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole3_put").value)
			}
		if(document.getElementById("txt_hole4_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole4_put").value)
			}
		if(document.getElementById("txt_hole5_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole5_put").value)
			}
		if(document.getElementById("txt_hole6_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole6_put").value)
			}
		if(document.getElementById("txt_hole7_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole7_put").value)
			}
		if(document.getElementById("txt_hole8_put").value!=''){

			indput += parseInt(document.getElementById("txt_hole8_put").value)
			}
		if(document.getElementById("txt_hole9_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole9_put").value)
			}
		if(document.getElementById("txt_hole10_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole10_put").value)
			}
		if(document.getElementById("txt_hole11_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole11_put").value)
			}
		if(document.getElementById("txt_hole12_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole12_put").value)
			}
		if(document.getElementById("txt_hole13_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole13_put").value)
			}
		if(document.getElementById("txt_hole14_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole14_put").value)
			}
		if(document.getElementById("txt_hole15_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole15_put").value)
			}
		if(document.getElementById("txt_hole16_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole16_put").value)
			}
		if(document.getElementById("txt_hole17_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole17_put").value)
			}
		if(document.getElementById("txt_hole18_put").value!=''){
			indput += parseInt(document.getElementById("txt_hole18_put").value)
			}
		if(document.getElementById("total_putsess").value==''){
				sestotput = 0;
		}else{
				sestotput = parseInt(document.getElementById("total_putsess").value);
		}
//validation session put end
//validation session fair start
		var indfair = 0; var sestotfair;
		if(document.getElementById("txt_hole1_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole1_fair").value)
			}
		if(document.getElementById("txt_hole2_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole2_fair").value)
			}
		if(document.getElementById("txt_hole3_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole3_fair").value)
			}
		if(document.getElementById("txt_hole4_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole4_fair").value)
			}
		if(document.getElementById("txt_hole5_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole5_fair").value)
			}
		if(document.getElementById("txt_hole6_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole6_fair").value)
			}
		if(document.getElementById("txt_hole7_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole7_fair").value)
			}
		if(document.getElementById("txt_hole8_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole8_fair").value)
			}
		if(document.getElementById("txt_hole9_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole9_fair").value)
			}
		if(document.getElementById("txt_hole10_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole10_fair").value)
			}
		if(document.getElementById("txt_hole11_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole11_fair").value)
			}
		if(document.getElementById("txt_hole12_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole12_fair").value)
			}
		if(document.getElementById("txt_hole13_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole13_fair").value)
			}
		if(document.getElementById("txt_hole14_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole14_fair").value)
			}
		if(document.getElementById("txt_hole15_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole15_fair").value)
			}
		if(document.getElementById("txt_hole16_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole16_fair").value)
			}
		if(document.getElementById("txt_hole17_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole17_fair").value)
			}
		if(document.getElementById("txt_hole18_fair").value!=''){
			indfair += parseInt(document.getElementById("txt_hole18_fair").value)
			}
		if(document.getElementById("total_fairsess").value==''){
				sestotfair = 0;
		}else{
				sestotfair = parseInt(document.getElementById("total_fairsess").value);
		}
//validation session fair end
//validation session gir start
		var indgir = 0; var sestotgir;
		if(document.getElementById("txt_hole1_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole1_gir").value)
			}
		if(document.getElementById("txt_hole2_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole2_gir").value)
			}
		if(document.getElementById("txt_hole3_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole3_gir").value)
			}
		if(document.getElementById("txt_hole4_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole4_gir").value)
			}
		if(document.getElementById("txt_hole5_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole5_gir").value)
			}
		if(document.getElementById("txt_hole6_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole6_gir").value)
			}
		if(document.getElementById("txt_hole7_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole7_gir").value)
			}
		if(document.getElementById("txt_hole8_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole8_gir").value)
			}
		if(document.getElementById("txt_hole9_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole9_gir").value)
			}
		if(document.getElementById("txt_hole10_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole10_gir").value)
			}
		if(document.getElementById("txt_hole11_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole11_gir").value)
			}
		if(document.getElementById("txt_hole12_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole12_gir").value)
			}
		if(document.getElementById("txt_hole13_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole13_gir").value)
			}
		if(document.getElementById("txt_hole14_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole14_gir").value)
			}
		if(document.getElementById("txt_hole15_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole15_gir").value)
			}
		if(document.getElementById("txt_hole16_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole16_gir").value)
			}
		if(document.getElementById("txt_hole17_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole17_gir").value)
			}
		if(document.getElementById("txt_hole18_gir").value!=''){
			indgir += parseInt(document.getElementById("txt_hole18_gir").value)
			}
		if(document.getElementById("total_girsess").value==''){
				sestotgir = 0;
		}else{
				sestotgir = parseInt(document.getElementById("total_girsess").value);
		}
//validation session gir end
//validation session sandy start
		var indsandy = 0; var sestotsandy;
		if(document.getElementById("txt_hole1_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole1_sandy").value)
			}
		if(document.getElementById("txt_hole2_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole2_sandy").value)
			}
		if(document.getElementById("txt_hole3_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole3_sandy").value)
			}
		if(document.getElementById("txt_hole4_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole4_sandy").value)
			}
		if(document.getElementById("txt_hole5_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole5_sandy").value)
			}
		if(document.getElementById("txt_hole6_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole6_sandy").value)
			}
		if(document.getElementById("txt_hole7_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole7_sandy").value)
			}
		if(document.getElementById("txt_hole8_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole8_sandy").value)
			}
		if(document.getElementById("txt_hole9_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole9_sandy").value)
			}
		if(document.getElementById("txt_hole10_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole10_sandy").value)
			}
		if(document.getElementById("txt_hole11_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole11_sandy").value)
			}
		if(document.getElementById("txt_hole12_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole12_sandy").value)
			}
		if(document.getElementById("txt_hole13_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole13_sandy").value)
			}
		if(document.getElementById("txt_hole14_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole14_sandy").value)
			}
		if(document.getElementById("txt_hole15_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole15_sandy").value)
			}
		if(document.getElementById("txt_hole16_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole16_sandy").value)
			}
		if(document.getElementById("txt_hole17_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole17_sandy").value)
			}
		if(document.getElementById("txt_hole18_sandy").value!=''){
			indsandy += parseInt(document.getElementById("txt_hole18_sandy").value)
			}
		if(document.getElementById("total_sandysess").value==''){
				sestotsandy = 0;
		}else{
				sestotsandy = parseInt(document.getElementById("total_sandysess").value);
		}
//validation session sandy end
//validation session scarmble start
		var indscramble = 0; var sestotscramble;
		if(document.getElementById("txt_hole1_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole1_scramble").value)
			}
		if(document.getElementById("txt_hole2_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole2_scramble").value)
			}
		if(document.getElementById("txt_hole3_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole3_scramble").value)
			}
		if(document.getElementById("txt_hole4_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole4_scramble").value)
			}
		if(document.getElementById("txt_hole5_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole5_scramble").value)
			}
		if(document.getElementById("txt_hole6_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole6_scramble").value)
			}
		if(document.getElementById("txt_hole7_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole7_scramble").value)
			}
		if(document.getElementById("txt_hole8_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole8_scramble").value)
			}
		if(document.getElementById("txt_hole9_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole9_scramble").value)
			}
		if(document.getElementById("txt_hole10_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole10_scramble").value)
			}
		if(document.getElementById("txt_hole11_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole11_scramble").value)
			}
		if(document.getElementById("txt_hole12_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole12_scramble").value)
			}
		if(document.getElementById("txt_hole13_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole13_scramble").value)
			}
		if(document.getElementById("txt_hole14_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole14_scramble").value)
			}
		if(document.getElementById("txt_hole15_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole15_scramble").value)
			}
		if(document.getElementById("txt_hole16_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole16_scramble").value)
			}
		if(document.getElementById("txt_hole17_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole17_scramble").value)
			}
		if(document.getElementById("txt_hole18_scramble").value!=''){
			indscramble += parseInt(document.getElementById("txt_hole18_scramble").value)
			}
		if(document.getElementById("total_scramblesess").value==''){
				sestotscramble = 0;
		}else{
				sestotscramble = parseInt(document.getElementById("total_scramblesess").value);
		}
//validation session scramble end
		if(indscore != sestotscore){
		alert('Total value of the score is not matching.');
		document.getElementById("total_scoresess").focus();
		return false;
		}
		if(indput != sestotput){
		alert('Total value of the put is not matching.');
		document.getElementById("total_putsess").focus();
		return false;
		}
		if(indfair != sestotfair){
		alert('Total value of the fairway is not matching.');
		document.getElementById("total_fairsess").focus();
		return false;
		}
		if(indgir != sestotgir){
		alert('Total value of the GIR is not matching.');
		document.getElementById("total_girsess").focus();
		return false;
		}
		if(indsandy != sestotsandy){
		alert('Total value of the sandy is not matching.');
		document.getElementById("total_sandysess").focus();
		return false;
		}
		if(indscramble != sestotscramble){
		alert('Total value of the scramble is not matching.');
		document.getElementById("total_scramblesess").focus();
		return false;
		}

	}
	return true;
}
function validateformofaddplayerseditnew(frm){
	with(frm) {

		var start = document.getElementById("startvalue").value;
		var totvalue = document.getElementById("totalcount").value;

/*			for (var i=1; i<=18; i++)
			{
				if(Trim(document.getElementById("txt_hole"+i+"_score").value)=="") {
					alert('Please enter your scores for all 18 holes.\n At this time we are not supporting 9-hole game scores.');
					document.getElementById("txt_hole"+i+"_score").focus();
					return false;
				} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score").value)) {
					alert('Please enter valid score values.');
					document.getElementById("txt_hole"+i+"_score").focus();
					return false;
				}
			}		
			if(document.getElementById("totalcount").value!='' || document.getElementById("totalcount").value!=0)
			{
				
				for (var j=start; j<=totvalue; j++)
				{
					if(document.getElementById("playersplayed_"+j).value!=0){
						if(document.getElementById("playersplayed_"+j).value=="Other")
						{
							if(Trim(document.getElementById("txt_playname_"+j).value)=="") {
								alert('Please enter the player name.');
								document.getElementById("txt_playname_"+j).focus();
								return false;
							}
						}
						for (var i=1; i<=18; i++)
						{
							if(Trim(document.getElementById("txt_hole"+i+"_score_"+j).value)=="") {
								alert('Please enter your scores for all 18 holes.\n At this time we are not supporting 9-hole game scores.');
								document.getElementById("txt_hole"+i+"_score_"+j).focus();
								return false;
							} else if(!Onlydigits(document.getElementById("txt_hole"+i+"_score_"+j).value)) {
								alert('Please enter valid score values.');
								document.getElementById("txt_hole"+i+"_score_"+j).focus();
								return false;
							}
						}
	
					}
	
				}
			}*/			
//validation session score start last changed file is 28th jan
		var indscore = 0; var sestotscore;
		if(document.getElementById("total_score_value_hidd").value==''){
				indscore = 0;
		}else{
				indscore = parseInt(document.getElementById("total_score_value_hidd").value);
		}
		if(document.getElementById("total_scoresess").value==''){
				sestotscore = 0;
		}else{
				sestotscore = parseInt(document.getElementById("total_scoresess").value);
		}
//validation session score end
//validation session put start
		var indput = 0; var sestotput;
		if(document.getElementById("total_put_value_hidd").value==''){
				indput = 0;
		}else{
				indput = parseInt(document.getElementById("total_put_value_hidd").value);
		}
		if(document.getElementById("total_putsess").value==''){
				sestotput = 0;
		}else{
				sestotput = parseInt(document.getElementById("total_putsess").value);
		}
//validation session put end
//validation session fair start
		var indfair = 0; var sestotfair;
		if(document.getElementById("total_fair_value_hidd").value==''){
				indfair = 0;
		}else{
				indfair = parseInt(document.getElementById("total_fair_value_hidd").value);
		}
		if(document.getElementById("total_fairsess").value==''){
				sestotfair = 0;
		}else{
				sestotfair = parseInt(document.getElementById("total_fairsess").value);
		}
//validation session fair end
//validation session gir start
		var indgir = 0; var sestotgir;
		if(document.getElementById("total_gir_value_hidd").value==''){
				indgir = 0;
		}else{
				indgir = parseInt(document.getElementById("total_gir_value_hidd").value);
		}
		if(document.getElementById("total_girsess").value==''){
				sestotgir = 0;
		}else{
				sestotgir = parseInt(document.getElementById("total_girsess").value);
		}
//validation session gir end
//validation session sandy start
		var indsandy = 0; var sestotsandy;
		if(document.getElementById("total_sandy_value_hidd").value==''){
				indsandy = 0;
		}else{
				indsandy = parseInt(document.getElementById("total_sandy_value_hidd").value);
		}
		if(document.getElementById("total_sandysess").value==''){
				sestotsandy = 0;
		}else{
				sestotsandy = parseInt(document.getElementById("total_sandysess").value);
		}
//validation session sandy end
//validation session scarmble start
		var indscramble = 0; var sestotscramble;
		if(document.getElementById("total_scramble_value_hidd").value==''){
				indscramble = 0;
		}else{
				indscramble = parseInt(document.getElementById("total_scramble_value_hidd").value);
		}
		if(document.getElementById("total_scramblesess").value==''){
				sestotscramble = 0;
		}else{
				sestotscramble = parseInt(document.getElementById("total_scramblesess").value);
		}
//validation session scramble end
			if(Trim(document.getElementById("playeddate").value)=="") {
				alert('Please choose the Date.');
				document.getElementById("playeddate").focus();
				return false;
			}	
		if(document.getElementById("total_score_value_hidd").value!='' && document.getElementById("total_score_value_hidd").value!='0'){
		if(indscore != sestotscore){
		    var msg1=confirm('The changed score total is now '+document.getElementById("total_scoresess").value+'. Press OK to post it anyway');
			if(msg1==true){
			return true;
			}else{		
			document.getElementById("total_scoresess").focus();
			return false;
			}
		}}
		if(document.getElementById("total_put_value_hidd").value!='' && document.getElementById("total_put_value_hidd").value!='0'){
		if(indput != sestotput){
		    var msg2=confirm('The changed put total is now '+document.getElementById("total_putsess").value+'.   Press OK to post it anyway');
			if(msg2==true){
			return true;
			}else{		
			document.getElementById("total_putsess").focus();
			return false;
			}		
		}}
		if(document.getElementById("total_fair_value_hidd").value!='' && document.getElementById("total_fair_value_hidd").value!='0'){
		if(indfair != sestotfair){
		    var msg3=confirm('The changed fairway total is now '+document.getElementById("total_fairsess").value+'. Press OK to post it anyway');
			if(msg3==true){
			return true;
			}else{		
			document.getElementById("total_fairsess").focus();
			return false;
			}		
		
		}}
		if(document.getElementById("total_gir_value_hidd").value!='' && document.getElementById("total_gir_value_hidd").value!='0'){
		if(indgir != sestotgir){
		    var msg4=confirm('The changed gir total is now '+document.getElementById("total_girsess").value+'. Press OK to post it anyway');
			if(msg4==true){
			return true;
			}else{		
			document.getElementById("total_girsess").focus();
			return false;
			}			
		
		}}
		if(document.getElementById("total_sandy_value_hidd").value!='' && document.getElementById("total_sandy_value_hidd").value!='0'){
		if(indsandy != sestotsandy){
		    var msg5=confirm('The changed sandy total is now '+document.getElementById("total_sandysess").value+'. Press OK to post it anyway');
			if(msg5==true){
			return true;
			}else{		
			document.getElementById("total_sandysess").focus();
			return false;
			}			
		}}
		if(document.getElementById("total_scramble_value_hidd").value!='' && document.getElementById("total_scramble_value_hidd").value!='0'){
		if(indscramble != sestotscramble){
		    var msg6=confirm('The changed scramble total is now '+document.getElementById("total_scramblesess").value+'. Press OK to post it anyway');
			if(msg6==true){
			return true;
			}else{		
			document.getElementById("total_scramblesess").focus();
			return false;
			}			
		}}
		for (var i=start; i<=totvalue; i++)
		{
//validation for all score start
		var indscoreall = 0; var sestotscoreall;
		if(document.getElementById("total_score_value_hidd_"+i).value==''){
				indscoreall = 0;
			}else{
				indscoreall = parseInt(document.getElementById("total_score_value_hidd_"+i).value)
			}
		if(document.getElementById("total_scoreall_"+i).value==''){
				sestotscoreall = 0;
			}else{
					sestotscoreall = parseInt(document.getElementById("total_scoreall_"+i).value);
			}
//validation for all score end

//validation for all put start
		var indputall = 0; var sestotputall;
		if(document.getElementById("total_put_value_hidd_"+i).value==''){
				indputall = 0;
			}else{
				indputall = parseInt(document.getElementById("total_put_value_hidd_"+i).value)
			}
		if(document.getElementById("total_putall_"+i).value==''){
				sestotputall = 0;
			}else{
					sestotputall = parseInt(document.getElementById("total_putall_"+i).value);
			}
//validation for all put end
//validation for all fair start
		var indfairall = 0; var sestotfairall;
		if(document.getElementById("total_fair_value_hidd_"+i).value==''){
				indfairall = 0;
			}else{
				indfairall = parseInt(document.getElementById("total_fair_value_hidd_"+i).value)
			}
		if(document.getElementById("total_fairall_"+i).value==''){
				sestotfairall = 0;
			}else{
					sestotfairall = parseInt(document.getElementById("total_fairall_"+i).value);
			}
//validation for all fair end
//validation for all gir start
		var indgirall = 0; var sestotgirall;
		if(document.getElementById("total_gir_value_hidd_"+i).value==''){
				indgirall = 0;
			}else{
				indgirall = parseInt(document.getElementById("total_gir_value_hidd_"+i).value)
			}
		if(document.getElementById("total_girall_"+i).value==''){
				sestotgirall = 0;
			}else{
					sestotgirall = parseInt(document.getElementById("total_girall_"+i).value);
			}
//validation for all gir end
//validation for all sandy start
		var indsandyall = 0; var sestotsandyall;
		if(document.getElementById("total_sandy_value_hidd_"+i).value==''){
				indsandyall = 0;
			}else{
				indsandyall = parseInt(document.getElementById("total_sandy_value_hidd_"+i).value)
			}
		if(document.getElementById("total_sandyall_"+i).value==''){
				sestotsandyall = 0;
			}else{
					sestotsandyall = parseInt(document.getElementById("total_sandyall_"+i).value);
			}
//validation for all sandy end
//validation for all scramble start
		var indscrambleall = 0; var sestotscrambleall;
		if(document.getElementById("total_scramble_value_hidd_"+i).value==''){
				indscrambleall = 0;
			}else{
				indscrambleall = parseInt(document.getElementById("total_scramble_value_hidd_"+i).value)
			}
		if(document.getElementById("total_scrambleall_"+i).value==''){
				sestotscrambleall = 0;
			}else{
					sestotscrambleall = parseInt(document.getElementById("total_scrambleall_"+i).value);
			}
//validation for all scramble end
		if(document.getElementById("total_score_value_hidd_"+i).value!='' && document.getElementById("total_score_value_hidd_"+i).value!='0'){
		if(indscoreall != sestotscoreall){
				var msg7=confirm('The changed score total is now '+document.getElementById("total_scoreall_"+i).value+'. Press OK to post it anyway');
				if(msg7==true){
				return true;
				}else{		
				document.getElementById("total_scoreall_"+i).focus();
				return false;
				}				
			}}
		if(document.getElementById("total_put_value_hidd_"+i).value!='' && document.getElementById("total_put_value_hidd_"+i).value!='0'){
		if(indputall != sestotputall){
				var msg8=confirm('The changed put total is now '+document.getElementById("total_putall_"+i).value+'. Press OK to post it anyway');
				if(msg8==true){
				return true;
				}else{		
				document.getElementById("total_putall_"+i).focus();
				return false;
				}			
			}}
		if(document.getElementById("total_fair_value_hidd_"+i).value!='' && document.getElementById("total_fair_value_hidd_"+i).value!='0'){
		if(indfairall != sestotfairall){
				var msg9=confirm('The changed fairway total is now '+document.getElementById("total_fairall_"+i).value+'. Press OK to post it anyway');
				if(msg9==true){
				return true;
				}else{		
				document.getElementById("total_fairall_"+i).focus();
				return false;
				}				
			}}
		if(document.getElementById("total_gir_value_hidd_"+i).value!='' && document.getElementById("total_gir_value_hidd_"+i).value!='0'){
		if(indgirall != sestotgirall){
				var msg10=confirm('The changed gir total is now '+document.getElementById("total_girall_"+i).value+'. Press OK to post it anyway');
				if(msg10==true){
				return true;
				}else{		
				document.getElementById("total_girall_"+i).focus();
				return false;
				}			
			}}
		if(document.getElementById("total_sandy_value_hidd_"+i).value!='' && document.getElementById("total_sandy_value_hidd_"+i).value!='0'){
		if(indsandyall != sestotsandyall){
				var msg11=confirm('The changed sandy total is now '+document.getElementById("total_sandyall_"+i).value+'. Press OK to post it anyway');
				if(msg11==true){
				return true;
				}else{		
				document.getElementById("total_sandyall_"+i).focus();
				return false;
				}			
			}}
		if(document.getElementById("total_scramble_value_hidd_"+i).value!='' && document.getElementById("total_scramble_value_hidd_"+i).value!='0'){
		if(indscrambleall != sestotscrambleall){
				var msg12=confirm('The changed scramble total is now '+document.getElementById("total_scrambleall_"+i).value+'. Press OK to post it anyway');
				if(msg12==true){
				return true;
				}else{		
				document.getElementById("total_scrambleall_"+i).focus();
				return false;
				}			
			}}


		}

	}
	return true;
}
function formforcreatescorevalidate(frm){
			with(frm) {
		if(addrad_tees.value=="") {
			alert('Please select the tee.');
			addrad_tees.focus();
			return false;
		}
}
		window.location.href="addplayers.php?cid="+document.getElementById("cid").value+"&rad_tee="+document.getElementById("addrad_tees").value+"&noofplayers=6";
		return true;

}


/*
function addTotalnewall(obj,option,did) {
	var len=document.getElementById('sel_holes').value;
	//alert(len);
	var inval=0;
	var outval=0;
	if(obj.value!="" && obj.value!=0) {
		if(!Onlydigits(obj.value)) {
			alert('-Please enter Number only.');
			obj.value="";
		}
	}
	if(option=="score") {

		for(i=1;i<=len;i++) {

			if(document.getElementById('txt_hole'+i+'_score_'+did).value!="") {
				if(i<=9) {
					outval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
					//alert(outval);
				} else {
					inval +=parseInt(document.getElementById('txt_hole'+i+'_score_'+did).value);
				}
				document.getElementById('div_out_score_'+did).innerHTML=outval;
				document.getElementById('div_in_score_'+did).innerHTML=inval;
				document.getElementById('total_score_value_hidd_'+did).value=parseInt(outval)+parseInt(inval);
				if(document.getElementById('total_score_value_hidd_'+did).value==0){
					document.getElementById('div_tot_score_'+did).innerHTML="<span class='addredtee'><input type='text' name='txt_tot_score' id='txt_tot_score' maxlength='5' class='scoretxtbox' onKeyUp='return readonlyautokeyscoreall(this,"+did+");' value='Total Score'  style='width:75px' onFocus='getvalue('Total Score',this);' onBlur='putvaluenewall('Total Score',this,"+did+");' /></span>";
				}else{
				document.getElementById('div_tot_score_'+did).innerHTML=parseInt(outval)+parseInt(inval);
					}
			}

		}

	}
	return false
}
*/

function showothervaluesforsess(){
		$('#hideowndivput').toggle();
		$('#hideowndivfair').toggle();
		$('#hideowndivgir').toggle();
		$('#hideowndivsandy').toggle();
		$('#hideowndivscramble').toggle();
	}

	function showothervaluesforall(divid){
		$('#hideplayersdivsput_'+divid).toggle();
		$('#hideplayersdivsfair_'+divid).toggle();
		$('#hideplayersdivsgir_'+divid).toggle();
		$('#hideplayersdivssandy_'+divid).toggle();
		$('#hideplayersdivsscramble_'+divid).toggle();
		}

/*function validate_edit_checkscore(frm){
	with(frm) {
        var totholes = document.getElementById("sel_holes").value;
		for (var i=1; i<=totholes; i++)
		{
			if(Trim(document.getElementById("txt_hole"+i+"_len").value)!="") {
				if(!Onlydigits(document.getElementById("txt_hole"+i+"_len").value)) {
					alert('Please enter valid score values.');
					document.getElementById("txt_hole"+i+"_len").focus();
					return false;
				}
			}
		}
	}
	return false;
}	*/



function delgroup(val,id){
//alert('hi');
var msg=confirm("Do you want delete this group");
if(msg==true){
location.href='groupsforcourse.php?delid='+val+'&post='+id;
}
}
function delgroupall(val){

//alert('hi');
var msg=confirm("Do you want delete this group");
if(msg==true){
location.href='create_groupsall.php?delidall='+val;
}
	
	}
function chk_DeleteEventconfirm(eventid, coursegetid, page, coursename){
var msg=confirm("Do you want to  delete this event");
	if(msg==true){
	chk_DeleteEvent(eventid, coursegetid, page, coursename)
	}
}


function validatejoingolf(frm)
{

	with(frm)
	{
		if(Trim(name.value)=='')
		{
			alert("Please enter the name");
			name.focus();
			return false;
		}
		if(Trim(emailid.value) == "")
		{
			alert("Please enter the email.");
			emailid.focus();
			return false;
		}
		if(!CheckEmail(emailid.value))
		{
			return false;
		}
	}
}
function validateinviteuser()
{
	if(Trim(document.getElementById("testmessage").value)=='')
	{
		alert("Please enter the message");
		document.getElementById("testmessage").focus();
		return false;
	}else{
		chk_inviteuser(document.getElementById("userid").value, document.getElementById("testmessage").value);
	}
}

function openvideofile(id){

	var urls = "admin/showvideoadmin.php?id="+id;
	emailwindow=parent.dhtmlmodal.open('EmailBox', 'iframe', urls, '', 'width=500px,height=500px,center=1,resize=0,scrolling=1')
}

function validatesearch(frm){
	with(frm) {
		//alert('hi');
		if(searchword.value=='Search Golfers') {
			alert('Please enter the users name.');
			searchword.focus();
			return false;
		}
		else if (searchword.value=='') {
			alert('Please enter the users name.');
			searchword.focus();
			return false;
		}
	} return true;
}
function validatefrmgroupsend(frm){
	with(frm) {
			if (txt_send.value=='') {
			alert('Please enter the message.');
			txt_send.focus();
			return false;
		}
	} return true;
}

function validatechangeemail(frm){
	with(frm){
		if(Trim(chg_email.value)==''){
			alert('Please enter the email address.');
			chg_email.focus();
			return false;
		}
	} return true;
}
