function set_class(placeholder) {
	if (document.all && document.getElementsByTagName) {
		navRoot = document.getElementById(placeholder)
		if (navRoot) {
			list_items = navRoot.getElementsByTagName("LI");
			for (i=0; i<list_items.length; i++) {
				node = list_items[i];
				if (node.parentElement.parentElement.tagName != "LI") {
//					node.onmouseover=function() { this.className+=" over"; } 
//					node.onmouseout=function() { this.className=this.className.replace(" over", ""); } 
										
					node.onmouseover=function() { if (!event.toElement || event.toElement.className != "a_sub") this.className+=" over"; } 
					node.onmouseout=function() { if (!event.toElement || event.toElement.className != "a_sub") this.className=this.className.replace(" over", ""); } 

				}
			}
		}
	}
}

function check_form(obj) {
	if (obj['EMAIL'].value == '') {
		alert(LC_NEWSLETTER_MAIL_ENTER);
		return false;
	} else if (obj['EMAIL'].value.indexOf('@') == -1) {
		alert(LC_NEWSLETTER_MAIL_INVALID);
		return false;
	} else {
		return true;
	}
}

function get_top_left(width, height) {

	if (parseInt(navigator.appVersion)>3) {

		if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	 		winL = window.screenX;
	 		winT = window.screenY;
	 	} else{
	  		winW = document.body.offsetWidth;
	  		winH = document.body.offsetHeight;
	  		winL = window.screenLeft;
	  		winT = window.screenTop;
	 	}
	}
	
	var scroll = 0;
	var l = winL + winW/2 - width/2;
	var t = winT + winH/2 - height/2;
	
	
  	if (screen.width <= width){
  		width=screen.width;
  	}
  	if (screen.height <= height){
  		height=screen.height;
 	 	var t = 0;
  		var scroll = 1;
  	}
	return Array(t,l);
}

function open_gallery (uri, w, h) {

	title = 'gallery';

	wwidth = (w) ? w : 660;
	
	wheight = (h) ? h : 740;
	
	xy = get_top_left(wwidth, wheight);

	wleft = xy[1];
	wtop = xy[0];
	
	prefs = "width="+wwidth+", height="+wheight+", left="+wleft+", top="+wtop+", toolbar=no, location=no, scrollbars=yes, status=no, menubar=no, resizable=no, directories=no";
	
	wnd = window.open(uri, title, prefs);
	
	return false;
}


function gallery_zoom(url,name,width,height){

	var l = 0;
	var t = 0;
	
	width=screen.width;
	height=screen.height;
	
  	
	mewin=window.open(url,name,'toolbar=0,location=0,top='+t+',left='+l+',directories=0,status=0,'+'menubar=0,scrollbars=auto,resizable=1,width='+width+',height='+height);
	mewin.focus();
}


/* generic window opener */
function openwin(uri,title,w,h){
	if(w){wwidth = w;}else{	wwidth = 380;}
	if(h){wheight = h; }else{ wheight = 380;}
	xy = get_top_left(wwidth, wheight);
	wleft = xy[1];
	wtop = xy[0];
	wnd = window.open(uri, title, "width="+wwidth+", height="+wheight+", left="+wleft+", top="+wtop+", toolbar=no, location=no, scrollbars=yes, status=no, menubar=no, resizable=no, directories=no");
}

function write_flash(filename, w, h, param, transparent) {
	document.write('<object align="middle" type="application/x-shockwave-flash" data="'+filename+'" Width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+filename+'" />');
	document.write('<param name="FlashVars" value="'+param+'" />');
	if (transparent) {
		document.write('<param name="wmode" value="transparent" />');
	}
	document.write('</object>');
}

/* toggle font / line size */
/* set cookie */
//function setCookie(name, value, expires, path, domain, secure) {
function setCookie(name, value, days) {
  if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

/* get cookie */
function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}

/* delete cookie */
function deleteCookie( name, path, domain ) {
	if ( getCookie(name) ) 
		document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function change_line_height() {
	if (!current_lh)
	current_lh = getCookie('line_height');

	if (!current_lh) current_lh = def_line_height;
	current_lh ++;
	if (current_lh == line_heights.length) current_lh = 0;

	setCookie('line_height', current_lh, 365);
	
	if(document.body.currentStyle) {// force IE redraw
		prevstyle = document.getElementById('page').currentStyle['position'];
		document.getElementById('page').style.position = 'static'; 
	}
	
	document.getElementById(content_holder).style.lineHeight = line_heights[current_lh] + "em";
	
	if (document.body.currentStyle) {// force IE redraw
		document.getElementById('page').style.position = prevstyle;
	}
}

function change_text_size() {
	if (!current_ts)
		current_ts = getCookie('text_size');
	if (!current_ts) current_ts = def_text_size;
	current_ts ++;
	if (current_ts == text_sizes.length) current_ts = 0;
	setCookie('text_size', current_ts, 365);
	
	if(document.body.currentStyle) {// force IE redraw
		prevstyle = document.getElementById('page').currentStyle['position'];
		document.getElementById('page').style.position = 'static'; 
	}
	
	document.getElementById(content_holder).style.fontSize = text_sizes[current_ts] + "px";
	
	if (document.body.currentStyle) {// force IE redraw
		document.getElementById('page').style.position = prevstyle;
	}
}



/*
	INIT
*/

window.onload = function() {
	set_class('hmenu');
}



