function PreloadImg(){
        $.ImagePreload("../images/slider/webdesign.jpg");
        $.ImagePreload("../images/slider/romlex_cms.jpg");
        $.ImagePreload("../images/slider/hirlevel.jpg");
        $.ImagePreload("../images/slider/webaruhaz.jpg");
        $.ImagePreload("../images/slider/extranet.jpg");
	}
	
	var autostart;
	var most_img="";
	

	

	$(document).ready(function(){
		PreloadImg();
		$("#menu a").mouseover(function(e){
		if (most_img=="") most_img=$('#slideshow_img').attr("src");
//		
		$('#slideshow_img').ImageStop(false,true,true);
//		$.ImageStopAll(true,true);
//		 $('#slideshow_img').attr("src",most_img);
		$('#slideshow_img').ImageSwitch({Type:'FadeIn', NewImage:$(this).attr("rel"), Speed: 1500 },function(){ $('#slideshow_img').attr("src",most_img); });
		//,function(){ $('#slideshow_img').attr("src",most_img); }
		most_img=$(this).attr("rel");
		$("#menu li").removeClass("current");
		$(this).parent().addClass("current");										
		clearTimeout(autostart);		
		autostart=setTimeout('autogo()',14000);
		e.preventDefault();
		});		
	
		autostart=setTimeout('autogo()',7000);

	});
	

	function autogo(){
	if ($("#menu li[class='current']").next().find("a").attr("rel")) {	$("#menu li[class='current']").next().find("a").click(); }
	else { $("#menu a[id='first_slide']").click();  }	
	clearTimeout(autostart);
	autostart=setTimeout('autogo()',7000);
	}


	
		function show_next_p(){
		if (autostart_portfolio)	clearTimeout(autostart_portfolio);
		$("div.gallery100 img[index='"+portfolio_id+"']").click();
		portfolio_id=$("div.gallery100 img[index='"+portfolio_id+"']").attr('next');					
		
		autostart_portfolio=setTimeout('show_next_p()',4000);
	}	
	
	var gallery;
		var autostart_portfolio;
		var portfolio_id=0;
		
		$(function() {
				gallery=$('div.gallery100 img').slidingGallery({
				container: $('#gallery_container'),
				Pheight:190,
				Pwidth:184,
				slideSpeed:"slow"
				}); 
				portfolio_id=$("div.gallery100 img[class='start']").attr('next');
				autostart_portfolio=setTimeout('show_next_p()',5000);				
		});
			$(document).ready(function(){
		$('#photos').galleryView({
			filmstrip_size: 6,
			frame_width: 126,
			frame_height: 126,
			background_color: 'transparent',
			nav_theme: 'light',
			border: 'none',
			show_captions:false,
			caption_text_color: 'white',
			transition_interval:4000,
			transition_speed:600,
			easing:	'linear',
			overlay_opacity:0.1
		});
	});
