//Fading Image
/*
Better(?) Image fader (C)2004 Patrick H. Lauke aka redux

Inspired by Richard Rutter / Clagnut http://www.clagnut.com/blog/1299/ 

Original concept and code adapted from Couloir http://www.couloir.org/ 

preInit "Scheduler" idea by Cameron Adams aka The Man in Blue
http://www.themaninblue.com/writing/perspective/2004/09/29/ 

*/

/* general variables */
//Only Pix 2 is being faded
	var fadeTargetId = 'the_pix_2'; /* change this to the ID of the fadeable object */

	var fadeTarget;
	var preInitTimer;
	var opacity;
/* functions */

function preInit() {
	/* an inspired kludge that - in most cases - manages to initially hide the image
	   before even onload is triggered (at which point it's normally too late, and a nasty flash
	   occurs with non-cached images) */
	if ((document.getElementById)&&(fadeTarget=document.getElementById(fadeTargetId))) {
		fadeTarget.style.visibility = "hidden";
		if (typeof preInitTimer != 'undefined') clearTimeout(preInitTimer); /* thanks to Steve Clay http://mrclay.org/ for this small Opera fix */
	} else {
		preInitTimer = setTimeout("preInit()",2);
	}
}


function fadeInit() {
	if (document.getElementById) {
		/* get a handle on the fadeable object, to make code later more manageable */
		preInit(); /* shouldn't be necessary, but IE can sometimes get ahead of itself and trigger fadeInit first */
		/* set the initial opacity in a (hopefully) cross browser way
		   notice that because of the way the image is in front, and not obfuscated
		   by another object we need to "fade out", i don't need a fallback mechanism
		   to show/hide the covering object...the image is just there, full stop */
		if (fadeTarget.style.MozOpacity!=null) {  
			/* Mozilla's pre-CSS3 proprietary rule */
			fadeTarget.style.MozOpacity = 0;
		} else if (fadeTarget.style.opacity!=null) {
			/* CSS3 compatible */
			fadeTarget.style.opacity = 0;
		} else if (fadeTarget.style.filter!=null) {
			/* IE's proprietary filter */
			fadeTarget.style.filter = "alpha(opacity=0)";
		}
		/* make the object visible again */
		fadeTarget.style.visibility = 'visible';
		window.setTimeout("fadeIn(0)", 500);
	}
}

function fadeIn(opacity) {
	if (fadeTarget) {
		if (opacity <= 100) {
			if (fadeTarget.style.MozOpacity!=null) {
				/* Mozilla's pre-CSS3 proprietary rule */
				fadeTarget.style.MozOpacity = (opacity/100)-.001;
				/* the .001 fixes a glitch in the opacity calculation which normally results in a flash when reaching 1 */
			} else if (fadeTarget.style.opacity!=null) {
				/* CSS3 compatible */
				fadeTarget.style.opacity = (opacity/100)-.001;
			} else if (fadeTarget.style.filter!=null) {
				/* IE's proprietary filter */
				fadeTarget.style.filter = "alpha(opacity="+opacity+")";
				/* worth noting: IE's opacity needs values in a range of 0-100, not 0.0 - 1.0 */ 
			}
			opacity += 10;
			window.setTimeout("fadeIn("+opacity+")", 30);
		}
	}
}

