var sInvalidChars
sInvalidChars="1234567890";
var iTotalChecked=0;
function checkNumericVals(objV,  msg)
{
	for(var i=0;i<sInvalidChars.length;i++)
	{
		if(objV.value.indexOf(sInvalidChars.charAt(i))!=-1)
		{
			alert(msg);
			objV.focus();
			return false;
		}
	}
	return true;
}
function objChecked(obj)
{
	if(obj.checked)
		iTotalChecked = iTotalChecked + 1
	else
		iTotalChecked = iTotalChecked - 1
 }
function fnSearch(iID)
{
	document.forms[0].HID_SearchID.value=iID;
	document.forms[0].action="../Users/Search.asp"
	document.forms[0].submit();
}
function fn_ValidateZipPhone(obj, iLen, sMsg)
{
	if(obj.value.length<iLen)
	{
		alert(sMsg);
		obj.select();
		obj.focus();
		return false;
	}
	return true;
}

function CheckConfirmPassword(fldPass,fldConPass,minChars)
{
	//created on: 30th Jan 2003
	//Programmer: Anita Mourya
	//Purpose	: This function is used to check that Password contains minimum characters and confirm Password matches the password. 
	//Arguments : password field name , confirm password field name, minimum characters to check.


		if(fldPass.value.length == 0)
		{
			alert("Please enter your password");
			fldPass.focus();
			fldPass.select();
			return false;
		}
		h = fldPass.value.length;
		x = fldPass.value.value;

			for( i=0;i<h;i++)
			{
			 
				if (  h < minChars )
				{
								alert(" Password can't be less than " + minChars + " characters");
								fldPass.focus();
								fldPass.select();
								return false;
				}


			}
		//=============================


		if(fldConPass.value.length == 0)
		{
			alert("Please re-enter your password");
			fldConPass.focus();
			fldConPass.select();
			return false;
		}
	
//	alert(fldPass.value);	
	//	alert(fldConPass.value);
		if(fldPass.value != fldConPass.value)
		{
			alert("Please ensure that you have entered the same password twice");
			fldConPass.focus();
			fldConPass.select();
			return false;
		}
	return true;

}


function CheckCharWithinField(fldName, fldAlias, chkChar)
{
	//created on: 30th Jan 2003
	//Programmer: Anita Mourya
	//Purpose	: This function is used to check that username does not contain any spaces. 
	//Arguments : field name object, field alias to be used, character to be checked

		b= fldName.value.length
		x= fldName.value
		
		if (x == "")
		{
			alert ("Please Enter Your " + fldAlias)
			fldName.focus();
			fldName.select();
			return false;
		}

		for( i=0;i<b;i++)
		{
			z = x.substring(i,i+1);
			if(z== chkChar)
			{
				alert("Please enter valid " + fldAlias + " without any '" + chkChar + "' in-between");
				fldName.focus();
				fldName.select();
				return false;
			}
		}
		//------------------------------

return true;
}
function SendtoPopup(obj,objaction,iwidth,iheight)
{
	if(ValidateForm(obj))
	{
		iLeft = parseInt(screen.width)/2-parseInt(iwidth)/2
		iTop = parseInt(screen.height)/2-parseInt(iheight)/2
		obj.target = "s"
		obj.method = "Post"
		obj.action = objaction
		win = 	window.open(objaction, "s", "toolbars=0, menubar=0, noresize, left=" + iLeft + ",top=" + iTop + ", width=" + iwidth + ", height=" + iheight)
		obj.submit(win)
	}
	else
	{
		return false;
	}
	return false;
}
function CheckAll(chk)
{
	//created on: 10th May 2002
	//Programmer: Prashant Sharma
	//Purpose	: This function is used to check all the checkboxes basedon state of chk checkbox. 
	//Arguments : checkbox object
	for (var i=0;i < document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if (e.type == "checkbox")
		{
			e.checked = chk.checked;
		}
	}
}

function fnRemoveSpaces(sFldval)
{
  var sTemp=sFldval;
  var sNewval=sTemp;
  //remove spaces from the front
  for(var i=0;i<sTemp.length;i++)
  {	
		if(sTemp.charAt(i)!=" ")
			break;
		else
			sNewval = sTemp.substring(i+1);
  }
	return sNewval;
}

function fnFixSpace(sFldval)
{
	//created on: 10th May 2002
	//Programmer: Prashant Sharma
	//Purpose	: This function is used to remove spaces. 
	//Arguments : text field object value
	var sTemp=sFldval;
  var sReversedString="";
  var sTemp1;
  
  //remove spaces from the front
  sNewval = fnRemoveSpaces(sTemp);
  
  // reverse n remove spaces from the front
  for(var i=sNewval.length-1;i>=0;i--)
		sReversedString = sReversedString + sNewval.charAt(i);
	sTemp1 = fnRemoveSpaces(sReversedString);
	//reverse again
	sReversedString="";
	for(var i=sTemp1.length-1;i>=0;i--)
		sReversedString = sReversedString + sTemp1.charAt(i);
	sNewval = sReversedString;
	return sNewval;
}

