function GetWindowFeat(wHeight, wWidth)
{
	var wLeft;
	var wTop;
	var features;
	wLeft = screen.availWidth - (screen.availWidth * 0.99)
	wTop = screen.availHeight - (screen.availHeight * 0.99)
	features = "height=";
	features = features + wHeight;
	features = features + ",width=";
	features = features + wWidth;
	features = features + ",resizable=yes,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes";
	features = features + ",left=" + wLeft;
	features = features + ",top=" + wTop;
	return features;
}
function WinSize()
{
	if (window.screen.width == 640 && window.screen.height == 480) return 1;
	if (window.screen.width == 800 && window.screen.height == 600) return 2;
	if (window.screen.width == 1024 && window.screen.height == 768) return 3;
	if (window.screen.width == 1280 && window.screen.height == 1024) return 4;
	if (window.screen.width == 1600 && window.screen.height == 1024) return 5;
	if (window.screen.width == 1600 && window.screen.height == 1200) return 6;
	if (window.screen.width == 1920 && window.screen.height == 1200) return 7;
	
	return 0;	
}

function GetWindowFeatures(w,h)
{

	if (WinSize() == 1) 
	{
	  availWidth = w - (w * 5) 
	  availHeight = h - (h * 0.48)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 2) 
	{
	  availWidth = w + (w * 0.55)
	  availHeight = h - (h * 0.3)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 3) 
	{
	  availWidth = w + (w * 1)
	  availHeight = h - (h * 0.12)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 4) 
	{
	  availWidth = w + (w * 1)
	  availHeight = h + (h * 0.1)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 5) 
	{
	  availWidth = w + (w * 1)
	  availHeight = h + (h * 0.1)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 6) 
	{
	  availWidth = w + (w * 1)
	  availHeight = h + (h * 0.1)
	  return GetWindowFeat(availHeight,availWidth)
	}
	if (WinSize() == 7) 
	{
	  availWidth = w + (w * 1)
	  availHeight = h + (h * 0.1)
	  return GetWindowFeat(availHeight,availWidth)
	}
 availWidth = w 
 availHeight = h
 return GetWindowFeat(availHeight,availWidth)
	
}

// Returns true if character c is an English letter 
// (A .. Z, a..z).
// Validate only the first entry
function isLetter (c)
{   
   return (((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")))   
}


// Returns true if character c is a digit 
// (0 .. 9).
//Validate only the first entry
function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}


// Returns true if character c is a letter or digit.
//Validate only the first entry
function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}

// Returns true if character str is a letter.
// Validate all the input entries
function isStrLetter(str)
{	
	for(i=0;i<str.length;i++)
	{
		v = str.charAt(i);
		if (isLetter(v) == false)
		{
			return false;
		}
	}
	return true;
}



// Returns true if character str is a digit.
// Validate all the input entries
function isStrDigit(str)
{	
	for(i=0;i<str.length;i++)
	{
		v = str.charAt(i);
		if (isDigit(v) == false)
		{
			return false;
		}
	}
	return true;
}


// Returns true if character str is a letter or digit.
// Validate all the input entries
function isStrLetterOrDigit(str)
{	
	for(i=0;i<str.length;i++)
	{
		v = str.charAt(i);
		if (isLetterOrDigit(v) == false)
		{
			return false;
		}
	}
	return true;
}

//The two function doacheck and doanothercheck are not allowing
//special numbers, special characters that mentioned in var mikeExp
function doacheck(val) 
{
    var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp)!= -1) 
	{
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
	}
}
function doanothercheck(form) 
{
	if(form.value.length < 1) 
	{
		//alert("Please enter something.");
		return false;
	}
	if(form.value.search(mikExp) == -1) {
	//alert("Correct Input");
	return false;
}
else 
{
	//alert("Sorry, but the following numbers 0123456789 and characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
	form.select();
	form.focus();
	return false;
}
//alert("Correct Input");
return false;
}

function trim(a){
  return a.replace(/^\s+/,'').replace(/\s+$/,'')
}

function ltrim( s )
{
  var lpatt = new RegExp( "^ *(.*)$" );
  var parse = s.match( lpatt );
  return parse[1];
}

function rtrim( s )
{
  var rpatt = new RegExp( "^(.*[^ ]) *$" );
  var parse = s.match( rpatt );
  return parse[1];
}
    
