<!--

if ((parent.frames.length != "0") || (parent.location.href != this.location.href))
{
   // remove any frames
   parent.location.href = this.location.href;
}
else {
   javascript:void(0);
}

function contains(password, validChars) { 
 
    count = 0; 
 
    for (i = 0; i < password.length; i++) { 
        var char = password.charAt(i); 
        if (validChars.indexOf(char) > -1) { 
            count++; 
        } 
    } 
 
    return count; 
}

// Copyright © caeus.com Ltd.
// www.caeus.com
// 0800 970 2955
// All Rights Reserved
// These scripts must not be reproduced in any way without permission.
// Please, however, feel free to link to the page from your web site.

function analyse(pwd) {

var points = 0;

var numbers = "0123456789"; 
var lowercase = "abcdefghijklmnopqrstuvwxyz"; 
var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var punctuation = "!.@$£#*()%~<>{}[]_\"^&-+=/\€";

var containsNumbers = contains(pwd, numbers);
var containsLowerCase = contains(pwd, lowercase);
var containsUpperCase = contains(pwd, uppercase);
var containsPunctuation = contains(pwd, punctuation);
var containsAlpha = contains(pwd, alpha);

//assess makeup of password, add points for each specific character type it contains
if((containsLowerCase) && (containsUpperCase)) { points += 15; }
if((containsNumbers) && (containsAlpha)) { points += 10; }
if((containsNumbers) && (containsPunctuation)) { points += 20; }

if((pwd.length >= 1) && (pwd.length < 8)) { points += 1; }
if((pwd.length >= 8) && (pwd.length < 10)) { points += 5; }
if((pwd.length >= 10) && (pwd.length < 15)) { points += 10; }
if((pwd.length >= 15) && (pwd.length < 20)) { points += 12; }
if(pwd.length >= 20) { points += 15; }

// maximum total points is 60

if(points == 0) { makebar("silver",5); clearwords(); }
if((points >= 1) && (points < 5)) { makebar("red",1); clearwords(); document.getElementById("r1").innerHTML = "Useless!"; }
if((points >= 5) && (points < 10)) { makebar("red",2); clearwords(); document.getElementById("r2").innerHTML = "Weak"; }
if((points >= 10) && (points < 20)) { makebar("orange",3); clearwords(); document.getElementById("r3").innerHTML = "Medium"; }
if((points >= 20) && (points < 45)) { makebar("green",4); clearwords(); document.getElementById("r4").innerHTML = "Strong"; }
if(points >= 45) { makebar("lime",5); clearwords(); document.getElementById("r5").innerHTML = "Very Strong";  }

   document.getElementById("result").innerHTML = points;
}

function makebar(colour,height) {

// first, make them all silver
   for(i=1;i<=5;i++)
   {
      var storeyname = "number" + i;
      var progressBar = document.getElementById(storeyname); 
      progressBar.style.backgroundColor = "silver";
   }

// then colour the right ones
   for(i=1;i<=height;i++)
   {
      var storeyname = "number" + i;
      var progressBar = document.getElementById(storeyname); 
      progressBar.style.backgroundColor = colour;
   }

}

function clearwords() {

   for(i=1;i<=5;i++)
   {
      var txtcat = "r" + i;
      var wordings = document.getElementById(txtcat); 
      wordings.innerHTML = "&nbsp;";
   }

}

function share(url) {
   window.open(url, "sharesite", "width=800, height=500, toolbar=no, status=no, resizeable=no, top=200, left=200");
}

function validate() {
	   if(document.econtact.txtname.value == "") {
	      alert("Please enter your name.");
	      document.econtact.txtname.focus();
	   }
	   else if(document.econtact.email.value == "") {
	      alert("Please enter your email address.");
	      document.econtact.email.focus();
	   }
	   else if(document.econtact.message.value == "") {
	      alert("Please enter a message.");
	      document.econtact.message.focus();
	   }
	   else if(document.econtact.code.value == "") {
	      alert("Please enter the Authorisation Code.");
	      document.econtact.code.focus();
	   }
	   else {
	      document.econtact.submit();
	   }
}