function ValidateEMail(objName)
{
	//created on: 12th May 2002
	//Programmer: Naveen Sharma
	//Purpose	: This function is used to validate email. 
	//Arguments : Email object
		
	var sobjValue;
	var iobjLength;
	
	sobjValue=objName;
	iobjLength=sobjValue.length;
	iFposition=sobjValue.indexOf("@");
	iSposition=sobjValue.indexOf(".");
	iTmp=sobjValue.lastIndexOf(".");	
	iPosition=sobjValue.indexOf(",");
	iPos=sobjValue.indexOf(";");
	
	if (iobjLength!=0)
	{
		if ((iFposition == -1)||(iSposition == -1))
		{
			return false;
		}
		else if(sobjValue.charAt(0) == "@" || sobjValue.charAt(0)==".")
		{
			return false;				
		}
		else if(sobjValue.charAt(iobjLength) == "@" ||
sobjValue.charAt(iobjLength)==".")
		{
			return false;				
		}	
		else if((sobjValue.indexOf("@",(iFposition+1)))!=-1)
		{	
			return false;
		}
		else if ((iobjLength-(iTmp+1)<2)||(iobjLength-(iTmp+1)>3))
		{
			return false;
		}
		else if ((iPosition!=-1) || (iPos!=-1))
		{
			return false;
		}
		else
		{
			return true;
		}		
	}		
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

/*--------------------------------------------------------------------------------------
	this sub routine checks for the mandatory fields, their data types and maximum length
	also validates valid email entered or not
	Return : True/False
	Input : objFrm ( form object name)
	Programmer : Naveen Sharma
	Dated : 22-05-2002
	Version : 1.0.0
----------------------------------------------------------------------------------------*/
function ValidateForm(objFrm)
{
	var iConventionPos;
	var sChangedName;
	
	for( var i =0; i< objFrm.length;i++)
	{
		
		if(objFrm[i].type=='text' || objFrm[i].type=='textarea' || objFrm[i].type=='select-one' || objFrm[i].type=='select-multiple' || objFrm[i].type=='password')
		{
			if(objFrm[i].type=='text' || objFrm[i].type=='textarea' || objFrm[i].type=='password')
				objFrm[i].value = fnFixSpace(objFrm[i].value);
			
			var objDataTypeHolder = objFrm[i].name.substring(0,3);
		
			if(objFrm[i].name.substring(0,5)=='TREF_' || objFrm[i].name.substring(0,5)=='TNEF_'  || objFrm[i].name.substring(0,5)=='POKR_')
				objDataTypeHolder = objFrm[i].name.substring(0,5);
			if((objFrm[i].type=='select-one' && objFrm[i].options[objFrm[i].selectedIndex].value=='' && objDataTypeHolder=="TR_"))
			{
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName);

				
				alert("Please select "+ sChangedName +".");
		
				objFrm[i].focus();
				return false;
				break;
				
				
			}

			if(objFrm[i].type=='password' && objFrm[i].name=='TR_password')
			{
				
						var error = "";
						if (objFrm[i].value.length==0) {
							error = "Please enter password.\n";
							
						} 
						else if (objFrm[i].value.indexOf(" ")!=-1) {
							error = "The password must not contain spaces.\n";
							
						}  else if ((objFrm[i].value.length < 6) || (objFrm[i].value.length > 20)) {
							error = "The password should be only 6-20 characters long. \n";
							
						}  
						 
					   
				if(error)	{
					alert(error);
					objFrm[i].focus();
					return false;
					break;
				}
			}
			if(objFrm[i].type=='password' && objFrm[i].name=='TR_Confirm_Password' && objFrm[i].value!=objFrm.TR_Password.value)
			{
				alert("Password and confirm password fields are not matching.");
				objFrm[i].select();
				return false;
				break;
			}
			if(objFrm[i].type=='password' && objFrm[i].name=='TR_Confirm_New_Password' && objFrm[i].value!=objFrm.TR_New_Password.value)
			{
				alert("New Password and confirm New password fields are not matching.");
				objFrm[i].select();
				return false;
				break;
			}
			if((objDataTypeHolder=="UN_" || objDataTypeHolder=="NN_" ||  objDataTypeHolder=="TR_" || objDataTypeHolder=="IR_" || objDataTypeHolder=="MR_"  )&& (objFrm[i].value==''))
			{	
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)

				alert("Please enter "+ sChangedName.replace("[]", "") +".");
				objFrm[i].focus();
				return false;
				break;
			}
			
			if((objDataTypeHolder=="TREF_" || objDataTypeHolder=="POKR_")  && objFrm[i].value=='')
			{
				sChangedName = objFrm[i].name.substring(5);
				sChangedName = getFormattedmsg(sChangedName);
			
				alert("Please enter "+ sChangedName +".");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}						
			if(objFrm[i].name=='TREF_Confirm_email' && objFrm[i].value!=objFrm.TREF_email.value)
			{
				alert("Email and confirm email fields are not matching.");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}	
			if((objDataTypeHolder=="IR_" || objDataTypeHolder=="MR_" )&& (isNaN(objFrm[i].value)))
			{
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)
				alert("Please enter numeric "+ sChangedName +".");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}
			
			var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
			if((objDataTypeHolder=="NN_" && !name_check.test(objFrm[i].value) ))
			{
					
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)
				alert(sChangedName +" should be in alphabets only");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}
			
			
			var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
			if(( objDataTypeHolder=="PN_" && objFrm[i].value!=''  && !name_check.test(objFrm[i].value) ))
			{
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)
				alert(sChangedName +" should be in alphabets only");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}
			
			
			if(objDataTypeHolder=="UN_" && objFrm[i].value!='' && objFrm[i].value.indexOf(" ")!=-1)
			{
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)
				alert("Spaces are not allowed in "+ sChangedName +".");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}			

			if((objDataTypeHolder=="IN_" || objDataTypeHolder=="MN_" )&& (isNaN(objFrm[i].value) && objFrm[i].value!='' ))
			{
				sChangedName = objFrm[i].name.substring(3);
				sChangedName = getFormattedmsg(sChangedName)
				alert("Please enter numeric "+ sChangedName +".");
				objFrm[i].focus();
				objFrm[i].select();
				return false;
				break;
			}

			if((objDataTypeHolder=="TREF_" || objDataTypeHolder=="TNEF_" || objDataTypeHolder=="POKR_" ) && objFrm[i].value!='' )
			{
			
				if(objDataTypeHolder=="POKR_"){
					var ln=objFrm[i].value.length;
					var postfix=objFrm[i].value.substr(ln-17,17);	
					if(postfix!="wharton.upenn.edu"){
						alert("Please enter valid email.");
						objFrm[i].focus();
						objFrm[i].select();
						return false;
						break;					
					}
				}
								
				if(!ValidateEMail(objFrm[i].value))
				{
					alert("Please enter valid email.");
					objFrm[i].focus();
					objFrm[i].select();
					return false;
					break;
				}
				
			}
			
			//ValidateNumber(objName)
			if((objDataTypeHolder=="NR_"))
			{
				if(!ValidateNumber(objFrm[i].value))
				{
					objFrm[i].focus();
					return false;
					break;
				}
			}
						
			if(objDataTypeHolder=="PHR")
			{
				var val=objFrm[i].value;
				
				if(val=="")
				{
					alert("Please Enter Phone Number");
					objFrm[i].focus();
					objFrm[i].select();
					return false;
					break;
				}
			}
			//ValidateNumber(objName)
			if((objDataTypeHolder=="NR_"))
			{
				if(!ValidateNumber(objFrm[i].value))
				{
					objFrm[i].focus();
					return false;
					break;
				}
				if(parseFloat(objFrm[i].value)<=0)
				{
					objFrm[i].focus();	
					alert('Price should be greater then 0');
					return false;
				}
			}
			if(objDataTypeHolder=="PHN")
			{
				var val=objFrm[i].value;
				if (val!="")
				{
					for(var j=0; j < val.length;j++)
					{
						if((val.charAt(j)!='(')&&(val.charAt(j)!=')')&&(val.charAt(j)!=' ')&&(val.charAt(j)!="-")&& !((val.charAt(j)>=0)&&(val.charAt(j)<=9)))
						{
							alert("Please enter valid Phone Number");
							objFrm[i].focus();
							objFrm[i].select();
							return false;
							break;
						}
					}
				}				
			}
		}
		

		
		if(objFrm[i].type=='file' && objDataTypeHolder=='FL_' && objFrm[i].value!=''){
				var len=objFrm[i].value.length;
				var ext=objFrm[i].value.substr(len-4,4);
				ext=ext.toLowerCase();
				if(len>0 && ext!='jpeg' && ext!='.jpg' && ext!='.bmp' && ext!='.gif' && ext!='.png' ){							
					alert("Please browse \n jpeg OR jpg OR bmp OR gif OR png \n type only");
					objFrm[i].focus();
					return false;
				} 		
		}		
		if(objFrm[i].type=='file' && objDataTypeHolder=='FE_' && objFrm[i].value!=''){
				var len=objFrm[i].value.length;
				var ext=objFrm[i].value.substr(len-4,4);
				ext=ext.toLowerCase();										
				if(len>0 && ext!='jpeg' && ext!='.jpg' && ext!='exif' && ext!='iptc' && ext!='tiff' && ext!='.tif' && ext!='.bmp' && ext!='.gif' && ext!='.png' && ext!='.pic' ){							
					alert("Please browse \n jpeg OR jpg OR exif OR iptc OR tiff OR tif OR bmp OR gif OR png OR pic OR cel OR cut OR pal OR eps OR ico \n type only");
					objFrm[i].focus();
					return false;
				} 		
		}
