/******************************************
Module name : Js Function file
Parent module : None
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : The functions_js.js file contains various functions related to the web directory project.
******************************************/	



/**********************************COMMMOM ADMIN FUNCTION IS NEEDED FOR THE ADMIN LOGIN & LOGOUT & SETTINMG OF THE ADMIN ****************/
/*****************************
Function name : resetDate
Return type : none
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to reset the date of a form
User instruction : resetDate()
************************************/
function resetDate()
{
 document.forms[0].frmDate.value = "From";
 document.forms[0].frmTodate.value = "To";
}

/*****************************
Function name : dateCompare
Return type : boolean
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the date compare form and to date.[ From date should be less than to date. ]
User instruction : dateCompare(formname)
************************************/
function dateCompare(formname)
{
 var sliptdate = document.getElementById(formname).frmTodate.value.split("-");
    var FromDate  = document.getElementById(formname).frmDate.value.split("-");
 /*********************** From Date *****************/
 var TY = FromDate[0];  //Year
 var TM = FromDate[1];  //Month
 var TD = FromDate[2];  //Date
 /******************* To Date *********************/
 var sY=sliptdate[0];  //Year
 var sM=sliptdate[1];  //Month
 var sD=sliptdate[2];  //Date
   
 if(document.getElementById(formname).frmDate.value != 'From' && document.getElementById(formname).frmTodate.value != 'To')
 {
  if(sY<TY ) 
  {
   alert("'To' date should be greater than 'From' date.");
   return false;   
  }
  else if(sM==TM && sD<TD && sY==TY) 
  { 
   alert("'To' date should be greater than 'From' date.");
   return false;
  }
  else if(sM<TM && sY==TY) 
  { 
   alert("'To' date should be greater than 'From' date.");
   return false;
  }
 }
 
 if(validateForm(formname, 'frmSearchOrderPrice', 'Order Price', 'isNaN'))
 { 
  return true;
 } 
 else 
 {
     return false;
 } 
 
}

/******************************************
Function name : showSearchBox
Return type : None
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : Function is used to show hide the seacch box
User instruction : showSearchBox()
******************************************/
function showSearchBox(varDocumentID, varShow)
{
	if(varShow == 'show')
	{
	 document.getElementById(varDocumentID).style.display = 'block';	
	}
	else
	{
	  document.getElementById(varDocumentID).style.display = 'none';
	}
	
}

