var y
var ty = new Array()
var FadeMethod = -2
var opac = 100
var opac2 = 0
var topac = new Array()

var trainl = 0
var traindivl = 0
var trainp = 0
var traing = 1
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
var trainpush = 0
var trainp = 0
var traininc = 0
trainmove = 2

var engaged
var trivtime = 15

var sticker
var sticktime

function DoRotate()
{
	clearTimeout(sticktime)
	sticker = document.getElementById("sticker").value
	sticker -= (0-1)
	if (sticker > 7)
	{
		sticker = 1
	}
	document.getElementById("sticker").value = sticker
	if (sticker == 1)
	{
		document.getElementById("StickerPic").src = "Images/kissme5.jpg"
	}
	else if (sticker == 2)
	{
		document.getElementById("StickerPic").src = "Images/blowme.jpg"
	}
	else if (sticker == 3)
	{
		document.getElementById("StickerPic").src = "Images/loveme.jpg"
	}
	else if (sticker == 4)
	{
		document.getElementById("StickerPic").src = "Images/touchme.jpg"
	}
	else if (sticker == 5)
	{
		document.getElementById("StickerPic").src = "Images/lickme.jpg"
	}
	else if (sticker == 6)
	{
		document.getElementById("StickerPic").src = "Images/holdme.jpg"
	}
	else if (sticker == 7)
	{
		document.getElementById("StickerPic").src = "Images/feelme.jpg"
	}
	sticktime = setTimeout("DoRotate()",5000)
}

function StopRotate()
{
	clearTimeout(sticktime)
}

function StartRotate()
{
	var sticktime = setTimeout("DoRotate()",5000)
}

function TriviaTime()
{
	trivtime -= 1
	document.getElementById("timer").innerHTML = trivtime
	if (trivtime == 0)
	{
		document.getElementById("QuestionForm").submit()
	}
	else
	{
		var tt = setTimeout("TriviaTime()",1000)
	}
}

function Trivia()
{
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="ShowQuestion.php?sid="+Math.random()
  xmlHttp.onreadystatechange=DoTrivia
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoTrivia() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("Question").innerHTML=xmlHttp.responseText
		var tt = setTimeout("TriviaTime()",1000)
  }
}

function OverNav(choice)
{
	if (engaged && engaged != choice)
	{
		Out2()
	}
	if (!engaged)
	{
		var thisone = "nav" + choice
		var thatone = "subnav" + choice
		document.getElementById(thatone).style.height = "auto"
		if (document.getElementById(thatone).offsetHeight > 300)
		{
			document.getElementById(thatone).style.height = "300px"
			document.getElementById(thatone).style.overflow = "scroll"
		}
		engaged = choice
	}
}

function Out2()
{
	var thisone = "nav" + engaged
	var thatone = "subnav" + engaged
	document.getElementById(thatone).style.height = "0px"
	document.getElementById(thatone).style.overflow = "hidden"
	engaged = ""
}

function GalDisp(image,gal,folder)
{
	document.getElementById("Display").innerHTML = "<a href=\"Display.php?gal=" + gal + "&choice=" + image + "\"><img src=\"Pics/" + folder + "/" + image + "\" style=\"border:solid 1px #333333;\" /></a>"
}

function getMouseXY2(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

  return tempX
}

function getMouseXY2(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

  return tempY
}

function MouseMove(e)
{
	var startx = tempX
	var endx = getMouseXY(e)
	var swidth = document.getElementById("TrainDiv").offsetWidth
	var twidth = document.getElementById("TrainWidth").value
	if (startx < endx && trainp >= 0 - (twidth - swidth) - 600)
	{
		var mpct = Math.ceil(((endx - startx) / swidth) * 100) / 100
		var xpush = mpct * twidth * (2/3)
		trainp -= xpush
		trainmove = 2
	}
	else if (endx < startx && trainp <= 300)
	{
		var mpct = Math.ceil(((startx - endx) / swidth) * 100) / 100
		var xpush = mpct * twidth * (2/3)
		trainp -= (0-xpush)
		trainmove = -2
	}
	document.getElementById("Train").style.left = trainp + "px"
}

