/* julian website javascript code 
 * peter assenov- AIP Solutions Ltd.' 2003
 * version: 2.1.0.0/27.07.2003
 */
/* theme definitions */
var tvars=[]
tvars['back']=['#bcbcbc','#c0bdb6','#d2cfbe'];/* page background color*/
tvars['menu']=['#d8d8d8','#dad9d5','#e5e3d9'];/* menu background color*/
tvars['menuback']=['#e2e2e2','#e4e3e0','#eceae3'];/* menu borders*/
tvars['tArr']=['#efefef','#efeee8','#efeee8']
tvars['submenu']=['#c8c8c8','#d0cec8','#dddbce'];/* sub-menu background color*/
tvars['submenuback']=['#dedcd8','#dedcd8','#e7e5dc'];/*sub-menu borders*/
tvars['flash']=['set1','set2','set3'];/* flash name */
tvars['noflash']=['back1','back2','back3'];/* if no flash plugin images */
/* theme implementation */


function applyTheme(theme)
{	if(!theme) theme=0;

	page.css.attr('.listSearchContent','background',tvars['tArr'][theme]);
	page.css.attr('#searchDiv1','background',tvars['back'][theme]);
	page.css.attr('body','background',tvars['back'][theme]);
	page.css.attr('.menu','background',tvars['menu'][theme]);
	page.css.attr('.menuHome','background',tvars['submenu'][theme]);
	//page.css.attr('.menu','border','1px '+tvars['menuback'][theme]+' solid');
	page.css.attr('#topArr','background',tvars['tArr'][theme]);
	page.css.attr('#top','background',tvars['menuback'][theme]);
	page.css.attr('.submenu','border-bottom','1px '+tvars['submenuback'][theme]+' solid');
	page.css.attr('.submenu','background',tvars['submenu'][theme]);
}
/* positions the active window in the middle of the screen */ 
page.pos='center';															
page.setPos=function(cont)
{	this.w=parseInt(this.css.attr('#'+cont,'width',null));					
	this.h=parseInt(this.css.attr('#'+cont,'height',null));
	this.winw=(ns6)? window.innerWidth:document.body.offsetWidth;			
	this.winh=(ns6)? window.innerHeight:document.body.offsetHeight;
	this.x=parseInt((this.winw-this.w)/2);									
	this.y=(this.pos=="center")? parseInt((this.winh-this.h)/2) : 0;			
	if(!ns6) this.x-=8;
	this.y-=4;
	this.css.attr('#'+cont,'left',(this.x>0)?this.x:0);							
	this.css.attr('#'+cont,'top',(this.y>0)?this.y:0);
log.add((this.x)?'- page positioned to: x->'+this.x+' y->'+this.y:'! fail to calculate page position');
}
/* centers the window on size changes */
onresize=function(){page.setPos('content')}
/* page redirection */
page.ext=".php";
page.load=function(url,query,frm)
{	if(!frm) self.location.href=(query)?url+this.ext+'?'+query:url+this.ext;
	else
	{	if(!url)url='../blank';
		var href=(query)?url+this.ext+'?'+query:url+this.ext;
		if(ns6)
		{	var frame=(document.getElementById(frm))?document.getElementById(frm):parent.document.getElementById(frm);
			frame.setAttribute('src','../blank');
			frame.setAttribute('src',href);
		}
		else 
		{	var frame=(document.frames[frm])? document.frames[frm]:parent.document.frames[frm];
			frame.location.href = href;
		}		
	}
}
/* popup window managing */
page.popupWin=0;
page.popupOpen=function(file,w,h) 
{	this.popupW=w||350;
	this.popupH=h||500;
	this.popupX=parseInt(((ns6)? window.innerWidth:document.body.offsetWidth)/2-this.popupW/2)||100;			
	this.popupY=parseInt(((ns6)? window.innerHeight:document.body.offsetHeight)/2-this.popupH/2)||50;
	if(this.popupWin)
	{	this.popupWin.close();
		this.popupWin=0;
	} 
	this.popupWin=window.open(file,'popupWindow','left='+this.popupX+',top='+this.popupY+',width='+this.popupW+',height='+this.popupH+',scrollbars=1');
	this.popupWin.focus();
};
/* category groups changing code */ 
function dyngroup(name)
{	this.name=name;
	this.cgroup=0;
	this.ready=0;
	page.add(this.name+'.init()');	
}
dyngroup.prototype.init=function()
{	var i=0;
	while(document.getElementById(this.name+i+'Div'))
		var temp=new dynobj(this.name+i++);
	this.maxgroup=i-1;
	this.display('block');
	this.ready=1;
}
dyngroup.prototype.up=function()
{	if(this.cgroup&&this.ready)
	{	this.display('none');
		this.cgroup--;
		this.display('block');
	}
}
dyngroup.prototype.down=function()
{	if(this.cgroup<this.maxgroup&&this.ready)
	{	this.display('none');
		this.cgroup++;
		this.display('block');
	}	
}
dyngroup.prototype.display=function(what)
{	window[this.name+this.cgroup].css.display=what;
}
/* submenu options */
function submenu(name,height,time,inc)
{	this.name=name
	this.ready=0;
	this.h=height||0;
	//page.add(this.name+'.init()');	
/* scroll code */
	this.time=time||30;
	this.inc=inc||4;
	this.timer=null;
}
submenu.prototype.init=function()
{	this.cont=new dynobj(this.name+'menu');
	this.data=new dynobj(this.name+'menuData');
	this.opened=0;
	this.ready=1;
/* scroll code */
	this.css=this.data.css;
	this.start=this.y=0;
	this.end=0;
}
submenu.prototype.action=function()
{	if(!this.cont) return;
	if(this.opened)	this.cont.css.display="none"
	else			
	{	this.cont.css.display="block"
		this.data.h=this.data.el.offsetHeight;
		this.cont.css.height=(this.h&&this.h<this.data.h)? this.h:this.data.h; 
/* scroll code */		
		this.end=this.h-this.data.h;
	}
	this.opened=!this.opened;	
}
/* scroll code */
submenu.prototype.up=function()
{	if(this.y<this.start)
	{	this.timer=setTimeout(this.name+'.up()',this.time);
		this.y+=this.inc;
	}	
	else
	{	this.y=this.start;
	evt.evoke(this.name,'onmoveupend');
	}
	this.moveTo();
}
submenu.prototype.down=function()
{	if(this.y>this.end)
	{ 	this.timer=setTimeout(this.name+'.down()',this.time);
		this.y-=this.inc;
	}	
	else 
	{	this.relpos=this.end;
	evt.evoke(this.name,'onmovedownend');
	}
	this.moveTo();
}
submenu.prototype.moveTo=function(rel)
{	this.css.top=this.y;
	//debug.status(this.css.top);	
} 
submenu.prototype.stop=function()
{	clearTimeout(this.timer);
}
function submenuMove(e)
{	var obj=(ns6)?e.target:event.srcElement;
	if(obj.parentNode.id=="submenuDataDiv")
	{	var objY=page.y+94;
		var objH=sub.h;
		var mouseY=(ns6)?e.pageY:event.clientY;
/* move up condition */
		if(mouseY>objY&&mouseY<objH/4+objY)
		{	sub.stop();
			sub.up();
		}
/* move down condition */
		else if(mouseY>objY+objH-objH/4&&mouseY<objY+objH)
		{	sub.stop();
			sub.down();
		}
		else sub.stop();
	}
}

function changeLang(lang)
{
tempUrl=document.location.href;
tempUrl=tempUrl.replace(/lang=\w+/,'lang='+lang);
document.location.href=tempUrl;
}

function showSearch()
{
document.getElementById('searchDiv1').style.visibility="visible";
document.getElementById('listSearchHeader').style.visibility="visible";
document.getElementById('listSearchDiv').style.visibility="visible";
}

function hideSearch()
{
document.getElementById('searchDiv1').style.visibility="hidden";
document.getElementById('listSearchHeader').style.visibility="hidden";
document.getElementById('listSearchDiv').style.visibility="hidden";
}
//that's all...