function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
function trimM(str)
{
    if(!str || typeof str != 'string')
        return null;

    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}
//Function to Select Records Using Checkbox
function checkall(objForm){
	len = objForm.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (objForm.elements[i].type=='checkbox') {
			objForm.elements[i].checked=objForm.check_all.checked;
		}
	}
}
//Function for Confirmation to Delete a record
function del()
{
var x=confirm("Do you want to delete the selected record?");
if(x)
  {
return true;
  }
else
   {
return false;
   }
}
function validateUser(userFrm)
{	
	var currentTime = new Date();
	//alert(currentTime.getMonth());
	//alert(currentTime);
	var time= currentTime.getTime();
	var Temp=(userFrm.dob.value).split('-');
	var dobTime=new Date(Temp[0],Temp[1]-1,Temp[2]);
	dobTime=dobTime.getTime();
	var ageCom=18*365*3600*24*1000;
	var email_str = userFrm.email.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		if(trim(userFrm.country.value)=='') 
		{ 
			errorstr += "- Please Select Country.\n";
		}
		if(trim(userFrm.email.value)=='') 
		{ 
			errorstr += "- Please Enter Email.\n";
		}
		else if(!filter.test(email_str))
		{
			errorstr += "- Please Enter a Valid Email.\n";
		}
		if(trim(userFrm.password.value)=='') 
		{ 
			errorstr += "- Please Enter Password.\n";
		}
		if(trim(userFrm.password.value)!=trim(userFrm.password_confirm.value)) 
		{ 
			errorstr += "- Confirm Password Should be Same.\n";
		}
		if(trim(userFrm.userName.value)=='') 
		{ 
			errorstr += "- Please Enter Username.\n";
		}
		if(trim(userFrm.firstName.value)=='') 
		{ 
			errorstr += "- Please Enter First Name.\n";
		}
		if(trim(userFrm.lastName.value)=='') 
		{ 
			errorstr += "- Please Enter Last Name.\n";
		}
		
		if((time-dobTime)<=ageCom) 
		{ 
			errorstr += "- Your Age Must be Atleast 18 Years.\n";
		}
		if(trim(userFrm.city.value)=='') 
		{ 
			errorstr += "- Please Enter City.\n";
		}
		if(trim(userFrm.zip.value)=='') 
		{ 
			errorstr += "- Please Enter Zip.\n";
		}
		if(trim(userFrm.cardNo.value)=='') 
		{ 
			errorstr += "- Please Enter Credit Card Number.\n";
		}
		if(trim(userFrm.CSCcode.value)=='') 
		{ 
			errorstr += "- Please Enter CSC Code.\n";
		}
		if(userFrm.checkConditionForBid.checked==false) 
		{ 
			errorstr += "- Please check the check box if you agreed with our Bidding Payment Condition.\n";
		}
    	if(trim(userFrm.captcha.value)=='') 
		{ 
			errorstr += "- Please Enter Security Code (Captcha).\n";
		}
		if(userFrm.tncCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you aggred with our terms and condition.\n";
		}
		if(userFrm.facCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving periodic free auction credits.\n";
		}
		if(userFrm.offerCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving exclusive invitations.\n";
		}
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
}
function validateUserUpdate(userFrm)
{	
	var currentTime = new Date();
	//alert(currentTime.getMonth());
	//alert(currentTime);
	var time= currentTime.getTime();
	var Temp=(userFrm.dob.value).split('-');
	var dobTime=new Date(Temp[0],Temp[1]-1,Temp[2]);
	dobTime=dobTime.getTime();
	var ageCom=18*365*3600*24*1000;
	var email_str = userFrm.email.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var cardNummber=trim(userFrm.cardNo.value);
	var cscCodeVal=trim(userFrm.CSCcode.value);
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		if(trim(userFrm.country.value)=='') 
		{ 
			errorstr += "- Please Select Country.\n";
		}
		if(trim(userFrm.email.value)=='') 
		{ 
			errorstr += "- Please Enter Email.\n";
		}
		else if(!filter.test(email_str))
		{
			errorstr += "- Please Enter a Valid Email.\n";
		}
		if(trim(userFrm.password.value)=='') 
		{ 
			errorstr += "- Please Enter Password.\n";
		}
		if(trim(userFrm.password.value)!=trim(userFrm.password_confirm.value)) 
		{ 
			errorstr += "- Confirm Password Should be Same.\n";
		}
		if(trim(userFrm.userName.value)=='') 
		{ 
			errorstr += "- Please Enter Username.\n";
		}
		if(trim(userFrm.firstName.value)=='') 
		{ 
			errorstr += "- Please Enter First Name.\n";
		}
		if(trim(userFrm.lastName.value)=='') 
		{ 
			errorstr += "- Please Enter Last Name.\n";
		}
		
		if((time-dobTime)<=ageCom) 
		{ 
			errorstr += "- Your Age Must be Atleast 18 Years.\n";
		}
		if(trim(userFrm.city.value)=='') 
		{ 
			errorstr += "- Please Enter City.\n";
		}
		if(trim(userFrm.zip.value)=='') 
		{ 
			errorstr += "- Please Enter Zip.\n";
		}
		if(trim(userFrm.cardNo.value)!='')
		{
			if(cardNummber.length<16)
			{
				errorstr+="- Card number should not be less than 16 digit.\n"
			}
			if(cardNummber.length>16)
			{
				errorstr+="- Card number should not be greater than 16 digit.\n"
			}
		}
	
		if(trim(userFrm.CSCcode.value)!='')
		{
			if(cscCodeVal.length<3)
			{
				errorstr+="- CSC code should not be less than 3 digit.\n"
			}
			if(cscCodeVal.length>3)
			{
				errorstr+="- CSC code should not be greater than 3 digit.\n"
			}
		}
		/*if(userFrm.checkConditionForBid.checked==false) 
		{ 
			errorstr += "- Please check the check box if you agreed with our Bidding Payment Condition.\n";
		}*/
/*	    	if(trim(userFrm.captcha.value)=='') 
		{ 
			errorstr += "- Please Enter Security Code (Captcha).\n";
		}
	if(userFrm.tncCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you aggred with our terms and condition.\n";
		}
		if(userFrm.facCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving periodic free auction credits.\n";
		}
		if(userFrm.offerCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving exclusive invitations.\n";
		}*/
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
}
function validateUnRegUser(userFrm)
{	
	var currentTime = new Date();
	//alert(currentTime.getMonth());
	//alert(currentTime);
	var time= currentTime.getTime();
	var Temp=(userFrm.dob.value).split('-');
	var dobTime=new Date(Temp[0],Temp[1]-1,Temp[2]);
	dobTime=dobTime.getTime();
	var ageCom=18*365*3600*24*1000;
	var email_str = userFrm.email.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		if(trim(userFrm.country.value)=='') 
		{ 
			errorstr += "- Please Select Country.\n";
		}
		if(trim(userFrm.email.value)=='') 
		{ 
			errorstr += "- Please Enter Email.\n";
		}
		else if(!filter.test(email_str))
		{
			errorstr += "- Please Enter a Valid Email.\n";
		}
		if(trim(userFrm.password.value)=='') 
		{ 
			errorstr += "- Please Enter Password.\n";
		}
		if(trim(userFrm.password.value)!=trim(userFrm.password_confirm.value)) 
		{ 
			errorstr += "- Confirm Password Should be Same.\n";
		}
		if(trim(userFrm.userName.value)=='') 
		{ 
			errorstr += "- Please Enter Username.\n";
		}
		if(trim(userFrm.firstName.value)=='') 
		{ 
			errorstr += "- Please Enter First Name.\n";
		}
		if(trim(userFrm.lastName.value)=='') 
		{ 
			errorstr += "- Please Enter Last Name.\n";
		}
		
		if((time-dobTime)<=ageCom) 
		{ 
			errorstr += "- Your Age Must be Atleast 18 Years.\n";
		}
		if(trim(userFrm.city.value)=='') 
		{ 
			errorstr += "- Please Enter City.\n";
		}
		if(trim(userFrm.zip.value)=='') 
		{ 
			errorstr += "- Please Enter Zip.\n";
		}
/*		if(trim(userFrm.promocode.value)=='') 
		{ 
			errorstr += "- Please Enter Promo Code.\n";
		}
*/		if(trim(userFrm.captcha.value)=='') 
		{ 
			errorstr += "- Please Enter Security Code (Captcha).\n";
		}
		/*if(userFrm.checkConditionForBid.checked==false) 
		{ 
			errorstr += "- Please check the check box if you agreed with our Bidding Payment Condition.\n";
		}*/
		if(userFrm.tncCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you agreed with our terms and condition.\n";
		}
		/*if(userFrm.facCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving periodic free auction credits.\n";
		}*/
		/*if(userFrm.offerCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you interested in receiving exclusive invitations.\n";
		}*/
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
}