function MouseMove2(e)
{
	var start = tempY
	var end = getMouseXY2(e)
	var outer = document.getElementById("TrainDiv").offsetHeight
	var inner = document.getElementById("Train").offsetHeight
	if (start < end)
	{
		mpct = (end - start) / 100
		if (mpct > .025)
		{
			mpct = .025
		}
		var pusher = mpct * inner * (2/3)
		if (pusher > outer * .1)
		{
			pusher = outer * .1
		}
		trainp -= pusher
		trainmove = 2
	}
	else if (end < start)
	{
		mpct = (start - end) / 100
		if (mpct > .025)
		{
			mpct = .025
		}
		var pusher = mpct * inner * (2/3)
		if (pusher > outer * .1)
		{
			pusher = outer * .1
		}
		trainp -= (0-pusher)
		trainmove = -2
	}
	if (trainp < (outer - inner))
	{
		trainp = outer - inner
	}
	if (trainp > 0)
	{
		trainp = 0
	}
	document.getElementById("Train").style.top = trainp + "px"
}

var Text = ""
var Banner = ""
var Square = ""
var Column = ""
var BaseStyle = "border:solid 1px black;opacity:0.5;filter:alpha(opacity=50);moz-opacity:0.5;position:absolute;"
var Full = 200
var Long = 126
var Med = 96
var Short = 66
var Tiny = 26
var Color = new Array()
Color['One'] = ""
Color['Two'] = ""
Color['Banner'] = ""
Color['Square'] = ""
Color['Column'] = ""
var Width = new Array()
Width['One'] = ""
Width['Two'] = ""
Width['Banner'] = ""
Width['Square'] = ""
Width['Column'] = ""
var Height = new Array()
Height['One'] = ""
Height['Two'] = ""
Height['Banner'] = ""
Height['Square'] = ""
Height['Column'] = ""
var Left = new Array()
Left['One'] = ""
Left['Two'] = ""
Left['Banner'] = ""
Left['Square'] = ""
Left['Column'] = ""
var Top = new Array()
Top['One'] = ""
Top['Two'] = ""
Top['Banner'] = ""
Top['Square'] = ""
Top['Column'] = ""
var In = new Array()
In['One'] = ""
In['Two'] = ""
In['Page'] = ""
var Style = new Array()
Style['One'] = ""
Style['Two'] = ""
Style['Banner'] = ""
Style['Square'] = ""
Style['Column'] = ""
var Code = new Array()
Code['Page'] = ""
Code['One'] = ""
Code['Two'] = ""
Code['Banner'] = ""
Code['Square'] = ""
Code['Column'] = ""

function GetTextSize()
{
	if (Text == "Short-Long")
	{
		Width['One'] = Short
		Width['Two'] = Long
	}
	else if (Text == "Medium-Medium")
	{
		Width['One'] = Med
		Width['Two'] = Med
	}
	else if (Text == "Long-Short")
	{
		Width['One'] = Long
		Width['Two'] = Short
	}
	else if (Text == "Full")
	{
		Width['One'] = Full
	}
	Left['One'] = "left:4px;";
	Left['Two'] = "left:" + (Width['One'] - (0-12)) + "px;"
}

function DownStep(Orig)
{
	if (Orig == 200)
	{
		return 126
	}
	else if (Orig == 126)
	{
		return 96
	}
	else if (Orig == 96)
	{
		return 66
	}
	else if (Orig == 66)
	{
		return 26
	}
	else if (Orig == 26)
	{
		return 26
	}
}

function GetImageSize(Mode,Var)
{
	var DoMode = Mode.split(" ")
	Pos = DoMode[0]
	Par = DoMode[1]
	
	if (Par == "Page")
	{
		Width[Var] = Full
		Height['One'] = 156
		Height['Two'] = 156
		if (Pos == "Head")
		{
			Top['One'] = "top:46px;"
			Top['Two'] = "top:46px;"
		}
	}
	else if (Pos != "Float" && Par != "Page")
	{
		if (Width[Par] != Full)
		{
			Width[Var] = Width[Par] - 10
		}
		else
		{
			Width[Var] = DownStep(Width[Par])
		}
	}
	else
	{
		Width[Var] = DownStep(Width[Par])
		if (Pos == "Float")
		{
			Width[Var] = DownStep(Width[Var])
		}
	}
	
	if (Var == "Column")
	{
		Width[Var] /= 2.5
	}
	
	var doleft = 0
	
	if (Pos == "Head")
	{
		Top[Var] = "top:4px;"
		doleft = (Width[Par] - Width[Var]) / 2
		if (Par == "Page")
		{
			doleft = 4
		}
		Left[Var] = "left:" + doleft + "px;"
	}
	else if (Pos == "Float" && Par == "One")
	{
		Top[Var] = "top:4px;"
		Left[Var] = "left:4px;"
	}
	else if ((Pos == "Float" && Par == "Two") || Pos == "FloatRight")
	{
		Top[Var] = "top:4px;"
		Left[Var] = "right:4px;"
	}
	else if (Pos == "Foot")
	{
		Top[Var] = "bottom:4px;"
		doleft = (Width[Par] - Width[Var]) / 2
		if (Par == "Page")
		{
			doleft = 4
		}
		Left[Var] = "left:" + doleft + "px;"
	}
	
	In[Par] = Var
}

