// BFS Image Popup
// usage: used in the Art Gifts section to auto size the artwork popups
// usage: uses /elements/popup.htm and scripts embedded there to auto size and locate on screen
// usage: format links as follows:
//			<a href="javascript:popImage('/path/to/image.jpg','Title for title tag')">link text or image</a>
var win=null;
function popImage(imgURL,imgTitle) { 
	settings='scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open("/elements/popup.htm?"+imgURL+"?"+imgTitle, "thewin", settings);
}

var temp=self.location.href.split("?");
var picUrl = (temp.length>1)?temp[1]:"";
var picTitle = (temp.length>2)?unescape(temp[2]):"untitled";
var NS = (navigator.appName=="Netscape")?true:false;

function fitPic() {
	iWidth = (NS)?window.innerWidth:document.body.clientWidth;
	iHeight = (NS)?window.innerHeight:document.body.clientHeight;
	iWidth = document.images[0].width;
	iHeight = document.images[0].height;
	TheLeft = screen.width/2-iWidth;
	TheTop = screen.height/2-iHeight;
	window.resizeTo(iWidth, iHeight-1);
	window.moveTo(TheLeft, TheTop);
	self.focus();
};


///////////////////////////
// BFS Share this page
function Share() {
	window.open('/share/share.php?pagetitle=' + escape(document.title) + '&pagelink=' + location.href, 'popup' ,'resizable=yes,width=350,height=480,status=no,location=no,toolbar=no,menubar=no,scrollbars=no'); 
}

///////////////////////////
// BFS EE Control Panel Popup instructions
function CPop(url) {
	window.open(url, 'popup' ,'resizable=yes,width=350,height=480,status=no,location=no,toolbar=no,menubar=no,scrollbars=no'); 
	
}


///////////////////////////
// StyleSwitcher functions written by Paul Sowden
// http://www.alistapart.com/stories/alternate/
function setActiveSS(title) { var i, a, main; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } }
function getActiveSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title"); } return null; }
function getPreferredSS() { var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; }
function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }
function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }
window.onload = function(e) { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredSS(); setActiveSS(title); }
window.onunload = function(e) { var title = getActiveSS(); createCookie("style", title, 365); }
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredSS();
setActiveSS(title);


///////////////////////////
// Show/Hide
 function showHide(entryID, entryLink, htmlObj) { 
		 extTextDivID = ('extText' + (entryID)); 
		 extLinkDivID = ('extLink' + (entryID)); 


	 if( document.getElementById ) { 
		 if( document.getElementById(extTextDivID).style.display ) { 
			 if( entryLink != 0 ) { 
				 document.getElementById(extTextDivID).style.display = "block"; 
				 document.getElementById(extLinkDivID).style.display = "none"; 
				 htmlObj.blur(); 
			 } else { 
				 document.getElementById(extTextDivID).style.display = "none"; 
				 document.getElementById(extLinkDivID).style.display = "block"; 
			 } 
		 } else { 
			 location.href = entryLink; 
			 return true; 
		 } 
	 } else { 
		 location.href = entryLink; 
		 return true; 
	 } 
	 
 } 
 
function erase(box) {
   if (box.defaultValue == box.value)
	   box.value = ""
} 


/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function FlashWin(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}



