function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function toggle_send_to_friend()
{
	var disp='block';
	document.getElementById('send_title').style.display=(document.getElementById('send_title').style.display=='none')?disp:'none';
	document.getElementById('send_body').style.display=(document.getElementById('send_body').style.display=='none')?disp:'none';

	if (document.getElementById('send_body').style.display!='none')
		document.getElementById("my_name").focus();
}

function print_picture(pimg, wid, hei)
{

	var wnd_height = ((hei) ? hei : 600)+120;
	var wnd_width = ((wid) ? wid : 500)+60;
	wnd_width = (wnd_width < 250) ? 250 : wnd_width;
	var wnd_left = (screen.width - wid)/2;
	var wnd_top = (screen.height - hei)/2;

	var vphoto = window.open("","Bigphoto","location=no,menubar=no,personalbar=no,scrollbars=no,status=no,toolbar=no,width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top);
	vphoto.document.write('<link rel="stylesheet" type="text/css" href="css/style.css">');
	vphoto.document.write('<body style="padding: 0 0 0 0;margin: 0 0 0 0;">');
	vphoto.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#E5E5E5" style="border-collapse:collapse;height:100%">');
	vphoto.document.write('<tr><td align="center"><table cellpadding="5" cellspacing="5" border="0" class="picture_table"><tr><td>');
	vphoto.document.write("<img src='"+pimg+"' border='0'>");
	vphoto.document.write("</td></tr></table><br><a href='javascript:window.close();'><img src='images/photo_close_icon.gif' border=0></a></td></tr></table><script>window.print()</script></body>");
	vphoto.resizeTo(wnd_width, wnd_height);
	vphoto.document.close();
	vphoto.focus();
	return false;


/*	var wnd = window.open(pic_url, 'printwnd', 'width=600,height=400,top=50,left=50');
	alert(wnd.print());
	//wnd.close();
	return false;
*/
}

function openSlideshowWindow(photo_id, ss_start, cat_id)
{
	var addon = '';
	if(cat_id != 'undefined')
	{
		addon = '&cat='+cat_id;
	}
	window.open('photoalbum_slideshow.php?id='+photo_id+'&slideshow='+ss_start+addon,'google', 'fullscreen=yes');
	return false;
}

var wnd;
function open_window(page_url, wid, hei, params)
{
	var wnd_height = (hei) ? hei : 600;
	var wnd_width = (wid) ? wid : 500;
	var wnd_left = (screen.width - wid)/2;
	var wnd_top = (screen.height - hei)/2;
	var wnd_params = (params) ? params : "location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top;
	if(wnd)
	{
		wnd = window.open(page_url, "preview_wnd", wnd_params);
		wnd.focus();
	}
	else
	{
		wnd = window.open(page_url, "preview_wnd", wnd_params);
	}
	return wnd;
}


function open_preview_window(pimg, wid, hei)
{
	var wnd_height = ((hei) ? hei : 600)+150;
	var wnd_width = ((wid) ? wid : 500)+60;
	wnd_width = (wnd_width < 250) ? 250 : wnd_width;
	var wnd_left = (screen.width - wid)/2;
	var wnd_top = (screen.height - hei)/2;

	var vphoto = window.open("","Bigphoto","location=no,menubar=no,personalbar=no,scrollbars=no,status=no,toolbar=no,width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top);
	vphoto.document.write('<link rel="stylesheet" type="text/css" href="css/style.css">');
	vphoto.document.write('<body style="padding: 0 0 0 0;margin: 0 0 0 0;">');
	vphoto.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#E5E5E5" style="border-collapse:collapse;height:100%">');
	vphoto.document.write('<tr><td align="center"><table cellpadding="5" cellspacing="5" border="0" class="picture_table"><tr><td>');
	vphoto.document.write("<img src='"+pimg+"' border='0' width='" + wid + "px' height='"+hei+"px'>");
	vphoto.document.write("</td></tr></table><br><a href='javascript:window.close();'><img src='images/photo_close_icon.gif' border=0></a></td></tr></table></body>");
	vphoto.resizeTo(wnd_width, wnd_height);
	vphoto.document.close();
	vphoto.focus();
	return false;

}

// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var SlideShowPic = new Array(); // don't touch this
var ClubSlideShowPic = new Array(); // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

// =======================================
// do not edit anything below this line
// =======================================

var t;
var j_ClubSlideShow = 0;
var j_SlideShow = 0;
var preLoad;
var p;
function preload(img_id)
{
//	var Pic = SlideShowPic.length;
	var Pic = eval(img_id+"Pic");
	p = Pic.length;
	preLoad = new Array();
	for (i = 0; i < p; i++){
		if(Pic[i] == "" || Pic[i] == undefined)
			continue;
	   preLoad[i] = new Image();
	   preLoad[i].src = Pic[i];
	}
}

function runSlideShow(img_id)
{
	if(img_id == undefined)
		return;
	var j = eval("j_"+img_id);
	if(document.getElementById(img_id) == undefined)
	{
		return;
	}
	preload(img_id);
	if (preLoad.length == 0)
	{
		return;
	}
   if (document.all){
      document.getElementById(img_id).style.filter="blendTrans(duration=2)";
      document.getElementById(img_id).style.filter="blendTrans(duration=crossFadeDuration)";
      document.getElementById(img_id).filters.blendTrans.Apply();
   }
   while(preLoad[j] == undefined || preLoad[j].src == "")
   {
	   j = j + 1;
	   if (j > (p-1)) j=0;
   }
   document.getElementById(img_id).src = preLoad[j].src;
   if (document.all){
      document.getElementById(img_id).filters.blendTrans.Play();
   }
   j = j + 1;
   if (j > (p-1)) j=0;
	eval("j_"+img_id+" = "+j);
   t = setTimeout('runSlideShow("'+img_id+'")', slideShowSpeed);
}