// validation for video clips---------------------------------> begin  wmv mov		

		if(objFrm[i].type=='file' && objDataTypeHolder=='VC_' && objFrm[i].value==''){
			alert("Please enter "+sChangedName);
			objFrm[i].focus();
			return false;
		}
		
		if(objFrm[i].type=='file' && objDataTypeHolder=='VC_' && objFrm[i].value!=''){
				var len=objFrm[i].value.length;
				var ext=objFrm[i].value.substr(len-4,4);
				ext=ext.toLowerCase();
				if(len>0 && ext!='.mov' && ext!='.wmv' ){							
					alert("Please browse mov OR wmv type only");
					objFrm[i].focus();
					return false;
				} 		
		}		
		if(objFrm[i].type=='file' && objDataTypeHolder=='VE_' && objFrm[i].value!=''){
				var len=objFrm[i].value.length;
				var ext=objFrm[i].value.substr(len-4,4);
				ext=ext.toLowerCase();										
				if(len>0 && ext!='.mov' && ext!='.wmv' ){							
					alert("Please browse mov OR wmv type only");
					objFrm[i].focus();
					return false;
				} 		
		}
// validation for video clips---------------------------------> end		
				
	}
	return true;
}


function FormatDate(d)
{
		var dd,mm;
		var l;
		l=d.indexOf("/");
		dd=d.substring(0,l);
		d=d.substring(l+1);
		l=d.indexOf("/");
		mm=d.substring(0,l);
		yy=d.substring(l+1);
		
		if (parseInt(dd) < 10)
			dd="0" + dd;
		if (parseInt(mm) < 10)
			mm="0" + mm;
		d= dd + "/" + mm + "/" + yy
		alert(d);
		return d;
		
}

function ValidateImg(objImg, isRequired)
{
	if(isRequired ==1 && objImg.value=='')
	{
		alert("Please enter image.");
		objImg.focus();
		return false;
	}
	if(objImg.value.length!=0)
	{
		if(objImg.value.length<5)
		{
			alert("Please enter valid image.");
			objImg.focus();
			objImg.select();
			return false;
		}
		var iPos = objImg.value.lastIndexOf(".")
		var sExt = objImg.value.substring(iPos);
		if((sExt.toUpperCase()=='.JPEG') || (sExt.toUpperCase()=='.JPG') || (sExt.toUpperCase()=='.GIF') || (sExt.toUpperCase()=='.BMP') )
		{
			return true;
		}
		else
		{
			alert("Please enter valid image.");
			objImg.focus();
			objImg.select();
			return false;
		}
	}
	return true;
}

function ValidateNumber(objName)
{
	//created on: 12th May 2002
	//Programmer: Naveen Sharma
	//Purpose	: This function is used to validate price. 
	//Arguments : Email object
		
	var h;
	var x;
	
	h=objName.length;
	x = objName;
	if (h==0)
	{
		alert("Price Can be numeric only");
		return false;
	}			
	for( i=0;i<h;i++)
	{
		z = x.substring(i,i+1);
		if ( z=="'"||z=='"' || (z >= "a" && z <= "z" ) || (z >= "A" && z <= "Z") )
		{
			alert("Price Can be numeric only");
			return false;
		}			
	}
	jj=x.indexOf(".");
	if (jj != "-1") 
		{
		hh=x.substring(jj);
		ll=hh.length;
		if (ll > 3) 
			{
			alert("Price Can have upto 2 decimal places");
			return false;
			}
		}
	x = objName;
	return true;
	
}

function ValidateNumber(objName)
{
	//created on: 12th May 2002
	//Programmer: Naveen Sharma
	//Purpose	: This function is used to validate email. 
	//Arguments : Email object
		
	var h;
	var x;
	
	h=objName.length;
	x = objName;
	if (h==0)
	{
		alert("Price cannot be left blank");
		return false;
	}			
	for( i=0;i<h;i++)
	{
		z = x.substring(i,i+1);
		if ( z=="'"||z=='"' || (z >= "a" && z <= "z" ) || (z >= "A" && z <= "Z") )
		{
			alert("Price Can be numeric only");
			return false;
		}			
	}
	jj=x.indexOf(".");
	if (jj != "-1") 
		{
		hh=x.substring(jj);
		ll=hh.length;
		if (ll > 3) 
			{
			alert("Price Can have upto 2 decimal places");
			return false;
			}
		}
	return true;
	
}