function validateAgent(userFrm)
{
	var email_str = userFrm.agentemail.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	
		if(trim(userFrm.agentfirstName.value)=='') 
		{ 
			errorstr += "- Please Enter First Name.\n";
		}
		if(trim(userFrm.agentlastName.value)=='') 
		{ 
			errorstr += "- Please Enter Last Name.\n";
		}
		if(trim(userFrm.agentemail.value)=='') 
		{ 
			errorstr += "- Please Enter Email.\n";
		}
		else if(!filter.test(email_str))
		{
			errorstr += "- Please Enter a Valid Email.\n";
		}
		if(trim(userFrm.password.value)=='') 
		{ 
			errorstr += "- Please Enter Password.\n";
		}
		if(trim(userFrm.password.value)!=trim(userFrm.password_confirm.value)) 
		{ 
			errorstr += "- Confirm Password Shoulb be Same.\n";
		}
		/*if(trim(userFrm.promocode.value)=='') 
		{ 
			errorstr += "- Please Enter Promocode Code .\n";
		}*/
		if(userFrm.tncCheck.checked==false) 
		{ 
			errorstr += "- Please check the check box if you aggred with our terms and condition.\n";
		}
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
}
function validateLogin(form_p)
{
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	if(trim(form_p.userName.value)=='')
	{
	errorstr+="- Please Enter Username.\n"
	}
	if(trim(form_p.password.value)=='')
	{
	errorstr+="- Please Enter Password.\n"
	}
	
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		return false;
	}
	else
	{
		return true;
	}	
} 
function validateRecover(form_p)
{
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	if(trim(form_p.userName.value)=='')
	{
	errorstr+="- Please Enter Username.\n"
	}		
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		return false;
	}
	else
	{
		return true;
	}	
} 
function validateBid(obj)
{
	
	var bid=document.getElementById('bid'+obj).value;
	bid=(Math.round(bid*100)/100).toFixed(2);
	var bidBelow=document.getElementById('bidBelow').value;
	document.getElementById('bid'+obj).value=bid;
	//alert(bidBelow);
	if(parseFloat(bid)>parseFloat(bidBelow))
	{
		alert('Please Change Your Bid Amount.\nYour Bid Must Less Than Or Equal To $'+bidBelow);
		//alert(bid);
		document.getElementById('bid'+obj).value='';
		//alert(document.getElementById('bid'+obj).value);
		document.getElementById('bid'+obj).focus();
		//return false;
	}
	for(var i=obj;i>1;i--)
	{
		//alert(parseFloat(document.getElementById('bid'+(i-1)).value));
		//alert(parseFloat(bid));
		if(parseFloat(bid)==parseFloat(document.getElementById('bid'+(i-1)).value))
		{
			alert('Please Change Your Bid Amount.\nYour Bid Must be unique in all the boxes');
			//alert(bid);
			document.getElementById('bid'+obj).value='';
			//alert(document.getElementById('bid'+obj).value);
			document.getElementById('bid'+obj).focus();
			break;
		}

	}
}
function validateBidValue(frm)
{
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	for (var i=1;i<=10;i++)
	{
		var bid='bid'+i;
		//alert(bid);
		if(trim(document.getElementById(bid).value)==''||trim(document.getElementById(bid).value)==0)
		{
			errorstr+="- Please Enter Bid Amount For Bid "+bid+ ".\n"
		}
		else if(isNaN(document.getElementById(bid).value))
		{
			errorstr+="- Please Enter Valid Bid Amount For Bid "+bid+ ".\n"
		}
	}
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		return false;
	}
	else
	{
		return true;
	}	

}
function validateBlab(form_p)
{
	var email_str = form_p.friendEmail.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var result = email_str.split(",");
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	
	if(trim(form_p.senderfName.value)=='')
	{
		errorstr+="- Please Enter Your First Name.\n"
	}
	if(trim(form_p.senderEmail.value)=='')
	{
		errorstr+="- Please Enter Your Email.\n"
	}
	else if(!filter.test(form_p.senderEmail.value))
	{
		errorstr+="- Please Enter Your valid Email.\n"
	}
	if(trim(form_p.receiverfName.value)=='')
	{
		errorstr+="- Please Enter First Name Of Friend.\n"
	}

	if(trim(form_p.friendEmail.value)=='')
	{
		errorstr+="- Please Enter Email of Friend.\n"
	}
	else if(!filter.test(email_str))
	{
		errorstr+="- Please Enter valid Email of Friend.\n"
	}
	if(trim(form_p.blabDescription.value)=='')
	{
	errorstr+="- Please Enter Blab Description.\n"
	}
	
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		return false;
	}
	else
	{
		return true;
	}	
}
function validateContact(contactFrm)
{
	var email_str = contactFrm.email.value;
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
		if(trim(contactFrm.name.value)=='') 
		{ 
			errorstr += "- Please Enter Name.\n";
		}
		if(trim(contactFrm.email.value)=='') 
		{ 
			errorstr += "- Please Enter Email.\n";
		}
		else if(!filter.test(email_str))
		{
			errorstr += "- Please Enter a Valid Email.\n";
		}
		if(trim(contactFrm.subject.value)=='') 
		{ 
			errorstr += "- Please Enter Subject.\n";
		}
		if(trim(contactFrm.message.value)=='') 
		{ 
			errorstr += "- Please Enter Message.\n";
		}
		
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}	
}
function validateAddCredit(form_p)
{
	var filter=/^.+@.+\..{2,3}$/;
	var errorstr = '';
	var payMode=document.getElementsByName('payThrough');
	var payMethod;
	for(var i=0;i<payMode.length;i++)
	{
		if(payMode[i].checked==true)
		{
			payMethod=payMode[i].value;
			break;
		}
	}
	var cardNummber=trim(form_p.cardNo.value);
	var cscCodeVal=trim(form_p.CSCcode.value);
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	//alert(form_p.ShippFirstName.value);
	if(payMethod=='creditCard')
	{
		
		if(trim(form_p.cardNo.value)=='')
		{
			errorstr+="- Please Enter Your Card Number.\n"
		}
		else if(form_p.cardNo.value!='')
		{
			if(cardNummber.length<16)
			{
				errorstr+="- Card No should not be less than 16 digit.\n"
			}
			if(cardNummber.length>16)
			{
				errorstr+="- Card No should not be greater than 16 digit.\n"
			}	
		}
		
		if(trim(form_p.CSCcode.value)=='')
		{
			errorstr+="- Please Enter Security Code.\n"
		}
		else if(form_p.CSCcode.value!='')
		{
			
			if(form_p.cardType.value==3)
			{
				
				if(cscCodeVal.length<4)
				{
					errorstr+="- Security Code should not be less than 4 digit.\n"
				}
				if(cscCodeVal.length>4)
				{
					errorstr+="- Security Code should not be greater than 4 digit.\n"
				}
			}
			else
			{
				if(cscCodeVal.length<3)
				{
					errorstr+="- Security Code should not be less than 3 digit.\n"
				}
				if(cscCodeVal.length>3)
				{
					errorstr+="- Security Code should not be greater than 3 digit.\n"
				}
			}
		}
		if(trim(form_p.expMonth.value)=='00')
		{
			errorstr+="- Please Select Expiration Month.\n"
		}
		if(trim(form_p.expYear.value)=='0000')
		{
			errorstr+="- Please Select Expiration Year.\n"
		}
		if(trim(form_p.ShippFirstName.value)=='')
		{
			errorstr+="- Please Enter Your First Name For Shipping Address.\n"
	
		}
		
		if(trim(form_p.BillFirstName.value)=='')
		{
			errorstr+="- Please Enter Your First Name For Billing Address.\n"
		}
		if(trim(form_p.BillLastName.value)=='')
		{
			errorstr+="- Please Enter Your Last Name For Billing Address.\n"
		}
		if(trim(form_p.BillAddress.value)=='')
		{
			errorstr+="- Please Enter Your Address For Billing Address.\n"
		}
		
		if(trim(form_p.BillCity.value)=='')
		{
			errorstr+="- Please Enter Your City For Billing Address.\n"
		}
		if(trim(form_p.BillState.value)=='')
		{
			errorstr+="- Please Enter Your State For Billing Address.\n"
		}
		if(trim(form_p.BillZipcode.value)=='')
		{
			errorstr+="- Please Enter Your Zipcode For Billing Address.\n"
		}
		if(trim(form_p.BillCountry.value)=='')
		{
			errorstr+="- Please Enter Your Country For Billing Address.\n"
		}
		if(trim(form_p.BillTelephone.value)=='')
		{
			errorstr+="- Please Enter Your Telephone For Billing Address.\n"
		}
		if(trim(form_p.BillEmail.value)=='')
		{
			errorstr+="- Please Enter Your Email.\n"
		}
		else if(!filter.test(form_p.BillEmail.value))
		{
			errorstr+="- Please Enter Your valid Email.\n"
		}
		if(trim(form_p.ShippLastName.value)=='')
		{
			errorstr+="- Please Enter Your Last Name For Shipping Address.\n"
		}
		if(trim(form_p.ShippAddress.value)=='')
		{
			errorstr+="- Please Enter Your Address For Shipping Address.\n"
		}
		if(trim(form_p.ShippCity.value)=='')
		{
			errorstr+="- Please Enter Your City For Shipping Address.\n"
		}
		if(trim(form_p.ShippState.value)=='')
		{
			errorstr+="- Please Enter Your State For Shipping Address.\n"
		}
		if(trim(form_p.ShippZipcode.value)=='')
		{
			errorstr+="- Please Enter Your Zipcode For Shipping Address.\n"
		}
		if(trim(form_p.ShippCountry.value)=='')
		{
			errorstr+="- Please Enter Your Country For Shipping Address.\n"
		}
		if(trim(form_p.ShippTelephone.value)=='')
		{
			errorstr+="- Please Enter Your Telephone For Shipping Address.\n"
		}
		
		if(trim(form_p.ShippEmail.value)=='')
		{
			errorstr+="- Please Enter Your Email For Shipping Address.\n"
		}
		else if(!filter.test(form_p.ShippEmail.value))
		{
			errorstr+="- Please Enter Your valid Email.\n"
		}
		
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			return true;
		}
	}
}
function validateFeed(frm)
{
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	if(trim(frm.message.value)=='')
	{
		errorstr+="- Please Enter Some Comments.\n"
	}
	if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		return false;
	}
	else
	{
		return true;
	}	

}
var bCheckNumbers = true;
var bCheckUpperCase = true;
var bCheckLowerCase = true;
var bCheckPunctuation = true;
var nPasswordLifetime = 365;

