


function inet_open_win() {
	if (ua["dom"]) {
		var url = "";
		var target = "";

		var attributes = "";


		if (arguments.length > 0) {
			url = arguments[0];
		}

		//Target attribute:
		if (arguments.length > 1) {
			target = arguments[1];
		}
			
		//Optional attributes:
		if (arguments.length > 2) {
			width = 0;
			height = 0;
			center = false;

			tmp = arguments[2];
			tmp_a = tmp.split(",");
			tmp = ""
			for (i = 0; i < tmp_a.length; i++) {
				val_a = tmp_a[i].split("=");
				if (val_a.length == 2) {
					if (i > 0) tmp += ",";

					if (val_a[0] == "width") width = val_a[1]
					else if (val_a[0] == "height") height = val_a[1]

					tmp += val_a[0]+"="+val_a[1];
				
				}
				else if (val_a.length > 0) {
					switch(val_a[0]) {
						case "center" :
							center = true;
							break;
					}
				}
			}
			if (center) {
				x_pos = (screen.width - width) / 2;
				y_pos = (screen.height - height) / 2;

				if (tmp.length > 0) tmp += ",";
				tmp += "left="+x_pos+",top="+y_pos
			}
			attributes = tmp;
		}
	
		win = window.open(url, target, attributes);
		win.focus();
		return false;
	}
}

	
function inet_pop_win(pageToLoad, winName, width, height, center, ramme) {
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
		}
	width = width + ramme * 2
	args = "width=" + width + "," 
	+ "height=" + height + "," 
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=0,"
	+ "scrollbars=0,"
	+ "status=0," 
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "left=" + xposition + ","
	+ "top=" + yposition;

	window.open(pageToLoad, winName, args);
}

function inet_print() {
	if (!ua["iemac"]){// && !ua["safari"]) {
		window.print();
	}
	return false;
}

/* Does the element <elm> have the className <cname>? */
function hasClassName(elm, cname) {
	if (ua["dom"]) {
		if (elm != null) {
			if (elm.className != null) {
				aCname = elm.className.split(" ");
				for (j=0; j<aCname.length; j++) {
					if (aCname[j] == cname) return true;
				}
			}
		}
	}
	return false;
}


/* Add the className <cname> to element <obj> */
function addClassName(obj, cname) {
	if (obj) {
		if (!hasClassName(obj, cname)) {
			obj.className += (obj.className.length > 0 ? " "+cname : cname);
		}
	}
}

/* Remove the className <cname> from element <obj> */
function removeClassName(obj, cname) {
	if (obj) {
		var res = "";
		var aCname = obj.className.split(" ");

		for (var i = 0; i < aCname.length; i++) {
			res += (aCname[i] == cname ? "" : " "+aCname[i]);
		}
		res = res.trim();
		obj.className = res;
	}					
}


/* Extends String objects with a trim function */
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, "");
}

/* Check if the string is an email address - simple, incomplete test */
function isEmail(s) {
	var rx = /^[a-z0-9\-_\.]*[a-z0-9\-_]@([a-z0-9\-\.])+\.[a-z]{2,4}$/i;
	return s.match(rx);
}


/* Add a function to run when document is loaded */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}




/**************************/
/**** COOKIE FUNCTIONS ****/

var cookie_domain = window.location.hostname;

function createCookie(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 = "";

	value = escape(value);

	document.cookie = name + "=" + value + expires + ";domain=" + cookie_domain + ";path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(";");
	for (var i=0; i<ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0)==" ") c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

/**** COOKIE FUNCTIONS ****/
/**************************/


function ChangeFontSize() {
    
    ChangeFontSizeCookie();
    SetFontSize();
    
}

function SetFontSize() {   
 
 var content = document.getElementById("inet_main"); 
 
 var cookieValue = parseInt(readCookie("FontSize"));
 switch (cookieValue) {
        case 1:
          content.style.fontSize="120%";
		  content.style.lineHeight="18px"; 
          break;
        //case 2:
        //content.style.fontSize="140%";
		//content.style.lineHeight="20px"; 
        //break;
        default:
          content.style.fontSize="100%";
		  content.style.lineHeight="16px"; 
          break;
	}
     
}

function ChangeFontSizeCookie() {
    var cookieValue = parseInt(readCookie("FontSize"));
    
    switch (cookieValue) {
        case 1:
          cookieValue = 2;
          break;
        //case 2:
        //cookieValue = 3;
        //break;
        default:
          cookieValue = 1;
          break;
	}    
      
    createCookie("FontSize", cookieValue, 365);
    
}


function initFontSize() {
	if(readCookie("FontSize")!=null) {
		SetFontSize();
	}
}


addLoadEvent(initFontSize);

/*****************/
/**** SUBMENU ****/

function toggleMenuLink(obj) {
	if (ua["dom"]) {
		var oParent = obj.parentNode;

		if (hasClassName(oParent, "closed")) {
			addClassName(oParent, "open");
			removeClassName(oParent, "closed");
		}
		else if (hasClassName(oParent, "open")) {
			addClassName(oParent, "closed");
			removeClassName(oParent, "open");
		}
	}
	return false;
}

/**** SUBMENU ****/
/*****************/






