// JavaScript Document
function show_props(obj, objName) 
{   
	var result = "";
	j=0;
	k=1000;
	l=0;
	for (var i in obj)
	{
		if(l>j&&l<k)
		result += objName + "." + i + " = " + obj[i] + "<br>";
		l++;
	}
	return result;
}

function BrowserInfo()
{
	if(document.body['scroll']!="undefined")
		return document.body;
	else if(document.documentElement['scroll']!="undefined")
		return document.documentElement;
}
var Next;
var Back;
var Play;
var timeOut;
var BrowX; 
var BrowY;
var Nx;

function GalleryShowThumb(File)
{
	TEMP='';
	temp=File.split('/');
	for(i=0;i<temp.length;i++)
	{
		if(i==(temp.length-1))
			TEMP+='thumbs/m_'+temp[i];
		else
			TEMP+=temp[i]+'/';
	}
	return TEMP;		
}
function GalleryShow(Id)
{
	Next=Id+1;
	Back=Id-1;
	if(Next>GalleryImg.length)
	{
		Id=0;
		GalleryShow(Id)
	}
	if(Play==1)
	{
		if(Next>GalleryImg.length)
			GalleryShow(0);
	}
	IMG=document.getElementById('GalleryImg');
	BIG=GalleryImg[Id];
	COMENT=document.getElementById('GalleryComentario');
	COMENT.innerHTML=GalleryComent[Id];
//	SMALL=GalleryShowThumb(GalleryImg[Id]);
	SMALL=GalleryImg[Id];
	if(Nx!=undefined)
	{
		IMG.style.width="auto";
		IMG.style.height="auto";
	}
	IMG.src=BIG;
}
function Gallery(Id)
{
	WS=document.getElementById('Gallery');
	WC=document.getElementById('GalleryClose');
	if(WS.style.visibility=='hidden')
	{
		SCROLL=BrowserInfo();
		WS.style.top=SCROLL.scrollTop;
		SCROLL.style.overflow = "hidden";
		WS.style.visibility='visible';
		WC.style.visibility='visible';		
		Play=0;
		GalleryShow(Id);
	}
	else
	{
		WS.style.visibility='hidden';
		WC.style.visibility='hidden';
	}
}
function GalleryClose()
{
	WS=document.getElementById('Gallery');
	WC=document.getElementById('GalleryClose');
	WS.style.visibility='hidden';
	WC.style.visibility='hidden';
	SCROLL.style.overflow = "auto";
	Play=0;
}
function GalleryNext()
{
	GalleryShow(Next);
}
function GalleryBack()
{
	GalleryShow(Back);
}
function GalleryBig()
{
	if(IMG.src==SMALL)
	{
		X=document.getElementById('TestImg');
		Y=X;
		X.src=BIG;
//		X=WS.tyle.width;
//......		alert(X.width);
//		X=WS.style.width;
		
		t=SCROLL.clientWidth;
		u=SCROLL.clientHeight;
		Nx=t*(95/100);
//		alert(Nx);
		if(X.width>Nx)
		{
			Nw=Math.round(((X.width/Nx)-2)*(-100));
			X.style.width=Nw+"%";
//			alert(X.style.width);
		}
		for(i=0;i<IMG.length;i++)
		{
			//tm+=IMG[]
		}
		IMG.src=X.src;
		IMG.style.width=X.style.width;
		IMG.style.height=X.style.height;
		WS.style.overflow="scroll";
	}
	else
	{
		IMG.src=SMALL;
		IMG.style.width="auto";
		IMG.style.height="auto";
	}
}

function startTimer() 
{
	GalleryNext();
    timeOut = setTimeout("startTimer()", 2000); 
} 

function stopTimer() 
{
    clearTimeout(timeOut); 
} 



//YouTube
var VideoNext;
var VideoBack;

function YouTubeShow(Id)
{
	DivVideo=document.getElementById('YouTubeMovie');
	DivShowVideo=document.getElementById('ShowYouTube');
	VideoDesc=document.getElementById('VideoDescript');
	VideoNext=Id+1;
	VideoBack=Id-1;
	if(VideoNext>YouTubeVideo.length)
		Id=0;
	if(VideoNext==YouTubeVideo.length)
		document.getElementById('VideoButtonNext').disabled=true;
	else
		document.getElementById('VideoButtonNext').disabled=false;
	if(VideoBack==-1)
		document.getElementById('VideoButtonBack').disabled=true;
	else
		document.getElementById('VideoButtonBack').disabled=false;
	VideoDesc.innerHTML=YouTubeDescrip[Id];
	DivShowVideo.innerHTML = '<object type="application/x-shockwave-flash" width="425" height="344" data="http://www.youtube.com/v/'+YouTubeVideo[Id]+'&hl=en&enablejsapi=1&playerapiid=ShowYouTube&color1=0x2b405b&color2=0x6b8ab6&fs=1&showsearch=0"> <param name="movie" allowfullscreen="true" value="http://www.youtube.com/v/'+YouTubeVideo[Id]+'&hl=en&enablejsapi=1&playerapiid=ShowYouTube&color1=0x2b405b&color2=0x6b8ab6&fs=1&showsearch=0" /> </object>';
}

function YouTubePlayer(Id)
{
	DivVideo=document.getElementById('YouTubeMovie');
	if(DivVideo.style.visibility=="hidden")
	{
		SCROLL=BrowserInfo();
		DivVideo.style.top=SCROLL.scrollTop;
		SCROLL.style.overflow = "hidden";
		DivVideo.style.visibility="visible";
		YouTubeShow(Id);
	}
	else
		DivVideo.style.visibility="hidden";
}
function YouTubeClose()
{
	DivVideo=document.getElementById('YouTubeMovie');
	DivShowVideo=document.getElementById('ShowYouTube');
	DivShowVideo.innerHTML="";
	DivVideo.style.visibility='hidden';
	SCROLL.style.overflow = "auto";
}
function YouTubeNext()
{
	YouTubeShow(VideoNext);
}
function YouTubeBack()
{
	YouTubeShow(VideoBack);
}
