/**********************************************************
	Project Name			: ProactiveFamilySolutions
	Site URL				: http://www.proactivefamilysolutions.com
	Project Phase			: User Phase
	Module Name				: ShowHide JS file
	Database Name			: proactiv_proact
	Page Name				: showhide.js
	Purpose of this page	: This page is used for show and hide particular section.
	Last Modified By		: Srinivasn.R.R
	Last Modified Date		: 10 July 2008
	Last Modified Purpose	: For writting Code Comments
 *********************************************************/
function isCharsInBag (s, bag)
{  
    var i;
    for (i = 0; i < s.length; i++)
    {   
       
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return false;
    }
    return true;
}


function isEmail (s)
{
	var i = 1;
	var j=0;
	var ar=0;
	var m=0;
	var sLength = s.length;
	
	while (i < sLength)
	{
		if (s.charAt(i) == "@")j++;			
		i++;
	}
	i=1;
	while (i < sLength)
	{
		if (s.charAt(i) == ".")ar++;			
		i++;
	}
	m=sLength-1;
	if (j==0) return false;
	if (ar==0) return false;
	if (j>1) return false;
	if (s.charAt(1) == "@")  return false;
	if (s.charAt(1) == ".")  return false;
	if (s.charAt(m) == "@") return false;
	if (s.charAt(m) == ".") return false;
		return true;
 }
function ext(s)
{
        var i,pos=0;
        for (i = 0; i < s.length; i++)
        {
                var c = s.charAt(i);
                if (c==".") pos=i;
        }
        var extValue="";
        for (i=pos+1;i<=s.length;i++)
        {
                extValue =extValue+s.charAt(i);
        }

        if (extValue != 'jpeg' && extValue != 'JPEG' && extValue != 'jpg' && extValue != 'JPG' && extValue != 'png' && extValue != 'PNG')
        return false;
    else
  		document.register.ftype.value=extValue;
	return true;
}
function trimString (str)
{
	str = this != window? this : str;
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
function isCharsInBag (s, bag)
{
    var i;
    for (i = 0; i < s.length; i++)
    {

        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return false;
    }
    return true;
}

function isFloatValue(s)
{
		var i,counter=0;
		for (i = 0; i < s.length; i++)
		{
			var c = s.charAt(i);
			if (c==".") counter++;
		}
		if (counter>1)
		return false;
		else
		return true;
}

/*********************** Function to show particular section starts here **********************/
function showcitizenship(id)
{
	var frm=document.frmeggdonor;
	document.getElementById(id).style.display="inline";
	return true;
}
/*********************** Function to hisde particular section starts here **********************/
function hidecitizenship(id)
{
	var frm=document.frmeggdonor;
	document.getElementById(id).style.display="none";
	return true;
}
/*********************** Function to take print out starts here **********************/
function takeprint()
{
	var browser=navigator.appName; // Browser name
	/*********************** If browser is "Microsoft Internet Explorer" starts here **********************/
	if (browser=="Microsoft Internet Explorer")
	{
		alert("We suggest you to use Firefox,Safari or Netscape browsers for best use.");
		return false;
	}
	/*********************** If browser is not "Microsoft Internet Explorer" starts here **********************/
	else
	{
		var a=window.print();
		if (a==true)
		{
			window.top.location='index.php';
		}
	}
}