// Check password
function checkPassword(strPassword)
{
	// Reset combination count
	nCombinations = 0;
	
	// Check numbers
	if (bCheckNumbers)
	{
		strCheck = "0123456789";
		if (doesContain(strPassword, strCheck) > 0) 
		{ 
        		nCombinations += strCheck.length; 
    		}
	}
	
	// Check upper case
	if (bCheckUpperCase)
	{
		strCheck = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		if (doesContain(strPassword, strCheck) > 0) 
		{ 
        		nCombinations += strCheck.length; 
    		}
	}
	
	// Check lower case
	if (bCheckLowerCase)
	{
		strCheck = "abcdefghijklmnopqrstuvwxyz";
		if (doesContain(strPassword, strCheck) > 0) 
		{ 
        		nCombinations += strCheck.length; 
    		}
	}
	
	// Check punctuation
	if (bCheckPunctuation)
	{
		strCheck = ";:-_=+\|//?^&!.@$£#*()%~<>{}[]";
		if (doesContain(strPassword, strCheck) > 0) 
		{ 
        		nCombinations += strCheck.length; 
    		}
	}
	
	// Calculate
	// -- 500 tries per second => minutes 
    	var nDays = ((Math.pow(nCombinations, strPassword.length) / 500) / 2) / 86400;
 
	// Number of days out of password lifetime setting
	var nPerc = nDays / nPasswordLifetime;
	
	return nPerc;
}
 
