function open_win(pic)
{
	win = window.open(pic, "WIN", "top=0,left=0,width=760,height=630");
	win.focus();
	return false;
}

function trim(s)
{
    while (s.substring(0,1) == ' ') 
    {
        s = s.substring(1,s.length);
    }   

    while (s.substring(s.length-1,s.length) == ' ') 
    {
        s = s.substring(0,s.length-1);
    }
    
    return s;
}

function check_empty(ctrl, form, ctrlname)
{
	obj = eval("document." + form + "." + ctrl)
    the_obj = trim(obj.value)	

    if (!obj)
	{
		alert (ctrl + " is not an object!")
		return 0
	}

    if (the_obj == '')
	{
		alert ("Please fill in your " + ctrlname + ".")
		obj.focus();
		return 1
	}
	
	return 0
}

function check_email(ctrl, form) 
{
    obj = eval("document." + form + "." + ctrl)
    
	if (!obj)
    {
		alert (ctrl + " is not an object!")
		return 0
    }

    // Return false if e-mail field does not contain an '@' and a '.'.
    if (obj.value.indexOf ('@',0) == -1 || obj.value.indexOf ('.',0) == -1)
    {
        alert("Invalid email address.");
		obj.focus();
        return 1
    }
    
	return 0
}