function signin(boxdata)
        {
        target= "http://" + boxdata.user.value + ":" + boxdata.pass.value + "@hodevel.sportcontract.com";
        // $.get(target, function(data){alert("Data Loaded: " + data)});
        }

function joinUs(boxdata)
{
       	required = new Array("firstname","lastname","birth","current","email");
		return false;
        if(false !== validate(boxdata, required)) {
			alert('SENT');
			return true;
		} else {
			return false;
		}
}

		
function contact(boxdata)
        {
        iForm = boxdata.attributes['name'].nodeValue;
       	required = new Array("name","email","code");
        if(false !== validate(boxdata, required))
        	{
			$.post("./inc/mail.inc.php", {
				subject : boxdata.subject.value,
				name : boxdata.name.value,
				email : boxdata.email.value,
				telefon : boxdata.telefon.value,
				message : boxdata.message.value,
				code : boxdata.code.value
				}, function(data) {
				if (data == "wrong code") { alert(data); }
					else
						{
						alert('Your message has been sent to SportContract');
						if (iForm == "mcontact") { self.location.href = "./"; }
							else { boxdata.reset(); }
						}
				});
			}
		return false;
        }

function validate(form, required) // used by contact form
	{
	error = 0;
	oForm = form;
	errormsg = unescape('Please%20complete%20following%20fields%3A%0A%0A');
	i = 0;
	while (oEle = oForm.elements[i])
		{
		if(oEle.name != 'IDscan') oEle.value = oEle.value.replace(/[<>]+/i,"** ");
		i++;
		}
	i = 0;
	while (oEle = required[i])
		{
		if (oForm.elements[oEle].value == "")
			{
			errormsg += oForm.elements[oEle].name + '\n';
			error = 1;
			}
		i++;
		}
		test = oForm.email.value.search(/..+@..+\...+/i);
		if (test == -1)
			{
			errormsg += '\n' + unescape('Please%20provide%20a%20valid%20email%20address.');
			error = 1;
			}

	if (error == 1){
		alert(errormsg);
		return false;
	} else {
		return true;
	}
}

function loadClubs(trigger,countryID,leagueID)
        {
        $.get("./inc/logos2.inc.php", { "league": leagueID }, function(data)
                {
                $("#"+countryID).css({'height':''});
                $("#"+countryID).html(data);
                h = $("#"+countryID).height() + "px";
                h1 = ($("#"+countryID).height()+38) + "px";
                $("#"+countryID).parent().css({'overflow':'visible', 'height':h1});
                $("#"+countryID).css({'height':h, 'display':'block'});
                var allDivs = $("#"+countryID).parent().find('.league-tab');
                for (var i = 0; i < allDivs.length; i++) {
                         allDivs[i].style.backgroundColor = '#efefef';
                }
                $("#league-tab-"+leagueID).css({'background':'#CCCCCC'});
                });
        }
