

var imgnow=1;
var theDIV="";

function resetStates(x,y) {
	var last = $('#'+theDIV+' img').length;
	for (i=1;i<=last;i++) {
		if (i!=x && i!=y) {
			var item="#sliderimg"+i;
			$(item).css({left:$(item).width()+"px"});			
		}
	}
}

function tmrRotate() {
	var last = $('#'+theDIV+' img').length;
	var itemnow  = "#sliderimg"+imgnow;
	var imgold   = imgnow;
	
	imgnow++; if (imgnow>last) imgnow=1;
	var imgnext  = imgnow;
	var itemnext = "#sliderimg"+imgnext;
	
	resetStates(imgold,imgnext);
	
	$(itemnow).animate({left:-$(itemnow).width()+"px"}, 1500, 'bounceout')
	$(itemnext).animate({left:"0px"}, 1500, 'bounceout')
}

function setSliderImgs(imgs,urls) {
	var cont="";
	
	for (i=imgs.length-1;i>=0;i--) {
		j=i+1; 
        
        if (urls[i]!="") cont+='<div id="sliderimg'+j+'" style="position: absolute; left:0px"><a href="'+urls[i]+'"><img src="'+imgs[i]+'" border="0" /></a></div>';
        else cont+='<div id="sliderimg'+j+'" style="position: absolute; left:0px"><img src="'+imgs[i]+'" border="0" /></div>';
	}
	
	$('#'+theDIV).html(cont);
}

function startSlide(tmr,imgs,urls,divID) {
	theDIV=divID;
	
	setSliderImgs(imgs,urls);
	
	resetStates(1,$('#'+theDIV+' img').length);
	var tmrRot=setInterval("tmrRotate()",tmr*1000); 
}


$(document).ready(function(){

	$('#all').css({display:"block", opacity:0.0});
	$('#all').animate({opacity:1.0},{duration:300});

	$("#toup").click(function(){
		$('html, body').animate({scrollTop:0}, 1500, 'bounceout');
		return false;
		
	});



	var pix   = new Array(
        "http://klasszis.hu/honlapkeszito/style/1/android.png",
		"http://klasszis.hu/honlapkeszito/style/1/pic3.jpg",
<!--		"http://klasszis.hu/honlapkeszito/style/1/pic7.jpg",-->
		"http://klasszis.hu/honlapkeszito/style/1/pic2.jpg",
		"http://klasszis.hu/honlapkeszito/style/1/pic5.jpg",
		"http://klasszis.hu/honlapkeszito/style/1/pic6.jpg"
	);
	var url   = new Array(
        "http://klasszis.hu/honlapkeszito/android_fejlesztesek",
		"",
		<!--"http://klasszis.hu/honlapkeszito/akciok",-->
		"",
		"",
		""
	);

	var tmr   = 6;
	var divID = "thepix";
	
	//startSlide(tmr,pix,url,divID);


    /*
    myGalery = new MyGal();
    with (myGalery) {
          background="#fff";
          fontColor="#000";
          fontsize=14;
          titleHeight=80;
          appearto="0.7";
          resizeToFullScreen=false;
          resizeWidth=700;
          borderWidth=5;
          borderColor="#dedede"
    }
    myGalery.initialize();
    */


});



