// JavaScript Document
function passwordStrength(password,descDiv,strnDiv) {
if(password.length>4)
{
	var new_div=strnDiv+1;
	var desc = new Array(); desc[0] = "Weak"; desc[1] = "Medium"; desc[2] = "Good"; desc[3] = "Strong"; desc[4] = "Strongest";
    var score = 0; 
	//if password bigger than 6 give 1 point 
	if (password.length > 6) score++; 
	//if password has both lower and uppercase characters give 1 point 
	if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++; 
	//if password has at least one number give 1 point 
	if (password.match(/\d+/)) score++; 
	//if password has special character give another 1 point 
	if ( ( password.match(/[!,@,#,$,%,^,*,?,_,~,-]/g) )) score++; 
	//if password bigger than 12 give another 1 point 
	//if (password.length > 12) score++; 
	document.getElementById(descDiv).style.display='block';
	document.getElementById(strnDiv).style.display='block';
	document.getElementById(descDiv).innerHTML = desc[score];
	document.getElementById(new_div).style.display='block';
	document.getElementById(new_div).className = "strength" + score; 
  }
  else if(password.length==0)
  {
	  document.getElementById(descDiv).style.display='none';
	  //document.getElementById(new_div).style.display='none';
	  document.getElementById(strnDiv).style.display='none';
 }
}
function hasWhiteSpace(s) 
{
     reWhiteSpace = new RegExp(/^\s+$/);
     if (reWhiteSpace.test(s)) {
       return false;
     }
return true;
} 

function checkSplchras(data)
{

	var iChars = "!@#$%^&*()+=-[]\\;,./{}|\"\':<>?~_"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}
function checkSplchras_contactus(data)
{

	var iChars = "#$^[]{}<>~_"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}
function checkSplchras_address(data)
{

	var iChars = "!@#$%^&*()+=[];{}|\":<>?~_"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}
function checkNumbers(data)
{

	var iChars = "0123456789"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}

function checkSplchras_resume(data)
{
	var iChars = "!#$%^*()=\"[]\\;,/{}|:<>?~+"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}

function checkSplchras_aliseName(data)
{
	var iChars = "!@#$%^&*()=[]\\;,/{}|:<>?~"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}



function removeHTMLTags(strInputCode){

		strInputCode = strInputCode.replace(/&(nbsp);/g,''); 

		strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){

			return (p1 == "lt")? "<" : ">";

		});

		var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");

		return strTagStrippedText;	

}
function trimAll(sString) 
{
	if(sString.length>0)
	{
		while (sString.substring(0,1) == ' ')
		{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
	}
	return sString;
}
function isnum(v)
{
	if((v=='') || isNaN(v))
		return false;
	else
		return true;
}
function gettime()
{
	var time=new Date(); 
	var month=time.getMonth();
	var date=time.getDate(); 
	var year=time.getYear();
	var hour=time.getHours();
	var minute=time.getMinutes();
	var second=time.getSeconds();
	var totaltime=year+month+date+minute+second;
	return totaltime;
}
function cnt(w){
var y=w;
var r = 0;
a=y.replace(/\s/g,' ');
a=a.split(' ');
for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
return r;
}
//Function for number of max allowed chracter
function lung(f,k,txtnm1,txtnm2,maxlength){ 
n=maxlength;//number of max allowed characters 
var v = new String(); 
s = k.split(''); 
for(i=0;i<n;i++){v += s[i]} 
if(s.length>=n){f.elements[txtnm1].value=v; 
f.elements[txtnm2].value = n-v.length; 
} 
else{f.elements[txtnm2].value = n-s.length;} 
} 
//Function for Print a document
function printit(){  
if (window.print) {
    window.print() ;  
} else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
}
}
function check(object,msg)
{
	object.value=trimAll(object.value);
	if(object.value!="")
	return true;
	else 
	{
		if(msg!="")
		{
			alert(msg);
			object.focus();
		}
		return false;
	}
}
function restrictChars(myfield, e,char_set)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;

keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers + alphabetic chars
else if (((char_set).indexOf(keychar) > -1))
   return true;

else
   return false;
}

function checkSplchras_search(data)
{

	var iChars = "!@#$%^&*()=-[]\\./{}|\"<>?~_"; 
	   for (var i = 0; i < data.length; i++) {
		if (iChars.indexOf(data.charAt(i)) != -1) {
		return false;
		}
	  }
	  return true;
}

function checkSplchras_jobtitle(data)
{
 var iChars = "!@#$%^*=\\;/{}|:<>?~./-_+"; 
    for (var i = 0; i < data.length; i++) {
  if (iChars.indexOf(data.charAt(i)) != -1) {
  return false;
  }
   }
   return true;
}