function openWindow(da_url, da_width, da_height) {
	var settings = "width=" + da_width + ",height=" + da_height + ",toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,toolbar=no,scrollbars=auto,resizable=yes";
	var mywindow = window.open(da_url, "galbeimage", settings);
	mywindow.focus();
}

function openLightboard() {
	var settings = "width=620,height=440,toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes";
	var da_url = "galbe_lightboardpopup.php";
	var mywindow = window.open(da_url, "galbelightboard", settings);
	mywindow.focus();
	return false;
}

function doSearch() {
	var myescaped = escape(document.search.search.value);

	if(myescaped != "") {
		myescaped = myescaped.replace("%20and%20","%20");
		myescaped = myescaped.replace("%20AND%20","%20");
		myescaped = myescaped.replace("%20And%20","%20");

		myescaped = myescaped.replace("%20not%20","%20-");	
		myescaped = myescaped.replace("%20NOT%20","%20-");
		myescaped = myescaped.replace("%20Not%20","%20-");
		myescaped = myescaped.replace("%20no%20","%20-");
		myescaped = myescaped.replace("%20NO%20","%20-");
		myescaped = myescaped.replace("%20No%20","%20-");

		myescaped = myescaped.replace("%20+","%20");
		myescaped = myescaped.replace("%20%20","%20");
		myescaped = myescaped.replace("%20%20","%20");

		//myescaped = myescaped.replace("%20-", "-");
		myescaped = myescaped.replace("-%20", "-");

		myescaped = myescaped.replace("%20","%20%2B");
		myescaped = "%2B" + myescaped;
		myescaped = myescaped.replace("%2B+","%2B");
		myescaped = myescaped.replace("%2B-","-");


		//myescaped = myescaped.replace(/[+]/gi,"%20%2B");
		//myescaped = myescaped.replace(/[-]/gi,"%20-");
	}


	var myloc = "/photos.php?groupID="+document.search.searcharchive.options[document.search.searcharchive.selectedIndex].value+"&SearchPhrase=" + myescaped +"&Page=1";

	location.href= myloc;
	return false;
}


function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth +  ' Height = ' + myHeight );
}

function contentIframe_nolight(da_content) {
	  var myWidth = 0, myHeight = 0;
	  
	document.body.scroll='no';
	  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = myHeight - 115;
	
	document.write('<IFRAME name="content" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="'+contentHeight+'"></IFRAME>');
	
}

function contentIframe_withlight(da_content) {
	  var myWidth = 0, myHeight = 0;
	  
	document.body.scroll='no';
	
	  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = myHeight - 205;
	
	document.write('<IFRAME name="content" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="'+contentHeight+'"></IFRAME>');	
}

function photogrid_withlight(da_content) {
	  var myWidth = 0, myHeight = 0;
	  
	document.body.scroll='no';	  
	  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = myHeight - 230;
	
	document.write('<IFRAME name="photogrid" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="'+contentHeight+'"></IFRAME>');	
}

function photogrid_nolight(da_content) {
	  var myWidth = 0, myHeight = 0;
	  
	document.body.scroll='no';	  
	  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = myHeight - 140;
	
	document.write('<IFRAME name="photogrid" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="'+contentHeight+'"></IFRAME>');	
}

