//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(
//2007
'gownpic2007/2007_49_1Dq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_49_1D.jpg" style="margin: 1px;">',
'gownpic2007/2007_39_9q2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_39_9.jpg" style="margin: 1px;">',
'gownpic2007/2007_34_7Dq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_34_7D.jpg" style="margin: 1px;">',
'gownpic2007/2007_29_1Dq2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_29_1D.jpg" style="margin: 1px;">',
'gownpic2007/2007_29_14q2.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_29_14.jpg" style="margin: 1px;">',
'gownpic2007/2007_18_3Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_18_3D.jpg" style="margin: 1px;">',
'gownpic2007/2007_18_1BDq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_18_1BD.jpg" style="margin: 1px;">',
'gownpic2007/2007_11_1Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic2007/2007_11_1D.jpg" style="margin: 1px;">',
//2006-2005
'gownpic/2006_47_16Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_16D.jpg" style="margin: 1px;">',
'gownpic/2006_47_14Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_14D.jpg" style="margin: 1px;">',
'gownpic/2006_47_13Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_13D.jpg" style="margin: 1px;">',
'gownpic/2006_47_12Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_12D.jpg" style="margin: 1px;">',
'gownpic/2006_47_11Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_11D.jpg" style="margin: 1px;">',
'gownpic/2006_47_9Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_9D.jpg" style="margin: 1px;">',
'gownpic/2006_47_8Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_8D.jpg" style="margin: 1px;">',
'gownpic/2006_47_7Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_7D.jpg" style="margin: 1px;">',
'gownpic/2006_47_6Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_6D.jpg" style="margin: 1px;">',
'gownpic/2006_47_5Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_5D.jpg" style="margin: 1px;">',
'gownpic/2006_47_4Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_4D.jpg" style="margin: 1px;">',
'gownpic/2006_47_3Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_3D.jpg" style="margin: 1px;">',
'gownpic/2006_47_2Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_2D.jpg" style="margin: 1px;">',
'gownpic/2006_47_1Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_47_1D.jpg" style="margin: 1px;">',
'gownpic/2006_43_21Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_21D.jpg" style="margin: 1px;">',
'gownpic/2006_43_15Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_15D.jpg" style="margin: 1px;">',
'gownpic/2006_43_10Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_10D.jpg" style="margin: 1px;">',
'gownpic/2006_43_9Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_9D.jpg" style="margin: 1px;">',
'gownpic/2006_43_7Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_7D.jpg" style="margin: 1px;">',
'gownpic/2006_43_6Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_6D.jpg" style="margin: 1px;">',
'gownpic/2006_43_5Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_5D.jpg" style="margin: 1px;">',
'gownpic/2006_43_4Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_4D.jpg" style="margin: 1px;">',
'gownpic/2006_43_1Dq.htm', '', '<img border="0" src="http://www.owl.hu/owl/3gallery/gownpic/2006_43_1D.jpg" style="margin: 1px;">'
);

	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;
}




