// JavaScript Document
// Copyright Christopher Donnelly T&C Web Concepts 2006/2007

//Page Variables for Bio Pages
var currentPage=0;
var totalPages=1;
var pageCount=1;
var itemCount=1;
var page=new Array();
var entering=true;
//Navigation Variables
var totalNav=0;
var navItems=new Array();
//Shadow Variables
var shadowDepth=6; //In Pixels
var shadowColor='#000000'; //Shadow Color
var addShadows=new Function(); //Function variable for addLoadEvents
var shadowContainer='contentLayer'; //Container Layer for shadows
var searchClass='shadow'; //Search for this Class
var shadowClass='shadow2'; //Shadow Class
//Mouse Move Variables
var mouseX, mouseY;
//Browser Variables
var	agent=navigator.userAgent;
var	dom=document.getElementById?true:false;
var docAll=document.all?true:false;
var	firefox=(agent.indexOf("Firefox")>-1)?true:false;
var	ie=(agent.indexOf("MSIE")>-1)?true:false;
var prevPNG=null;
var lastSpot=null;
var prevTableObj=null;
var IEverNum=7;

var pdfDocs=new Array();
pdfDocs['birdCare']='docs/BirdCareInstructions.pdf';
pdfDocs['contribute']='contributionCard.htm';
pdfDocs['adoptionApp']='docs/AdoptionApplication.pdf';
pdfDocs['adoptionContract']='docs/AdoptionContract.pdf';
pdfDocs['volunteerApp']='docs/Volunteer_Application.pdf';
pdfDocs['flockTalk01']='docs/Flock_Talk_Issue1_Summer06.pdf';
pdfDocs['flockTalk02']='docs/Flock_Talk_Issue2_Winter0607.pdf';
pdfDocs['flockTalk03']='docs/Flock_Talk_Issue3_Summer07.pdf';
pdfDocs['flockTalk04']='docs/Flock_Talk_Issue4_Winter0708.pdf';
pdfDocs['flockTalk05']='docs/Flock_Talk_Issue5_Spring08.pdf';
pdfDocs['currentIssue']='docs/Flock_Talk_Issue5_Spring08.pdf';
pdfDocs['brochure']='docs/BirdSanctuaryBrochure2006.pdf';
pdfDocs['relinquishment']='docs/Bird_Relinquishment.pdf';
pdfDocs['nutrition']='docs/NutritionInformation.pdf';
pdfDocs['grooming']='docs/GroomingTrapping.pdf';

/*if(window.Event && document.captureEvents)
	document.captureEvents(Event.MOUSEMOVE);

document.onmousemove=getMousePos;*/

var	ver=navigator.appVersion;
if(ver.indexOf("MSIE")){
	var startPos=parseInt(ver.indexOf("MSIE"));
	IEverNum=findNum(ver.substring(startPos,startPos+6));
}

var posX=345;
var posY=50;
var endX=345;
var endY=50;
var fadeTime=4;
var animTime=6;
var effect='slideLeftFade';
var hidePrev;
var currentImg=0;
var loops=0;
var requiredMajorVersion=8;
var requiredMinorVersion=0;
var requiredRevision=0;
//var gotFlash=DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

function changeSize(){
	var viewportwidth;
	var viewportheight;
	 
	if(typeof window.innerWidth != 'undefined'){
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight-20;
	}else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	}else{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}
	document.getElementById('contentLayer').style.width=viewportwidth-parseInt(document.getElementById('contentLayer').offsetLeft)+'px';
	document.getElementById('contentLayer').style.height=viewportheight-parseInt(document.getElementById('contentLayer').offsetTop)+'px';
	document.getElementById('headerLayer').style.width=viewportwidth+'px';
	document.getElementById('leftColumn').style.height=viewportheight-parseInt(document.getElementById('contentLayer').offsetTop)-80+'px';
}

