var menus = new Object();
var step = 6;
var delay = 10;
function move(id, dir) {
	var curH = menus[id]['submenu'].clientHeight;
	if ((curH >= menus[id]['submenu_height'] && dir == 'down') || (curH <= 0 && dir == 'up')) {
		clearInterval(menus[id]['interval']);
		delete menus[id]['interval'];
		return;
	}
	if (dir == 'down') menus[id]['submenu'].style.height = (menus[id]['submenu_height']-curH<step) ? menus[id]['submenu_height'] + 'px' : curH+step+'px';
	if (dir == 'up') menus[id]['submenu'].style.height = (curH-step<0)?0:curH-step+'px';
}
function init(id, dir) {
	if (menus[id]['interval']) {
		clearInterval(menus[id]['interval']);
		delete menus[id]['interval'];
	}
	if (dir == 'over') {
		menus[id]['interval'] = setInterval(function() {move(id, 'down')}, delay);
	}
	if (dir == 'out') {
		menus[id]['interval'] = setInterval(function() {move(id, 'up')}, delay);
	}
}
function slide(menuItem) {
	menus[menuItem.id]['submenu'] = menuItem.getElementsByTagName('div')[0];
	menus[menuItem.id]['submenu_height'] = menuItem.getElementsByTagName('div')[0].getElementsByTagName('ul')[0].clientHeight;
	menuItem.onmouseover = function () {
		init(menuItem.id, 'over');
	}
	menuItem.onmouseout = function () {
		init(menuItem.id, 'out');
	}
}

var imgArr = new Array();
function showContent(link) {
	if (link.hash == '' || link.hash.replace('#','')=='') return;
	var needId = link.hash.replace('#','');
	if (document.getElementById(needId)) {
		if (opened) opened.style.display = 'none';
		document.getElementById(needId).style.display = 'block';
		opened = document.getElementById(needId);
	}
}
function moveImg(obj, link) {
	var top = parseInt(obj.style.top);
	if (top+step < 0) {
		obj.style.top = top+step+'px';
		setTimeout(function(){moveImg(obj, link)},delay);
	}
	else {
		for (var i=0; i < imgArr.length; i++) {
			imgArr[i].style.top = (imgArr[i] != obj) ? '-229px' : 0 + 'px';
			imgArr[i].style.zIndex = 1;
		}
		showContent(link);
	}
}
function changeImg(link) {
	var prefId = link.parentNode.parentNode.parentNode.parentNode.id;
	var movedEl = document.getElementById(prefId+'_img');
	if (parseInt(movedEl.style.top) == 0) {
		showContent(link);
		return;
	}
	movedEl.style.top = '-229px';
	movedEl.style.zIndex = 5;
	timer = setTimeout(function(){moveImg(movedEl, link)},delay);
}

function addToFavorites() 
{ 
	if (window.sidebar) 
	{
		window.sidebar.addPanel("WebsiteSecure.org", "http://www.WebsiteSecure.org","");
	}
	else if (window.external) 
	{ 
		window.external.AddFavorite("http://www.WebsiteSecure.org","WebsiteSecure.org") 
	} 
}

function chkForm()
{
	var ret = true;
	
	document.getElementById("comdivName").style.display = 'none';
	document.getElementById("comdivMail").style.display = 'none';
	document.getElementById("comdivCom").style.display = 'none';
	
	
	if (document.getElementById("comName").value.length < 2)
	{
		document.getElementById("comdivName").style.display = 'block';
		ret = false;
	}
	
	if (document.getElementById("comEmail").value.length < 2)
	{
		document.getElementById("comdivMail").style.display = 'block';
		ret = false;
	}
	
	if (document.getElementById("comCom").value.length < 2)
	{
		document.getElementById("comdivCom").style.display = 'block';
		ret = false;
	}

	
	return ret;
}