<!-- common functions :::
// written by Vady.
// vady@i.com.ua

// 2use popup() function: <a href="javascript:;" onClick="javascript:popup('name', '#link', 0, 0, 300, 150, 0, 0, 1, 1, 1); return false;"></a>
function popup(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
	var wint = (screen.height - height) / 2;
	var winl = (screen.width - width) / 2;
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+winl+',top='+wint+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function restore() {
	obj.src = obj.lsrc;
}

function change(id,src) {
	var lsrc;
	if (!src) src = 'menu/bullet-over.gif';
	obj = findObj(id,'');
	if(!obj.lsrc) obj.lsrc = obj.src;
	obj.src = "images/" + src;
}

function preloadImgs() {
	var d = document;
	if(d.images) {
		if(!d.IMGs) d.IMGs=new Array();
		var i,j=d.IMGs.length,a=preloadImgs.arguments;
		for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){
		d.IMGs[j]=new Image; d.IMGs[j++].src = 'images/' + a[i];
		}
	}
}

function findObj(n, d) { //v4.01
	var p,i,x;	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function addEvent(obj, eventType,fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(eventType, fn, useCapture);
		return true;
	} else {
		if (obj.attachEvent) {
			var r = obj.attachEvent("on"+eventType, fn);
			return r;
		}
	}
}

// ajust intro columns (c)2005 (v)Development [www.vady.kiev.ua]
function calculateAbs() {
	if(isDOM) {
		var lfblock = layer("blank");
		var lfwidth = (getWindowWidth() >= 777 ) ? (getWindowWidth() - 760) / 2 : 9;
		lfblock.style.width = lfwidth + 'px';
/*		var rtblock = layer("newz");
		if(getScrollX() > 0) {
			layer("container").style.width = getDocumentWidth() + 'px';
			rtblock.style.width = getDocumentWidth() - getScrollX() - 507 - lfwidth + 'px';
			rtblock.style.width = getDocumentWidth() + 'px'; //layer("footerz");
		
		}*/
	}	
}

function popupimg(name, url, width, height){
	var imgss;
	winl = (screen.width) ? (screen.width - width) / 2 : 0;
	wint = (screen.height) ? (screen.height - height) / 2 : 0;
	//var winname = urlencode(name);
	var winname = name;
	var settings = 'left='+winl+',top='+wint+',width='+(width+40)+',height='+(height+40)+',toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes';
	myimgss = window.open('','imgpoint',settings);
	myimgss.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><title>'+urldecode(winname)+'</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table height="100%" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><a href="javascript:self.close();"><img src="'+url+'" name="fullbimg" alt="Click to close the window..." width="'+width+'" height="'+height+'" border="0"></a></td></tr></table></body></html>');
	myimgss.document.close();
	if(myimgss.window.focus) {
		myimgss.window.focus();
	}
}

function urlencode(ch) {
//	ch = ch.replace(/[ ]/g,"+")
	ch = ch.replace(/[ ]/g,"%20")
	return escape(ch)
}
function urldecode(ch) {
   ch = ch.replace(/[+]/g," ")
   return unescape(ch)
}


//-->
