/* function for opening popup window */
function openpopup(url,popup_name,height,width,other_properties)
{
	var left		= parseInt((screen.width-350)/2);
	var top			= parseInt((screen.height-300)/2)	
	var win_options = 'height='+ height +',width='+ width +',resizable=yes,' 
	+ 'scrollbars=yes,left=' + left + ',top=' + top;

	window.open(url,popup_name,win_options);
}

function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function removeLeadingAndTrailingChar (inputString, removeChar) 

{

	var returnString = inputString;

	if (removeChar.length)

	{

	  while(''+returnString.charAt(0)==removeChar)

		{

		  returnString=returnString.substring(1,returnString.length);

		}

		while(''+returnString.charAt(returnString.length-1)==removeChar)

	  {

	    returnString=returnString.substring(0,returnString.length-1);

	  }

	}

	return returnString;

}


function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }

}

function ShowForgotPasswordBox()
{
forgot = document.getElementById('forgotpass');

if(forgot.style.display == 'none')
	forgot.style.display = 'block';
else
	forgot.style.display = 'none';
		
}

function testimonial_showhide(id)
{
for(i=1;i<=document.getElementById('total_testimonial').value ;i++)
{
if(document.getElementById('link_'+i))
	{
		if(i == id)		
		{
			document.getElementById('full_'+i).style.display = '';
			document.getElementById('link_'+i).style.display = 'none';
			document.getElementById('short_'+i).style.display = 'none';			
		}	
		else		
		{
			document.getElementById('full_'+i).style.display = 'none';
			document.getElementById('link_'+i).style.display = '';
			document.getElementById('short_'+i).style.display = '';			
		}	
		
	}
}
}