function LayoutShow()
{
	Text = document.getElementById("TextMode").options[document.getElementById("TextMode").selectedIndex].value
	Banner = document.getElementById("BannerMode").options[document.getElementById("BannerMode").selectedIndex].value
	Square = document.getElementById("SquareMode").options[document.getElementById("SquareMode").selectedIndex].value
	Column = document.getElementById("ColumnMode").options[document.getElementById("ColumnMode").selectedIndex].value
	
	Color['One'] = ""
	Color['Two'] = ""
	Color['Banner'] = ""
	Color['Square'] = ""
	Color['Column'] = ""
	
	Width['One'] = ""
	Width['Two'] = ""
	Width['Banner'] = ""
	Width['Square'] = ""
	Width['Column'] = ""
	
	Height['One'] = ""
	Height['Two'] = ""
	Height['Banner'] = ""
	Height['Square'] = ""
	Height['Column'] = ""
	
	Left['One'] = ""
	Left['Two'] = ""
	Left['Banner'] = ""
	Left['Square'] = ""
	Left['Column'] = ""
	
	Top['One'] = ""
	Top['Two'] = ""
	Top['Banner'] = ""
	Top['Square'] = ""
	Top['Column'] = ""
	
	In['One'] = ""
	In['Two'] = ""
	In['Page'] = ""
	
	Style['One'] = ""
	Style['Two'] = ""
	Style['Banner'] = ""
	Style['Square'] = ""
	Style['Column'] = ""
	
	Code['Page'] = ""
	Code['One'] = ""
	Code['Two'] = ""
	Code['Banner'] = ""
	Code['Square'] = ""
	Code['Column'] = ""
	
	Color['One'] = "red"
	Color['Two'] = "green"
	Color['Banner'] = "blue"
	Color['Square'] = "cyan"
	Color['Column'] = "yellow"
	
	GetTextSize()
	GetImageSize(Banner,'Banner')
	GetImageSize(Square,'Square')
	GetImageSize(Column,'Column')
	
	if (!Top['One'])
	{
		Top['One'] = "top:4px;";
		Top['Two'] = "top:4px;";
	}
	
	if (!Height['One'])
	{
		Height['One'] = 198
		Height['Two'] = 198
	}
	
	Height['Banner'] = ((Width['Banner'] - (0-2)) / 5) - 2
	Height['Square'] = Width['Square']
	Height['Column'] = ((Width['Column'] - (0-2)) * 2) - 2

	Style['One'] = BaseStyle + "background-color:" + Color['One'] + ";" + Left['One'] + Top['One'] + "width:" + Width['One'] + "px;" + "height:" + Height['One'] + "px;"
	Style['Two'] = BaseStyle + "background-color:" + Color['Two'] + ";" + Left['Two'] + Top['Two'] + "width:" + Width['Two'] + "px;" + "height:" + Height['Two'] + "px;"
	Style['Banner'] = BaseStyle + "background-color:" + Color['Banner'] + ";" + Left['Banner'] + Top['Banner'] + "width:" + Width['Banner'] + "px;" + "height:" + Height['Banner'] + "px;"
	Style['Square'] = BaseStyle + "background-color:" + Color['Square'] + ";" + Left['Square'] + Top['Square'] + "width:" + Width['Square'] + "px;" + "height:" + Height['Square'] + "px;"
	Style['Column'] = BaseStyle + "background-color:" + Color['Column'] + ";" + Left['Column'] + Top['Column'] + "width:" + Width['Column'] + "px;" + "height:" + Height['Column'] + "px;"
	
	Code['One'] = "<div id=\"One\" style=\"" + Style['One'] + "\">"
	Code['Two'] = "<div id=\"Two\" style=\"" + Style['Two'] + "\">"
	Code['Banner'] = "<div id=\"Banner\" style=\"" + Style['Banner'] + "\"></div>"
	Code['Square'] = "<div id=\"Square\" style=\"" + Style['Square'] + "\"></div>"
	Code['Column'] = "<div id=\"Column\" style=\"" + Style['Column'] + "\"></div>"
	
	if (In['One'])
	{
		Code['One'] += Code[In['One']]
	}
	if (In['Two'])
	{
		Code['Two'] += Code[In['Two']]
	}
	Code['One'] += "</div>"
	Code['Two'] += "</div>"
	if (In['Page'])
	{
		Code['Page'] = Code[In['Page']]
	}
	Code['Page'] += Code['One']
	if (Text != "Full")
	{
		Code['Page'] += Code['Two']
	}
	document.getElementById("LayoutDiv").innerHTML = Code['Page']
	
}

