function handleError()
{
return true;
}
function checkemail(val)
{
	if((val=="")||(val==' ')||(val==null))
	{
			document.getElementById("lblemailid").style.color="red"
			return false
	}
	else
	{
		document.getElementById("lblemailid").style.color="black"
		return true;
	}
		
}

function checkcountry() 
{
	alert("in");
	var country=document.register.country;
	alert(country.value);
	if((country.value=="")||(country.value==' ')||(country.value=='Choose a country')||(country.value==null))
	{
	   document.getElementById("lblcountry").style.color="red";
	   country.focus();
	   return false;
	}
	else
	{
		document.getElementById("lblcountry").style.color="black";
		return true
	}
}

function registercheck() 
{
		var fname=document.register.txtfname
		var lname=document.register.txtlname
		var Email=document.register.txtemail
		var pin=document.register.txtPIN

		var pwd=document.register.txtpassword
		var cpwd=document.register.txtcpwd
		var reg=document.register.btnRegister

		var add1=document.register.txtadd1
		var city=document.register.txtcity
		var state=document.register.txtstate
		var country=document.register.txtcountry
		var pincode=document.register.txtZIP
		var phone=document.register.txtPhone
		
		
		if((fname.value=="")||(fname.value==' ')||(fname.value==null))
		{
		   document.getElementById("lblfname").style.color="red"
		   fname.focus()	
		   return false
		}
		else{document.getElementById("lblfname").style.color="black"}
		if((lname.value=="")||(lname.value==' ')||(lname.value==null))
		{
		   document.getElementById("lbllname").style.color="red"
		   lname.focus()	
		   return false
		}
		else{document.getElementById("lbllname").style.color="black"}
		if((pin.value=="")||(pin.value==' ')||(pin.value==null))
		{
		   document.getElementById("lblpin").style.color="red"
		   pin.focus()	
		   return false
		}
		else{document.getElementById("lblpin").style.color="black"}
		var str=Email.value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1)
		{
		   document.getElementById("lblemail").style.color="red"
		   Email.focus()	
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   document.getElementById("lblemail").style.color="red"
   		   Email.focus()
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
			document.getElementById("lblemail").style.color="red"
			Email.focus()
		    return false
		}
		if (str.indexOf(at,(lat+1))!=-1)
		{
			document.getElementById("lblemail").style.color="red"
			Email.focus()		    
			return false
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		{
			document.getElementById("lblemail").style.color="red"
			Email.focus()
		    return false
		}
		if (str.indexOf(dot,(lat+2))==-1)
		{
			document.getElementById("lblemail").style.color="red"
			Email.focus()
		    return false
		}
		if (str.indexOf(" ")!=-1)
		{
			document.getElementById("lblemail").style.color="red"
			Email.focus()
		    return false
		}
		 document.getElementById("lblemail").style.color="black"
		
		
		if((add1.value=="")||(add1.value==' ')||(add1.value==null))
	{
	   document.getElementById("lbladd1").style.color="red"
	   add1.focus()	
	   return false
	}
	else{document.getElementById("lbladd1").style.color="black"}
	
	if((city.value=="")||(city.value==' ')||(city.value==null))
	{
	   document.getElementById("lblcity").style.color="red"
	   city.focus()	
	   return false
	}
	else{document.getElementById("lblcity").style.color="black"}
	
	if((state.value=="")||(state.value==' ')||(state.value==null))
	{
	   document.getElementById("lblstate").style.color="red"
	   state.focus()	
	   return false
	}
	else{document.getElementById("lblstate").style.color="black"}
	if((country.value=="")||(country.value==' ')||(country.value==null))
	{
	   document.getElementById("lblcountry").style.color="red"
	   country.focus()	
	   return false
	}
	else{document.getElementById("lblcountry").style.color="black"}
	
	if((pincode.value=="")||(pincode.value==' ')||(pincode.value==null))
	{
	   document.getElementById("lblZIP").style.color="red"
	   pincode.focus()	
	   return false
	}
	else{document.getElementById("lblZIP").style.color="black"}
	
	if((phone.value=="")||(phone.value==' ')||(phone.value==null))
	{
	   document.getElementById("lblPhone").style.color="red"
	   phone.focus()	
	   return false
	}
	else{document.getElementById("lblPhone").style.color="black"}
		
			
			
		 return true					
}



function isAlpha(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if ((charCode > 32 && charCode < 65)||(charCode > 90 && charCode < 97)||(charCode > 122 && charCode < 127))
	return false;

 return true;
}