function getFormattedmsg(sVal)
{
	while(sVal.indexOf("_")!=-1)
	{
		sVal = sVal.replace("_", " ")
	}
	return sVal;
	
}

// Function for cheking the proper Email ID while making login in Classified and Community section
	function valLoginForm(obj)
{

if(ValidateForm(obj))
	{
			if (ValidateEMail(obj.TR_Email_ID.value))
			{
				return true;
			}
			else
			{
				alert("Please enter Email ID in proper format");
				obj.TR_Email_ID.focus();
				return false;			
			}
	}
	return false;
}

function fnDetails(detailpage,iwidth,iheight)
{
	iLeft = parseInt(screen.width)/2-parseInt(iwidth)/2
	iTop = parseInt(screen.height)/2-parseInt(iheight)/2
	window.open(detailpage, "a", "toolbars=0, menubar=0, noresize, scrollbars=yes, left=" + iLeft + ",top=" + iTop + ", width=" + iwidth + ", height=" + iheight)
}


function valform(obj)
{
	
	if(ValidateForm(obj))
	{
			if (ValidateEMail(obj.TR_Email.value))
			{
				obj.submit()
				return true;
			}
			else
			{
				alert("Please enter Email in proper format")
				obj.TR_Email.select()
				return false;			
			}
	}
	return false;
}

	function keyvalid(){
			if(event.keyCode < 45 || event.keyCode > 57){ 
				event.returnValue = false;
			}	
			if(event.which < 45 || event.which > 57){ 
				return false;
			}
	}
	function redirect(opt){				
		if(opt==1){
			window.location="product.php";
		}else if(opt==2){
			window.location="billinfo.php";
		}else if(opt==3){
			window.location="historyview.php";
		}else if(opt==4){
			window.location="cart.php?cls=1";						
		}
	}
function addRowToTable()
{
  var tbl = document.getElementById('tblatributeID');
  var lastRow = tbl.rows.length;  
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
  var row = tbl.insertRow(lastRow);  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration+'.');  
  cellLeft.setAttribute('align','center');    
  cellLeft.appendChild(textNode);
  
  var sizecell = row.insertCell(1);
  var el = document.createElement('input');
  el.setAttribute('type', 'text');

  el.setAttribute('name', 'psize[]');
  el.setAttribute('id', 'sizeid' + iteration);
  el.setAttribute('size', '20');
  el.setAttribute('class', 'inp');  
  sizecell.appendChild(el);

  var pricecell = row.insertCell(2);
  var el = document.createElement('input');
  el.setAttribute('type', 'text');
  el.setAttribute('name', 'pprice[]');
  el.setAttribute('id', 'priceid' + iteration);
  el.setAttribute('size', '10');  
  el.setAttribute('class', 'inp');
  el.onkeypress = keyvalid;
  pricecell.appendChild(el);

  var colorcell = row.insertCell(3);
  var el = document.createElement('input');
  el.setAttribute('type', 'text');
  el.setAttribute('name', 'pcolor[]');
  el.setAttribute('id', 'colorid' + iteration);
  el.setAttribute('size', '20');
  el.setAttribute('class', 'inp');  
  colorcell.appendChild(el);
}
function keyvalid(){
			if(event.keyCode < 45 || event.keyCode > 57){ 
				event.returnValue = false;
			}	
			if(event.which < 45 || event.which > 57){ 
				return false;
			}
}
function removeRowFromTable()
{
  var tbl = document.getElementById('tblatributeID');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}

function validateRow()
{
    var tbl = document.getElementById('tblatributeID');
    var lastRow = tbl.rows.length - 1;
    var i;
    for (i=1; i<=lastRow; i++) {
		var txtSize = document.getElementById('sizeid' + i);
		var txtPrice = document.getElementById('priceid' + i);
		var txtColor = document.getElementById('colorid' + i);
		  if (txtSize.value.length <= 0 || txtPrice.value.length <= 0 || txtColor.value.length <= 0) {
			alert('Product attributes: -\n\nRow '+ i +' is not filled \nEach cell of row must be filled');
			document.getElementById('sizeid' + i).focus();
			return false;
		  }    
  	}
	return true; 
}

	function popwin(page,iwidth,iheight){
		iLeft = parseInt(screen.width)/2-iwidth/2
		iTop = parseInt(screen.height)/2-iheight/2
		window.open(page, "a", "toolbars=0, menubar=0, noresize, scrollbars=yes, left=" + iLeft + ",top=" + iTop + ", width="+iwidth+", height="+iheight)
	}
function show_tbl(tbl_id){		
		document.getElementById(tbl_id).style.display='';		
}
function hide_tbl(tbl_id){				
		document.getElementById(tbl_id).style.display='none';
}
function hideshowtbl(show_tbl,hide_tbl){		
		document.getElementById(show_tbl).style.display='';
		document.getElementById(hide_tbl).style.display='none';
}
function full_screen_pop_up(theURL,windowname){
	window.open(theURL, windowname, ',type=fullWindow,fullscreen,scrollbars=yes');
}
function backtolist(url){
	window.location=url;
}

function validateDob(){
	var day = document.getElementById('day').value;
	var month = document.getElementById('month').value;
	var year = document.getElementById('year').value;
	if(day!='' || month!='' || year!=''){
			if(day==''){
				alert("Please select day.");
				return false;
			}
			if(month==''){
				alert("Please select month.");
				return false;
			}
			if(year==''){
				alert("Please select year.");
				return false;
			}
	}
	return true;
}

function getById(id){
		return document.getElementById(id);
}

function validateDonate(){
	
		if(getById('how_know').value==''){
				alert("Please select how you know about Yes2funding");
				getById('how_know').focus();
				return false;
		}
		var error = true;
		for(var x=1;x<=4;x++){
				if(getById('pay_type'+x).checked){
					error = false;
				
			}
		}
		if(error){
				alert("Please select pay type");
				return false;
		}else if(getById('pay_type4').checked){
			
			if(getById('other_amount').value==''){
					alert("Please enter other donate amount");
					getById('other_amount').focus();
					return false;
			}
			
		}
		return true;
}
function showMore(val){
		
			for(var x=1;x<=4;x++){
				if(val=='other'){
					getById('other_pay_type'+x).disabled=false;
					getById('other_pay_type1').checked=true;
					getById('other_amount').disabled=false;
							
				}
				else{
					getById('other_amount').disabled=true;
					getById('other_pay_type'+x).disabled=true;
					getById('other_pay_type1').checked=false;
				}
			}
		
}


