	var c = 0;
	var x = 0;
	var y = 0;
	var u = true;
	var g = true;
	var mode = true;
	var MaxNum ,MaxComment;
	var currentimg=0;
	var Go=0;
	//setTimeout("set()",100)
function set(){
	//alert(MaxNum)
	document.getElementById("screen").style.width= loadImg.length*500+"px"
	num=0
	
	while(num < loadImg.length){
		if(num==0){
			ImgStyle="block";
			}else{
				ImgStyle="none";
				}
		document.getElementById("screen").innerHTML += "<img src='"+loadImg[num]+"' id='img"+num+"' alt='SODIC' border=\"0\" width=\"500\" height=\"355\"  style=\"display:"+ImgStyle+";z-index:"+(loadImg.length-num)+";position:absolute\" />";
		num++
		}
		MaxNum=(num-1)
		autoPlay(true);
}
function setComment(){
	num=0
	while(num < loadImgComment.length){
		if(num == 0 ){
			loading2 = "onload='autoPlayComment(true)'"
			//
			}else{
				loading2="";
				}
		document.getElementById("comment").innerHTML += "<a href='"+loadImgComment[num]+"' rel=\"prettyPhoto[slideGallery]\"><img id=\"imgComment"+num+"\" "+loading2+" src='"+loadImgComment[num]+"'  border=\"0\" width=\"465\" height=\"145\" /></a>";
	//	document.getElementById("block").innerHTML +="<div class=\"TxtComment\">"+loadTxtComment[num]+"</div>"
		num++
		}
		document.getElementById("comment").style.width=(num*465)+470+"px"
		//document.getElementById("block").style.width=(num*210)+215+"px"
	MaxComment=(num-1)
	}
function next(){
if(Go==MaxNum){
	currentimg=MaxNum
	Go=0;
	}else{
		currentimg=Go
		Go=(currentimg+1);
		}
	autoPlay(false)
	//document.getElementById("Txt").innerHTML=loadTxt[Go];
	//document.getElementById("img"+Go).style.display="block"
	//document.getElementById("img"+currentimg).style.display="block"
	$("#img"+Go).fadeIn(500);
	$("#img"+currentimg).fadeOut(500);
	//FadeOpacity("img"+Go, 0, 100, 200, 100)
	//FadeOpacity("img"+currentimg, 100, 0, 200, 100)	
		
		
}
function prev(){
if(Go==0){
	currentimg=0
	Go=MaxNum;
	}else{
		currentimg=Go
		Go=(currentimg-1);
		}
	autoPlay(false)
	//document.getElementById("Txt").innerHTML=loadTxt[Go];
	//document.getElementById("img"+Go).style.display="block"
	//document.getElementById("img"+currentimg).style.display="block"
	$("#img"+Go).fadeIn(500);
	$("#img"+currentimg).fadeOut(500);
	//FadeOpacity("img"+Go, 0, 100, 100, 100)
	//FadeOpacity("img"+currentimg, 100, 0, 100, 100)	
}
function autoPlay(x){
	if(mode == false){
		clearInterval(q)
		}else if(x==true){
	q = setInterval("next();",7000)
	}
	else
		{
		clearInterval(q)
		autoPlay(true)
		}
			}
			
			

function prevComment(){
	if(y < MaxComment ){
	$("#block").animate({"left": "-=225px"}, "slow");
	$("#comment").animate({"left": "-=465px"}, "slow");
	y++;
	}else{
	$("#block").animate({"left": "0px"}, "normal");
	$("#comment").animate({"left": "0px"}, "normal");
	y=0;
		}
		g= true
	}
			
function autoPlayComment(x){
	//document.getElementById("imgComment0").setAttribute("onload","");
 if(x==true && g == true){
	g = false;
	si= setInterval('prevComment()',5000);
	
	}else{
		clearInterval(si)
		//autoPlay(true)
		}
			}
function Stop(){

	if(document.getElementById("play").style.display == "none"){
		mode = false
		autoPlay(true)
		document.getElementById("play").style.display = "inline";
		document.getElementById("pause").style.display = "none";
		}else{
			mode = true
		autoPlay(true)
		document.getElementById("play").style.display= "none";
		document.getElementById("pause").style.display = "inline";
			
			}
	
	}
		
///////////////////////////Opacity////////////////////////////////////
function SetOpacity(elem, opacityAsInt)
{
	var opacityAsDecimal = opacityAsInt;
	
	if (opacityAsInt > 100)
		opacityAsInt = opacityAsDecimal = 100; 
	else if (opacityAsInt < 0)
		opacityAsInt = opacityAsDecimal = 0; 
	
	opacityAsDecimal /= 100;
	if (opacityAsInt < 1)
		opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
	
	elem.style.opacity = opacityAsDecimal;
	elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}

function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps)
{
	var steps = Math.ceil(fps * (time / 1000));
	var delta = (toOpacity - fromOpacity) / steps;
	
	FadeOpacityStep(elemId, 0, steps, fromOpacity, delta, (time / steps));
}

function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep)
{
    SetOpacity(document.getElementById(elemId), Math.round(parseInt(fromOpacity) + (delta * stepNum)));

    if (stepNum < steps)
        setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum+1) + ", " + steps + ", " + fromOpacity + ", " + delta + ", " + timePerStep + ");", timePerStep);
}

