/******************************************
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
Comments : JavaScript Common Function File
******************************************/
/******************************************
Function name : toggleOption
Return type : None
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
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;
		}
	}
}
//***select on selection
function showlist(varname)
{
 if(varname == "selected")
 {
   document.getElementById('radiotype').style.display = '';
 }
 else
 {
    document.getElementById('radiotype').style.display = 'none';
 }
}

//*****validate send Mail Form **********************
function validateSendMailForm(formname)
{
	if(validateForm(formname,'frmSubject','Subject','R','frmFrom','From','R'))
	{	
		var errors = '';
		if(document.frmSendMailToUsers.frmMailTo[0].checked == false && document.frmSendMailToUsers.frmMailTo[1].checked == false)
		{
			errors += "\n Please choose one of the option to send mail.";
		}
		else if(document.frmSendMailToUsers.frmMailTo[1].checked)
		{
			  //multi select values 
			   var len = document.frmSendMailToUsers.elements.length;
				for(i=0;i<len;i++)
				{
					if(document.frmSendMailToUsers.elements[i].type == "select-multiple" && document.frmSendMailToUsers.elements[i].name == "frmMailSelected[]")
					{
						if(document.frmSendMailToUsers.elements[i].value == "")
						{
							errors += "\n Please select the Email from list";
						}
					}
				}	
		}
		if(document.frmSendMailToUsers.frmMessage.value == "")
		 {
		   errors+='\n- Mail Content is required.\n';
		 }
		 
		if(errors!='')
		{
			checkError(errors);
			document.frmSendMailToUsers.frmSubject.focus();
			return false;
		}
		else
		{
		  return true;
		}
	} 
	else 
	{
		return false;
	} 	
}
/******************************************
Function name : checkPhone
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
Comments : Function will return the true or false according to phone field validation
User instruction : checkPhone(phone)
******************************************/
function checkPhone(phone)
{
	var phoneRequired = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/
	if(!phoneRequired.test(phone))
		return false;
	return true;
}

/******************************************
Function name : checkEmail
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
Comments : Function will return the true or false according to email field validation
User instruction : checkEmail(address)
******************************************/
function checkEmail(address)
{
	if ((address == "") || (address.indexOf ('@') == -1) || (address.indexOf ('.') == -1))
		return false;
	return true;
}

/******************************************
Function name : getMasterString
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
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 : checkError
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Mohit Malik
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 : askConfirm
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Rupesh Parmar
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 : validator
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Rupesh Parmar
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 += "\nPlease select at least one record.";
			
	return checkError(error);
}

//////////////////////////////////////////All validation below this function/////////////////////////////////


/******************************************
Function name : validator
Return type : boolean
Date created : 21st September 2006
Date last modified : 21st September 2006
Author : Mohit Malik
Last modified by : Vivek Avasthi
Comments : Function will return the true or error message after validating checkboxes
User instruction : validator(btnType)
******************************************/

/*
'clientPassword', 'password','RisEqualconfpassword: confpassword'
'age','Age','RinRange10:30'
*/