function validateExtra(){
		
				
				if(getById('acceptBox').checked==false){
					alert("Please select Terms & Conditions.");		
					return false;
				}
				if(getById('agree_type1').checked==false && getById('agree_type2').checked==false){
					alert("Please select one option from agreement below.");				
					return false;
				}
				if(getById('checkEmail').value=='1'){
					alert("Sorry, this email is already in used.Please try other.");				
					return false;
				}
				
		
}
function ValidateChangePassword(){
			
		if (document.getElementById("old_password").value.length==0) {
			alert("Enter old password");
			document.getElementById("old_password").focus();
			return false;
			
		} 
		if (document.getElementById("new_password").value.length==0) {
			alert("Enter new password ");
			document.getElementById("new_password").focus();
			return false;
			
		} 		
		else if (document.getElementById("new_password").value.indexOf(" ")!=-1) {
			alert("The password must not contain spaces");
			document.getElementById("new_password").focus();
			return false;
						
		}  else if ((document.getElementById("new_password").value.length < 6) || (document.getElementById("new_password").value.length > 20)) {
			alert("The password should be only 6-20 characters long");
			document.getElementById("new_password").focus();
			return false;
		}  
		if(document.getElementById("new_password").value!=document.getElementById("confirm_password").value){
			alert(" The new password and confirm password did not match");
			document.getElementById("confirm_password").focus();
			return false;
		}
		if(document.getElementById("new_password").value==document.getElementById("old_password").value){
			alert(" Old password and new password must not be same");
			document.getElementById("new_password").focus();
			return false;
		}
		
		return true;
}
function allAtOnce(val){
		var txt = '&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="donate_by" value="1">&nbsp;Single donation by credit/debit card<br>';
		txt +='&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="donate_by" value="2">&nbsp;Single donation by PayPal';
	if(val==4)
		document.getElementById('target').innerHTML = txt;
	else
		document.getElementById('target').innerHTML = '';
		
}

function checkContactus()
{
	var comvarable=document.contactusFrm

		if (comvarable.name.value=="" )
		{
		alert ( "Enter Name." );
		comvarable.name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.name.value)==false)
		{
		alert("Name should be character.")
		return false;
		}
		
		
		var emailID=document.contactusFrm.email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
		
			
		
		if (comvarable.phone.value=="" )
		{
		alert ( "Enter Phone No." );
		comvarable.phone.focus();  
		return false;
		}
		
		if (comvarable.address.value=="" )
		{
		alert ( "Enter Address." );
		comvarable.address.focus();  
		return false;
		}
		if (comvarable.enquiry.value=="" )
		{
		alert ( "Enter your Feedback ." );
		comvarable.enquiry.focus();  
		return false;
		}
		
		if (comvarable.city.value=="" )
		{
		alert ( "Enter City." );
		comvarable.city.focus();  
		return false;
		}
		
		
		if (comvarable.word_code.value=="" )
				{
				alert ( "Enter the code." );
				comvarable.word_code.focus();  
				return false;
				}

      if (comvarable.country.value==0)
		{
		alert ( "Please select country." );
		comvarable.country.focus();  
		return false;
		}
return true;
}

function isAlpha(argvalue) {
  argvalue = argvalue.toString();
  var validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";

    for (var n = 0; n < argvalue.length; n++) {
        if (validChars.indexOf(argvalue.substring(n, n+1)) == -1)
         return false;
    }
  return true;
}
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function show_images(val) {
	

	var totalImages=parseInt(document.getElementById('totalImages').value);
	
	
	for(i=1;i<=totalImages;i++) {
		
		var cat="cat"+i;
		var gallzoom="gallzoom"+i;
		
		if(i==val) {
			
			document.getElementById(cat).style.display="block";
			document.getElementById(gallzoom).style.display="block";
			
			
		}else{
			
			document.getElementById(cat).style.display="none";
			document.getElementById(gallzoom).style.display="none";

			
		}
		
	}
	
}

function checkRefer()
{

var comvarable=document.postreferfriend

	
		if (comvarable.your_name.value=="" )
		{
		alert ( "Enter your name." );
		comvarable.your_name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.your_name.value)==false)
		{
		alert("Your name should be character.")
		return false;
		}	
		    
		var emailID=document.postreferfriend.your_email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
        
        
        	
		if ( comvarable.friend_name.value=="" )
		{
		alert ( "Enter friend name." );
		comvarable.friend_name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.friend_name.value)==false)
		{
		alert("Friend name should be character.")
		return false;
		}	
        
        
        var emailID1=document.postreferfriend.friend_email;
		if ((emailID1.value==null)||(emailID1.value=="")){
		alert("Please Enter your friend Email ID")
		emailID1.focus()
		return false
		}
		if (echeck(emailID1.value)==false){
		emailID1.value=""
		emailID1.focus()
		return false
		}
		
			
		
		
return true;


}


function BillinToShipping()
	{
	var comm=document.regfrm;
	if (comm.sameasbilling.checked==true)
	{
	
	comm.countryShip.value = comm.country.value;
	comm.stateShip.value = comm. state.value;
	comm.cityShip.value = comm.city.value;
	comm.zipcodeShip.value = comm.zipcode.value;
	comm.addressShip.value = comm.address.value;
	comm.phoneShip.value = comm.phone.value;
	}
	else
	{
	comm.countryShip.value = '';
	comm.stateShip.value = '';
	comm.cityShip.value = '';
	comm.zipcodeShip.value ='';
	comm.addressShip.value = '';
	comm.phoneShip.value ='';
	}
   }