// Runs password through check and then updates GUI 
function runPassword(strPassword, strFieldID) 
{
	// Check password
	nPerc = checkPassword(strPassword);
	//alert(nPerc);
	 // Get controls
    	var ctlBar = document.getElementById(strFieldID + "_bar"); 
    	var ctlText = document.getElementById(strFieldID + "_text");
    	if (!ctlBar || !ctlText)
    		return;
    	
    	// Set new width
    	var nRound = Math.round(nPerc * 100);
	if (nRound < (strPassword.length * 5)) 
	{ 
		nRound += strPassword.length * 5; 
	}
	if (nRound > 100)
		nRound = 100;
    	ctlBar.style.width = nRound + "%";
 
 	// Color and text
 	if (nRound > 95)
 	{
 		strText = "Very Secure";
 		strColor = "#3bce08";
 	}
 	else if (nRound > 75)
 	{
 		strText = "Secure";
 		strColor = "orange";
	}
 	else if (nRound > 50)
 	{
 		strText = "Mediocre";
 		strColor = "#ffd801";
 	}
 	else
 	{
 		strColor = "red";
 		strText = "Insecure";
 	}
	ctlBar.style.backgroundColor = strColor;
	ctlText.innerHTML = "<span style='color: " + strColor + ";'>" + strText + "</span>";
}
 