function agree()
{
   if(document.signup.read.checked)
   {
      document.signup.submit();
   }
   else {
      alert("You must read and agree to the Terms & Conditions before using this web site.\n\nPlease make sure you have ticked the box to indicate your agreement.");
   }
}

function verify() {

// minus two, because final elements are a button ("save changes") and the hidden value ("place")...
var qtys = (document.trolley.elements.length - 2);

for(i=0; i < qtys; i++)
{
   if((isNaN(document.trolley.elements[i].value)) && (document.trolley.elements[i].value != "Add Priority"))
   {
      alert("Please only enter numeric values for the Qty.\n\n\""+document.trolley.elements[i].value+"\" is not a valid quantity.");
      document.trolley.elements[i].value="";
      document.trolley.elements[i].focus();
      return;
   }
}
         document.trolley.submit();
}

function placeorder() {

   document.getElementById('placeorder').value = "true";

   verify();
}

function showpopup(status){
   var url = "./orderstatus.php?status=" + status;
   var x = (screen.availWidth / 2) - 100;
   var y = (screen.availHeight / 2) - 100;
   statustext = window.open(url, "status", "width=200, height=200, toolbar=no, status=no, resizeable=no");
   statustext.moveTo(x,y);
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function submitRecovForm() {
   var price = getCheckedValue(document.dataprices.recov);

   if(!price)
      alert("Please select the capacity of your hard drive from the pricelist table.\n\nTo avoid delays to your order, please select the correct price bracket.\nNote that the 20% discount is strictly for home users only.");
   else
      document.dataprices.submit();
}

function submitEraseForm() {
   var price = getCheckedValue(document.eraseprices.erase);

   if(!price)
      alert("Please select the capacity of your hard drive from the pricelist table.\n\nTo avoid delays to your order, please select the correct price bracket.\nNote that the 10% discount is strictly for home users only.");
   else
      document.eraseprices.submit();
}

function setReason(neg) {
   if(neg == "1")
   {
      document.getElementById('reason').style.display = "inline";
   }
   else if(neg == "0") {
      document.getElementById('reason').style.display = "none";
   }
}

function toggle(theElement, theWord) {
   if(theElement.style.display == "none")
   {
      theElement.style.display = "inline";
      theWord.innerHTML = "hide";
   }
   else {
      theElement.style.display = "none";
      theWord.innerHTML = "show";
   }
}

function showTab(tabid) {

   // first define list of tabs
   var tabs = new Array(
	"custnotes",
	"custaccount"
   );

   count = 0;

   while (count<tabs.length) {
      if(tabs[count] == tabid)
      {
         document.getElementById(tabs[count]).style.display = "block";
      }
      else {
         document.getElementById(tabs[count]).style.display = "none";
      }
   count++;
   }

}

function confirmDelCust(username, custID) {
   if(document.custdel.username.value != username) 
   {
      alert("Please enter this customer's username.");
      document.custdel.username.focus();
   }
   else if(document.custdel.custID.value != custID) {
      alert("Please enter this customer's account number.");
      document.custdel.custID.focus();
   }
   else if(document.custdel.password.value == "") {
      alert("Please enter your own password to authorise account deletion.");
      document.custdel.password.focus();
   }
   else if(confirm("Are you sure you want to delete this user's account? This is irreversible.\n\nUsername: " + username + "\nAcc Number: "+custID + "\n\nClick OK to delete the account. This action cannot be undone.\nIf you are unsure, click Cancel now."))
   {
      document.custdel.submit();
    }
   else {
      javascript:void(0);
    }
}

function delConfirm(url) {

   if(confirm("Are you sure you want to remove this IP address from the blacklist?"))
   {
      window.location.href = url;
   }
   else {
      javascript:void(0);
   }

}

//-->