//For Selecting/ deselecting check boxed
	var marked_row = new Array;
	var grupid = 1;
	function clearerror()
	{
	return true;
	}
	window.onerror=clearerror;
	
	function numbersonly(e) {
		var unicode=e.charCode? e.charCode : e.keyCode
		if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
			if (unicode<48||unicode>57) //if not a number
				return false //disable key press
		}
	}
	function nameonly(e)
	{
		var unicode=e.charCode? e.charCode : e.keyCode;
		if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
			if ((unicode >= 48 && unicode <= 57) || (unicode >= 65 && unicode <= 90) || (unicode >= 97 && unicode <= 122) || unicode == 32) //if not a number
				return true 
			else				
				return false 
		}
	}
	function resetJS()
	{
		if(document.getElementById('sp_err')) { 
			var t = document.getElementById('sp_err');
			t.parentNode.removeChild(t);
		}
	}
	function selectDeselect(field, isCheck)
	 {
		var boxes = document.getElementsByName(field);
		var boxes_checked = anyChecked();
		if(isCheck)
		{
		   if(document.getElementsByName(isCheck)[0].checked) setChecks(true);
			else setChecks(false);
		}
		else
		{
			if(!boxes_checked) setChecks(true);
			else setChecks(false);
		}	

		function setChecks(setting) 
		{
			for(var j=0; j< boxes.length; j++ ) 
			{
			   boxes[j].checked = setting;
			   theObjects = document.getElementsByTagName("tr");
			   if(setting==true)
			  		 {
						for (var i = 0; i < theObjects.length; i++)
						{
							if(theObjects[i].id.indexOf('_') != -1) 
							{
							theObjects[i].className = 'over';
							}							  
						} 
			    	 }
			    	 else
			    	 {
						for (var i = 0; i < theObjects.length; i++)
						{
							if(theObjects[i].id.indexOf('0_') != -1) 
							{
							theObjects[i].className = 'evenTr';
							}
							else if(theObjects[i].id.indexOf('1_') != -1) 
							{
							  theObjects[i].className = 'oddTr';
							}
							  
						} 
			   		 }
			}
		}
		
		function anyChecked()
		 {
			for( var i=0; i < boxes.length; i++ ) 
			{
				if( boxes[i].checked == true) 
				{
					return (true);
				} 
			}
			return (false);
		}
	}
	
	function checkany(field, message)
	{
		var boxes = document.getElementsByName(field);
		var bol = anyChecked(boxes);
		if(bol == false) {
			alert(message);
			return true;
		}
		else
			return false;
	}

	//To check wheather user have selected box or not
	function anyChecked(boxes) 
	{ 
		for( var i=0; i < boxes.length; i++ ) {
			if( boxes[i].checked == true) {
				return (true);
			} 
		}
		return (false);
	}

	//For checking Null values
	function isNull(aStr)
	{
		var index;
		for (index=0; index < aStr.length; index++)
			if (aStr.charAt(index) != ' ')
				return false;
		return true;
	}	

	//For checking invalid E-Mail address
	function isEmail(aStr)
	{
		var reEmail=/^[0-9a-zA-Z_\.-]+\@[0-9a-zA-Z_\.-]+\.[0-9a-zA-Z_\.-]+$/;
		if(!reEmail.test(aStr)) {
			return false;
		}
		return true;
	}

	//Removing the newline character
	function countChars(str)
	{
		var reg = new RegExp("[\f\n\r\v]*","g");
		str = str.replace(reg,"");
		return str.length;   
	}

	//For checking invalid Numaric
	function isNum(aStr)
	{
	   
		var reNum=/^[0-9.]+$/;
		if(!reNum.test(aStr)) {
			return false;
		}
		return true;
	}

	function chknewslatter()
	{
		if(!isEmail(document.subscription.email_add.value)) {
			alert("Please enter valid Email Address.");
			document.subscription.email_add.focus();
			return (false);
		}
		return (true);
	}

	//For checking invalid AlphaNumaric
	function isAlphaNumaric(aStr){
		var reNum=/^[0-9.a-zA-Z_-]+$/;
		if(!reNum.test(aStr)) {
			return false;
		}
		return true;
	}
	