function WordCount(ta)
{
	var WC = "WC" + ta
	var formcontent=document.getElementById(ta).value
	var initial_whitespace_rExp = /^[^A-Za-z0-9'"]+/gi;
	var left_trimmedStr = formcontent.replace(initial_whitespace_rExp, "");
	var non_alphanumerics_rExp = /[^A-Za-z0-9'"]+/gi;
	formcontent = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
	formcontent = formcontent.split(/\s/)
	document.getElementById(WC).value=formcontent.length - 1
}

function Brighten(choice)
{
	clearTimeout(ty[choice])
	dochoice = "Thumb" + choice
	if (!topac[choice])
	{
		topac[choice] = 50
	}
	topac[choice] -= (0-2)
	document.getElementById(dochoice).style.filter="alpha(opacity=" + topac[choice] + ")"
	document.getElementById(dochoice).style.MozOpacity=(topac[choice] / 100)
	document.getElementById(dochoice).style.opacity=(topac[choice] / 100)
	if (topac[choice] < 100)
	{
		ty[choice] = setTimeout("Brighten(" + choice + ")",10)
	}
}

function Darken(choice)
{
	clearTimeout(ty[choice])
	dochoice = "Thumb" + choice
	if (!topac[choice])
	{
		topac[choice] = 51
	}
	topac[choice] -= 2
	document.getElementById(dochoice).style.filter="alpha(opacity=" + topac[choice] + ")"
	document.getElementById(dochoice).style.MozOpacity=(topac[choice] / 100)
	document.getElementById(dochoice).style.opacity=(topac[choice] / 100)
	if (topac[choice] > 50)
	{
		ty[choice] = setTimeout("Darken(" + choice + ")",10)
	}
}

function doPreload(folder)
{
	for (var i = 1; i <= document.getElementById("IMax").value; i++)
	{
		var a = new Image()
		a.src = folder + Images[i]
	}
}

function DoSub2(Sub,Exp,Price)
{
	document.getElementById("Subscription").value = Sub
	document.getElementById("Expire").value = Exp
	document.getElementById("Price").value = Price
	
	document.getElementById("JoinForm").submit()
}

function DoSub(Sub,Exp,Price)
{
	var Email = document.getElementById("Email").value
	var Password = document.getElementById("Password").value
	var PW2 = document.getElementById("PW2").value
	
	document.getElementById("Subscription").value = Sub
	document.getElementById("Expire").value = Exp
	document.getElementById("Price").value = Price
	
	if (Email && Password)
	{
		if (Password == PW2)
		{
			document.getElementById("JoinForm").submit()
		}
		else
		{
			alert("Passwords Don't Match")
		}
	}
	else
	{
		alert("Please fill out all required fields.")
	}
}

function Help(helptext)
{
	document.getElementById("Help").innerHTML = helptext
	document.getElementById("Help").style.visibility = "visible"
	document.getElementById("Help").style.width = "100%"
	document.getElementById("Help").style.height = "auto"
	document.getElementById("Help").style.bottom = "0px"
	document.getElementById("Help").style.left = "0px"
}

function HelpClose()
{
	document.getElementById("Help").innerHTML = ""
	document.getElementById("Help").style.visibility = "hidden"
	document.getElementById("Help").style.width = "0px"
	document.getElementById("Help").style.height = "0px"
	document.getElementById("Help").style.bottom = "0px"
	document.getElementById("Help").style.left = "0px"
}

function IMan()
{
	if (document.getElementById("imanagetxt").innerHTML == "Open Image Manager")
	{
		document.getElementById("imanagetxt").innerHTML = "Close Image Manager"
		document.getElementById("imanage").style.width = "auto"
		document.getElementById("imanage").style.height = "auto"
	}
	else if (document.getElementById("imanagetxt").innerHTML == "Close Image Manager")
	{
		document.getElementById("imanagetxt").innerHTML = "Open Image Manager"
		document.getElementById("imanage").style.width = "0px"
		document.getElementById("imanage").style.height = "0px"
	}
}

function AMan()
{
	if (document.getElementById("amanagetxt").innerHTML == "Open Author Manager")
	{
		document.getElementById("amanagetxt").innerHTML = "Close Author Manager"
		document.getElementById("amanage").style.width = "auto"
		document.getElementById("amanage").style.height = "auto"
	}
	else if (document.getElementById("amanagetxt").innerHTML == "Close Author Manager")
	{
		document.getElementById("amanagetxt").innerHTML = "Open Author Manager"
		document.getElementById("amanage").style.width = "0px"
		document.getElementById("amanage").style.height = "0px"
	}
}

function IssueLoad()
{
	var x=document.getElementById("Issue")
	var iss = x.options[x.selectedIndex].value
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="IssueLoad.php?iss=" + iss + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoIssueLoad
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoIssueLoad()
{
	if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("Columns").innerHTML=xmlHttp.responseText
  }
}

function Comment(choice)
{
	var CLink = "CLink" + choice
	var CDiv = "CDiv" + choice
	
	if (document.getElementById(CLink).innerHTML == "Show Comments")
	{
		document.getElementById(CLink).innerHTML = "Hide Comments"
		document.getElementById(CDiv).style.width = "auto"
		document.getElementById(CDiv).style.height = "auto"
		document.getElementById(CDiv).style.visibility = "visible"
	}
	else
	{
		document.getElementById(CLink).innerHTML = "Show Comments"
		document.getElementById(CDiv).style.width = "0px"
		document.getElementById(CDiv).style.height = "0px"
		document.getElementById(CDiv).style.visibility = "hidden"
	}
}

function CPages(choice,post,maxpg)
{
	
	for (var i = 1; i <= maxpg; i++)
	{
		var CDiv = "CDiv" + post + "-" + i
		document.getElementById(CDiv).style.width = "0px"
		document.getElementById(CDiv).style.height = "0px"
		document.getElementById(CDiv).style.visibility = "hidden"
	}
	
	var CDiv = "CDiv" + post + "-" + choice
	
	document.getElementById(CDiv).style.width = "auto"
	document.getElementById(CDiv).style.height = "auto"
	document.getElementById(CDiv).style.visibility = "visible"
}

var Editing = ""

function ShowCEdit(choice)
{
	Editing = "Cmt" + choice
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="CEdit.php?choice=" + choice + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoCEdit
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function ShowCEdit2(choice,col,art)
{
	Editing = "Cmt" + choice
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="CEdit.php?choice=" + choice + "&method=2&col=" + col + "&art=" + art + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoCEdit
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoCEdit() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById(Editing).innerHTML=xmlHttp.responseText
  }
}

function BlogJoin(page,blogger)
{
	var bUN = document.getElementById("bUN").value
	var bPW = document.getElementById("bPW").value
	
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="BlogJoin.php?bUN=" + bUN + "&bPW=" + bPW + "&page=" + page + "&blogger=" + blogger + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoBlogJoin
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoBlogJoin() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("BLogin").innerHTML=xmlHttp.responseText
  }
}

function CheckBlogJoin()
{
	var UN = document.getElementById("blogUN").value
	var PW = document.getElementById("blogPW").value
	var Email = document.getElementById("blogEmail").value
	
	if (UN && PW && Email)
	{
		document.getElementById("blogSubmit").innerHTML = "<input type=\"submit\" value=\"Submit\" />"
	}
	else
	{
		document.getElementById("blogSubmit").innerHTML = "Please fill out <font color=\"red\">*</font>required fields to activate the submit button.<br /><input type=\"submit\" value=\"Submit\" disabled />"
	}
}

function Go(choice)
{
	document.location = choice;
}

function Over(choice)
{
	var thisone = "dd" + choice
	var thatone = "nav" + choice
	document.getElementById(thatone).style.color = "#dd6600";
	document.getElementById(thisone).style.visibility = "visible"
}

function Out(choice)
{
	var thisone = "dd" + choice
	var thatone = "nav" + choice
	document.getElementById(thatone).style.color = "white";
	document.getElementById(thisone).style.visibility = "hidden"
}

function Expand(choice)
{
	var thisone = "outer" + choice
	var td = "tdo" + choice
	document.getElementById(thisone).style.height = "auto"
	document.getElementById(td).style.zIndex = 1
}

function Contract(choice)
{
	var thisone = "outer" + choice
	var td = "tdo" + choice
	document.getElementById(thisone).style.height = "22px"
	document.getElementById(td).style.zIndex = 0
}

var turn = 0
var paused = 0
var folder = ""

function Fade()
{
	//document.getElementById("AFade").style.visibility="visible"
	clearTimeout(y)
	opac = Math.floor(opac + FadeMethod)
	opac2 = (100 - opac)
	//document.getElementById("Fader").style.filter="alpha(opacity=" + opac + ")"
	//document.getElementById("Fader").style.MozOpacity=(opac / 100)
	//document.getElementById("Fader").style.opacity=(opac / 100)
	document.getElementById("FadeImg").style.filter="alpha(opacity=" + opac + ")"
	document.getElementById("FadeImg").style.MozOpacity=(opac / 100)
	document.getElementById("FadeImg").style.opacity=(opac / 100)
	document.getElementById("FadeImg2").style.filter="alpha(opacity=" + opac2 + ")"
	document.getElementById("FadeImg2").style.MozOpacity=(opac2 / 100)
	document.getElementById("FadeImg2").style.opacity=(opac2 / 100)
	//document.getElementById("AFade").style.height = opac2 + "px"
	if (opac == 0)
	{
		FadeMethod = FadeMethod * (0-1)
		var curimg = document.getElementById("ICount").value
		var maximg = IMax
		curimg = curimg - (0-1)
		if (curimg > maximg)
		{
			curimg = 1
		}
		if (document.getElementById("FadeSpan"))
		{
			document.getElementById("Slide1").style.zIndex = 1
			document.getElementById("Slide2").style.zIndex = 2
			document.getElementById("FadeSpan").innerHTML = "<a href=\"Display.php?ss=" + document.getElementById("ssgal").value +"&choice=" + Images[curimg] + "\"><img src=\"Pics/Gal/" + Images[curimg] + "\" style=\"border:solid 1px #333333;opacity:0.0;filter:alpha(opacity=0);moz-opacity:0.0;\" id=\"FadeImg\" /></a>"
		}
		else
		{
			document.getElementById("FadeImg").src = folder + Images[curimg];
			document.getElementById("FadeImg").style.zIndex = 1
			document.getElementById("FadeImg2").style.zIndex = 2
		}
		document.getElementById("ICount").value = curimg
		y = setTimeout("Fade()",turn)
	}
	else if (opac == 100)
	{
		FadeMethod = FadeMethod * (0-1)
		curimg = document.getElementById("ICount").value
		maximg = IMax
		curimg = curimg - (0-1)
		if (curimg > maximg)
		{
			curimg = 1
		}
		if (document.getElementById("FadeSpan2"))
		{
			document.getElementById("Slide1").style.zIndex = 2
			document.getElementById("Slide2").style.zIndex = 1
			document.getElementById("FadeSpan2").innerHTML = "<a href=\"Display.php?ss=" + document.getElementById("ssgal").value +"&choice=" + Images[curimg] + "\"><img src=\"Pics/Gal/" + Images[curimg] + "\" style=\"border:solid 1px #333333;opacity:0.0;filter:alpha(opacity=0);moz-opacity:0.0;\" id=\"FadeImg2\" /></a>"
		}
		else
		{
			document.getElementById("FadeImg").style.zIndex = 2
			document.getElementById("FadeImg2").style.zIndex = 1
			document.getElementById("FadeImg2").src = folder + Images[curimg];
		}
		document.getElementById("ICount").value = curimg
		y = setTimeout("Fade()",turn)
	}
	else
	{
		y = setTimeout("Fade()",20)
	}
}

function SideBanners(doFade)
{
	/*var pagesize = document.getElementById("middle").offsetHeight
	if (document.getElementById("sidelinks"))
	{
		pagesize = pagesize - document.getElementById("sidelinks").offsetHeight
	}
	xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="AdTall.php?pagesize=" + pagesize + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoSideBanners
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)*/
	
	if (doFade == 1)
	{
		StartFade('http://www.mainstreamerotica.com/Pics/Home/',4000)
	}
	if (doFade == 2)
	{
		StartFade('http://www.mainstreamerotica.com/Images/',4000)
	}
}

function DoSideBanners() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("sidebanners").innerHTML=xmlHttp.responseText
  }
}

