

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+"&ramme="+ramme,winName,args );
}


var win = null;

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) {
			attributes = arguments[2];
		}
	
		if (win != null) {
			if (!win.closed) {
				win.close();
			}
		}

		win = window.open(url, target, attributes);
		win.focus();
		return false;
	}
}

function toggleMenuLink(obj) {
	parobj = obj.parentNode;

	parclasses = parobj.className.split(" ");

	for (i=0; i<parclasses.length; i++) {
		if (parclasses[i] == "closed") {
			parclasses[i] = "open";
			parobj.className = parclasses.join(" ");
			i = parclasses.length;
		}
		else if (parclasses[i] == "open") {
			parclasses[i] = "closed";
			parobj.className = parclasses.join(" ");


			i = parclasses.length;


		}
	}

	return false;
}



/**** INIT ****/

function blurAnchors(){ 
	if(document.getElementsByTagName) { 
	var a = document.getElementsByTagName("a"); 
	//collect all anchors A 
	for(var i = 0; i < a.length; i++){ 
		// mouse onfocus, blur anchors 
		a[i].onfocus = function(){this.blur();}; 
		} 
	} 
} 

addLoadEvent(blurAnchors);

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != "function") {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


/**** MENU ****/
function inet_menu_delay_hide() {
	if (ua["dom"]) {
		delayhide=setTimeout("inet_menu_show_default()",500)
	}
}

function inet_menu_clear_hide() {
	if (ua["dom"]) {
		if (window.delayhide) clearTimeout(delayhide)
	}
}

function inet_menu_over(id) {
	if (ua["dom"]) {
		if (window.delayhide) clearTimeout(delayhide)
		inet_show_sub(id);
	}
}

function inet_menu_out() {
	if (ua["dom"]) {
		inet_menu_delay_hide();
	}
}

function inet_show_sub(id) {
	if (ua["dom"]) {
		submenudiv = document.getElementById("inet_submenus");
		aDIV = submenudiv.getElementsByTagName("div");
		for (i=0; i<aDIV.length; i++) {
			aDIV[i].style.visibility = (aDIV[i].id == "submenu"+id ? "visible" : "hidden");
			aDIV[i].style.display = (aDIV[i].id == "submenu"+id ? "block" : "none");
		}
	}
}

function inet_menu_show_default() {
	if (ua["dom"]) {
		submenudiv = document.getElementById("inet_submenus");
		aDIV = submenudiv.getElementsByTagName("div");
		for (i=0; i<aDIV.length; i++) {
			is_default = hasClassName(aDIV[i], "default");
			aDIV[i].style.visibility = (is_default ? "visible" : "hidden");
			aDIV[i].style.display = (is_default ? "block" : "none");
		}
	}
}




function hasClassName(elm, cname) {
	if (ua["dom"]) {
		aCname = elm.className.split(" ");
		for (j=0; j<aCname.length; j++) {
			if (aCname[j] == cname) return true;
		}
	}
	return false;
}


var default_img = 0;
var current_state = 0;

function galleryImg(src, txt, thumb_x, thumb_y, ass_id) {
	if (ua['dom']) {
		this.src = src;
		this.txt = txt;
		this.thumb_x = thumb_x;
		this.thumb_y = thumb_y;
		this.ass_id = ass_id
		var oImg = new Image();
		oImg.src = this.src;
	}
}


function showGalleryImg(i) {
	setState(1);
	if (ua['dom']) {
		var galimg = document.getElementById('galimg');
		var galimgtxt = document.getElementById('galimgtxt');
		//var galimglink = document.getElementById('galimglink');
		
		galimg.src = galleryImgs[i].src;
		galimgtxt.innerHTML = galleryImgs[i].txt;
		
		/* var new_href = "/site/utils/imgpop.asp?ass_id="+galleryImgs[i].ass_id;
		galimglink.href = new_href;
		var thumb_x = galleryImgs[i].thumb_x;
		var thumb_y = galleryImgs[i].thumb_y + 30;
		galimglink.onclick = function() {
			return inet_open_win(''+new_href+'', 'img', 'width='+thumb_x+',height='+thumb_y+',center');
		}*/
	}
}

function setDefaultImg(i) {
	default_img = i;
	return false;
}

function setState(state) {
	current_state = state;
}

function delayShowDefaultImg() {
	setState(0);
	setTimeout("showDefaultImg()",500);
}

function showDefaultImg() {
	if (current_state == 0) {
		showGalleryImg(default_img);
	}
}




/*function inet_coltext(str_txt, w, h, max_cols) {
	var aCol = Columns.splitText(str_txt, w, h);
	var str = '';
	var mxc = max_cols;
	var ac = '';

	if (!mxc > 0 || mxc > aCol.length) {
		mxc = aCol.length;
	}
	
	for (i = 0; i < mxc; i++) {
		if (i + 1 == mxc) {
			ac = ' last_col';
		} else {
			ac = '';
		}
		str += '<div class="text_col'+ ac +'">';
		str += '<div class="text_col_content">';
		str += aCol[i];
		str += '</div>';
		str += '</div>';
		
	}

	str += '<div class="reset"></div>';

	document.write(str);
}*/

function inet_coltext(w, h, max_cols) {
	if (ua['dom']) {
		var oDivSource = document.getElementById('inet_colsource');
		var oHTML = oDivSource.innerHTML;
		oDivSource.parentNode.removeChild(oDivSource);
		
		var aCol = Columns.splitText(oHTML, w, h);
		var str = '';
		var mxc = max_cols;
		var ac = '';

		if (!mxc > 0 || mxc > aCol.length) {
			mxc = aCol.length;
		}
		
		for (i = 0; i < mxc; i++) {
			if (i + 1 == mxc) {
				ac = ' last_col';
			} else {
				ac = '';
			}
			str += '<div class="text_col'+ ac +'">';
			str += '<div class="text_col_content">';
			str += aCol[i];
			str += '</div>';
			str += '</div>';
			
		}

		str += '<div class="reset"></div>';
		
		var oDivDest = document.getElementById('inet_coldest');
		oDivDest.innerHTML = str;
	}
}


function entsub(event, myform) {
	if (window.event && window.event.keyCode == 13) {
		myform.submit();
		myform.reset();
	}
	else if (event && event.which == 13) {
		myform.submit();
		myform.reset();
	}
	else {
		return true;
	}
}




