var t="";
var non=1;
//t=setTimeout("", 10000);
//clearInterval(t);
var this_def=0;
function nextgallery()
	{
			var time_new=10000;
				
				if (this_def==0)
					{
						time_new=My2[0];
					}
			
			
				t=setTimeout("nextgallery();", 9000);
						if (slideshow=="[object Object]")
							{
							if (slideshow!="undefined")
								{
								slideshow.nextSlideShow();
								}
							}
			
	}
	
function noload()
{
				non=0;
}
function nload()
{
				non=1;
}
function load_new_image(def,val_all)
	{
		this_def=def;
		clearInterval(t);
		non=0;
		slideshow.SlideShow_one(def);
	
		for (var i=1;i<=val_all;i++)
			{
				window.document.getElementById('Image1'+i).src='images/control_but.png';	
			}
		window.document.getElementById('Image1'+(def +1)).src='images/control_butOver.png';
		if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
						window.document.getElementById('Image109').src='images/s_pause-h.png';
					}
		clearInterval(t);
		non=1;
	}
function nextimage(val_all)
	{
		non=0;
		this_def=this_def+1;
		if (this_def>=my2.length)
				{
					this_def=0;	
					}
	//	alert(window.document.getElementById('Image109'));
		slideshow.nextSlideShow(val_all);
	if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
						window.document.getElementById('Image109').src='images/s_pause-h.png';
					}
		clearInterval(t);
		non=1;
	}
function preimage(val_all)
	{
		
		non=0;
		this_def=this_def-1;
		if (this_def<0)
			{
					this_def=my2.length-1;
				}
		slideshow.prevSlideShow(val_all);
		if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
						window.document.getElementById('Image109').src='images/s_pause-h.png';
					}
		clearInterval(t);
		non=1;
	}
function new_run(value)
	{
			
			var time_new=10000;
			if (this_def>=my2.length)
				{
					this_def=0;	
					}
			time_new=my2[this_def] * 1000;
			if (time_new<=0)
				{
						time_new=10000;
				}
			//alert(time_new);
					t=setTimeout("new_run();", time_new);
					if (slideshow=="[object Object]")
							{
							if (slideshow!="undefined")
								{
								slideshow.nextSlideShow(my2.length);
								this_def=this_def+1;
								//alert(this_def + " " + time_new + " " + my2.length);
								}
							}
			
				
				
			
	}
	
function close_time()
	{ 
								clearInterval(t);
	}
function run_time()
	{ 
	var time_new=8000;
	if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
					window.document.getElementById('Image109').src='images/play.gif';
					}
					
						//alert('ok' );
								t=setTimeout("new_run();", time_new);
	}
var chk_run=1;
function gallery_run()
	{
			if(chk_run==1)
				{
					chk_run=0;
					close_time();
					if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
						window.document.getElementById('Image109').src='images/s_pause-h.png';
					}
				}
			else
				{
					
					chk_run=1;
					run_time();
					if ((window.document.getElementById('Image109')=="[object]") ||  (window.document.getElementById('Image109')=="[object HTMLImageElement]"))
					{
							window.document.getElementById('Image109').src='images/play.gif';
					}
				}
				//alert(chk_run);
		}

//nextgallery();
//new_run();
t=setTimeout("new_run();", (my2[0] * 1000));
function click_link()
	{
		if (isNaN(slideshow.currentIter))
			{}
		else
			{
				if (mySlideData[slideshow.currentIter][1]!="") 
					{
						if (non==1)
							{
									$('mySlideshow').addEvent('click', function(){ if (non==1) 
																					   {
																						   	if (mySlideData[slideshow.currentIter][1]!="")
																								{
																						   window.open(mySlideData[slideshow.currentIter][1]);
																								}
																						//   window.parent.location.href=mySlideData[slideshow.currentIter][1];
																					   }});
							}
					}
			}
	}