function StartFade(fchoice,turner)
{
	//document.getElementById("AFade").style.visibility="hidden"
	doPreload(fchoice)
	turn = turner
	folder = fchoice
	y = setTimeout("Fade()",turn)
}

function Slow()
{
	turn = turn * 2
	if (opac == 0 || opac == 100)
	{
		clearTimeout(y)
		y = setTimeout("Fade()",turn)
	}
}

function Fast()
{
	turn = turn / 2
	Fade()
}

function Pause()
{
	if (paused == 0)
	{
		paused = 1
		clearTimeout(y)
		document.getElementById("Pause").value="Play"
	}
	else
	{
		paused = 0
		Fade()
		document.getElementById("Pause").value="Pause"
	}
}

function Slide(choice,gal)
{
	clearTimeout(y)
	if (FadeMethod < 0)
	{
		document.getElementById("Slide1").style.zIndex = 2
		document.getElementById("Slide2").style.zIndex = 1
		document.getElementById("FadeSpan2").innerHTML = "<a href=\"Display.php?ss=" + document.getElementById("ssgal").value +"&choice=" + Images[choice] + "\"><img src=\"Pics/Gal/" + Images[choice] + "\" style=\"border:solid 1px #333333;opacity:0.0;filter:alpha(opacity=0);moz-opacity:0.0;\" id=\"FadeImg2\" /></a>"
	}
	else
	{
		document.getElementById("Slide1").style.zIndex = 1
		document.getElementById("Slide2").style.zIndex = 2
		document.getElementById("FadeSpan").innerHTML = "<a href=\"Display.php?ss=" + document.getElementById("ssgal").value +"&choice=" + Images[choice] + "\"><img src=\"Pics/Gal/" + Images[choice] + "\" style=\"border:solid 1px #333333;opacity:0.0;filter:alpha(opacity=0);moz-opacity:0.0;\" id=\"FadeImg\" /></a>"
	}
	document.getElementById("ICount").value = choice
	Fade("http://www.mainstreamerotica.com/Pics/Gal/",6000)
}

function DoCheck(choice)
{
	var cbox = "C" + choice
	var IString = document.getElementById("Images").value
	var ImageList = new Array()
	ImageList = IString.split(",")
	for (i = 0; i < ImageList.length; i++)
	{
		if (ImageList[i] == choice)
		{
			ImageList.splice(i,1)
		}
	}
	if (document.getElementById(cbox).checked == true)
	{
		ImageList.push(choice)
	}
	NString = ImageList.toString()
	document.getElementById("Images").value = NString
}

function GetPics()
{
	var x=document.getElementById("LICol")
	var col = x.options[x.selectedIndex].value
	var page = document.getElementById("LIPage").value
	var string = document.getElementById("Images").value
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="GetPics.php?col=" + col + "&pg=" + page + "&string=" + string + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoGetPics
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoGetPics() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("LPics").innerHTML=xmlHttp.responseText
  }
}

var curvote = ""

function Vote(member,article,vote)
{
	curvote = "Vote" + article
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="DoVote.php?member=" + member + "&article=" + article + "&vote=" + vote + "&sid="+Math.random()
  xmlHttp.onreadystatechange=DoVote
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function DoVote() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById(curvote).innerHTML=xmlHttp.responseText
  }
}

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    //Internet Explorer
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