function checkRegValidation()
{
	
var comvarable=document.regfrm

if ( comvarable.title.selectedIndex == 0 )
		{
		alert ( "Please select Title." );
		comvarable.title.focus();  
		return false;
		}
		
	
		if (comvarable.firstName.value=="" )
		{
		alert ( "Enter First name." );
		comvarable.firstName.focus();  
		return false;
		}
		else if(isAlpha(comvarable.firstName.value)==false)
		{
		alert("First name should be character.")
		return false;
		}

		
		if ( comvarable.lastName.value=="" )
		{
		alert ( "Enter Last name." );
		comvarable.lastName.focus();  
		return false;
		}
		else if(isAlpha(comvarable.lastName.value)==false)
		{
		alert("Last name should be character.")
		return false;
		}

		
		if (comvarable.address.value=="" )
		{
		alert ( "Enter billing address ." );
		comvarable.address.focus();  
		return false;
		}
		if (comvarable.city.value=="" )
		{
		alert ( "Enter billing city ." );
		comvarable.city.focus();  
		return false;
		}
		else if(isAlpha(comvarable.city.value)==false)
		{
		alert("Billing city should be character.")
		return false;
		}
		
		if ( comvarable.state.value=="" )
		{
		alert ( "Enter billing state." );
		comvarable.state.focus();  
		return false;
		}
		else if(isAlpha(comvarable.state.value)==false)
		{
		alert("Billing state should be character.")
		return false;
		}
		
		
		if (comvarable.country.value=="" )
		{
		alert ( "Enter billing country ." );
		comvarable.country.focus();  
		return false;
		}
		
		if ( comvarable.zipcode.value=="" )
		{
		alert ( "Enter billing zip." );
		comvarable.zipcode.focus();  
		return false;
		}
		
		else if ( IsNumeric(comvarable.zipcode.value)==false )
		{
		alert ( "please enter the numeric zip." );
		comvarable.zipcode.focus();  
		return false;
		}	
			
		
		//----------s-----------------------------------------//
		
		if (comvarable.addressShip.value=="" )
		{
		alert ( "Enter shipping address ." );
		comvarable.addressShip.focus();  
		return false;
		}

		if (comvarable.cityShip.value=="" )
		{
		alert ( "Enter shipping city ." );
		comvarable.cityShip.focus();  
		return false;
		}
		else if(isAlpha(comvarable.cityShip.value)==false)
		{
		alert("Shipping city should be character.");
		comvarable.cityShip.focus();
		return false;
		}
		
		if ( comvarable.stateShip.value=="" )
		{
		alert ( "Enter shipping state." );
		comvarable.stateShip.focus();  
		return false;
		}
		else if(isAlpha(comvarable.stateShip.value)==false)
		{
		alert("Shipping state should be character.");
		comvarable.state.focus();
		return false;
		}
		
		
		if (comvarable.countryShip.value=="" )
		{
		alert ( "Enter shipping country ." );
		comvarable.countryShip.focus();  
		return false;
		}
		
		if ( comvarable.zipcodeShip.value=="" )
		{
		alert ( "Enter shipping zip." );
		comvarable.zipcodeShip.focus();  
		return false;
		}
		else if ( IsNumeric(comvarable.zipcodeShip.value)==false )
		{
		alert ( "please enter the numeric zip." );
		comvarable.zipcodeShip.focus();  
		return false;
		}	
		
	var emailID=document.regfrm.email;
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	if(comvarable.pwd.value=='')
	{
	alert('Enter Password');
	comvarable.pwd.focus();
	return false;
	}
	if(comvarable.pwd.value.length < 6) {
	alert('Your Password must be at least 6 characters');
	comvarable.password.focus();
	return false;
	}
	
	if(comvarable.cpwd.value=='')
	{
	alert('Enter Confirm Password');
	   
	comvarable.cpwd.focus();
	return false;
	}
	
	if(comvarable.cpwd.value!=comvarable.pwd.value)
	{
	alert('Confirm Password Password not match');
	   
	comvarable.cpwd.focus();
	return false;
	}
		

return true;
}	


function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
   
   
function checkEditRegValidation()
{
	
var comvarable=document.regfrm

if ( comvarable.title.selectedIndex == 0 )
		{
		alert ( "Please select Title." );
		comvarable.title.focus();  
		return false;
		}
		
	
		if (comvarable.firstName.value=="" )
		{
		alert ( "Enter First name." );
		comvarable.firstName.focus();  
		return false;
		}
		else if(isAlpha(comvarable.firstName.value)==false)
		{
		alert("First name should be character.")
		return false;
		}

		
		if ( comvarable.lastName.value=="" )
		{
		alert ( "Enter Last name." );
		comvarable.lastName.focus();  
		return false;
		}
		else if(isAlpha(comvarable.lastName.value)==false)
		{
		alert("Last name should be character.")
		return false;
		}


	
		/*if (comvarable.mobile.value=="" )
		{
		alert ( "Enter Mobile No." );
		comvarable.mobile.focus();  
		return false;
		}
		
		if ( comvarable.phone.value=="" )
		{
		alert ( "Enter Phone No." );
		comvarable.phone.focus();  
		return false;
		}
		
		
		if (comvarable.company.value=="" )
		{
		alert ( "Enter Company Name ." );
		comvarable.company.focus();  
		return false;
		}
		
		if ( comvarable.customertype.selectedIndex == 0 )
		{
		alert ( "Please select Customer Type." );
		comvarable.customertype.focus();  
		return false;
		}
		
		if ( comvarable.fax.value=="" )
		{
		alert ( "Enter Fax No." );
		comvarable.fax.focus();  
		return false;
		}*/
		//----b-------------------//
		
		if (comvarable.address.value=="" )
		{
		alert ( "Enter billing address ." );
		comvarable.address.focus();  
		return false;
		}
		if (comvarable.city.value=="" )
		{
		alert ( "Enter billing city ." );
		comvarable.city.focus();  
		return false;
		}
		else if(isAlpha(comvarable.city.value)==false)
		{
		alert("Billing city should be character.")
		return false;
		}
		
		if ( comvarable.state.value=="" )
		{
		alert ( "Enter billing state." );
		comvarable.state.focus();  
		return false;
		}
		else if(isAlpha(comvarable.state.value)==false)
		{
		alert("Billing state should be character.")
		return false;
		}
		
		
		if (comvarable.country.value=="" )
		{
		alert ( "Enter billing country ." );
		comvarable.country.focus();  
		return false;
		}
		
		if ( comvarable.zipcode.value=="" )
		{
		alert ( "Enter billing zip." );
		comvarable.zipcode.focus();  
		return false;
		}
		
		else if ( IsNumeric(comvarable.zipcode.value)==false )
		{
		alert ( "please enter the numeric zip." );
		comvarable.zipcode.focus();  
		return false;
		}	
		
		/*if ( comvarable.phone.value=="" )
		{
		alert ( "Enter Phone No." );
		comvarable.phone.focus();  
		return false;
		}*/
		
		
		
		
		
		
		
		//----------s-----------------------------------------//
		
		if (comvarable.addressShip.value=="" )
		{
		alert ( "Enter shipping address ." );
		comvarable.addressShip.focus();  
		return false;
		}

		if (comvarable.cityShip.value=="" )
		{
		alert ( "Enter shipping city ." );
		comvarable.cityShip.focus();  
		return false;
		}
		else if(isAlpha(comvarable.cityShip.value)==false)
		{
		alert("Shipping city should be character.");
		comvarable.cityShip.focus();
		return false;
		}
		
		if ( comvarable.stateShip.value=="" )
		{
		alert ( "Enter shipping state." );
		comvarable.stateShip.focus();  
		return false;
		}
		else if(isAlpha(comvarable.stateShip.value)==false)
		{
		alert("Shipping state should be character.");
		comvarable.state.focus();
		return false;
		}
		
		
		if (comvarable.countryShip.value=="" )
		{
		alert ( "Enter shipping country ." );
		comvarable.countryShip.focus();  
		return false;
		}
		
		if ( comvarable.zipcodeShip.value=="" )
		{
		alert ( "Enter shipping zip." );
		comvarable.zipcodeShip.focus();  
		return false;
		}
		else if ( IsNumeric(comvarable.zipcodeShip.value)==false )
		{
		alert ( "please enter the numeric zip." );
		comvarable.zipcodeShip.focus();  
		return false;
		}
		
		/*if ( comvarable.phoneShip.value=="" )
		{
		alert ( "Enter Phone No." );
		comvarable.phoneShipe.focus();  
		return false;
		}*/
		
}