function lightboard(da_content) {
	  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = 80;
	
	document.write('<TABLE height="130" width="'+contentWidth+'" cellspacing="0" cellpadding="0" border="0">');
	document.write('<TR><TD width="'+contentWidth+'" height="11" valign="top"><img src="images/spacer.gif" height="11" width="'+contentWidth+'"><br></TD></TR>');
	document.write('<TR><TD width="'+contentWidth+'" height="24" valign="top">');
	
	
	var mystring = location.href.toString();
	mystring = mystring.replace(/[?&]lightboard=1/gi,"");


	//------------	
	if (mystring.indexOf('?') >= 0) {
		var da_char = '&';
	} else {
		var da_char = '?';
	}

	document.write('<table width="100%" height="22" cellspacing="0" cellpadding="0" border="0"><tr>');

	document.write('<td width="92" align="left"><img src="images/spacer.gif" height="3"><br><img src="images/current_lightboard.gif"></td>');
	document.write('<td width="175">');

document.write('<form name="lightboardsettings" class="lightboardsettings" method=POST target="lightboard" action="lightboard.php"><select name="current_lightbox" class="lightboardsettings" onChange="document.lightboardsettings.submit();"></select></form>');

	document.write('</td>');
	document.write('<td width="'+(contentWidth-347)+'">');

document.write('<span class="lightboardsettings">| <a href="'+da_content+'?newlightboard=true" target="lightboard" class="lightboardtoggle">New Lightboard</a> | <a href="" onClick="return openLightboard();" class="lightboardtoggle">Open Lightboard</a> | <a href="'+da_content+'?deleteLightboard=true" target="lightboard" class="lightboardtoggle" onClick="return confirm(\'Are you sure you want to delete current lightboard\');">Delete current Lightboard</a> | ');



	document.write('</span></td>');
		
	document.write('<td width="120" align="right"><span class="lightboardsettings">| <a href="'+ mystring + da_char +'lightboard=0" class="lightboardtoggle">Hide lightboard</a> |</span><br></td>');
	
	document.write('</tr></table>');
	//------------	
	
		
	document.write('</TD></TR>');
	document.write('<TR><TD width="'+contentWidth+'" height="95" valign="top">');
	document.write('<IFRAME name="lightboard" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="'+contentHeight+'"></IFRAME>');	
	document.write('</TD></TR></TABLE>');
}


function lightboard_hidden(da_content) {
	  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }	
	
	contentWidth = myWidth - 30;
	contentHeight = 35;
	
	
	document.write('<TABLE height="35" width="'+contentWidth+'" cellspacing="0" cellpadding="0" border="0">');
	document.write('<TR><TD width="'+contentWidth+'" height="9" valign="top"><img src="images/spacer.gif" height="9" width="'+contentWidth+'"><br></TD></TR>');
	document.write('<TR><TD width="'+contentWidth+'" height="22" valign="left">');


	//------------
	var mystring = location.href.toString();
	mystring = mystring.replace(/[?&]lightboard=0/gi,"");

	if (mystring.indexOf('?') >= 0) {
		var da_char = '&';
	} else {
		var da_char = '?';
	}

	document.write('<table width="100%" height="22" cellspacing="0" cellpadding="0" border="0"><tr>');

	document.write('<td width="92" align="left"><img src="images/spacer.gif" height="3"><br><img src="images/current_lightboard.gif"></td>');
	document.write('<td width="175">');

document.write('<form name="lightboardsettings" class="lightboardsettings" method=POST target="lightboard" action="lightboard.php"><select name="current_lightbox" class="lightboardsettings" onChange="document.lightboardsettings.submit();"></select></form>');

	document.write('</td>');
	document.write('<td width="'+(contentWidth-347)+'">');

document.write('<span class="lightboardsettings">| <a href="'+da_content+'?newlightboard=true" target="lightboard" class="lightboardtoggle">New Lightboard</a> | <a href="" onClick="return openLightboard();" class="lightboardtoggle">Open Lightboard</a> | <a href="'+da_content+'?deleteLightboard=true" target="lightboard" class="lightboardtoggle" onClick="return confirm(\'Are you sure you want to delete current lightboard\');">Delete current Lightboard</a> | ');

	document.write('</span></td>');
		
	document.write('<td width="100" align="right"><a href="'+ mystring + da_char +'lightboard=1" class="lightboardtoggle">Show lightboard</a><br></td>');
	
	document.write('</tr></table>');
	//---------------
	
	document.write('</TD></TR>');
	document.write('<TR><TD width="'+contentWidth+'" height="0" valign="top">');
	document.write('<IFRAME name="lightboard" FRAMEBORDER="0" src="'+da_content+'" width="'+contentWidth+'" height="0"></IFRAME>');	
		
	document.write('</TD></TR><TR><TD width="'+contentWidth+'" height="4" valign="top"><img src="images/spacer.gif" height="4" width="'+contentWidth+'"><br>');

	document.write('</TD></TR></TABLE>');
}

