function getDay (day) {

	switch (day) {

		case 0: return 'Duminica';
		case 1: return 'Luni';
		case 2: return 'Mar&#355;i';
		case 3: return 'Miercuri';
		case 4: return 'Joi';
		case 5: return 'Vineri';
		case 6: return 'Samb&#259;t&#259;';

	}

}

function getMonth (month) {

	switch (month) {

		case 0: return 'Ianuari';
		case 1: return 'Februarie';
		case 2: return 'Martie';
		case 3: return 'Aprilie';
		case 4: return 'Mai';
		case 5: return 'Iunie';
		case 6: return 'Iulie';
		case 7: return 'August';
		case 8: return 'Septembrie';
		case 9: return 'Octombrie';
		case 10: return 'Noiembrie';
		case 11: return 'Decembrie';

	}

}

today	= new Date();
day	= today.getDay();
date	= today.getDate();
month	= today.getMonth();
year	= today.getYear();

dayName		= getDay (day);
monthName	= getMonth(month);
yearName	= year;

function showdiv(pass) {

	var divs = document.getElementsByTagName('div');
	for(i=0; i < divs.length; i++) {

		if (divs[i].id.match(pass)) { //if they are 'see' divs

			if (document.getElementById) // DOM3 = IE5, NS6
				divs[i].style.visibility="visible";// show/hide
			else if (document.layers) // Netscape 4
				document.layers[divs[i]].display = 'visible';
			else // IE 4
				document.all.divs[i].visibility = 'visible';

		} else {

			if (document.getElementById)
				divs[i].style.visibility="hidden";
			else if (document.layers) // Netscape 4
				document.divs[i].visibility = 'hidden';
			else // IE 4
				document.all.divs[i].visibility = 'hidden';

		}

	}

}


function toggle(id){

	var el = document.getElementById(id);
	el.style.display = el.style.display == 'block' ? 'none' : 'block';
	return false;

}

function toggleBox(id){

	var el = document.getElementById(id);
	el.style.display = el.style.display == 'block' ? 'none' : 'block';
	document.images[id + '-icon'].src = 'images/toggle-' + (el.style.display == 'none' ? 'up' : 'down') + '.gif';
	return false;

}

function bookmarksite(title, url) {

	if (document.all) window.external.AddFavorite(url, title);
	else if (window.sidebar) window.sidebar.addPanel(title, url, "");

}

image_user_off		= new Image();
image_user_off.src	= "images/menu/user_off.png";

image_user_on		= new Image();
image_user_on.src	= "images/menu/user_on.png";

/*
*	Last visit
*/

var lastvisit = new Object()

lastvisit.firstvisitmsg		= "Esti pentru prima data cand vizitezi acest site. Bine ai venit!" //Change first visit message here
lastvisit.subsequentvisitmsg	= "Bine ai revenit! Ai accesat acest site: <b>[displaydate]</b>" //Change subsequent visit message here

lastvisit.getCookie = function(Name) { //get cookie value

	var re = new RegExp(Name + "=[^;]+", "i"); //construct RE to search for target name/value pair

	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value

	return ""

}

lastvisit.setCookie = function (name, value, days) { //set cookei value

	var expireDate	= new Date()
	//set "expstring" to either future or past date, to set or delete cookie, respectively
	var expstring	= expireDate.setDate(expireDate.getDate() + parseInt(days))
	document.cookie	= name + "=" + value + "; expires=" + expireDate.toGMTString() + "; path=/";

}

lastvisit.showmessage = function() {

	if (lastvisit.getCookie("visitcounter") == "") { //if first visit

		lastvisit.setCookie("visitcounter", 2, 730) //set "visitcounter" to 2 and for 730 days (2 years)
		document.write(lastvisit.firstvisitmsg)

	}
	else document.write(lastvisit.subsequentvisitmsg.replace("\[displaydate\]", new Date().toLocaleString()))

}

function validateForm (formName) {

	switch(formName) {

		case 'registerForm':	return validateRegisterForm(document.forms['registerForm']);
		case 'profileForm':	return validateProfileForm(document.forms['profileForm']);

	}

	return true;

}

function go2(url) {

	window.location.href = url;

}
