// JavaScript Document
function doStuff() {
	regh = document.getElementById("theHeader");
	regh.style.visibility = "visible";
	ltManim();
	return;
}
function regShowH() {
	if (rl<16) {
		window.clearInterval(reih);
		reih = false;
		regc.style.clip = "rect(0px,540px,304px,0px)";
		regsf = true;
		ganrf = true;
		glid = window.setInterval("globeAnim()",120);
		tmid = window.setTimeout("checkLayout()",750);
		return;
	} else {
		rr+=16;
		rl-=16;
		regc.style.clip = "rect("+rt+"px,"+rr+"px,"+rb+"px,"+rl+"px)";
	}
	return;
}
function regShowV() {
	if (rt<8) {
		window.clearInterval(reiv);
		reih = false;
		regc.style.clip = "rect(0px,"+rr+"px,304px,"+rl+"px)";
		reih = window.setInterval("regShowH()",40);
		return false;
	} else {
		rb+=8;
		rt-=8;
		regc.style.clip = "rect("+rt+"px,"+rr+"px,"+rb+"px,"+rl+"px)";
	}
	return;
}
function ltManim() {
	if (!regsf) {
		regc = document.getElementById("worldMap");
		regc.style.clip = "rect("+rt+"px,"+rr+"px,"+rb+"px,"+rl+"px)";
		regc.style.visibility = "visible";
		reiv = window.setInterval("regShowV()",40);
	}else{
		tmid = window.setTimeout("checkLayout()",100);
	}
	return;
}
function showCy() {
	showEl("theCountries");
	if (ctryf) {
		ctryf = false;
	} else {
		ctryf = true;
	}
	return;
}

// news in detail
var nEl = "";
function showNd(n) {
	if (!n) {
		a = "newsP"
	} else {
		a = "newsS"
	}
	if ((nEl == a) && (newsf)) {
		showEl(nEl);
		newsf = false;
	} else if ((nEl != "") && (newsf)) {
		showEl(nEl);
		nEl = a;
		showEl(nEl);
	} else {
		nEl = a;
		showEl(nEl);
		newsf = true;
	}
	return;
}

function showLg() {
//memLg = document.getElementById("IsMem")
	showEl("logIn");
	if (abutf) {
		abutf = false;
//memLg.isamember.value = "";
	} else {
		abutf = true;
//memLg.isamember.value = "iniLogin";
	}
//memLg.submit();
	return;
}

var lgform = "";
function logmeout() {
	lgform = document.getElementById('logout_form');
	lgform.TM_logout.value = "logout_now";
	lgform.submit();
}

function checkEmail(theForm , strng)
{
	var error="";
	if (strng == "")
	{
   		error = "You have not enter your identification.\n";
//   		error = "Vous avez omis d'entrer votre adresse courriel.\n";
	}
	else
	{
    	var emailFilter = /^.+@.+\..{2,3}$/;
    	if (!(emailFilter.test(strng)))
		{ 
			error = "Your identification is not valid.\n";
//			error = "L'adresse couriel n'est pas valide.\n";
    	}
    	else 
		{
			var illegalChars = /[\(\)\<\>\,\;\:\|\\\/\[\]]/;
			if (strng.match(illegalChars))
			{
				error = "Your identification is not valid.\n";
//				error = "L'adresse couriel contient des caracteres non conformes.\n";
			}
    	}
	}
	return error;
}

function checkPass(theForm , strng)
{
	var error = "";
	if (strng == "")
	{
  		error = "You have not entered your password.\n";
//  		error = "Vous avez omis d'entrer votre mot de passe.\n";
	}

    var illegalChars = /[\W_]/;
    if ((strng.length < 5) || (strng.length > 12))
	{
			error += "Your identification is not valid.\n";
//       	error += "Le mot de passe n'est pas valide.\n";
    }
    else if (illegalChars.test(strng))
	{
			error += "Your identification is not valid.\n";
//      	error += "Le mot de passe contient des caracteres non conformes.\n";
    } 
	if (error != "")
	{
		theForm.password.value = "";
		theForm.password.focus();
	}
	return error;    
}

function checkForm(theForm)
{
    var why = "";
//    why += checkEmail(theForm , theForm.user_id.value);
    why += checkPass(theForm , theForm.password.value);
    if (why != "")
	{
       alert(why);
       return false;
    }
	theForm.submit();
} 
var cDetail="";
function getProfile(c,n) {
	cDetail = document.getElementById("ViewCy");
	cDetail.selectcy.value = c;
	cDetail.submit();
}
var regDetail="";
function getRegProfile(c,n) {
	regDetail = document.getElementById("ViewReg");
	regDetail.selectreg.value = c;
	regDetail.submit();
}