function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 48 || charCode > 57))
	return false;

 return true;
}
//Function that prompts for confirmation tro delete Albums
function confirmdelalbum()
{
		var r=confirm("This would delete the selected album(s) and any photos in the shopping cart!")
  if (r==true)
    {
    return true;
    }
  else
    {
    	return false;
    }
}
function confirmdelpics()
{
			var r=confirm("This would delete the selected picture(s) from the album and your shopping cart!")
			if (r==true)
					{
					return true;
					}
			else
					{
						return false;
					}
}
function confirmcancelorder()
{
			var r=confirm("Are you sure you want to cancel this order?")
			if (r==true)
					{
					return true;
					}
			else
					{
						return false;
					}
}
function confirmdelpicsfromcart()
{
			var r=confirm("This would remove the selected picture(s) from your shopping cart!")
			if (r==true)
					{
					return true;
					}
			else
					{
						return false;
					}
}
function confirmdelcard()
{
		var r=confirm("This would delete the selected card(s). It will be removed from the shopping cart if present!")
  if (r==true)
    {
    return true;
    }
  else
    {
    	return false;
    }
}
function confirmdelcalendar()
{
  var r=confirm("This would delete the selected calendar(s). It will be removed from the shopping cart if present!")
  if (r==true)
    {
    return true;
    }
  else
    {
    	return false;
    }
}
function confirmdelbook()
{
		var r=confirm("This would delete the selected book(s). It will be removed from the shopping cart if present!")
  if (r==true)
    {
    return true;
    }
  else
    {
    	return false;
    }
}
//Function that verifies the Number of prints in the Qquick order section of Orderprints1.php is not Null
function isNop(val) 
{
if((val=="")||(val==' ')||(val==null))
{
	return false
}
else
{
	return true
}
}
//Function that verifies an address has been selected from teh addressbook listing
function valaddbook()
{
if (addressbook.addressradiobutton.checked)
{		
			//alert( addressbook.addressradiobutton.value );
			return true
}
for (i = 0;  i < addressbook.addressradiobutton.length;  i++)
{
   if (addressbook.addressradiobutton[i].checked)
			{
			//alert( addressbook.addressradiobutton[i].value );
			return true
			}
}
return false
}
///to check if pics are selected before order
function valpicselection()
{

if (document.showalbum.filename.checked)
			{
			return true
   //alert(document.showalbum.filename[i].value );
			}
for (i = 0;  i < document.showalbum.filename.length;  i++)
{
   if (document.showalbum.filename[i].checked)
			{
			return true
   //alert(document.showalbum.filename[i].value );
			}
}
return false
}

//Function that Album Name is not empty in Create Album utility
function checkalbum(val)
{
if((val=="")||(val==' ')||(val=='/')||(val=='-')||(val=='_')||(val==null))
{
///[A-Za-z0-9]/
		document.getElementById("lblalbum").style.color="red"
		alert("Invalid Album Name");
 	return false
}
}

//Function to validate teh changepassword utility in Personal.php
function checkpass() 
{
	var opwd=document.changepass.oldpwd
	var npwd=document.changepass.newpwd
	var pwd=document.changepass.cfmpwd
	if((opwd.value=="")||(opwd.value==' ')||(opwd.value==null))
	{
	   document.getElementById("lbloldpwd").style.color="red"
	   return false
	}
	else
		document.getElementById("lbloldpwd").style.color="black"
	if((npwd.value=="")||(npwd.value==' ')||(npwd.value==null))
	{
	   document.getElementById("lblnewpwd").style.color="red"
	   return false
	}
	else
		document.getElementById("lblnewpwd").style.color="black"
	if((pwd.value=="")||(pwd.value==' ')||(pwd.value==null))
	{
	   document.getElementById("lblcpwd").style.color="red"
	   return false
	}
	else
		document.getElementById("lblcpwd").style.color="black"
}

//Function that validates shipping address 
function check() 
{
	var add1=document.address.add1
	var city=document.address.city
	var state=document.address.state
	var pincode=document.address.pincode
	var phone=document.address.phone
	
	if((add1.value=="")||(add1.value==' ')||(add1.value==null))
	{
	   document.getElementById("lbladd1").style.color="red"
	   add1.focus()	
	   return false
	}
	else{document.getElementById("lbladd1").style.color="black"}
	
	if((city.value=="")||(city.value==' ')||(city.value==null))
	{
	   document.getElementById("lblcity").style.color="red"
	   city.focus()	
	   return false
	}
	else{document.getElementById("lblcity").style.color="black"}
	
	if((state.value=="")||(state.value==' ')||(state.value==null))
	{
	   document.getElementById("lblstate").style.color="red"
	   state.focus()	
	   return false
	}
	else{document.getElementById("lblstate").style.color="black"}
	
	if((pincode.value=="")||(pincode.value==' ')||(pincode.value==null))
	{
	   document.getElementById("lblpincode").style.color="red"
	   pincode.focus()	
	   return false
	}
	else{document.getElementById("lbladd1").style.color="black"}
	
	if((add1.value=="")||(add1.value==' ')||(add1.value==null))
	{
	   document.getElementById("lbladd1").style.color="red"
	   add1.focus()	
	   return false
	}
	else{document.getElementById("lbladd1").style.color="black"}
	
	return true
}