// JScript File

function setStyle(x) {
  document.getElementById(x).className="txtHighlight";
}

function setStyleClearText(x) {
  document.getElementById(x).className="txtHighlight";
  document.getElementById(x).value="";
}

function clearStyle(x) {
  document.getElementById(x).className="none";
}


function bookmarkSite(title, url){
  if (document.all)
    window.external.AddFavorite(url, title);
  else if (window.sidebar)
    window.sidebar.addPanel(title, url, "")
}

function search() {
  var strPhrase = document.getElementById("phrase").value;
  if (strPhrase == '')
    alert('You must enter a phrase or keyword to search for.  Please try again.')
  else
    window.location = '~/search/content.aspx?phrase=' + strPhrase;
}

 
function password_strength(password) {
	var desc = new Array();
	desc[0] = "Very Weak";
	desc[1] = "Weak";
	desc[2] = "Medium";
	desc[3] = "Strong";
	desc[4] = "Very Strong";

	var points = 0;

	//---- if password is bigger than 4 , give 1 point.
	if (password.length > 4) points++;

	//---- if password has both lowercase and uppercase characters , give 1 point.	
	if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) points++;

	//---- if password has at least one number , give 1 point.
	if (password.match(/\d+/)) points++;

	//---- if password is bigger than 12 ,  give 1 point.
	if (password.length > 10) points++;

	//---- Showing  description for password strength.
	document.getElementById("password_description").innerHTML = desc[points];
	
	//---- Changeing CSS class.
	document.getElementById("password_strength").className = "strength" + points;
}
  

