whitespace = "\t \n\r";
function isEmptyString(s)
{
    var i;
	if((s == null) || (s.length == 0)) return true;
	for(i=0;i < s.length;i++)
	{
		var currchar = s.charAt(i);
		if(whitespace.indexOf(currchar) == -1) return false;
	}
	return true;
}

All_numbers = "1234567890";
function isAnyNumber_Check(s)
{
    var i;
	for(i=0;i < s.length;i++)
	{
		var currchar = s.charAt(i);
		if(All_numbers.indexOf(currchar) != -1) return true;
	}
	return false;
}

function isNotNumeric(s)
{
	if(isNaN(s))
	{
		return(true);
	}
	return(false);
}

function isEmail(n)
{
		if ((n==null) || (n.length==0))
		{
			return true;
		}
		if (isEmptyString(n)) return false;
		var i=1;
		var nLength=n.length;
		while((parseInt(i) < parseInt(nLength)) && (n.charAt(parseInt(i)) != '@'))
		{
			i++;
		}
		if ((parseInt(i) >= parseInt(nLength)) || (n.charAt(i)!="@"))
		{
			return false;	
		}	
		else i+=2;
		while((i<nLength) && (n.charAt(i)!="."))
		{
			i++;
		}
		if ((i>=nLength-1) || (n.charAt(i)!="."))
		{
			return false;	
		}	
		else return true;		
}
///----------------------Phone number ------------------------
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

///----------------------End Validation------------

function DonloadWindow(my_url)
{ 
	var My_Download_Open = window.open(my_url,"My_Download","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resize=no,copyhistory=0,width=627,height=375")
	My_Download_Open.focus();
	My_Download_Open.moveTo(85,50);
}

function confship()
{
	var fl = 0;
	for(i = 0; i < (document.frm_1.elements.length); i++)
	{
		if((document.frm_1.elements[i].type=="checkbox") && (document.frm_1.elements[i].checked==true))
		{
			fl = 1;
			break;
		}
	}
	if(fl == 1)
	{
		if(confirm("Are you sure you want to Implement?"))
		{
			fl = 1;
		}
		else
		{
			fl = 0;
		}
	}
	else
	{
		alert("Nothing to Implement.");
		fl = 0;
	}
	if(fl == 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}


function confdel()
{
	var fl = 0;
	for(i = 0; i < (document.frm_1.elements.length); i++)
	{
		if((document.frm_1.elements[i].type=="checkbox") && (document.frm_1.elements[i].checked==true))
		{
			fl = 1;
			break;
		}
	}
	if(fl == 1)
	{
		if(confirm("Records related will also get Deleted, Are you sure you want to Delete?"))
		{
			fl = 1;
		}
		else
		{
			fl = 0;
		}
	}
	else
	{
		alert("Nothing to Delete.");
		fl = 0;
	}
	if(fl == 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function Select_Delect_All(total_records_viewed)
{
	for(i=0;i<total_records_viewed;i=i+1)
	{
		if(document.frm_1.chk_SD.checked==true)
		{
			document.frm_1.elements["chk_1["+i+"]"].checked=true;
		}
		else
		{
			document.frm_1.elements["chk_1["+i+"]"].checked=false;
		}
	}
}
jobfiles = new Array(".doc");
function Allowed_Resume_Files(File_Value)
{
	allowSubmit = false;
	if (!File_Value)
	{
		return true;
	}
	while (File_Value.indexOf("\\") != -1)
	{
		File_Value = File_Value.slice(File_Value.indexOf("\\") + 1);
	}
	ext = File_Value.slice(File_Value.indexOf(".")).toLowerCase();
	for (var i = 0; i < jobfiles.length; i++)
	{
		if (jobfiles[i] == ext)
		{
			allowSubmit = true;
			break;
		}
	}
	if (allowSubmit)
	{
		return true;
	}
	else
	{
		return false;
	}
}


extArray = new Array(".gif",".jpg",".jpeg",".jpe");
function Allowed_Uploaded_Files(File_Value)
{
	allowSubmit = false;
	if (!File_Value)
	{
		return true;
	}
	while (File_Value.indexOf("\\") != -1)
	{
		File_Value = File_Value.slice(File_Value.indexOf("\\") + 1);
	}
	ext = File_Value.slice(File_Value.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++)
	{
		if (extArray[i] == ext)
		{
			allowSubmit = true;
			break;
		}
	}
	if (allowSubmit)
	{
		return true;
	}
	else
	{
		return false;
	}
}