// JavaScript Document

// --------------- DOM functions --------------------

function jsObj( ObjID ){
	if (document.getElementById) { return(document.getElementById( ObjID )); }	// IE5, IE6, IE7, NetScape6, Opera, Firefox
	else { if (document.all) {return(document.all[ ObjID ]); }                  // IE4, and someIE5
		   else { BrVersion = parseInt(navigator.appVersion);							
	       		if ((navigator.appName.indexOf('Netscape')!=-1)&&(BrVersion==4)) { return (document.layers[ ObjID ]); }
		 	}  // for nautghy NetScape4
	} 
}

function jsAttr( ObjID, Parametro, Valor  ){
		Obj= jsObj( ObjID );
		eval( "Obj."+ Parametro +"='"+ Valor +"'" );
}

function jsCss( ObjID, Parametro, Valor  ){
		Obj= jsObj( ObjID );
		eval( "Obj.style."+ Parametro +"='"+ Valor +"'" );
}


// -----------------  Screen functions --------------------

function jsPageWidth() {
	return window.innerWidth!=null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body!=null ? document.body.clientWidth : null;
} 

function jsPageHeight() {
	return  window.innerHeight!=null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body!=null? document.body.clientHeight : null;
} 

function jsPosLeft() {
	 return typeof window.pageXOffset!='undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
} 

function jsPosTop() {
	 return typeof window.pageYOffset!='undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
} 

function jsPosRight() {
	 return jsPosLeft()+jsPageWidth();
} 

function jsPosBottom() {
	return jsPosTop()+jsPageHeight();
}
													
function jsMouseXY(e) {			//  p = jsMouseXY(ev); result p.x and p.y
	var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
	var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)
	var posx = 0; var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)	{  posx = e.pageX;	posy = e.pageY;	}
	else if (e.clientX || e.clientY) { 	posx = e.clientX; posy = e.clientY;
		 if (isIE) {	posx += document.documentElement.scrollLeft;
						posy += document.documentElement.scrollTop;
		 }
	}
	return { x:posx,y:posy };  
}                    

// end --


// *********************** Photos Functions *************************

function PhotoNavi(m){   
	i=CurrentPhoto+m;	j=ArPhotos.length-1;
	if (i==0) i=j;		if (i>j) i=1;
	PhotoShow(i);
}

function PhotoName( ImgName, ImgText ){
	n=ArPhotos.length;
	ArPhotos[n]=ImgName;
	ArTexts[n] =ImgText;
	IdName = "Im"+n;
	document.write('<a href="javascript:PhotoShow('+n+');">'); 
	document.write('<img id="'+IdName+'" src="images/pic-photo-circle.gif" class="ImN" '); 
	document.write(' onmouseover=\'jsAttr("'+IdName+'","src","images/pic-photo-circle-over.gif" )\' '); 
	document.write(' onmouseout=\'jsAttr("'+IdName+'","src","images/pic-photo-circle.gif" )\' />'); 
	document.write('</a>'); 
}

function PhotoShow( z){
	x=CurrentPhoto; 
	jsAttr("Im"+x ,"src","images/pic-photo-circle.gif" );
	jsAttr("Im"+x ,"onmouseover",'jsAttr("Im'+x+'","src","images/pic-photo-circle-over.gif")' );
	jsAttr("Im"+x ,"onmouseout", 'jsAttr("Im'+x+'","src","images/pic-photo-circle.gif")');
	jsAttr("Im"+z ,"src","images/pic-photo-circle-over.gif" );
	jsAttr("Im"+z ,"onmouseover",' ' );
	jsAttr("Im"+z ,"onmouseout",' ');
	jsAttr("Photo","src","images/pic-loading.gif" );
	jsAttr("Photo","src",ArPhotos[z] );
	jsAttr("Text","innerHTML",ArTexts[z]);
	CurrentPhoto=z;
}

// *********************** Photos Functions *************************

function VideoNavi(m){   
	i=CurrentVideo+m;	j=ArVideos.length-1;
	if (i==0) i=j;		if (i>j) i=1;
	VideoShow(i);
}

function VideoName( VidName, VidText ){
	n=ArVideos.length;
	ArVideos[n]=VidName;
	ArTexts[n] =VidText;
	IdName = "Im"+n;
	document.write('<a href="javascript:VideoShow('+n+');">'); 
	document.write('<img id="'+IdName+'" src="images/pic-photo-circle.gif" class="ImN" '); 
	document.write(' onmouseover=\'jsAttr("'+IdName+'","src","images/pic-photo-circle-over.gif" )\' '); 
	document.write(' onmouseout=\'jsAttr("'+IdName+'","src","images/pic-photo-circle.gif" )\' />'); 
	document.write('</a>'); 
}

function VideoShow( z ){
	x=CurrentVideo; 
	jsAttr("Im"+x ,"src","images/pic-photo-circle.gif" );
	jsAttr("Im"+x ,"onmouseover",'jsAttr("Im'+x+'","src","images/pic-photo-circle-over.gif")' );
	jsAttr("Im"+x ,"onmouseout", 'jsAttr("Im'+x+'","src","images/pic-photo-circle.gif")');
	jsAttr("Im"+z ,"src","images/pic-photo-circle-over.gif" );
	jsAttr("Im"+z ,"onmouseover",' ' );
	jsAttr("Im"+z ,"onmouseout",' ');
	jsAttr("VPlayer","src","vplayer.html?filev="+ArVideos[z] );
	jsAttr("Text","innerHTML",ArTexts[z]);
	CurrentVideo=z;
}


//============================= PDF fucntions ===============================

function PdfShow(PdfName) {
	window.open("docums/"+PdfName+"#zoom=70&navpanes=0","Peter Bossio - Pdfs Document","scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,fullscreen=yes,width=700,height=700,left=0");
}