function checkRefer()
{
	
var comvarable=document.postreferfriend

	
		if (comvarable.your_name.value=="" )
		{
		alert ( "Enter your name." );
		comvarable.your_name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.your_name.value)==false)
		{
		alert("Your name should be character.")
		return false;
		}	
		    
		var emailID=document.postreferfriend.your_email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
        
        
        	
		if ( comvarable.friend_name.value=="" )
		{
		alert ( "Enter friend name." );
		comvarable.friend_name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.friend_name.value)==false)
		{
		alert("Friend name should be character.")
		return false;
		}	
        
        
        var emailID1=document.postreferfriend.friend_email;
		if ((emailID1.value==null)||(emailID1.value=="")){
		alert("Please Enter your friend Email ID")
		emailID1.focus()
		return false
		}
		if (echeck(emailID1.value)==false){
		emailID1.value=""
		emailID1.focus()
		return false
		}
		
			
		
		
return true;


}

function check_form_password(frm)
    {
var comvarable=document.changepasswordfrm
     
	if(comvarable.oldpassword.value=="")
	{
	alert("Enter the old password");
	
	comvarable.oldpassword.focus();
	
	return false;
	}    
	if(comvarable.newpassword.value=="")
	{
	alert("Enter the new password");
	
	comvarable.newpassword.focus();
	
	return false;
	} 
	
	if(comvarable.newpassword.value.length < 6) {
	alert('Your Password must be at least 6 characters');
	comvarable.newpassword.focus();
	return false;
	}
	
if(comvarable.cpassword.value=="")
	{
	alert("Enter Confirm Password");
	
	comvarable.cpassword.focus();
	
	return false;
	} 	
if(comvarable.cpassword.value!=comvarable.newpassword.value)
	{
	alert('Confirm Password Password not match');
	   
	comvarable.cpassword.focus();
	return false;
	}	
	
		
	return true;
	}
function validate_manage_members() {
	var pb=document.manage_members;
	
	if (pb.title.value==0) {
		alert("Please select your title");
		pb.title.focus();
		return false;
	}
	
	if (pb.firstName.value==0) {
		alert("Please enter your first name");
		pb.firstName.focus();
		return false;
	}
	
	if (!isNaN(pb.firstName.value)) {
		alert("First name should be in alphabets only");
		pb.firstName.focus();
		return false;
	}
	
	if (pb.lastName.value==0) {
		alert("Please enter your last name");
		pb.lastName.focus();
		return false;
	}
	if (!isNaN(pb.lastName.value)) {
		alert("Last name should be in alphabets only");
		pb.lastName.focus();
		return false;
	}
	
	if (pb.address.value==0) {
		alert("Please enter your billing address");
		pb.address.focus();
		return false;
	}
	
	if (pb.city.value==0) {
		alert("Please enter your billing city");
		pb.city.focus();
		return false;
	}
	
	if (pb.state.value==0) {
		alert("Please enter your billing state");
		pb.country.focus();
		return false;
	}
	if (pb.country.value==0) {
		alert("Please select your billing country");
		pb.country.focus();
		return false;
	}
	
	if (pb.zipcode.value==0) {
		alert("Please enter your billing zip code");
		pb.zipcode.focus();
		return false;
	}
	if (pb.addressShip.value==0) {
		alert("Please enter your shipping address");
		pb.addressShip.focus();
		return false;
	}
	
	if (pb.cityShip.value==0) {
		alert("Please enter your shipping city");
		pb.cityShip.focus();
		return false;
	}
	if (pb.stateShip.value==0) {
		alert("Please enter your shipping state");
		pb.stateShip.focus();
		return false;
	}
	
	if (pb.countryShip.value==0) {
		alert("Please select your shipping country");
		pb.countryShip.focus();
		return false;
	}
	
	if (pb.zipcodeShip.value==0) {
		alert("Please enter your shipping zip code");
		pb.zipcodeShip.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value.length < 6) {
		alert("Please enter a valid password [Minimum 6 characters]");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.pwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}
}


function filldata() {
	var f1=document.manage_members;
  if(f1.chk.checked==1) {
	  f1.addressShip.value=f1.address.value;
	  f1.cityShip.value=f1.city.value;
	  f1.zipcodeShip.value=f1.zipcode.value;
	  f1.stateShip.value=f1.state.value;
	  f1.countryShip.value=f1.country.value;
	  f1.phoneShip.value=f1.phone.value;	  
  }
  else{
	  f1.addressShip.value="";
	  f1.cityShip.value="";
	  f1.zipcodeShip.value="";
	  f1.stateShip.value="";
	  f1.countryShip.value="";
	  f1.phoneShip.value="";
  }
}