/*****************************
Function name : checkCapsLock
Return type : none
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to display alert message when caps lock is on.
User instruction : checkCapsLock( e , FieldID) 
************************************/
function checkCapsLock(e , FieldID) 
{
	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;

	}
	
	if(document.getElementById(FieldID).value.length==0) {

		// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
		if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
			alert( myMsg );
			//return;
	
		// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
		} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
			alert( myMsg );
		//	return;
		}
		return false;
	}
}
/******************************************
Function name : checkUserName
Return type : None
Date created : 10th March 2009
Date last modified : 10th March 2009
Author :  Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : Function is used to login check using ajax.The ajax login check is a combination of functions all are using to check login system.
User instruction : checkUserName()
******************************************/
/* AJAX LOGIN CHECK CODE START FROM HERE */
function checkUserName() 
{
	var alphaNum = /^[0-9a-zA-Z_@.]+$/;
	var Usermail = document.getElementById('frm_login').frmAdminUserName.value;

	var charArray = new Array();
	var tString = "";
	for(i = 0; i < Usermail.length; i++) 
	{
		charArray[i] = Usermail.charAt(i);
	}

	for(i = 0; i < charArray.length; i++) 
	{
		if (charArray[i].match(alphaNum))
		{
			tString += charArray[i];
		}
	}	
	
	if (tString != "")
	{
		checkUserEmail(tString);
	}	
}
function checkUserEmail(mailID)
{ 
	
	doAjax('ajax_act.php','type=signUp&userEmail='+mailID,'showUserEmail','GET');
}
function showUserEmail(item)
{
		
	if(item)
	{
			
		document.getElementById('showUserName').style.display = 'none';	
	}
	else
	{
		document.getElementById('showUserName').style.display = 'inline';
	}

}
/*****************************
Function name : validateAdminForm
Return type : integer
Date created : 20 june 2008
Date last modified : 20 june 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : This is used to check admin login authentications.
User instruction : validateAdminForm(charToCheck)
************************************/
function validateAdminLogin(formname)
{
	if(validateForm(formname,'frmAdminUserName','Username(E-mail)','R', 'frmAdminPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/******************************************
Function name : validator
Return type : boolean
Date created : 
Date last modified : 
Author : 
Last modified by : 
Comments : Function will return the true or error message after validating checkboxes
User instruction : validator(btnType)
******************************************/
function validateForm() 
{ 
	var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
	j=0;
	
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var regBlank = /[^\s]/;
	
	//var regSpace = /^([a-zA-Z0-9_\!#@^&*%~-]+)$/;
	var regSpace = /^([a-zA-Z0-9-/_!#@]+)$/;
    var regAlphaNum = /^([a-zA-Z0-9_#@]+)$/;
	var regDate = /^([0-9_]+-[0-9][0-9]+-[0-9][0-9]+)$/; 
  	var regChar = /^([a-zA-Z]+)$/;
	var regNumeric = /^([0-9]+)$/; 
	//var regDecimal = /^([0-9]+|(\.?)[0-9]+)$/;
	var regDecimal = /^([0-9]{0,20}\.?[0-9]{1,2})$/;
	
	for (i=1; i<(args.length-2); i+=3) 
	{	
		mesg=args[i+1];
		test=args[i+2]; 
		val=document.forms[""+args[0]].elements[""+args[i]];
		
		if (val) 
		{	
			
			nm=mesg; 
			noVal = val;
			val = val.value;
			if(regBlank.test(val))
			{
				if(test.indexOf('isEqual')!=-1)
				{
					result = trim(val);

					if(result.length==0)
					{
											
					errors += '- '+nm+' is required.\n'; 
					}
					else
					{
					equal_obj_val = test.substring(8,test.indexOf(":"));
					mesg_string =test.substring((test.indexOf(":")+1));

						if(val != document.forms[""+args[0]].elements[""+equal_obj_val].value)
						{ 
							errors+='- '+nm+' and '+mesg_string+' must be same.\n';
						}
					}
				}
				else if(test.indexOf('isAlphaNum')!=-1)
				{
					result = trim(val);
					if(result.length==0){
					errors += '- '+nm+' is required.\n'; 
					}else{
						if(!regAlphaNum.test(val))
						{
							errors += '- '+nm+' is not valid.\n';
						}
					}
				
				}
				else if(test.indexOf('isNumeric')!= -1)
				{
						if(!regNumeric.test(val))
						{
							errors += '- '+nm+' must contain a numeric value.\n';
							
						}
				}
				else if(test.indexOf('isDecimal') != -1)
				{
					
					if(!regDecimal.test(val))
					{
						errors += '- '+nm+' must contain a number.\n';
					}
				}
			
				
				else if(test.indexOf('isSpace')!=-1)
				{
					result = trim(val);
					
					if(result.length==0)
					{
						errors += '- '+nm+' is required.\n'; 
					}
					else
					{
						if(!regSpace.test(val))
						{
							errors += '- '+nm+' is not valid.\n';
						}
					}
				}
				else if(test.indexOf('isBlank')!=-1)
				{
					result = trim(val);
					
					if(result.length==0)
					{
						errors += '- '+nm+' is required.\n'; 
					}
					else
					{
						if(!regSpace.test(val))
						{
							errors += '- '+nm+' is not valid. Should not contain space.\n';
						}
					}
				}
				else if (test.indexOf('isEmail')!=-1) 
				{ 
					p=val.indexOf('@');
					s=val.indexOf('.');
			        if (p<1 || p==(val.length-1))
					{
						errors+='- '+nm+' must contain an e-mail Address.\n';
		
					}
					else if(!regEmail.test(val))
					{
						errors+='- '+nm+' must contain a valid e-mail Address.\n';
					}
			     }
				else if (test.indexOf('isUrl')!=-1) 
				{ 
					p=val.indexOf('http://');
					s=val.indexOf('.');
			        if (p<0 || p==(val.length-1))
					{
						errors+='- '+nm+' must be valid URL e.g. http://www.abc.com\n';
		
					}
					else if(s<p || s==(val.length-1))
					{
						errors+='- '+nm+' must be valid URL e.g. http://www.abc.com\n';
					}
			     }
				else if (test.indexOf('isChar')!=-1) 
				 { 
					var first_char;
					
					if(val.match(regChar)==null)
					{
					 	errors+='- '+nm+' must contain a character.\n';
					}
			     }
				else if(test.indexOf('isCheckbox')!=-1)//Check is check box is not checked generate error
				{	
					var valueCheckbox = noVal.checked;
					if(!valueCheckbox)
					{
						errors+='- '+' Accept terms and Policy.\n';
					}
				}
				else if (test.charAt(0)=='R')
				{
					result = trim(val);
					if(result.length==0){
						
					errors += '- '+nm+' is required.\n'; 
					}
				} 
			
		}
		else if (test.charAt(0)=='R')
		{
			result = trim(val);
				if(result.length==0){
					
				errors += '- '+nm+' is required.\n'; 
				}
		}
		
		 if (test.indexOf('isDate')!=-1) 
				{ 
					//alert("vineet");
					p=val.indexOf('-');
			       // alert(test.indexOf('isDate'));
			       	var sliptdate	= val.split("-");
					
					/*******************Added by rupesh Date is not before current date and month*********************/
					var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate(),TH=today.getHours();
					TM+=1;			
					if(TM<=9) 
					{	
						TM='0'+TM;
					}
					if(TD<=9)
					{
						TD='0'+TD;
					}
					/*******************Added by rupesh*********************/
					
					var sY=sliptdate[0];
					var sM=sliptdate[1];
					var sD=sliptdate[2];
					
					/*******************Added by rupesh*********************/
					//alert(TM);
				  if(sY>1)
				   {     
						
						if(sY<TY )
						{
						    errors+='- '+nm+' should be greater than current date.\n';
						}
						else if(sM==TM && sD<TD && sY==TY) 
						{ 
	
							errors+='- '+nm+' should be greater than current date.\n';
							
						}
						else if(sM<TM && sY==TY) 
						{ 
	
							errors+='- '+nm+' should be greater than current date.\n';
					    }
				   }
				
				}
		if(errors !="")
		{	if(j<=0)
			{
				focusitem = document.forms[""+args[0]].elements[""+args[i]];
				j++;
			}	
		}
		}
		
	} 
	
  if (errors)
  {
	var MasterString = getMasterString();
	alert(MasterString+'\n'+errors);
	focusitem.focus();
	return false;
   }
   else
	return true;

  document.MM_returnValue = (errors == '');
}
/*****************************
Function name : validateEmailChange
Return type : boolean
Date created : 20 june 2008
Date last modified : 21 june 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : This function is used to validate admin notification email id.
User instruction : validateEmailChange(charToCheck)
************************************/
function validateEmailChange(formname)
{
	if(validateForm(formname, 'frmAdminEmail','Email','RisEmail'))
	{			
		var flag=confirm('Are you sure you want to change notification E-mail?')
		if(flag)
		return true;
		else
		return false;		
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateCommentApprovalChange
Return type : boolean
Date created : 12 March 2009
Date last modified : 12 March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate admin comment approval.
User instruction : validateCommentApprovalChange(charToCheck)
************************************/
function validateCommentApprovalChange(formname)
{
	if(validateForm(formname, 'frmAdminCommentApproval','Change Comment Approval','R'))
	{			
		var flag=confirm('Are you sure you want to change comment approval?')
		if(flag)
		return true;
		else
		return false;		
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateTestimonialApprovalChange
Return type : boolean
Date created : 12 March 2009
Date last modified : 12 March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate admin testimonial approval.
User instruction : validateTestimonialApprovalChange(charToCheck)
************************************/
function validateTestimonialApprovalChange(formname)
{
	if(validateForm(formname, 'frmAdminTestimonialApproval','Change Testimonial Approval','R'))
	{			
		var flag=confirm('Are you sure you want to change testimonial approval?')
		if(flag)
		return true;
		else
		return false;		
	} 
	else 
	{
		return false;
	} 
}

/*****************************
Function name : validateChangePassword
Return type : boolean
Date created : 10th September 2008
Date last modified : 
Author : Gulshan Verma
Last modified by :
Comments : This is used to validate admin password and confirm passwords.
User instruction : validateChangePassword(formname)
************************************/
function validateChangePassword(formname)
{
	if(validateForm(document.getElementById(formname).id,'frmAdminOldPassword', 'Current Password', 'RisSpace', 'frmAdminNewPassword', 'New Password','RisSpace','frmAdminConfirmPassword', 'Confirm New Password', 'RisEqualfrmAdminNewPassword:New Password'))
	{			
		var flag=confirm('Are you sure you want to change password?')
		if(flag)
		{
			return true;
		}
		else
		{
			return false;		
		}
	} 
	else 
	{
		return false;
	} 

}

/*****************************
Function name : validateResetPassword
Return type : boolean
Date created : 23rd September 2008
Date last modified : 23rd September 2008
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
Comments : This is used to validate admin password and confirm passwords.
User instruction : validateResetPassword(formname)
************************************/
function validateResetPassword(formname)
{
	if(validateForm(document.getElementById(formname).id, 'frmNewPassword', 'New Password','RisSpace','frmConfirmNewPassword', 'Confirm New Password', 'RisEqualfrmNewPassword:New Password'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}

/*****************************
Function name : validateAdminForgotPassword
Return type : none
Date created : 10th September 2008
Date last modified : 
Author : Gulshan Verma
Last modified by :
Comments : This function is used to validate forgot password form.
User instruction : validateAdminForgotPassword(formname)
************************************/
function validateForgotPassword(formname)
{
	if(validateForm(formname,'frmUserName','Username (E-mail) ','RisEmail','frmSecurityCode','Verification code','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}

/******************************************
Function name : ltrim
Return type : string
Date created : 
Date last modified : 
Author : 
Last modified by : 
Comments : Function will return the main string after removing white spaces from the left
User instruction : ltrim(str)
******************************************/
function ltrim(str) { 
	for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
	return str.substring(k, str.length);
}
/******************************************
Function name : rtrim
Return type : string
Date created : 
Date last modified : 
Author : 
Last modified by : 
Comments : Function will return the main string after removing white spaces from the right
User instruction : rtrim(str)
******************************************/
function rtrim(str) {
	for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
	return str.substring(0,j+1);
}
/******************************************
Function name : trim
Return type : string
Date created : 
Date last modified :
Author : 
Last modified by : 
Comments : Function will return the main string after removing white spaces from the right and left of the main string
User instruction : trim(str)
******************************************/
function trim(str) {
	return ltrim(rtrim(str));
}
/******************************************
Function name : isWhitespace
Return type : integer
Date created : 
Date last modified : 
Author : 
Last modified by : 
Comments : Function will return the index of white space encounter in the string.
User instruction : isWhitespace(charToCheck)
******************************************/
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}
/******************************************
Function name : checkError
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will return the true or false acording to form validation
User instruction : checkError(error)
******************************************/
function checkError(error)
{
 var flag=false;
 var MasterString = getMasterString();
 
 if(error != "")
 {
  MasterString = MasterString + error;
  flag=true;
 }
 
 if(flag == true)
 {
  alert(MasterString);
  return false;
 }
 else
  return true;
}
/******************************************
Function name : getMasterString
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will return the main string
User instruction : getMasterString()
******************************************/
function getMasterString()
{
 return "Sorry, we can not complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n";
}
/******************************************
Function name : toggleOption
Return type : None
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will toggle the select all checkbox option.
User instruction : toggleOption(spanChk)
******************************************/
 
function toggleOption(spanChk)
{
 
 var xState=spanChk.checked;
 var theBox=spanChk;
 
 elm=theBox.form.elements;
 
 for(i=0;i<elm.length;i++)
 {
  if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
  {
   if(xState == false)
    elm[i].checked = false;
   else
    elm[i].checked = true;
  }
 }
}
/******************************************
Function name : toggleOption
Return type : None
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will deselect the main checkbox
User instruction : deSelectCheckbox(spanChk)
******************************************/
function deSelectCheckbox(formname)
{
 document.getElementById('Main').checked = false;
}
 
/******************************************
Function name : setvalidAction
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will ask for confirmation of updating records
User instruction : setValidAction(value, formname,listname)
******************************************/
function  setValidAction(value, formname,listname)
{
 if(value == 'Delete' || value.indexOf ('Delete')>-1)
 {
  message = "delete selected "+listname;  
 }
 else
 {
  message = "change status of selected "+listname;
 }

 var flag = validator(message,formname);   
 if(flag)
 {   
  formname.submit();
 }
 else
 {
  formname.frmChangeAction.value=''; 
  document.getElementById('Main').checked = false;
  if(listname == 'Group(s)' || listname == 'Testimonial(s)' || listname == 'Comment(s)' || listname == 'Tag(s)' || listname =='Contact(s)' || listname == 'Advertisement(s)' || listname == 'User(s)' || listname == 'Thread(s)' || listname == 'Banner(s)')
  {
   document.forms[1].Main.checked=false; 
   elm=document.forms[1].elements;
  }
  else
  {
   document.forms[0].Main.checked=false; 
   elm=document.forms[0].elements; 
  }

  for(i=0;i<elm.length;i++)
  {
   //alert(elm[i].type);
   if(elm[i].type == "checkbox" )
   {   
    elm[i].checked = false;
   }
   
  }
  return false;
 }
}
/******************************************
Function name : validator
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will return the true or error message after validating checkboxes
User instruction : validator(btnType)
******************************************/
var btnType;
function validator(btnType,formname)
{

 var obj = formname;

 var error="", flagCheck=0;
 
 var len = obj.elements.length; 

 var i=0;
 for(i=0;i<len;i++) 
 {
  if(obj.elements[i].type=='checkbox')
  {
   if(obj.elements[i].checked)
   {
    //if(btnType == 'Delete')
     return askConfirm(btnType);
    //else
     //return true;
   }
   else
    flagCheck = 1;
  }
 }
 
 if(flagCheck == 1)
  error += "\n Please select at least one record.";
   
 return checkError(error);
}
/******************************************
Function name : askConfirm
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will return the true or false after asking for confirmation
User instruction : askConfirm(type)
******************************************/
function askConfirm(type)
{ 
 var sen = "Are you sure you want to "+type+"?";
 if(confirm(sen))
 {
  return true;
 }
 else
 {
  return false;
 }
}

/*****************************
Function name : validateCMSForm
Return type : bollean
Date created : 04 feb 2009
Date last modified : 04 feb 2009
Author : Sharad Agarwal
Last modified by :Sharad Agarwal
Comments : This function is used to validate the CMS form.
User instruction : validateCMSForm(formname)
************************************/
function validateCMSForm(formname)
{
	if(document.getElementById(formname).frmPageID.value == '4')
	{
		if(validateForm(formname,'frmPageTitle','Page Title','R','frmPageKeywords','Meta Keywords','R','frmPageDescription','Meta Description','R'))
		{	
			return true;
		} 
		else 
		{
			return false;
		} 
	}
	else
	{
		if(validateForm(formname,'frmPageTitle','Page Title','R', 'frmPageHeading','Page Heading','R','frmPageKeywords','Meta Keywords','R','frmPageDescription','Meta Description','R'))
		{	
			return true;
		} 
		else 
		{
			return false;
		} 
	}
}
/*****************************
Function name : carValidator
Return type : integer
Date created : 10th Feb 2009
Date last modified : 10th Feb 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the User.
User instruction : carValidator(formname)
************************************/  
var btnType;
function carValidator(btnType,formname)
{
	var obj = document.forms[formname];
	var error="", flagCheck=0;
	var len = obj.elements.length;
	var i=0;
	for(i=0;i<len;i++) 
	{
		if(obj.elements[i].type=='checkbox')
		{
			if(obj.elements[i].checked)
			{
				//if(btnType == 'Delete')
					if(askConfirm(btnType))
					{
						return true;
					}
					else
					{
						for(i=0;i<len;i++) 
						{
							if(obj.elements[i].type == 'checkbox')
							{
								if(obj.elements[i].checked)
								{
									obj.elements[i].checked = false;
								}
							}
						}
						return false;

					}
				//else
					//return true;
			}
			else
				flagCheck = 1;
		}
	}
	if(flagCheck == 1)
		error += "\n - Please select at least one record.";
	return checkError(error);


}
/*****************************
Function name : validateGroupFrm
Return type : integer
Date created : 10th March 2009
Date last modified : 10th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the User.
User instruction : validateGroupFrm(formname)
************************************/  
function validateGroupFrm(formname)
{
	if(validateForm(formname,'frmGroupName','Group name','R','frmGroupTag','Group tag','R','frmGroupDescription','Group description','R', 'frmGroupNumberOfAdvertisement', 'Number of Advertisement', 'RisNumeric'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateTestimonialFrm
Return type : integer
Date created : 10th March 2009
Date last modified : 10th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the User.
User instruction : validateTestimonialFrm(formname)
************************************/  
function validateTestimonialFrm(formname)
{
	/*if(validateForm(formname,'frmGroupID','Group name','R', 'frmTestimonialDescription','Description','R','frmTestimonialYouTubeVideoURL','You Tube URL','isUrl','frmSecurityCode','Verification Code','R'))*/
	if(validateForm(formname,'frmGroupID','Group name','R', 'frmTestimonialDescription','Description','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateMergeGroupFrm
Return type : integer
Date created : 10th March 2009
Date last modified : 10th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Merge group.
User instruction : validateMergeGroupFrm(formname)
************************************/  
function validateMergeGroupFrm(formname)
{
	bolfocus = false;
	//var MasterString = getMasterString();
	var errorString = '';
	if(validateForm(formname,'frmGroupIDOne','Group','R', 'frmGroupIDTwo','Group to be Merged','R'))
	{	
		if(document.getElementById('frmGroupIDOne').value == document.getElementById('frmGroupIDTwo').value)
		{
			errorString+='- Same group can\'t be merged.\n';
			if(!bolfocus)
			{
				bolfocus = true; 
				orderElementID = 'frmGroupIDTwo';
			}
		}
		if(bolfocus)
		{
			alert(errorString);  
			document.getElementById(orderElementID).focus();
			return false;
		}
		else
		{
			return true;
		}
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateCommentFrm
Return type : integer
Date created : 12th March 2009
Date last modified : 12th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the comment.
User instruction : validateCommentFrm(formname)
************************************/  
function validateCommentFrm(formname)
{
	if(validateForm(formname,'frmCommentDescription','Description','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateTagFrm
Return type : integer
Date created : 12th March 2009
Date last modified : 12th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the tag.
User instruction : validateTagFrm(formname)
************************************/  
function validateTagFrm(formname)
{
	if(validateForm(formname,'frmTagName','Tag name','R', 'frmGroupID','Group name','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateContactFrm
Return type : integer
Date created : 12th March 2009
Date last modified : 12th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the tag.
User instruction : validateContactFrm(formname)
************************************/  
function validateContactFrm(formname)
{
	if(validateForm(formname,'frmContactName','Contact Name','R', 'frmContactMessage','Contact Message','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validateAdvertisementFrm
Return type : integer
Date created : 13th March 2009
Date last modified : 13th March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the tag.
User instruction : validateAdvertisementFrm(formname)
************************************/  
function validateAdvertisementFrm(formname)
{
	//if(validateForm(formname,'frmAdvertisementTitle','Title','R', 'frmAdvertisementContent','Content','R'))
	if(validateForm(formname, 'frmAdvertisementContent','Content','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
/******************************************
Function name : rpValidInteger
Return type : none
Date created : 16th Dec 2008
Date last modified :16th Dec 2008
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : Function will check whether value entered is integer or not.
User instruction : rpValidInteger(myfield, e)
******************************************/

function rpValidInteger(myfield, e) 
 
{
 
            var key;
 
            var keychar;
 
            if (window.event) 
 
            {
 
                        key = window.event.keyCode;
 
            }           
 
            else if (e) 
 
            {
 
                        key = e.which;
 
            }           
 
            else 
 
            {
 
                        return true;
 
            }
 
                        
 
            keychar = String.fromCharCode(key);
 
            // control keys
 
            if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) 
 
            {
 
                        return true;
 
            }           
 
            // numbers or decimal
 
            else if( (("0123456789.").indexOf(keychar) > -1) ) 
 
            {
 
                        return true;
 
            }
 
            else 
 
            {
 
                        return false;
 
            }
 
}
/*****************************
Function name : changeGroupAprovalStatus
Return type : integer
Date created : 17 March 2009
Date last modified : 17 March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to change the status of user group.
User instruction : changeGroupAprovalStatus(payment,recordID)
************************************/
function changeGroupApprovalStatus(groupApproval,recordID)
 {
   
  if(groupApproval == "Approve")
   {
	var flag=confirm('Are you sure you want to approve user group?');
	 if(flag) 
	  {
	    
		document.forms[1].action='group_approval_action.php?groupID='+recordID+'&groupApproval='+groupApproval+'&changeAction=group_approval';
		document.forms[1].submit();
	    return true;  
	  }
	  else
	  {
		 return false;  	
	  }
	
	}
	else
	{
		var flag=confirm('Are you sure you want to reject user group?');
		 if(flag) 
		  {
			document.forms[1].action='group_approval_action.php?groupID='+recordID+'&groupApproval='+groupApproval+'&changeAction=group_approval';
			document.forms[1].submit();
			return true;  
		  }
		   else
		  {
			 return false;  	
		  }
	}
  }
/*****************************
Function name : textPorfileInfoTextCounter
Return type : none
Date created : 19 March 2009
Date last modified : 19 March 2009
Author :Pankaj Pandey
Last modified by :Pankaj Pandey 
Comments : This function is used to count the text limit for the text field for profile updation.
User instruction : textPorfileInfoTextCounter(formname, maxlimit)
************************************/
function textPorfileInfoTextCounter(formname, textfieldname, maxlimit) 
{
	//alert(textfieldname);
	  var fieldValue = document.getElementById(textfieldname).value;
	  var fieldValueLength = fieldValue.length;
	  var countValue = document.getElementById(formname).remShortInfoLen1.value;
	  if (fieldValueLength > maxlimit) 
	  {
	   document.getElementById(textfieldname).value = document.getElementById(textfieldname).value.substring(0, maxlimit);
	  } 
	  else
	  {
	   document.getElementById(formname).remShortInfoLen1.value = maxlimit - fieldValueLength;
	  } 

}
/*****************************
Function name : setAdminRecordLimit
Return type : none
Date created : 23 March 2009
Date last modified : 23 March 2009
Author :Pankaj Pandey
Last modified by :Pankaj Pandey 
Comments : This function is used to count the text limit for the text field for profile updation.
User instruction : setAdminRecordLimit(formname, maxlimit)
************************************/
function setAdminRecordLimit(hiddenId)
{
	//alert(hiddenId);return false;
	document.getElementById(hiddenId).value = 'setRecordLimit';
	return true;
}
/*****************************
Function name : setBannerAction
Return type : none
Date created : 26 March 2009
Date last modified : 26 March 2009
Author :Pankaj Pandey
Last modified by :Pankaj Pandey 
Comments : This function is used to count the text limit for the text field for profile updation.
User instruction : setBannerAction(hiddenId)
************************************/
function setBannerAction(formname , sortOrder, bannerID)
{
	 var flag=confirm('Are you sure you want to change the order of selected banner?');
	 if(flag) 
	  {
		document.forms[formname].action='banner_action.php?bannerID='+bannerID+'&changeBannerOrder=yes&sortOrder='+sortOrder;
		document.forms[formname].submit();
		return true;  
	  }
	return true;
}

/*****************************
Function name : validateRegistrationForm
Return type : none
Date created : 24 March 2009
Date last modified : 24 March 2009
Author :Pankaj Pandey
Last modified by :Pankaj Pandey 
Comments : This function is used to validate user registrtion form.
User instruction : validateRegistrationForm(formname)
************************************/
function validateRegistrationForm(formname)
{
	//alert(formname);return false;
	var MasterString = getMasterString();
	if(validateForm(formname,'frmUserFirstName','First Name','R', 'frmUserLastName','Last Name','R','frmUserEmail','Username(Email)','RisEmail', 'frmUserPassword','Password','RisSpace', 'frmConfirmPassword','Confirm Password','RisEqualfrmUserPassword:Password', 'frmUserGender', 'Gender','R','frmUserCountry', 'Country','R','frmVerificationCode', 'Verification Code','R', 'frmPrivacyPolicy', '','RisCheckbox'))
	{	
		var month = document.getElementById('frmUserBirthMonth').value;
		var days = document.getElementById('frmUserBirthDay').value;
		var year = document.getElementById('frmUserBirthYear').value;
		var dateOfBirth = month+'/'+days+'/'+year;
		//alert(dateOfBirth); 
		var errorString = validateTheDateOfBirth(dateOfBirth);
		if(errorString != '')
		{
			bolfocus = true; 
			orderElementID = 'frmUserBirthDay';
			alert(MasterString+'\n'+errorString);
			document.getElementById(orderElementID).focus();
			return false;
		}
		else
		{
			return true;
		}
	} 
	else 
	{
		return false;
	} 
}
/*****************************
Function name : validBannerForm
Return type : boolean
Date created : 22nd October 2007
Date last modified : 22nd October 2007
Author : Sandeep Kumar
Last modified by : Sandeep Kumar
Comments : This function is used to validate admin setting form
User instruction : validBannerForm(formname)
************************************/
function validBannerForm(formname)
{
	if(document.getElementById('Image').style.display=='none')
	{
		
		if(validateForm(document.getElementById(formname).id,'frmGroupID', 'Group Name', 'R','frmBannerTitle', 'Banner Title', 'R','frmBannerURL', 'Banner URL', 'isUrl','frmBannerHTMLCode', 'Banner HTML Code', 'R'))
		{
			
			return true;
		}
		else 
		{
			return false;	
		}
		
	}
	if(document.getElementById('HTML').style.display=='none')
	{
	
		if(document.getElementById('frmBannerImageName').value =='' && document.getElementById('frmUploadedImage').value =='')
		{			
		
			if(validateForm(document.getElementById(formname).id,'frmGroupID', 'Group Name', 'R','frmBannerTitle', 'Banner Title', 'R','frmBannerURL', 'Banner URL', 'isUrl','frmBannerImageName', 'Banner Image', 'R'))
			{
				return true;
			}
			else 
			{
				return false;	
			}
			
		}
		
		else
		{	
			
			if(validateForm(document.getElementById(formname).id,'frmGroupID', 'Group Name', 'R','frmBannerTitle', 'Banner Title', 'R','frmBannerURL', 'Banner URL', 'isUrl'))
			{
				return true;
			}
			else 
			{
				return false;	
			}
		}
		
	}
}
/*****************************
Function name : showBannerOptions
Return type : boolean
Date created : 22nd October 2007
Date last modified : 22nd October 2007
Author : Sandeep Kumar
Last modified by : Sandeep Kumar
Comments : This function is used to show Banner Options.
User instruction : showBannerOptions(formname)
************************************/
function showBannerOptions(option)
{
	if(option == 'Image')
	{
		document.getElementById('Image').style.display = 'block';
		document.getElementById('HTML').style.display = 'none';
		document.getElementById('BannerField').innerHTML = '<span class="color_red">* </span><strong>Banner Image :</strong>';
		document.getElementById('frmBannerImageName').focus();
	}
	else
	{
		document.getElementById('Image').style.display = 'none';	
		document.getElementById('HTML').style.display = 'block';
		document.getElementById('BannerField').innerHTML = '<span class="color_red">* </span><strong>Banner HTML Code :</strong>';
		document.getElementById('frmBannerHTMLCode').focus();	
	}
}
/*****************************
Function name : isInteger
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : isInteger(enteredDate)
************************************/
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 name : stripCharsInBag
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : stripCharsInBag(enteredDate)
************************************/
function stripCharsInBag(s, bag)
{
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
	{   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

/*****************************
Function name : daysInFebruary
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : daysInFebruary(enteredDate)
************************************/
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 );
}
/*****************************
Function name : DaysArray
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : DaysArray(enteredDate)
************************************/
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
}
/*****************************
Function name : validateTheDateOfBirth
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : validateTheDateOfBirth(enteredDate)
************************************/
function validateTheDateOfBirth(enteredDate)
{
	var bolValidity = isValidDateOfBirth(enteredDate);
	//alert(bolValidity);return false;
	if (bolValidity == '')
	{
		return '';
	}
	else
	{
		return bolValidity;	
	}
}

/*****************************
Function name : isValidDateOfBirth
Return type : boolean
Date created : 31st March 2009
Date last modified : 31st March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Date form. 
User instruction : isValidDateOfBirth(enteredDate)
************************************/
function isValidDateOfBirth(dtStr)
{
	//alert(dtStr);
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;
	var errorString = '';
	var daysInMonth = 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)
	{
		errorString += '- Birthdate format should be : mm/dd/yyyy\n';
		return errorString;
	}
	
	if (strMonth.length<1 || month<1 || month>12)
	{
		errorString += '- Please enter a valid month';
		return errorString;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
	{
		errorString += '- Please enter a valid day.\n';
		//alert(errorString); return false;
		return errorString;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
	{
		errorString += "- Please enter a valid 4 digit year between "+minYear+" and "+maxYear+"\n";	
		return errorString;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false)
	{
		errorString += "- Please enter a valid Birthdate.\n";
		return errorString;
	}
	return '';	
}
/*****************************
Function name : checkPasswordLength
Return type : Boolean
Date created : 27 March 2009
Date last modified :27 March 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to check the length of the password.
User instruction :  checkPasswordLength(str)
*****************************/
function checkPasswordLength(str)
{
 
 var len = str.length;
 if(len< 6)
 {
  alert('Password must be of atleast 6 characters or more.');
  return false;
 }
 
}
/*****************************
Function name : validateLoginFrom
Return type : integer
Date created : 02 April 2009
Date last modified : 02 April 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This is used to check user login authentications.
User instruction : validateAdminForm(charToCheck)
************************************/
function validateLoginFrom(formname)
{
	if(validateForm(formname,'frmUserEmail','Username','RisEmail', 'frmUserPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}
/*****************************
Function name : validateUserGroupFrm
Return type : integer
Date created : 02 April 2009
Date last modified : 02 April 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the User.
User instruction : validateUserGroupFrm(formname)
************************************/  
function validateUserGroupFrm(formname)
{
	if(validateForm(formname,'frmGroupName','Group Name','R','frmGroupTag','Group Tag','R','frmGroupDescription','Group Description','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}
function validateShareLinkForm(formname)
{
	if(validateForm(formname,'frmYourName','Your Name','R', 'frmYourEmail','Your Email','RisEmail', 'frmDestinationEmail', 'Destination Email', 'RisEmail'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
function validateThread(formname) 
{
	if(validateForm(formname,'frmThread','Reply','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}
/*****************************
Function name : validateAddTagForm
Return type : integer
Date created : 03 April 2009
Date last modified : 03 April 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the tag .
User instruction : validateAddTagForm(formname)
************************************/  
function validateAddTagForm(formname)
{
	if(validateForm(formname,'frmGroupTag','Add Tag','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
function validateCommentsForm(formname) 
{
	if(document.getElementById('frmLogInVarification').value == 'Yes')
	{
		if(validateForm(formname,'frmComments','Comments','R'))
		{	
			return true;
		} 
		else 
		{
			return false;
		} 
	}

}
function validateSettingForm(formname)
{
	if(validateForm(formname,'frmOldPassword', 'Old Password', 'RisSpace', 'frmNewPassword', 'New Password', 'RisSpace', 'frmConfirmPassword','Confirm Password', 'RisEqualfrmNewPassword:New Password'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}

function validateProfileForm(formname)
{
	if(validateForm(formname,'frmUserFirstName', 'First Name', 'RisBlank', 'frmUserLastName', 'Last Name', 'RisBlank'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}
/*****************************
Function name : validateUserTestimonialFrm
Return type : integer
Date created : 05 April 2009
Date last modified : 05 April 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the User.
User instruction : validateUserTestimonialFrm(formname)
************************************/  
function validateUserTestimonialFrm(formname) 
{
	if(validateForm(formname,'frmTestimonialDescription','Description','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}
/******************************************
Function name : setvalidAction
Return type : boolean
Date created : 10th September 2008
Date last modified : 10th September 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : Function will ask for confirmation of updating records
User instruction : setValidAction(value, formname,listname)
******************************************/
function  validateCheckForm(value, formname,listname)
{
 if(value == 'Delete' || value.indexOf ('Delete')>-1)
 {
  message = "delete selected "+listname;  
 }
 else
 {
  message = "change status of selected "+listname;
 }

 var flag = validator(message,formname);   
 if(flag)
 {   
  formname.submit();
 }
 else
 {

   document.forms[1].Main.checked=false; 
   elm=document.forms[1].elements; 

  for(i=0;i<elm.length;i++)
  {
   //alert(elm[i].type);
   if(elm[i].type == "checkbox" )
   {   
    elm[i].checked = false;
   }
   
  }
  return false;
 }
}
/*****************************
Function name : validateUserTestimonialFrm
Return type : integer
Date created : 06 April 2009
Date last modified : 06 April 2009
Author : Pankaj Pandey
Last modified by : Pankaj Pandey
Comments : This function is used to validate the Testimonials.
User instruction : validateUserTestimonialForm(formname)
************************************/  
function validateUserTestimonialForm(formname)
{
	bolfocus = false;
	var MasterString = getMasterString();
	var errorString = '';
	if(document.getElementById('frmTestimonialDescription').value == 'Tell your story HERE... Anonymously (No Registration Required)')
	{
		errorString +='- Testimonial description is required.\n';
		if(!bolfocus)
		{
			bolfocus = true; 
			orderElementID = 'frmTestimonialDescription';
		}
	}
	/*if(document.getElementById('frmLogInVarification').value == 'Yes')
	{
		if(document.getElementById('frmTestimonialYouTubeVideoURL').value != 'Embed YouTube Video and tell your story anonymously')
		{
			if(document.getElementById('frmTestimonialYouTubeVideoURL').value)
			{
				var val;
				val = document.getElementById('frmTestimonialYouTubeVideoURL').value;
				p=val.indexOf('http://');
				s=val.indexOf('.');
				if (p<0 || p==(val.length-1))
				{
					errorString+='- URL must be valid URL e.g. http://www.abc.com\n';
					 if(!bolfocus)
					 {
						bolfocus = true; 
						orderElementID = 'frmTestimonialYouTubeVideoURL';
					 }
		
				}
				else if(s<p || s==(val.length-1))
				{
					errorString+='- URL must be valid URL e.g. http://www.abc.com\n';
					if(!bolfocus)
					{
						bolfocus = true; 
						orderElementID = 'frmTestimonialYouTubeVideoURL';
					}
				}
			}
		}
	}*/
	if(document.getElementById('frmSecurityCode').value == 'Enter above verification code here')
	{
		errorString +='- Security code is required.\n';
		if(!bolfocus)
		{
			bolfocus = true; 
			orderElementID = 'frmSecurityCode';
		}
	}
	if(errorString == '')
	{
		return true;  
	}
	else
	{
			alert(MasterString+'\n'+errorString);  
			if(bolfocus)
			{
			  document.getElementById(orderElementID).focus();
			}
			return false;
				   
	 }

}


/*****************************
Function name : validateDefalutAdvertisementGroup
Return type : integer
Date created : 06 April 2009
Date last modified : 06 April 2009
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
Comments : This function is used to validate the default advertisement group.
User instruction : validateDefalutAdvertisementGroup(formname)
************************************/  
function validateDefalutAdvertisementGroup(formname)
{
	if(validateForm(formname, 'frmAdminDefalutAdvertisementGroupID','Group Name','R'))
	{			
		var flag=confirm('Are you sure you want to change default advertisement group?')
		if(flag)
		return true;
		else
		return false;		
	} 
	else 
	{
		return false;
	}

}
function validateForgotPasswordFrm(formname)
{
	if(validateForm(formname, 'frmUserFullName','Username(E-mail)','RisEmail','frmSecurityCode','Verification Code','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
}
function validateRetrievePasswordForm(formname)
{
	if(validateForm(formname, 'frmNewPassword', 'New Password', 'RisSpace', 'frmConfirmPassword','Confirm Password', 'RisEqualfrmNewPassword:New Password'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}

/*****************************
Function name : validateContactForm
Return type : integer
Date created : 20 june 2008
Date last modified : 20 june 2008
Author : Gulshan Verma
Last modified by : Gulshan Verma
Comments : This is used to check admin login authentications.
User instruction : validateContactForm(charToCheck)
************************************/
function validateContactForm(formname)
{
	if(validateForm(formname,'frmName','Name','R', 'frmEmail','Email','RisEmail', 'frmMessage', 'Message', 'R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 

}

/*****************************
Function name : validateDefalutNumberOfAdvertisement
Return type : integer
Date created : 18 April 2009
Date last modified : 18 April 2009
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
Comments : This function is used to validate the default number of advertisement per group.
User instruction : validateDefalutNumberOfAdvertisement(formname)
************************************/  
function validateDefalutNumberOfAdvertisement(formname)
{
	if(validateForm(formname, 'frmAdminDefalutNumberOfAdvertisement','Number Of Advertisement','RisNumeric'))
	{			
		var flag=confirm('Are you sure you want to change default number of advertisement per group?')
		if(flag)
		return true;
		else
		return false;		
	} 
	else 
	{
		return false;
	}

}