function isCharacter(aStr){
		var reNum=/[a-zA-Z]/;
		if(!reNum.test(aStr.value)) {		
		alert('Please enter characters only.');
	    field.focus();
		return true;	
		}
		
		
		return false;
		
		
	}

	//	Start: is valid uszip code
	function isZip(str)	{
		if (str.indexOf("-",0) > 0)  var t = /^\d{5}-\d{4}$/
		else var t = /^\d{5}$/
		return t.test(str)
	}

	//	Start: is valid URL
	function isURL(argvalue) {
	  if (argvalue.indexOf(" ") != -1)
		return false;
	  else if (argvalue.indexOf("http://") == -1 || argvalue.indexOf("https://") == -1)
		return false;
	  else if (argvalue == "http://")
		return false;
	  else if (argvalue.indexOf("http://") > 0 || argvalue.indexOf("https://") > 0 )
		return false;
	  argvalue = argvalue.substring(7, argvalue.length);
	  if (argvalue.indexOf(".") == -1)
		return false;
	  else if (argvalue.indexOf(".") == 0)
		return false;
	  else if (argvalue.charAt(argvalue.length - 1) == ".")
		return false;
	  if (argvalue.indexOf("/") != -1) {
		argvalue = argvalue.substring(0, argvalue.indexOf("/"));
		if (argvalue.charAt(argvalue.length - 1) == ".")
		  return false;
	  }	

	  if (argvalue.indexOf(":") != -1) {
		if (argvalue.indexOf(":") == (argvalue.length - 1))
		  return false;
		else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
		  return false;
		argvalue = argvalue.substring(0, argvalue.indexOf(":"));
		if (argvalue.charAt(argvalue.length - 1) == ".")
		  return false;
	  }
  return true;
}

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function isValidDate(dateStr) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables
var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("Date is not in a valid format.")
return true;
}
month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return true;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return true;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!")
return true
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
return true;
   }
}
return false;  // date is valid
}
//  End -->
/***********************************************************************************/
	function invalidLength(field, message, intMin, intMax)
	{
		if(countChars(field.value) < intMin || countChars(field.value) > intMax) {
			 addMessage(field, message+intMin+" to "+intMax+" characters");
			return true;
		}
		return false;
	 }
	function blankField(field, message)
	{   
	    var html = field.value;
	    var stripped = html.replace(/(<([^>]+)>)/ig,""); 
	    var stripped = stripped.replace(/[#$%?\\*\\&^!@|']/ig,""); 
		
		if(isNull(leftTrim(stripped)) || leftTrim(stripped)=="") 
		{
		   var inputId=field;
		   addMessage(field, message);
		   return true;
		}
		return false;
	 }

/***************************************************************/

	function delConfiram()
	{	
		if(checkany('delete[]', 'Please select atleast one record to delete.'))
			return false;
		else if(confirm('Are you sure you want to delete the selected record(s)?'))
			return true;			
		else
			return false;
	}
	
	function delConfiramVenue()
	{	
		if(checkany('delete[]', 'Please select atleast one record to delete.'))
			return false;
		else if(confirm('All events of selected venue(s) will be deleted permanently. \n\n Are you sure you want to delete the selected record(s)?'))
			return true;			
		else
			return false;
	}
	
	
	function selectall()
	{
		selectDeselect('delete[]', 'sel_del');
	
	}
	function validateFrm(tmpVar,mode)
	{
		with(tmpVar)
		{
			for(i = 0; i < elements.length; ++i)
			{ 
				field = elements[i];				
				var strMsg, strArgvalue;
				myString = new String(field.name);	
				myStringId = new String(field.id);
				
				if(myString.substring(0, 3) == 'md_' || myStringId.substring(0, 3) == 'm__') 
				{
					var strMessage = '';
					strArgvalue = myString.substring(3, myString.length);
					strMsg = strArgvalue.replace(/_/g, ' ');
					
					
					if(field.type == 'select-one') {
						strMessage = '- Please select the value.';
					}
				
					else if(field.type == 'file') {
						strMessage = '- Please fill all the required fields.';
					} if(field.name.indexOf("date") != -1) {
						strMessage = '- Please fill all the required fields.';
					}
					else if(field.value=="$" || field.value=="%" || field.value=="@" || field.value=="#" || field.value=="!" || field.value=="^" || field.value=="&" || field.value=="*") 
					{
						strMessage = 'Special characters are not allowed.';
					}
					
					else {
						strMessage = '- Please fill all the required fields.';
					}
					if(blankField(field, strMessage))
						return false;
						
					if(field.type == 'file' && field.name == "db_csvfile") 
					{ 
						if(isCSV(field, 'Please browse only CSV file.'))
						{
							return false;
						}
					}	
				} 
				if(field.type == 'file' && field.name.indexOf("image") != -1) 
				{ 
					if(invalidFileFormat(field, 'Please browse only gif, png,jpeg and jpg.'))
					{
						return false;
					}
				}
				if(field.name.indexOf("Numberofcolors") != -1 && field.value!="") 
				{
					if(invalidNumber(field, 'Please enter integer value.'))
					{
						return false;
					}
				}
				if(field.name.indexOf("Size") != -1 && field.value!="") 
				{
					if(invalidNumber(field, 'Please enter integer value.'))
					{
						return false;
					}
				}	
					
				if(field.name.indexOf("fld_state_name") != -1 && field.value!="") 
				{
					if(isCharacter(field))
					{
						return false;
					}
					
				}			
				
				if(field.name.indexOf("email") != -1 && field.value!="") 
				{
					if(invalidEmail(field, 'Plaese enter valid email format.'))
					{
						return false;
					}
				}
				
				
				if(field.name.indexOf("phone") != -1 && field.value!="") 
				{
					if(checkInternationalPhone(field, 'Plaese enter valid Mobile number'))
					{
						return false;
					}
				}
				
				
				if(field.name.indexOf("zip") != -1 && field.value!="") 
				{
					 
					if(checkInternationalZipcode(field, 'Plaese enter integer number'))
					{
						return false;
					}
				}
				
				if(field.name.indexOf("chk_terms")!=-1 && field.checked==false)
				{
					  addMessageCMS(field, 'Please check terms & conditions');
					  return false;
				}
			}
		}		
		return true;;			
	}
	
	function showdiv_sendmail()
	{
		document.getElementById('_divSendTmp').style.display='block';
	}
	function closediv_sendmail()
	{
		document.getElementById('_divSendTmp').style.display='none';
	}
	
	function ValidateChForm(tmpVar)
	{
		   with(tmpVar)
		   {
		    
			  if(blankField(md_old_password,'Please enter old password'))
			  return false 
			  if(blankField(md_new_password,'Please enter new password'))
			   return false 
			  if(invalidLength(md_new_password,'Please update the password from its default value to something having ',6,15))
			    return false; 
			   
			  if(md_old_password.value == md_new_password.value)
			   {
				addMessage(md_new_password, "Old password and New password should not be same");
				 return false;
			   }
			 if(blankField(md_con_password,'Please enter confirm password'))
			   return false
			 
			 if(md_con_password.value != md_new_password.value)
			  {
			    addMessage(md_con_password, 'New Password and confirm Password are not same');
			     return false;
		     }  
		  }
		   return true;
		}
		
		
	function checkpwd()
	{
		if(trim(document.getElementById('md_oldpassword').value)=="" || trim(document.getElementById('md_password').value)=="" ||trim(document.getElementById('md_cnfpassword').value)=="")
		{
			alert("Required field can not be left blank.");
			return false;
		}
		if(document.getElementById('md_password').value.length<6)
		{
			alert("Password length should be minimum 6 character.");
			return false;
		}
		if(trim(document.getElementById('md_password').value)!=trim(document.getElementById('md_cnfpassword').value))
		{
			alert("New password and confirm password should be same");
			document.getElementById('md_cnfpassword').value="";
			document.getElementById("md_cnfpassword").focus();
			return false;
		}
	}
	
	
	function checkUserValidateForm(Userid)
	{
		
		if(trim(document.getElementById('md_usertype_id').value)=="")
		{
			alert("Please select usertype.");
			document.getElementById('md_usertype_id').focus();
			return false;
		}
		
		if(trim(document.getElementById('md_username').value)=="")
		{
			alert("Please enter username.");
			document.getElementById('md_username').focus();
			return false;
		}
		if(Userid=='')
		{
			if(trim(document.getElementById('md_password').value)=="")
			{
				alert("Please enter password.");
				document.getElementById('md_password').focus();
				return false;
			}
			if(document.getElementById('md_password').value.length<6)
			{
				alert("Password length should be minimum 6 character.");
				return false;
			}
			if(trim(document.getElementById('md_password').value)!=trim(document.getElementById('md_con_password').value))
			{
				alert("Password and confirm passwords should be same");
				document.getElementById('md_con_password').value='';
				document.getElementById('md_con_password').focus();
				return false;
			}
		}
		if(trim(document.getElementById('md_first_name').value)=="")
		{
			alert("Please enter first name.");
			document.getElementById('md_first_name').focus();
			return false;
		}
		if(trim(document.getElementById('md_last_name').value)=="")
		{
			alert("Please enter last name.");
			document.getElementById('md_last_name').focus();
			return false;
		}
		if(trim(document.getElementById('md_email').value)=="")
		{
			alert("Please enter email.");
			document.getElementById('md_email').focus();
			return false;
		}
		if(isValidEmail(trim(document.getElementById('md_email').value)) == false) 
		{
			alert("Please enter valid email.");
			document.getElementById('md_email').focus();
			return false;
		}
		
		if(trim(document.getElementById('md_companyname').value)=="")
		{
			alert("Please enter/select company name.");
			document.getElementById('md_companyname').focus();
			return false;
		}
		if(trim(document.getElementById('db_phone').value)!="")
		{
			if(checkInternationalPhone(document.getElementById('db_phone'), 'Plaese enter valid phone number'))
			{
				return false;
			}
		}
		
	}
	
	
	function checkcontactfrm()
	{
		if(trim(document.getElementById('md_name').value)=="" )
		{
			alert("Please enter your name.");
			return false;
		}
		
		if(trim(document.getElementById('md_email').value)=="" )
		{
			alert("Please enter your email.");
			return false;
		}
		
		if(isValidEmail(trim(document.getElementById('md_email').value)) == false) 
		{
			alert("Please enter valid email.");
			return false;
		}
		
		if(trim(document.getElementById('md_phone').value)=="" )
		{
			alert("Please enter your contact number.");
			return false;
		}
	}
	
	
	
	function checksendtofrnd()
	{
		if(trim(document.getElementById('md_friend_name').value)=="" )
		{
			alert("Please enter friend's name.");
			return false;
		}
		if(trim(document.getElementById('md_friend_email').value)=="" )
		{
			alert("Please enter friend's email.");
			return false;
		}
		if(isValidEmail(trim(document.getElementById('md_friend_email').value)) == false) 
		{
			alert("Please enter valid email.");
			return false;
		}
		if(trim(document.getElementById('md_name').value)=="" )
		{
			alert("Please enter your name.");
			return false;
		}
		if(trim(document.getElementById('md_email').value)=="" )
		{
			alert("Please enter your email.");
			return false;
		}
		if(isValidEmail(trim(document.getElementById('md_email').value)) == false) 
		{
			alert("Please enter valid email.");
			return false;
		}
	}
	
	function validateListFrm()
	{
		if(checkany('md_flyer', 'You are about three minutes away from completing the flyer.Please select a color for design a template.'))
		return false;
		else
		return true;
	}

	 function addMessage(field1, message)
	 {		
		var str = field1.parentNode.innerHTML;
		var field = field1;
		 alert(message);
		field.focus();
	 }

/***************************************************************/

	  function addMessageCMS(field1,message)
	 {
	     alert(message);
	 }
	/*
	 Function to check CMS Value is Null
	*/
	function blankCMS(field, message)
	{
		var html=field.value;
		var stripped = html.replace(/(<([^>]+)>)/ig,""); 
		
		if(isNull(LTrim(stripped))) {
			addMessageCMS(field, message);
			return true;
		}
		string=validCMS(stripped);
		if(leftTrim(string) == "") {
			addMessageCMS(field, message);
			return true; 
		}
		return false;
	}
	 
	function invalidEmail(field, message)
	{
		if(isValidEmail(field.value) == false) 
		{
		   addMessage(field, message);
			field.focus();
			return true;
		}
		else if(isEmail1(field.value) == 3) 
		{
			alert(VALID_CHAR_EMAIL);
			field.focus();
			return true;
		}
		return false;
	 }
	 
	function equalField(field1, field2, message)
	{
		if(field1.value != field2.value) {
			addMessage(field2, message);
			return true;
		}
		return false;
	}
	 
	function dateCompare(field1, field2, message)
	{		
		d1 = new Date(field1.value);
		d2 = new Date(field2.value);
		if (d1 > d2) {
			addMessage(field2, message);
			return true;
		}
		return false;
	}
	 
	function invalidDate(field1, field2, field3)
	{	
		if (isValidDate(field1.value+"/"+field2.value+"/"+field3.value) == false){
		 addMessage(field1, message);
			return true;
		}
	}
	 
	function invalidEmailList(field, message)
	{
		var b = field.value;
		var temp = new Array();
		temp = b.split(',');
		for(var i = 0; i < temp.length; i++)
		{
			if(!isEmail(temp[i])) {
				alert(message);
				field.focus();
				return true;
			}
		}
		return false;
	}
	
	function invalidAvailableUsername(field, message)
	{
		if(isNull(field.value)) {
			alert(message);
			field.focus();
			return true;
		}
		return false;
	 }
	 
	function invalidUrl(field, message)
	{	
		if (!isVUrl(field.value)) {
			addMessage(field, message);
			return true;
		}
	}
	 
	function invalidNumber(field, message)
	{	
		if (!isNum(field.value)) {
			addMessage(field, message);
			return true;
		}
	}
	 
	function invalidAlphaNumaric(field, message)
	{	
		if (!isAlphaNumaric(field.value)){
			addMessage(field, message);
			return true;
		}
	}
	 
	function invalidFileFormat(field, message)
	{
		if (field.value != "") {
			myString = new String(field.value);					
			start=myString.lastIndexOf(".");
			argvalue = myString.substring(start, myString.length);		
			if(argvalue.toLowerCase() != ".gif" && argvalue.toLowerCase() != ".png" && argvalue.toLowerCase() != ".jpeg" && argvalue.toLowerCase() != ".jpg" ) {
				addMessage(field, message);	
				return true;					
			}					
		}
	}
	
	function isCSV(field, message)
	{
		if (field.value != "") {
			myString = new String(field.value);					
			start=myString.lastIndexOf(".");
			argvalue = myString.substring(start, myString.length);		
			if(argvalue.toLowerCase() != ".csv") {
				addMessage(field, message);	
				return true;					
			}					
		}
	}

	
	function ISPDF(field, message)
	{
		myString = new String(field.value);					
		start=myString.lastIndexOf(".");
		argvalue = myString.substring(start+1, myString.length);
		if (argvalue.toLowerCase()!= "pdf" ) {
			addMessage(field, message);
			return true;					
		}
	}
	
	function ISCSV(field, message)
	{
		myString = new String(field.value);					
		start=myString.lastIndexOf(".");
		argvalue = myString.substring(myString.length-3, myString.length);
		
		if (argvalue.toLowerCase() != "xls" ) {	
			addMessage(field, message);	
			return true;					
		}
	}
	
	
	function ISDOC(field, message)
	{
		if(field.value!= "") {
			 myString = new String(field.value);					
			 start=myString.lastIndexOf(".");
			 argvalue = myString.substring(start, myString.length);		
			if (argvalue.toLowerCase()!= "doc" ) {
				addMessage(field, message);
				return true;					
			}					
		}
	}
	
	function IsFile(field, message,extension)
	{
		
		if(field.value!= "") {
			myString = new String(field.value);					
			start=myString.lastIndexOf(".");
			argvalue = myString.substring(start, myString.length);

			if (argvalue.toLowerCase()!= "xml" ) {
				addMessage(field, message);		
				return true;					
			}					
		}
	}	
		

	function invalidFromToZip(field1, field2)
	{	
		if ((isNum(field1.value) & !isNum(field2.value)) | (!isNum(field1.value) & isNum(field2.value))) {
			alert(AI_FROMTOZIPCODE);
			if(isNum(field1.value))
				field2.focus();
			else
				field1.focus();			
			return true;
		}
	}
/***********************************************************************************/
	function isValidEmail(emailid)	// Email Validation
	{		
	var email=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		return email.test(emailid);
	}


	function isEmail1(field)//email checking
	{
		var atPosition, dotPosition, lastPosition;
		var c = field.charAt(0);  
		aPosition = field.indexOf("@");
		dotPosition = field.lastIndexOf(".");
		lastPosition = field.length-1;
		
		if (aPosition < 1 || dotPosition - aPosition < 2 || lastPosition - dotPosition > 6 || lastPosition - dotPosition < 2) {
			return(false);
		}
		return(true);
	}

	function compareDates (start_field, end_field,message) 
	{
		var start = new Date (start_field.value);
		var end = new Date (end_field.value);
		if(start > end) {
			addMessage(end_field, message);
			return true;
		}
		else {
			return false;
		}
	} 

	function comparePass(oldVal,newVal,message)
	{
		if(oldVal.value == newVal.value) {
			addMessage(newVal, message);
			return true;			  
		}
		return false;
	}

/**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+"+".";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 10;

	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 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++)
		{   
			// Check that current character isn't whitespace.
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function checkInternationalPhone(field,message){
	strPhone=field.value;
	s=stripCharsInBag(strPhone,validWorldPhoneChars);
	bol= (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
	if(bol==false)
	{ 
	   addMessage(field, message); 
	   return true;
	}
	else
	{
	 return false;
	}
	}


	function isVUrl(s)
	 {
		var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
		return regexp.test(s);
	}
	
	function validCMS(s)
	{
	
	str=s.replace(/(&nbsp;)/ig,""); 
	return str;
	
	}



	function frm_submit(tmp)
	{
	 tmp.submit();
	}
	
	function form_sub(tmp)
	{ 
	 document.headerfrm.page.value=tmp;
	 document.headerfrm.submit();
	}
	
	
	function leftTrim(sString) 
	{
	  while (sString.substring(0,1) == ' ' || sString.substring(0,1) == "\n" || sString.substring(0,1) == "\r" || sString.substring(0,1) == "\t")
	   {
		 
		 sString = sString.substring(1, sString.length);
	   }
	  return sString;
	}
	
	function LTrim( value ) {
	 var re = /\s*((\S+\s*)*)/;
	 return value.replace(re, "$1");
	}
	
	
	function RTrim( value )
	{
	 var re = /((\s*\S+)*)\s*/;
	 return value.replace(re, "$1");
	}
	
	
	function trim( value )
	{
	  return LTrim(RTrim(value));
	}


	function check_fileSize(field,tmpW)
	{
		var img = new Image();
		img.src = field.value;
		var wid=img.width;
		var hit=img.height;
		
		if(wid >tmpW ) {
			alert("Banner image width should not be greater than "+tmpW+"");
			return true;
		}
		return false;
	}
	
	function setCss(id,ch,css,pre)
	{  
	 if(ch.checked==true)
	 {
	  document.getElementById(pre+"_"+id).className='over';
	 }
	  else
	  {   document.getElementsByName('sel_del').checked=false;
		document.getElementById(pre+"_"+id).className=css;
		
		//selectDeselect('sel_del',false);
	  }
	}
	
	function check_chars(id,char,field)
	{
	   var len=field.value.length;
	   var string=field.value;
	   
	   if(len<char || len==char)
		 document.getElementById(id).innerHTML=eval(char-len);
	   else
	   {
		 field.value=string.substring(0,250);
		 id.innerHTML=0;
	   }
		 
	}


<!--
	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_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_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];}
	}
	//-->
	
	
	function filesize(field)
	{
		
	var control = new ActiveXObject("Scripting.FileSystemObject");
	var d = field;
	var e = control.GetFile(d);
	var f = e.size;
	alert(f + " bytes");
	}
	
	
	 var ret = false;
	function createRequest() 
	{
	try {
		 request = new XMLHttpRequest();
		} catch (trymicrosoft) { 
	
		 try 
		 {
			  request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) 
		{
		  try
		  {
			request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (failed)
			{
			   request = false;
			  }
		  }
	
		}
	
	if (!request)
	alert("Error initializing XMLHttpRequest!");
	 }
	 
	 
	
	function checkDiv_temp()
	{
		var val_id = document.getElementById('_hddGrpId').value;
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById("showColortemplate_"+val_id).innerHTML=xmlHttp.responseText;
		}
		else
		{
			document.getElementById("showColortemplate_"+val_id).innerHTML='<img src="../demo/images/loading.gif" border="0">';
		}
	}
	
	function check_availability(tmpField, tmpDivId,tmpMessage,frm) 
	{
		createRequest()
		var url = "check_availablility.php?"+tmpField;
		request.open("GET", url, true);
		request.onreadystatechange = function(){ updatePage(tmpDivId,tmpMessage,frm);};
		request.send(null);
		return ret;
	 }
	
	function updatePage(tmpDivId,tmpMessage,frm)
	{	 		
	   if (request.readyState == 4) 
		 {
		   if (request.status == 200)
		   {
			var response = request.responseText;
			
			  if(response==1 || response>1)
				{
					// tmpDivId.innerHTML='<div id="err" style="font-family:verdana;font-size:11px;color:#FF0000;font-weight:bold;">'+tmpMessage+'</div>';
					
					addMessage(tmpDivId,tmpMessage);
					 
					 //frm.md_username.focus();
						return false;
				 
				}
				else
				{
					  return ret = validateFrm(frm);
				}
	
			}
		   
	
			  }
	 }             
	
	
	function setFoucs()
	{ 
	  var strForm = document.forms[0];
		for (i=0;i<strForm.length;i++)
			{
				 var tempobj=strForm.elements[i];
				
				 if ((tempobj.type=="text" || tempobj.type=="select-one" || tempobj.type=="password"))
				 {
					
					   var strElementName=tempobj.id;
					   var strEle =document.getElementById(strElementName);
					
					strEle.focus();
					break;
				 }
			}
				
				
	}
	

	function bookmark(url,title){
	  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
	  window.external.AddFavorite(url,title);
	  } else if (navigator.appName == "Netscape") {
		window.sidebar.addPanel(title,url,"");
	  } else {
		alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	  }
	}
	
	
	function frmpageUrl(tmpVar,tmpField)
		{
			var strUrl = tmpVar.replace(/ /g, '-');
			tmpField.value = strUrl.toLowerCase()+'.html';
		}
	
	
	setFoucs();
	
	
	function textCounter(field, countfield, maxlimit)
	{
		
	if (field.value.length > maxlimit) // if too long...trim it!  
	field.value = field.value.substring(0, maxlimit);  
	// otherwise, update 'characters left' counter  
	else   
	countfield.value = maxlimit - field.value.length;  
	}
	
	function show_bullets(textvalue,intcounter, groupId,intFlyerId)
	{
		var arrGid = new Array("2","3","6","7","8");
		var arrGidValue = new Array("5");
		var gidgound=-0;
		var showtrvalue=0; 
		
		for(var p=0; p<=arrGid.length; p++)
		{
			  if(arrGid[p]==groupId)
			  {
				 gidgound=1; 
			  }
		}
		for(var h=0; h<=arrGidValue.length; h++)
		{
			  if(arrGidValue[h]==groupId)
			  {
				 showtrvalue=1; 
			  }
		}
		
			var url='library/classes/ajax_bullet_points.php?textvalue='+textvalue+'&intcounter='+intcounter+'&gId='+groupId+'&Flyrid='+intFlyerId;
			xmlHttp=getobject();
			xmlHttp.onreadystatechange=checkDiv;
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		
		var maxBullet = eval(textvalue)+1;
		 var myIFrame = document.getElementById('frame_src');
		
		  for(var j=1; j<maxBullet; j++)
			{
			 myIFrame.contentWindow.document.getElementById('Bullet'+j).style.display='';
			if(showtrvalue==1 && textvalue==2)
			 {
				myIFrame.contentWindow.document.getElementById('Bullet3').style.display='none';
			 }
			 else
			 {
				myIFrame.contentWindow.document.getElementById('Bullet3').style.visibility='visible';
			 }
			}
			
		 
		   
			for(var i=maxBullet; i<=13; i++)
			{
			   if((textvalue==2 || textvalue==1) && i==3)
			   {
					myIFrame.contentWindow.document.getElementById('Bullet'+i).style.visibility='hidden';
			   }
				else
				{
				
				 myIFrame.contentWindow.document.getElementById('Bullet'+i).style.display='none';
				 
			   }
	
			}
			
	}
	function checkDiv()
	{
	
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById("showbullets").innerHTML=xmlHttp.responseText;
		}
	}
	function show_highlighted(id)
	{
		var c2 = id.substring(0,3);
		if(c2='m__')
		{
			var value = id.split('m__');
			var tempid = value[1];
		}
		else
		{
			var tempid = id;
		}
		document.getElementById(tempid).style.border='red 2px solid';
	}
	
	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;
	}
	//ajax function for checking username in signup page
	var xmlHttp;
	
	function getobject()
	{
		var xmlHttp=null;
		try
		{
			xmlHttp=new XMLHttpRequest;
		}
		catch(e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")	;
			}	
		}
		return xmlHttp;
	}
	
	
	
	var anchors = document.getElementsByTagName('input');
	var orgcolor
	var orgfont
	for (var i=0; i<anchors.length; i++)
			{
				
				 var anchor = anchors[i];
				
				var relAttribute = String(anchor.getAttribute('title'));
			
					anchor.onmouseover = function () { 
					 var titId = this.getAttribute('title');
					 var myIFrame = document.getElementById('frame_src');
					 orgcolor = myIFrame.contentWindow.document.getElementById(titId).style.color;
					 orgfont = myIFrame.contentWindow.document.getElementById(titId).style.fontSize;
					 var fontArr = orgfont.split("px");
					 var newFont =eval(fontArr[0])+3+"px";
					
					 //myIFrame.contentWindow.document.getElementById(titId).style.fontSize=newFont;
					 myIFrame.contentWindow.document.getElementById(titId).style.color="#12EABF";
					 myIFrame.contentWindow.document.getElementById(titId).style.overflow="hidden";
				
					}
					
					anchor.onmouseout = function () { 
					var titId = this.getAttribute('title');
					var myIFrame = document.getElementById('frame_src');
					
					myIFrame.contentWindow.document.getElementById(titId).style.color=orgcolor;
					//myIFrame.contentWindow.document.getElementById(titId).style.fontSize=orgfont;
		
				
					}
			}
			
	function showHiglight(tmp)
	{
				   
					var titId = tmp.getAttribute('title');
				
					var myIFrame = document.getElementById('frame_src');
					 orgcolor = myIFrame.contentWindow.document.getElementById(titId).style.color;
					
					 orgfont = myIFrame.contentWindow.document.getElementById(titId).style.fontSize;
					 var fontArr = orgfont.split("px");
						 var newFont =eval(fontArr[0])+3+"px";
					
					  //myIFrame.contentWindow.document.getElementById(titId).style.fontSize=newFont;
					  myIFrame.contentWindow.document.getElementById(titId).style.color="#12EABF";
					  myIFrame.style.overflow="hidden";
	}
	
	function hideHighlight(tmp)
	{
				   var titId = tmp.getAttribute('title');
					var myIFrame = document.getElementById('frame_src');
					
					myIFrame.contentWindow.document.getElementById(titId).style.color=orgcolor;
					//myIFrame.contentWindow.document.getElementById(titId).style.fontSize=orgfont;
				
	}
	function validation()
	{
		if(trim(document.getElementById('name').value)=="" )
			{
				alert("Please enter your name.");
				return false;
			}
			if(trim(document.getElementById('email').value)=="" )
			{
				alert("Please enter your email.");
				return false;
			}
			if(isValidEmail(trim(document.getElementById('email').value)) == false) 
			{
				alert("Please enter valid email.");
				return false;
			}
			if(trim(document.getElementById('phone').value)=="" )
			{
				alert("Please enter your phone no.");
				return false;
			}
	}

