// PRELOADING imageS
if (document.images) {
	img1_on =new Image(); img1_on.src ="images/scroll/scroller_top_hover.gif";
	img1_off=new Image(); img1_off.src="images/scroll/scroller_top.gif";

	img2_on =new Image(); img2_on.src ="images/scroll/scroller_bottom_hover.gif";
	img2_off=new Image(); img2_off.src="images/scroll/scroller_bottom.gif";
}

function movr(k) {
	if (document.images)
	eval('document.img'+k+'.src=img'+k+'_on.src');
}

function mout(k) {
	if (document.images)
	eval('document.img'+k+'.src=img'+k+'_off.src');
}

function handleOver() {
	if (document.images)
	document.imgName.src=img_on.src;
}

function handleOut() {
	if (document.images)
	document.imgName.src=img_off.src;
}

var menus = [
		new ypSlideOutMenu("menu1", "down", 276, 78, 178, 97),
		new ypSlideOutMenu("menu2", "down", 374, 78, 178, 59),
		new ypSlideOutMenu("menu3", "down", 472, 78, 178, 337),
		new ypSlideOutMenu("menu4", "down", 570, 78, 178, 59),
		new ypSlideOutMenu("menu5", "down", 668, 78, 178, 197) 
]

for (var i = 0; i < menus.length; i++) {
	menus[i].onactivate = new Function("if (document.getElementById('act"+i+"').className == '') document.getElementById('act" + i + "').className='active';");
	menus[i].ondeactivate = new Function ("if (document.getElementById('act"+i+"').className == 'active') document.getElementById('act" + i + "').className='';");
}

ypSlideOutMenu.writeCSS();

/*
window.onload=function(){
//alert("asd");
//nem működik
}*/

function clearinput(id){
	var inp=document.getElementById(id);
	if(inp){
		inp.value="";
	}
}

function visibility(visible,obj,menu) {
    if (document.all) {
		if (window.document.all(obj)) {
			if (visible=='change') visible=window.document.all(obj).style.display=='none';
			if (visible) window.document.all(obj).style.display='';
			else window.document.all(obj).style.display='none';
		}
		if (window.document.all(menu)) { 
			if (visible) window.document.all(menu).setAttribute("className", "aktiv"); 
			else window.document.all(menu).setAttribute("className", "inaktiv"); 
		}
    }
    else
	if (document.getElementById) {
		if (document.getElementById(obj)) {
			if (visible=='change') visible=document.getElementById(obj).style.display=='none';
			if (visible) document.getElementById(obj).style.display='';
			else document.getElementById(obj).style.display='none';
		}
		if (document.getElementById(menu)) {
			if (visible) document.getElementById(menu).setAttribute("class", "aktiv"); 
			else document.getElementById(menu).setAttribute("class", "inaktiv"); 
		}
	}
	return true;
} 

var c=1;
var d=1;
var t;
function posboxkever(boxnum,stop){
	visibility(false,'posbox_'+d,'posmenu_'+d);
	visibility(true,'posbox_'+c,'posmenu_'+c);
	d=c;
	c=c+1;
	if (c == boxnum) c = 1;
	if (stop == 0){
		t=setTimeout("posboxkever("+boxnum+",0,0)",3000);
	}else{
		clearTimeout(t);
		c=stop;
		visibility(false,'posbox_'+d,'posmenu_'+d);
		visibility(true,'posbox_'+c,'posmenu_'+c);
	}
}


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()



/*
//The speed of the timeout between each scroll.
timSpeed = 50

//The height of the container (change this when it scrolls to much or to little)
contHeight = 100

function makeScrollObj(obj,nest){
	nest=(!nest) ? "":'document.'+nest+'.'		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;		
	this.height=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.top=b_gettop										
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

//Getting the top for the top method
function b_gettop(){
	var gleft=(bw.ns4 || bw.ns6)?parseInt(this.css.top):eval(this.css.pixelTop);
	return gleft;
}
//Variables
var scrollTim = 1;
var active = 0;
function scroll(speed){
	clearTimeout(scrollTim)
	way = speed>0?1:0
	if ((!way && oScroll[active].top()>-oScroll[active].height+contHeight) || (oScroll[active].top()<0 && way)){
		oScroll[active].css.top = (oScroll[active].top()+speed)+px
		scrollTim = setTimeout("scroll("+speed+")",timSpeed)
	}
}
//Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll(){
	clearTimeout(scrollTim)
}
function changeActive(num){
	oScroll[active].css.visibility = "hidden"
	active = num
	oScroll[active].css.top = 0+px
	oScroll[active].css.visibility = "visible"
}
function scrollInit(){
	oScroll = new Array()
	
	// You can add and remove scrollObjects here.
	oScroll[0] = new makeScrollObj('divScroll1','divCont')
	
	oScroll[0].css.left = 0+px
	oScroll[0].css.top = 0+px
	oScroll[0].css.visibility = "visible"
	oControl = new makeScrollObj('divControl')
	oControl.css.visibility = "visible"

	oScroll[0] = new makeScrollObj('divScroll1','divCont')
	
	oScroll[0].css.left = 0+px
	oScroll[0].css.top = 0+px
	oScroll[0].css.visibility = "visible"
	oControl = new makeScrollObj('divControl1')
	oControl.css.visibility = "visible"
}
*/
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

window.onload = function(){
	//scrollInit();
	externalLinks();
}