// JavaScript Document
/*********** Variables **************/
<!--
function FP_preloadImgs() 
{//v1.0
 var d=document,a=arguments; 
 if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) 
 	{
	d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; 
	}
}

function FP_swapImg() 
{//v1.0
 var doc=document,args=arguments,elm,n;
 doc.$imgSwaps=new Array(); 
 for(n=2; n<args.length; n+=2)
 	{ 
 	elm=FP_getObjectByID(args[n]); 
		if(elm)
			{
			doc.$imgSwaps[doc.$imgSwaps.length]=elm;
			elm.$src=elm.src; 
			elm.src=args[n+1]; 
			}
	}
}

function FP_swapLink() 
{//v1.0
 var doc=document,args=arguments,elm,n;
 doc.$linkSwaps=new Array(); 
 for(n=2; n<args.length; n+=2)
 	{ 
 	elm=FP_getObjectByID(args[n]); 
		if(elm)
			{
			doc.$linkSwaps[doc.$linkSwaps.length]=elm;
			elm.$link=elm.href; 
			elm.href=args[n+1]; 
			}
	}
}

function FP_getObjectByID(id,o) 
{//v1.0
 var c,el,els,f,m,n; 
 if(!o)
 	o=document; 
 if(o.getElementById) 
 	el=o.getElementById(id);
 else if(o.layers) 
 	c=o.layers;
 else if(o.all) 
 	el=o.all[id]; 
 if(el) 
 	return el;
 if(o.id==id || o.name==id) 
 	return o;
 if(o.childNodes) 
 	c=o.childNodes;
 if(c)
 	for(n=0; n<c.length; n++) 
		{ 
		el=FP_getObjectByID(id,c[n]);
		if(el) 
			return el; 
		}
 f=o.forms;
 if(f)
 	for(n=0; n<f.length; n++) 
		{ 
		els=f[n].elements;
 		for(m=0; m<els.length; m++)
			{ 
			el=FP_getObjectByID(id,els[n]);
			if(el) return el; 
			} 
		}
 return null;
}//

function textswitch(id,text)
{
	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
		var elem = document.getElementById(id);
		
		if(!hasInnerText){
			elem.textContent = text;
		} else{
			elem.innerText = text;
		}
}

function FP_swapOnClick() 
{//v1.0
 var doc=document,args=arguments,elm,n;
 doc.$clickSwaps=new Array(); 
 for(n=2; n<args.length; n+=2)
 	{ 
 	elm=FP_getObjectByID(args[n]); 
		if(elm)
			{
			doc.$clickSwaps[doc.$clickSwaps.length]=elm;
			elm.$click=elm.onclick; 
			elm.onclick=args[n+1]; 
			}
	}
}

function getAlt(id)
{
	var elem, alttext;
	elem = document.getElementById(id);
	alert(elem);
	alttext = elem.Alt;
	alert(alttext);
}

function movieswitch(imgloc,title,summary)//arguments-- mainimg loc, movie title, movie summary
{
	FP_swapImg(1,0,'mainimg',imgloc);//main picture swap
	textswitch('movietitle',title);//new title
	textswitch('moviesummary',summary);//new summary
}

function bioswitch(imgloc1,imgloc2,imgloc3,imgloc4,name1,name2,title,summary)//arguments-- main, thumb1,thumb2,thumb3,person,position,summary,onclickloc1,onclickloc2,onclickloc3
{
	FP_swapImg(1,0,'bio1',imgloc1);//main image swap
	FP_swapImg(1,0,'biothmb1',imgloc2);//thumb1 swap
	FP_swapImg(1,0,'biothmb2',imgloc3);//thumb2 swap
	FP_swapImg(1,0,'biothmb3',imgloc4);//thumb3 swap
	textswitch('name1',name1);//person
	textswitch('name2',name2);//person
	textswitch('position',title);//title
	textswitch('personsummary',summary);//summary
}

function biopic1()
{
	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
		var elem = document.getElementById('name1');
		
		if(!hasInnerText){
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.textContent + '1.jpg');
		} else{
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.innerText + '1.jpg');
		}		
	
}

function biopic2()
{
	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
		var elem = document.getElementById('name1');
		
		if(!hasInnerText){
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.textContent + '2.jpg');
		} else{
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.innerText + '2.jpg');
		}		
	
}

function biopic3()
{
	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
		var elem = document.getElementById('name1');
		
		if(!hasInnerText){
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.textContent + '3.jpg');
		} else{
			FP_swapImg(0,0,/*id*/'bio1',/*url*/'../Pictures/Bio/' + elem.innerText + '3.jpg');
		}	
}

function nextpic(id,amt,total)//must include pic id#
{
	var srcname,picnumb,elem,numero,nextnumb,writnumb,nameo;
	elem = document.getElementById(id);
	srcname = elem.src;
	picnumb = picnum(srcname);
	numero = whatnum(picnumb);
	nextnumb = numero + amt;
	if (nextnumb > total)
	{
		nextnumb = nextnumb - total;
	}
	//alert(nextnumb);
	writnumb = convertnum(nextnumb);
	nameo = newpic(srcname,writnumb);
	FP_swapImg(0,0,id,newpic(srcname,writnumb));
}

function picwinload(id)
{
	var elem,srcname,picnumb,nameo,elem2,srcname2;
	elem = document.getElementById(id);
	srcname = elem.src;
	elem2 = document.getElementById('pic');
	srcname2 = elem2.src;
	picnumb = picnum(srcname);
	nameo = newpic(srcname2,picnumb);
	FP_swapImg(1,0,'pic',nameo);
}

function newpic(name,nombo)
{
	var nleng,newname;
	nleng = name.length;
	newname = name.charAt(0);
	for(i=1;i<nleng-6;i++)
	{
			newname = newname + name.charAt(i);
	}
	newname = newname + nombo + '.jpg';
	return newname;
}

function prevpic(id,amt,total)//must include pic id#
{
	var srcname,picnumb,elem,numero,nextnumb,writnumb,nameo;
	elem = document.getElementById(id);
	srcname = elem.src;
	picnumb = picnum(srcname);
	numero = whatnum(picnumb);
	nextnumb = numero - amt;
	if (nextnumb < 1)
	{
		nextnumb = nextnumb + total;
	}
	writnumb = convertnum(nextnumb);
	nameo = newpic(srcname,writnumb);
	FP_swapImg(0,0,id,newpic(srcname,writnumb));
}

function picnum(name)//includes src string from picture
{
	var namelong,numb,numbout;
	namelong=name.length;
	numbout=(name.charAt(namelong-6)+ name.charAt(namelong-5));
	return numbout;
}

function convertnum(num)
{
	var nums, num1, num2, numba;
	nums = '0123456789';
	num1 = num/10 | 0;
	num2 = num%10;
	numba = nums.charAt(num1) + nums.charAt(num2);
	return numba;
}

function whatnum(num)
{
	var num1, num2, nums, numba;
	nums = '0123456789';
	num1 = num.charAt(0);
	num2 = num.charAt(1);
	for (i=0; i<10; i++)
	{
		if (num1 == nums.charAt(i))
		{
			num1=i;
		}
	}
	for (j=0; j<10; j++)
	{
		if (num2 == nums.charAt(j))
		{
			num2=j;
		}
	}
	numba = (num1*10) + num2;
	return numba;
}

-->