// Quiet Room JavaScript File

// Add Bookmark
function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

// Check Form Field Is Empty
function isEmpty(value){
	if (trim(value) == "")
		return true;
	
	return false;
}

// Trim White Spaces
function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

function numberOnly(value)
{
    
	var num;
	for(var i=0; i<value.length;i++)
	{
	
		if(isNaN(value.charAt(i)))
		{
		   num = true;
		   break;
		}
		else
		{
			   num = false;
		}
	}	  
	if(num == true)
	    return true;
}

function contact(value)
{
  
	if(value.length <8 || value.length >8)
	{
	  return true;
	}
	else
	{
	   return false;
	}
}	

function loginName(value)
{
  
	if(value.length > 15)
	{
	  return true;
	}
	else
	{
	   return false;
	}
}	

function password(value)
{
  
	if(value.length > 15)
	{
	  return true;
	}
	else
	{
	   return false;
	}
}	

// Check White Spaces
function checkSpace(strText) 
{ 
    // this will get rid of trailing spaces 
    for(var i = 0; i < strText.length; i ++)
	{
        if(strText.substring(i, i+1) == ' ')
		{
			return true;
			break;
		}	
	}
}