//Array of Pictures 
	var pix_array = new Array(
//2009
// from dedicated family group in 2009
'gownpic2010F/2010_11_41Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2010F/2010_11_41F.jpg" style="margin: 1px;">',
'gownpic2010F/2010_04_43Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2010F/2010_04_43F.jpg" style="margin: 1px;">',
'gownpic2010F/2010_04_42Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2010F/2010_04_42F.jpg" style="margin: 1px;">',
'gownpic2010F/2010_04_41Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2010F/2010_04_41F.jpg" style="margin: 1px;">',
'gownpic2009F/2009_42_44Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_42_44B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_42_43Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_42_43B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_42_42Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_42_42B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_42_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_42_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_41_48Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_41_48F.jpg" style="margin: 1px;">',
'gownpic2009F/2009_41_47Fq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_41_47F.jpg" style="margin: 1px;">',
'gownpic2009F/2009_38_04Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_38_04B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_38_03Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_38_03B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_38_02Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_38_02B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_38_01Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_38_01B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_35_45Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_35_45B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_35_44Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_35_44B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_35_43Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_35_43B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_35_42Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_35_42B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_35_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_35_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_46Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_46B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_45Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_45B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_44BDq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_44BD.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_43BDq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_43BD.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_42BDq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_42BD.jpg" style="margin: 1px;">',
'gownpic2009F/2009_28_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_28_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_26_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_26_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_22_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_22_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_44Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_44B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_43Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_43B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_42Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_42B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_41Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_41B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_36Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_36B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_35Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_35B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_34Bq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_34B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_32Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_32B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_17_31Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_17_31B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_16_38Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_16_38B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_16_36Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_16_36B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_16_35BDq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_16_35BD.jpg" style="margin: 1px;">',
'gownpic2009F/2009_16_34BDq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_16_34BD.jpg" style="margin: 1px;">',
'gownpic2009F/2009_11_32Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_11_32B.jpg" style="margin: 1px;">',
'gownpic2009F/2009_11_31Bq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2009F/2009_11_31B.jpg" style="margin: 1px;">'
//2008

);

	no_of_pix= pix_array.length/3;
//	Selection of Picture 1 then link to enlarge from it; for DomiPic it is not used
	function display_random_pix_1()
	{
	random_num=Math.floor(Math.random()*no_of_pix);
	link_to_enlarge=pix_array[(random_num)*3];
	selected_pix=pix_array[(random_num)*3+2];
	obj=document.getElementById('the_pix_1');
	obj.innerHTML=selected_pix;
	obj.href='http://www.owl.hu/owl/3gallery/'+link_to_enlarge;

//	alert ();

}

//	Getting Title of Picture 1 then link to enlarge from it
	function display_random_pix_1_title()
	{
//	link_to_enlarge=pix_array[(random_num)*3];
	selected_pix_title=pix_array[(random_num)*3+1];
//Optional fading
//	preInit();
//	fadeInit();
//	fadeIn(opacity);

	obj=document.getElementById('the_pix_1_title');
	obj.innerHTML=selected_pix_title;

//Typing Text Option
	new TypingText(obj);
	TypingText.runAll();
	obj.href='http://www.owl.hu/owl/3gallery/'+link_to_enlarge;

//	alert ();

}

function goto_1()
{
	top.location=document.getElementById('the_pix_1').href;
}

//Selection of 2nd Pic, this is used for DomiPic; including photos of Bius
	function display_random_pix_2()
	{
	random_num=Math.floor(Math.random()*no_of_pix);
	link_to_enlarge=pix_array[(random_num)*3];
	selected_pix=pix_array[(random_num)*3+2];
	obj=document.getElementById('the_pix_2');
//Optional fading
	preInit();
	fadeInit();
	fadeIn(opacity);

	obj.innerHTML=selected_pix;
	obj.href='http://www.owl.hu/owl/3gallery/'+link_to_enlarge;

//	alert ();
}

//	Getting Title of Picture 2 then link to enlarge from it
	function display_random_pix_2_title()
	{
//	link_to_enlarge=pix_array[(random_num)*3];
	selected_pix_title=pix_array[(random_num)*3+1];
	obj=document.getElementById('the_pix_2_title');
//	Optionally blending the title text
//	
	obj.innerHTML=selected_pix_title;

//Typing Text Option
//	new TypingText(obj);
//	TypingText.runAll();
	obj.href='http://www.owl.hu/owl/3gallery/'+link_to_enlarge;

//	alert ();

}

function goto_2()
{
	top.location=document.getElementById('the_pix_2').href;
}