function ValidateTestimonial()
{
	
var comvarable=document.testimonail
	
		if (comvarable.your_name.value=="" )
		{
		alert ( "Enter your name." );
		comvarable.your_name.focus();  
		return false;
		}
		else if(isAlpha(comvarable.your_name.value)==false)
		{
		alert("Your name should be character.")
		return false;
		}	
				
        	
		if (comvarable.designation.value=="" )
		{
		alert ( "Enter designation." );
		comvarable.designation.focus();  
		return false;
		}
		
      if (comvarable.subject.value=="" )
		{
		alert ( "Enter designation." );
		comvarable.subject.focus();  
		return false;
		} 

     if (comvarable.comments.value=="" )
		{
		alert ( "Enter comments." );
		comvarable.comments.focus();  
		return false;
		} 
	return true;
}


function checkCharacter(val,description,maxcharacter) {

var lengthString=val.length;

if(lengthString==1000) {

document.getElementById(description).value=val.substring(0,999);

document.getElementById(maxcharacter).innerHTML=0;

}else{

document.getElementById(maxcharacter).innerHTML=1001-(parseInt(lengthString)+1);


}

} 




function refreshCaptcha(){
	
		document.getElementById('captcha_div').src="visual-captcha.php?"+Math.random();
} 

function checkNewsLetter()
{
	
	
		var emailID=document.newsLetter.email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
					
}


function enquiryTouch()
{
	var comvarable=document.touch

		if (comvarable.name.value=="" )
		{
		alert ( "Enter  Name ." );
		comvarable.name.focus();  
		return false;
		}
		
		if (comvarable.phone.value=="" )
		{
		alert ( "Enter  Phone ." );
		comvarable.phone.focus();  
		return false;
		}
			
		var emailID=document.touch.email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
		
		if (comvarable.enquiry.value=="" )
		{
		alert ( "Enter enquiry ." );
		comvarable.enquiry.focus();  
		return false;
		}
		
					
}

function forgotEmailValidation()
{
	var emailID=document.forgotFrom.email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
		
		
	
}


function suggestionValidation()
{
	var comvarable=document.suggFrm

		if (comvarable.name.value=="" )
		{
		alert ( "Enter  Name ." );
		comvarable.name.focus();  
		return false;
		}
					
		var emailID=document.suggFrm.email;
		if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
		}
		if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
		}
		
		if (comvarable.comments.value=="" )
		{
		alert ( "Enter comments ." );
		comvarable.comments.focus();  
		return false;
		}
		
					
}

function commentValidation()
{
var comvarable=document.commentFrom
if (comvarable.comment.value=="" )
		{
		alert ( "Enter comments ." );
		comvarable.comment.focus();  
		return false;
		}

}

function postTopicValidtion()
{
var comvarable=document.postTopic
if (comvarable.catID.value=="0" )
		{
		alert ( "Select category ." );
		comvarable.catID.focus();  
		return false;
		}
		
if (comvarable.topicTitle.value=="" )
		{
		alert ("Enter topic title ." );
		comvarable.topicTitle.focus();  
		return false;
		}		
	if (comvarable.topicDescription.value=="" )
		{
		alert ("Enter topic description ." );
		comvarable.topicDescription.focus();  
		return false;
		}		
			
	
}

function validate_manage_members() {
	var pb=document.manage_members;
	

	
	if (pb.name.value==0) {
		alert("Please enter employee name");
		pb.name.focus();
		return false;
	}
	
	if (!isNaN(pb.name.value)) {
		alert("First name should be in alphabets only");
		pb.name.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Please enter Company Name");
		pb.companyName.focus();
		return false;
	}
	
	
	if (pb.phone.value==0) {
		alert("Please enter contact no.");
		pb.phone.focus();
		return false;
	}
	
	
	
	if (pb.address.value==0) {
		alert("Please enter address");
		pb.address.focus();
		return false;
	}
	
	if (pb.city.value==0) {
		alert("Please enter city");
		pb.city.focus();
		return false;
	}
	/*
	if (pb.state.value==0) {
		alert("Please enter  state");
		pb.state.focus();
		return false;
	}
	*/
	if (pb.country.value==0) {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
			
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value.length < 6) {
		alert("Please enter a valid password [Minimum 6 characters]");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.pwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}
	
	if (pb.word_code.value==0) {
		alert("Please enter Captcha code");
		pb.word_code.focus();
		return false;
	}
	
	if(pb.name_news.value==0)
	{
	alert("Please enter Your Name");
		pb.name_news.focus();
		return false;	
	}
	/*
	if((pb.email_news.value.length >= 0) && (!email_check.test(pb.email_news.value))) {
		alert("Please enter a valid Email ID");
		pb.email_news.focus();
		return false;
	}
	*/
	
}

function validate_manage_members_edit() {
	var pb=document.manage_members;
	

	
	if (pb.name.value==0) {
		alert("Please enter employee name");
		pb.name.focus();
		return false;
	}
	
	if (!isNaN(pb.name.value)) {
		alert("First name should be in alphabets only");
		pb.name.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Please enter Company Name");
		pb.companyName.focus();
		return false;
	}
	
	
	if (pb.phone.value==0) {
		alert("Please enter phone");
		pb.phone.focus();
		return false;
	}
	
	
	
	if (pb.address.value==0) {
		alert("Please enter address");
		pb.address.focus();
		return false;
	}
	
	if (pb.city.value==0) {
		alert("Please enter city");
		pb.city.focus();
		return false;
	}
	/*
	if (pb.state.value==0) {
		alert("Please enter  state");
		pb.state.focus();
		return false;
	}
	*/
	if (pb.country.value==0) {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
			
		
}

	
function checkLoginValidation()
{

var comvarable=document.loginfrm
var emailID=document.loginfrm.email;
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

if(comvarable.pwd.value=='')
	{
	alert('Enter Password');
	comvarable.pwd.focus();
	return false;
	}
	if(comvarable.pwd.value.length < 6) {
	alert('Your Password must be at least 6 characters');
	comvarable.pwd.focus();
	return false;
	}

return true;
}	
