var checkboxName = 'ChkType'
var isCheck = true;

function checkall(FormInput) {
  for (var i = 1; true; i++){
    if(FormInput.elements[checkboxName+i] == null)
      break;
    FormInput.elements[checkboxName+i].checked = isCheck;
  }
  isCheck = !isCheck;
  FormInput.elements['ChkType1'].focus();
  
}

var p_bSubmit = 0;
function CheckSignIn(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.user.value ==  ""){
			alert("Please enter your username");
			FormInput.user.focus();
			return false;
		}
		else if(FormInput.pword.value ==  ""){
			alert("Please enter your password");
			FormInput.pword.focus();
			return false;
		}
		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function CheckBeforeSubmit(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.username.value ==  ""){
			alert("Please enter a username");
			FormInput.username.focus();
			return false;
		}
		else if(FormInput.email.value ==  ""){
			alert("Please enter your email");
			FormInput.email.focus();
			return false;
		}
		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function helpdirect(strurl)
	{
	// can vary position
	var popUpWidth = 200;
	var popUpHeight = 300;
	var x = ((screen.width - popUpWidth)/1.05);
	var y = ((screen.height - popUpHeight)/2);
	window.status="general";
	
	window.open('help.asp?lan='+strurl, 'helpWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,HEIGHT='+popUpHeight+',WIDTH='+popUpWidth+',top='+y+',left='+x+',screenX='+x+',screenY='+y+'');
	}
	
	
function CheckDblClick(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		p_bSubmit = 1;
		return true;
	}
}

function CheckECcard(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.emailto.value ==  ""){
			alert("Please enter email to");
			FormInput.emailto.focus();
			return false;
		}
		else if(FormInput.pmessage.value ==  ""){
			alert("Please write a personal message");
			FormInput.pmessage.focus();
			return false;
		}
		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function EmailSignIn(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.email.value ==  ""){
			alert("Please enter your email");
			FormInput.email.focus();
			return false;
		}
		else if(FormInput.id.value ==  ""){
			alert("Please enter the message ID");
			FormInput.id.focus();
			return false;
		}		
		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function PasswordUpdate(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.upword1.value ==  ""){
			alert("Please enter a new password");
			FormInput.upword1.focus();
			return false;
		}
		else if(FormInput.upword2.value ==  ""){
			alert("Please repeat the new password");
			FormInput.upword2.focus();
			return false;
		}
		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function SendMessage(FormInput)
{
	if (p_bSubmit)
	{
		alert("Page is processing, please wait...");
		return false;
	}
	else
	{
		if(FormInput.recipientemail.value ==  ""){
			alert("Please enter email to");
			FormInput.recipientemail.focus();
			return false;
		}

		else
		{
			p_bSubmit = 1;
			return true;
		}
	}
}

function vldChars(n) {
	var validChars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-/& .()";
	for(var i = 0; i < n.length; i++)
	{
		if(validChars.indexOf(n.charAt(i)) == -1)
		{
			return false;
		}
	}
	return true;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

	
function updateHeader(area,helpPage)
{
	// check to see if the header is fully loaded
	if ((parent.frames[0].document) && (parent.frames[0].HeaderLoaded))
	{
		parent.frames[0].updateNow(area, helpPage);
	}
	else
	// if not try again in 1/10 of a second
	{
		eval("setTimeout('updateHeader(" + '"' + area + '","' + helpPage + '"' + ")',100)");
	}
}
function updateNow(area,helpPage)
{
	// check to see if the header is fully loaded
	if ((parent.frames[0].document) && (parent.frames[0].HeaderLoaded))
	{
		parent.frames[0].updateNavImages(area,helpPage);
	}
	else
	// if not try again in 1/10 of a second
	{
		eval("setTimeout('updateNow(" + '"' + area + '","' + helpPage + '"' + ")',100)");
	}
}


function SubsPopOpen(strurl)
	{
	// can vary position
	var popUpWidth = 400;
	var popUpHeight = 200;
	var x = ((screen.width - popUpWidth)/2);
	var y = ((screen.height - popUpHeight)/2);
	window.status="Done";
	
	window.open('$subs.asp?'+strurl, 'SubsInfoWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,HEIGHT='+popUpHeight+',WIDTH='+popUpWidth+',top='+y+',left='+x+',screenX='+x+',screenY='+y+'');
	}
	
function SysPopOpen(strurl)
	{
	// can vary position
	var popUpWidth = (0.9 * screen.width);
	var popUpHeight = (0.7 * screen.height);
	var x = 0;
	var y = 0;
	window.status="Done";
	
	window.open('SysCheck.asp?v='+strurl, 'SysInfoWindow', 'toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,HEIGHT='+popUpHeight+',WIDTH='+popUpWidth+',top='+y+',left='+x+',screenX='+x+',screenY='+y+'');
	}	

