var tabs = new Array();

tabs['geo_vodic'] = new Array('tv', 'dogadanja');
tabs['vijesti'] = new Array('hrvatska', 'svijet');

function switch_tabs(group, selected) {
	for (var i = 0; i < tabs[group].length; i++) {
		document.getElementById('a_' + tabs[group][i]).className = '';
		document.getElementById('tab_' + tabs[group][i]).style.display = 'none';
	}
	document.getElementById('a_' + tabs[group][selected]).className = 'active';
	document.getElementById('tab_' + tabs[group][selected]).style.display = 'block';
}

function menu(selection, show) {
	if (show == 'auto') {
		document.getElementById(selection).style.display = (document.getElementById(selection).style.display == 'none') ? 'block' : 'none';
	} else {
		document.getElementById(selection).style.display = show ? 'block' : 'none';
	}
}

function isValidEmail(obj) {
	var rv = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i.test(obj.value);
	return rv;
}

var effects_duration = .45;

function openWindow(target, width, height) {
	var url = (typeof(target) == "object") ? target.href : target;
    var top = Math.round(screen.height/2-height/2-100);
    var left = Math.round(screen.width/2-width/2-100);
    
	var win = window.open(url, 'window', 'toolbar=0,status=0,scrollbars=1,resizable=1,menubar=1,width='+width+',height='+height+',top='+top+',left='+left);
}

function removeChildrenFromNode(node) {
	if(node.hasChildNodes()) {
		while(node.childNodes.length >= 1 ) {
			node.removeChild(node.firstChild);
		}
	}
}