// Checks a string for a list of characters
function doesContain(strPassword, strCheck)
 {
    	nCount = 0; 
 
	for (i = 0; i < strPassword.length; i++) 
	{
		if (strCheck.indexOf(strPassword.charAt(i)) > -1) 
		{ 
	        	nCount++; 
		} 
	} 
 
	return nCount; 
} 
function getBillAddress()
{
	if(document.getElementById('sameAsBillAddress').checked==true)
	{
		document.getElementById('ShippFirstName').value=document.getElementById('BillFirstName').value;
		document.getElementById('ShippLastName').value=document.getElementById('BillLastName').value;
		document.getElementById('ShippAddress').value=document.getElementById('BillAddress').value;
		document.getElementById('ShippCity').value=document.getElementById('BillCity').value;
		document.getElementById('ShippState').value=document.getElementById('BillState').value;
		document.getElementById('ShippZipcode').value=document.getElementById('BillZipcode').value;

		document.getElementById('ShippTelephone').value=document.getElementById('BillTelephone').value;
		document.getElementById('ShippEmail').value=document.getElementById('BillEmail').value;
		document.getElementById('ShippSuite').value=document.getElementById('BillSuite').value;
	}
	else
	{
		document.getElementById('ShippFirstName').value='';
		document.getElementById('ShippLastName').value='';
		document.getElementById('ShippAddress').value='';
		document.getElementById('ShippCity').value='';
		document.getElementById('ShippState').value='';
		document.getElementById('ShippZipcode').value='';
		document.getElementById('ShippCountry').value='';
		document.getElementById('ShippTelephone').value='';
		document.getElementById('ShippEmail').value='';
		document.getElementById('ShippSuite').value='';
	}
} 
 
 
 
 