function ControlVersion(){
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try{
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	}catch (e){ }

	if (!version){
		try{
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			// default to the first public version
			version = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
		}catch (e){ }
	}

	if (!version){
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		}catch (e){ }
	}

	if (!version){
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		}catch (e){ }
	}

	if (!version){
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision){
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		userVer=versionStr;
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray=versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString=tempArray[1];			// "2,0,0,11"
			versionArray=tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray=versionStr.split(".");
		}
		var versionMajor=versionArray[0];
		var versionMinor=versionArray[1];
		var versionRevision=versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		userVer=versionMajor;
		if (versionMajor>parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor==parseFloat(reqMajorVer)) {
			if (versionMinor>parseFloat(reqMinorVer))
				return true;
			else if (versionMinor==parseFloat(reqMinorVer)) {
				if (versionRevision>=parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function getFlashMovieObject(movieName){
	if (navigator.appName.indexOf("Microsoft Internet")==-1){
		if (document.embeds && document.embeds[movieName]){
			return document.embeds[movieName];
		}
	}else{
		if (window.document[movieName]){
			return window.document[movieName];
		}
		else return document.getElementById(movieName);
	}
}

function findNum(arg){
	var st=-1;
	var en=arg.length;
	var found=false;
	var temp;
	for(var i=0;i<arg.length;i++){
		if (!isNaN(arg.charAt(i))&&!found){found=true;st=i;
		}else if (isNaN(arg.charAt(i)) && found){en=i;}
	}
	temp=(st>-1)?parseInt(arg.substring(st,en)):null;
	return temp;
}

function getMousePos(e){
	if (!e)
		var e=window.event||window.Event;

	if('undefined'!=typeof e.pageX){
		mouseX=e.pageX;
		mouseY=e.pageY;
	}else{
		mouseX=e.clientX+document.body.scrollLeft;
		mouseY=e.clientY+document.body.scrollTop;
	}

}

function returnObjById(id){
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function navObj(arg1,arg2,arg3){
	this.name=arg1;
	this.value=arg2;
	this.page=arg3;
}

function addNavItem(navItem,navValue,navPage){
	navItems[totalNav]=new navObj(navItem,navValue,navPage);
	totalNav++;
}

function initNav(){
	addNavItem('home','Home','index.htm');
	addNavItem('booth','Our Booth','booth.htm');
	addNavItem('jewelry','Jewelry','jewelry.htm');
	/*addNavItem('birds','Sanctuary Birds','birds.htm');
	addNavItem('success','Successful Adoptions','stories.htm');
	addNavItem('rescue','Rescue\'s Song','rescue.htm');
	addNavItem('care','Bird Care','care.htm');
	addNavItem('events','SBBS Events','events.htm');
	addNavItem('education','Educational Information','education.htm');
	addNavItem('articles','Newsletter Articles','articles.htm');
	addNavItem('nutrition','Nutritional Information','nutrition.htm');
	addNavItem('contribute','Contribution Information','contribute.htm');
	addNavItem('info','Additional Information','info.htm');
	addNavItem('founder','SBBS Founder','founder.htm');
	addNavItem('boardMembers','SBBS Board Members','boardMembers.htm');
	addNavItem('videos','Videos','videos.htm');*/
	addNavItem('contact','Contact','contact.htm');
	/*addNavItem('map','Map &amp; Directions','map.htm');
	addNavItem('documents','SBBS Documents','documents.htm');
	addNavItem('links','Links','links.htm');
	addNavItem('sitemap','Site Map','sitemap.htm');*/
}

function addBio(imgLoc,name,bio){
	if(itemCount>6){
		itemCount=1;
		pageCount++;
	}
	initPages(pageCount,6);
	
	page[pageCount].image[itemCount]=imgLoc;
	page[pageCount].name[itemCount]=name;
	page[pageCount].bio[itemCount]=bio;
	
	itemCount++;
}

function writeEmails(){
	document.write('<p class="contentAddy" style="padding-left:25px;"><a href="mailto:JMENAGERIE@aol.com?subject=E-Mail%20Treasurer" title="E-Mail Treasurer">Treasurer</a></p>');
	document.write('<p class="contentAddy" style="padding-left:25px;"><a href="mailto:JMENAGERIE@aol.com?subject=E-Mail%20President" title="E-Mail President">President</a></p>');
	document.write('<p class="contentAddy" style="padding-left:25px;"><a href="mailto:JMENAGERIE@aol.com?subject=E-Mail%20Vice%20President" title="E-Mail Vice President">Vice President</a></p>');
	document.write('<p class="contentAddy" style="padding-left:25px;"><a href="mailto:JMENAGERIE@aol.com?subject=E-Mail%20Secretary" title="E-Mail Secretary">Secretary</a></p>');
	document.write('<p class="contentAddy" style="padding-left:25px;"><a href="mailto:JMENAGERIE@aol.com?subject=E-Mail%20Information" title=Information>Info</a></p>');
}

function writeImage(arg,width,height){
	if(firefox)
		document.write('<img src="images/'+arg+'.png" name="'+arg+'" id="'+arg+'" width="'+width+'" height="'+height+'" border="0">');
	else
		document.write('<img src="images/trans.gif" name="'+arg+'" id="'+arg+'" width="'+width+'" height="'+height+'" border="0" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=\'images/'+arg+'.png\');">');
}

function writeBio(arg){
	if(firefox){
		document.write('<td align="center" valign="top" width="33%">')
		document.write('<img src="birds/imgLoading.png" name="birdImg'+arg+'" id="birdImg'+arg+'" width="175" height="247" class="'+searchClass+'"></td>');
	}else{
		document.write('<td align="center" valign="top" width="33%">')
		document.write('<img src="birds/trans.gif" name="birdImg'+arg+'" id="birdImg'+arg+'" width="175" height="247" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=\'birds/imgLoading.png\');" class="'+searchClass+'"></td>');
	}
}

function writeInfo(arg){
	document.write('<td align="left" valign="top">');
	document.write('<p class="contentAddy" name="birdName'+arg+'" id="birdName'+arg+'">"Loading Name '+arg+'" Bird Age: ?</p>');
	document.write('<p class="content" name="birdBio'+arg+'" id="birdBio'+arg+'">Birdie Bio is Loading...</p></td>');
}

function writeNavBar(arg){
	document.write('<table width="140" border="0" cellpadding="0" cellspacing="7">');
	for(var i=0;i<totalNav;i++){
		var curPage=navItems[i].page;
		document.write('<tr><td style="padding-left:4px;">');
		if(document.location.href.indexOf(curPage)==-1)
			document.write('<a href="'+navItems[i].page+'" name="'+navItems[i].name+'" target="_self" class="contentLink">'+navItems[i].value+'</a>');
		else
			document.write('<p class="contentSel" style="text-align:left;"><strong>'+navItems[i].value+'</strong></p>');
		document.write('</td></tr>');
	}
	document.write('</table>');
}

function pageObj(arg){
	this.image=new Array();
	this.name=new Array();
	this.bio=new Array();
	for(var j=1;j<=arg;j++){
		this.image[j]='birds/trans.gif';
		this.name[j]='&nbsp;';
		this.bio[j]='&nbsp;';
	}
}

function initPages(arg1,arg2){
	totalPages=arg1;
	for(var i=1;i<=arg1;i++){
		if(page[i]==null)
			page[i]=new pageObj(arg2);
	}
}

function switchPage(arg){
	if(arg=='aboutSBBS') arg='about';
	else if(arg=='rescueStories') arg='rescue';
	else if(arg=='dietGuide') arg='education';
	else if(arg=='addInfo') arg='info';
	location.replace(arg+'.htm');
}

function changePage(arg){
	hideStory();
	var pageLinks;
	
	if(isNaN(arg)){
		if(arg=='next')
			currentPage++;
		else
			currentPage--;
	}else currentPage=parseInt(arg);

	if(totalPages>1){
		pageLinks=(currentPage>1)?"<a href='#' class='contentAddy' onClick='changePage(\"back\")'>&lt;-- Prev Birds</a>&nbsp;&nbsp;":"<img src='images/trans.gif' width='96' height='5'>&nbsp;&nbsp;";
		for(var i=1;i<=totalPages;i++){
			if(i!=currentPage)
				pageLinks+="<a href='#' class='contentAddy' onClick='changePage("+i+")'>"+i+"</a>&nbsp;&nbsp;"
			else
				pageLinks+="<span class='contentAddy'>"+i+"</span>&nbsp;&nbsp;"
		}
		pageLinks+=(currentPage<totalPages)?"<a href='#' class='contentAddy' onClick='changePage(\"next\")'>More Birds --&gt;</a>":"<img src='images/trans.gif' width='100' height='5'>";
	}else pageLinks='&nbsp;';

	var topNav=returnObjById('topNav');
	var bottomNav=returnObjById('bottomNav');
	topNav.innerHTML=pageLinks;
	bottomNav.innerHTML=pageLinks;
	
	for(var j=1;j<=6;j++){
		//alert(page[currentPage].name[j])
		var birdName=returnObjById('birdName'+j);
		var birdBio=returnObjById('birdBio'+j);
		if(page[currentPage].image[j]=='birds/trans.gif') returnObjById('birdImg'+j).className='';
		else returnObjById('birdImg'+j).className=searchClass;
		
		if(firefox){
			document.images['birdImg'+j].src=page[currentPage].image[j];
		}else{
			document.images['birdImg'+j].src=page[currentPage].image[j];
			document.all['birdImg'+j].style.filter="none";
		}
		birdName.innerHTML=page[currentPage].name[j];
		if(page[currentPage].bio[j].length>375){
			var synops="";
			for(var i=0;i<375;i++)
				synops+=page[currentPage].bio[j].charAt(i);
			birdBio.innerHTML=synops+"... <a href='#' class='content' onMouseOver='showStory(\""+page[currentPage].bio[j]+"\")'>[Full Story]</a>";
		}else 
			birdBio.innerHTML=page[currentPage].bio[j];
	}
	if(!entering){
		removeShodows();
		addShadows();
	}
	entering=false;
}

function hideStory(){
	var divLayer=returnObjById('moreBio');
	divLayer.style.visibility='hidden';
	divLayer.innerHTML="";
}

function showStory(arg){
	if (parseInt(navigator.appVersion)>3){
		if (navigator.appName=="Netscape"){
			winW=window.innerWidth;
			winH=window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1){
			winW=document.body.offsetWidth;
			winH=document.body.offsetHeight;
		}
	}
	if(document.documentElement&&document.documentElement.scrollTop){
		theTop=document.documentElement.scrollTop;
		theLeft=document.documentElement.scrollLeft;
	}else if(document.body){
		theTop=document.body.scrollTop;
		theLeft=document.body.scrollLeft;
	}
		
	var divLayer=returnObjById('moreBio');
	divLayer.style.visibility='visible';
	
	var height=grabComputedHeight(divLayer);
	var width=grabComputedWidth(divLayer);

	divLayer.innerHTML="<div style='position:absolute; right:2px; top:2px; width:15px; height:15px; text-align:center;' class='tableBorder'><a href='#' onClick='hideStory();'><span class='content'><strong>&nbsp;X&nbsp;</strong><span></a></div><span class='content'>"+arg+"</span>";
	
	var leftPos=(winW/2)-(width/2)-theLeft;
	divLayer.style.left=leftPos;
	
	var topPos=(winH/2)-(height/2)+theTop;
	divLayer.style.top=topPos;
}

function grabComputedStyle(elementObject){
    if(document.defaultView&&document.defaultView.getComputedStyle)
        return document.defaultView.getComputedStyle(elementObject, null);
    else if(elementObject.currentStyle)
        return elementObject.currentStyle;
    else
        return null;
}

function grabComputedHeight(elementObject){
    var height=grabComputedStyle(elementObject).height;
    if(height!=null){
        if(height.indexOf('px')!=-1)
            height=height.substring(0, height.indexOf('px'));
        if(height=='auto'){
            if(elementObject.offsetHeight)
                height=elementObject.offsetHeight;
        }
    }
    return height;
}

function grabComputedWidth(elementObject){
    var width=grabComputedStyle(elementObject).width;
    if(width!=null){
        if(width.indexOf('px')!=-1)
            width=width.substring(0, width.indexOf('px'));
        if(width=='auto'){
            if(elementObject.offsetWidth)
                width=elementObject.offsetWidth;
        }
    }
    return width;
}

function printForm(arg){
	if(pdfDocs[arg].indexOf('pdf')!=-1){
		width=780;
		height=565;
	}else{
		width=780;
		height=575;
	}
	custWindowLink(pdfDocs[arg],width,height)
}

function custWindowLink(arg1,width,height){
	var left=(screen.width/2)-width/2;
	var top=(screen.height/2)-height/2;
	var features='width='+width+',height='+height+',left='+left+',top='+top+',resizable=1';
	window.open(arg1,'sbbsPopup',features);
}

// addLoadEvent created by: Simon Willison 
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent
// Modified by Christopher Donnelly 01/28/2007 to save the passed 
// function into a variable for use after moving or resizing images.
function addLoadEvent(arg){
	addShadows=arg;
	var oldonload=window.onload;
	if(typeof window.onload!='function') window.onload=addShadows;
	else{
		window.onload=function(){
			if(oldonload) oldonload();
			addShadows();
		}
	}
}

addLoadEvent(
	function() {
		// Created by: Michael Burt
		// http://galaxydefense.ga.funpic.org/
		// Modified by : Christopher Donnelly 01/28/2007 to append Child objects within container objects 
		var a=document.all?document.all:document.getElementsByTagName('*');
		var b=returnObjById(shadowContainer);
		for(var i=0;i<a.length;i++){
			if (a[i].className==searchClass){
				for (x=0;x<shadowDepth;x++){
					var newSd=document.createElement('DIV');
					newSd.className=shadowClass;
					newSd.style.background=shadowColor;
					newSd.style.width=a[i].offsetWidth+'px';
					newSd.style.height=a[i].offsetHeight+'px';
					newSd.style.left=a[i].offsetLeft+x+'px';
					newSd.style.top=a[i].offsetTop+x+'px';
					b.appendChild(newSd);
				}
			}
		}
	}
);

function removeShodows(){
	var b = returnObjById(shadowContainer);
	var i=b.childNodes.length;
	for(var i=b.childNodes.length;i>=0;i--){
		if(b.childNodes[i]!=null){
			if(b.childNodes[i].className==shadowClass) b.removeChild(b.childNodes[i]);
		}
	}
}

function showHideInfo(arg){
	var tableLayerObj=returnObjById(arg+'Block');
	if(prevTableObj){
		prevTableObj.style.display="none";
		removeShodows();
	}
	if(tableLayerObj!=prevTableObj){
		tableLayerObj.style.display="block";
		prevTableObj=tableLayerObj;
		addShadows();
	}else{
		prevTableObj=null;
	}
}

function showLargerImage(arg){					
	var divLayer=returnObjById(arg);

	if (parseInt(navigator.appVersion)>3){
		if (navigator.appName=="Netscape"){
			winH=window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1){
			winH=document.body.offsetHeight;
		}
	}
	if(document.documentElement&&document.documentElement.scrollTop){
		theTop=document.documentElement.scrollTop;
		var b=document.getElementsByTagName('body');
	}else if(document.body){
		theTop=document.body.scrollTop;
		var b=document.body;
	}

	if(document.getElementById('blackOut')==null) {
		var newSd=document.createElement('DIV');
		newSd.id='blackOut';
		newSd.style.position='absolute';
		newSd.style.width=b.clientWidth;
		newSd.style.height=b.clientHeight;
		newSd.style.left='0px';
		newSd.style.top='0px';
		newSd.style.zIndex=divLayer.style.zIndex-1;
		newSd.className='transparent';
		b.appendChild(newSd);
	}


	divLayer.style.visibility='visible';
	document.getElementById('blackOut').style.visibility='visible';
	document.getElementById('blackOut').innerHTML='<a href="#" onClick="hideLargeImage(\'largeImageLayer\');return false;"><img src="images/trans.gif" width="'+b.clientWidth+'" height="'+b.clientHeight+'"></a>';	

	var height=grabComputedHeight(divLayer);
		
	var topPos=(winH/2)-(height/2)+theTop;
	divLayer.style.top=topPos;
	document.getElementById('blackOut').style.top=theTop;
}

function hideLargeImage(arg){
	if(document.getElementById('blackOut')!=null) document.getElementById('blackOut').style.visibility='hidden';
	document.getElementById(arg).style.visibility='hidden';
}

function swapPNG(arg1, arg2){
	if(IEverNum>=7){
		MM_swapImage(arg1,'',arg2,0);
		return;
	}
	if(swapPNG.arguments[swapPNG.arguments.length-1]){
		prevPNG=arg1;
		lastSpot=document.getElementById(arg1).style.filter;
	}
	document.images[arg1].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='"+arg2+"')";
}

function swapPNGrestore(){
	if(IEverNum>=7){
		MM_swapImgRestore();
		return;
	}
	document.images[prevPNG].style.filter=lastSpot;
}

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 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_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;
}