function validateForm() 
{ 
	var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
	j=0;
	//	/^([-a-zA-Z0-9._]+@[-a-zA-Z0-9.]+(\.[-a-zA-Z0-9]+)+)$/;
	var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var urlstring= /http:\/\/[www\.-]{3,}\.[A-Za-z]{3}/;
	///var URLcheck = /^w+([.-]?w+)*.w+([.-]?w+)*(.w{2,3})+$/;
	var URLexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	var regBlank = /[^\s]/;
	//var regAlphaNum = /^([a-zA-Z0-9-/_ :;#!@\n\r.,$*&%?^~`=+(){}\[\]\"\'\\]+)$/;
	var regAlphaNum = /^([a-zA-Z0-9_#@]+)$/;
	 var regDate = /^([0-9_]+-[0-9][0-9]+-[0-9][0-9]+)$/; 
  /* var regDate = /^([0-9_]{4}+-[0-9]{2}+-[0-9]{2}+)$/;*/
	
	//alert (validateForm.arguments[1].name);
	//alert("sss--->"+document.forms[""+args[0]].elements[""+args[0]].value);
	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(test=='BLNK')
			{
			 if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
			 if (val<0) errors+='- '+nm+' must contain a number.\n';
			 }			
			 else if(test=='CHKURL' && val !="")
				{
					p=val.indexOf('http://');
					s=val.indexOf('.');
					 if (!urlstring.test(val)) { 	
						errors+='- '+nm+' must be valid URL e.g. http://www.abc.com\n';
						}
			       else 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 ((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+' must be same as '+mesg_string+'.\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';
						//errors+='- '+nm+': Only Alpha Numeric and "_ , . - ! @ # () {} [] " coma,  single cots and Chars Allowed.\n';
					}
				}
				}
				else if (test.indexOf('isDate')!=-1) 
				{ 
					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<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';
						
					}
					
					/*************************Added by rupesh********************/
					else if (p != 4 || sY.length != 4 || sM.length != 2 || sD.length != 2 )
					{
						errors+='- '+nm+' must contain Valid Date YYYY-MM-DD.\n';
		
					}
					else if(!regDate.test(val))
					{
						errors+='- '+nm+'  must contain Valid Date YYYY-MM-DD.\n';
					}
					else if(sM>12 || sD>31 || sY<2006)
					{
						errors+='- '+nm+'  must contain Valid Date YYYY-MM-DD.\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(s<p || s==(val.length-1))
					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;
					first_char= val.charAt(0);
					if(first_char==0||first_char==1||first_char==2||first_char==3||first_char==4||first_char==5||first_char==6||first_char==7||first_char==8||first_char==9)
					{
					 errors+='- '+nm+' must starts with  a char.\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!='R' || test=='Numbers') 
				 {
					 
				 result = trim(val);
					if(result.length==0){
						
						if(errors.indexOf('Phone') == -1)
					errors += '- '+nm+' is required.\n'; 
					}
					
				    if (isNaN(val)) 
					{
					 if(errors.indexOf('Phone') == -1)
					 errors+='- '+nm+' must contain a number.\n';
					}
					else
					{
					if(test=='Numbers' && !isNaN(val))
					{
					var i1;
					var num1=0;
						for (i1 = 0; i1 < val.length; i1++)
						{   
							// Check that current character is number.
							var c = val.charAt(i1);
							if (((c < "0") || (c > "9"))) num1=1;
						}
						if(num1==1)
						{
							if(errors.indexOf('Phone') == -1)
							errors+='- '+nm+' can only contain numbers.\n';
						}
						
					}
				 }
					if (test.indexOf('inRange') != -1) 
					{ num = parseFloat(val);
						p=test.indexOf(':');
						min=test.substring(8,p); 
						max=test.substring(p+1);
						
						
						if (num<min || max<num) 
							if(min==max)
							{
							  if(min==1 && max==1 & num==0)
								{
							errors+='- '+nm+' should  be more than '+min+'.\n';
							    }
								if(min!=1 && max!=1 && min==max)
								{
							errors+='- '+nm+' should not be more than '+min+'.\n';
								}
								
							}				
							
						else
						{
						errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
						}
					} 
					if (val.indexOf('-') != -1) 
					{ 
						errors='- '+nm+' must contain a number.\n';
					} 
					if (val.indexOf('+') != -1) 
					{ 
						errors='- '+nm+' must contain a number.\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' || test=='Numbers'){
				if(errors.indexOf('Phone') == -1 && test=='Numbers')
				{
					
				errors += '- '+nm+' is required.\n'; 
				}
				if (test.charAt(0) == 'R')
				{					
				errors += '- '+nm+' is required.\n'; 	
				}
			}
		}
			}
		if(errors !="")
		{	if(j<=0)
			{
				
				focusitem = document.forms[""+args[0]].elements[""+args[i]];
				j++;
			}	
			
		}
	} 
	
//return errors;
  
  if (errors)
  {
	var MasterString = getMasterString();

	alert(MasterString+'\n'+errors);
	
	focusitem.focus();
	return false;
   }
   else
	return true;

//  document.MM_returnValue = (errors == '');
	
}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function
//CODE FOR RECURRENCE STUFF

//This function check file extensions
function checkImageExt(val)
{
var isOK = false;

var lent =  document.frmAddProductImage.elements.length;

with (val)
  { 
	for (var i = 0; i < lent ; i++)
    { 
	
      if ((document.frmAddProductImage.elements[i].type == "file") )
      { isOK = true;
	   	var imagePath = document.frmAddProductImage.elements[i].value;
		ext=imagePath;
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();		
		//var imageExt = imagePath.split('.');	
		if(imagePath!='')
		  {
			if (ext == 'jpeg' || ext == 'gif' || ext == 'png' || ext == 'jpg' || ext == 'bmp' || ext == 'undefined')      
			{
			  isOK = true;
			 
			} 
			else
			{
				isOK = false;
			}
		
	   } }
	} 
 }
 
  if (!(isOK)) 
  { 
  	alert("Please select image!"); 
	return false; 
  }
}
/******************************************
Function name : stripHTML
Return type : string
Date created : 12 Feb 2007
Date last modified : 12 Feb 2007
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
Comments : Function will return the main string after removing HTML tags
User instruction : stripHTML(str)
******************************************/
function stripHTML(str){
      var re= /<\S[^><]*>(&nbsp;)*/g ;
      return str.replace(re, "") ;
}
/******************************************
Function name : ltrim
Return type : string
Date created : 5 Feb 2007
Date last modified : 5 Feb 2007
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
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 : 5 Feb 2007
Date last modified : 5 Feb 2007
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
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 : 5 Feb 2007
Date last modified : 5 Feb 2007
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
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 : 5 Feb 2007
Date last modified : 5 Feb 2007
Author : Ashok Singh Negi
Last modified by : Ashok Singh Negi
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);
}

/******************************************** Site function **************************************/

//Check admin login form
function validateAdminForm(formname)
{
	if(validateForm(formname,'frmAdminUserName','Username','R', 'frmAdminPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
	
}
//Check Team Member form

function validSearch()
{
	var error="";
	if(document.frmSearch.frmSrchCatID.value=="")
	{
		if(document.frmSearch.frmSrchKey.value==0)
		{
		 error +="\n Please either select category or enter search keyword.";
		}	
	}
	
	
	if(error!='')
	{
		checkError(error);
		return false;
	}
}




//Check login form
function validLoginFrm(formname)
{
	if(validateForm(formname,'frmEmail','Email','RisEmail', 'frmPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
	
}



//Check password and confirm password

function validChangePass(formname)
{
	if(validateForm(formname,'frmUserOldPassword', 'Old password', 'R', 'frmUserPassword', 'New password', 'RisEqualfrmUserConfPassword:confirm password'))
	{	
		var flag=confirm('Are you sure you want to change password?')
		if(flag)
		return true;
		else
		return false;
	} 
	else 
	{
		return false;
	} 
	
}
////Check login form
function validLogin(formname)
{
	if(validateForm(formname,'frmEmail','Email','RisEmail', 'frmPassword','Password','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
	
}


function checkKeyIE()
{
	if (window.event.keyCode == 13) // checks whether the SHIFT key
	// is pressed
	{
	window.event.cancelBubble = true;
	window.event.returnValue = false;
	var updateBtn = document.getElementById("btnUpdate");
	updateBtn.click();
	
	}
}
function CheckKey()
{
	if(window.navigator.appName=='Microsoft Internet Explorer')
	{
		checkKeyIE();
	}
	else if(window.navigator.appName=='Netscape')
	{
		checkKeyMozilla(event);
	}
}	
function checkKeyMozilla(e)
{
	e = (window.event)? window.event : e;
	if (e.keyCode == 13) // checks whether the SHIFT key
	// is pressed
	{
	e.stopPropagation();
	e.preventDefault();
	var updateBtn = document.getElementById("btnUpdate");

	 updateBtn.click();
	}
	
}

//**change password
function validAdminChangePass(formname)
{
	if(validateForm(formname,'frmAdminOldPassword', 'Current Password', 'R', 'frmAdminNewPassword', 'New Password','RisAlphaNum','frmAdminNewPassword', 'Confirm Password', 'RisEqualfrmAdminConfirmPassword:New Password'))
	{			
			var flag=confirm('Are you sure you want to change password?')
			if(flag)
			return true;
			else
			return false;		
		
	} 
	else 
	{
		return false;
	} 
	
}
//***check admin email
function validateSettingForm(formname)
{
	if(validateForm(document.getElementById(formname).id, 'frmAdminEmail','Email','RisEmail'))
	{	
		
		  return true;
	} 
	else 
	{
		return false;
	} 
}
//** remove text options 
function removeTxtValue()
{
	for(i=0;i<document.forms[0].elements.length;i++)
	{
		if(document.forms[0].elements[i].type=='text')
		{
				document.forms[0].elements[i].value='';
		}
		if(document.forms[0].elements[i].type=='select-one')
		{
				document.forms[0].elements[i].value='';
		}
	}	
}
//********for hide and show search options 
function hideElement (elementId) {
 var element;
 if (document.all)
 element = document.all[elementId];
 else if (document.getElementById)
 element = document.getElementById(elementId);
 if (element && element.style)
 element.style.display = 'none';
 }
 //***show
 function showElement (elementId) {
 var element;
 if (document.all)
 element = document.all[elementId];
 else if (document.getElementById)
 element = document.getElementById(elementId);
 if (element && element.style)
 element.style.display = '';
 }

// ********
 

	/********************Business-Management******************/
function  validAction(value, formname, fileName)
{
		
	
	// For the Candidate 
	
	// For the Category 
	
	//**** for CAtegory 
	// For the News
	if(fileName=='news')
	{		
		if(value == 'Delete')
		{
		value = "delete selected News Title(s) ";		
		}
		else
		{
		value = "change status of selected News Title(s) ";
		}
		var flag = validator(value,formname);			
		if(flag)
		{
			formname.submit();
		}
		else
		{
			formname.frmChangeAction.value='';	
			document.forms[1].selectAll.checked=false;				
			elm=document.forms[1].elements;
			for(i=0;i<elm.length;i++)
			{
				if(elm[i].type=="checkbox")
				{			
					elm[i].checked = false;
				
				}
			}
			return false;
		}

	}
//For shopping Centers
if(fileName=='ShoppingCenter')
	{		
		if(value == 'Delete')
		{
		value = "delete selected Shopping Center(s) ";		
		}
		else
		{
		value = "change status of selected Shopping Center(s) ";
		}
		var flag = validator(value,formname);			
		if(flag)
		{
			formname.submit();
		}
		else
		{
			formname.frmChangeAction.value='';	
			document.forms[1].selectAll.checked=false;				
			elm=document.forms[1].elements;
			for(i=0;i<elm.length;i++)
			{
				if(elm[i].type=="checkbox")
				{			
					elm[i].checked = false;
				
				}
			}
			return false;
		}
	
	
	}
}

	function deSelectCheckbox(formname)
	{
		document.forms[1].selectAll.checked=false;
	}
	
	






//**** check news form 

function validateNewsForm(formname)
{
	
	if(validateForm(document.getElementById(formname).id,'frmNewsTitle','News Title','R','frmNewsReferenceWebsiteUrl','Reference Website Url','CHKURL'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
	


}

function validateShoppingCenterForm(formname)
{
	
	if(validateForm(document.getElementById(formname).id,'frmShoppingCenterTitle','Mall Title','R'))
	{	
		return true;
	} 
	else 
	{
		return false;
	} 
	


}
//function to validate contact us form in the front end 
function ValidateContactUsForm(formname)
{
	if(validateForm(document.getElementById(formname).id,'frmName','Name','R', 'frmEmail','Email','RisEmail', 'frmPhone','Phone Number','RisNan','frmDepartment','Department','R','frmComments','Comments','R'))
	{	
		
		  return true;
	} 
	else 
	{
		return false;
	} 
}