function childCreate( parentFrame, childEleType, childTypeID ) { if ( parentFrame != "body" && (!document.getElementById || !document.getElementById(parentFrame)) ) { alert("childCreate:: Invalid parent frame target! (" + parentFrame+ ")"); return "";}
if (childEleType === "" || typeof childEleType == 'undefined') {childEleType = "div";}
if (childTypeID === "" || typeof childTypeID == 'undefined') {childTypeID = "Child";}
var childID = "" + parentFrame + childTypeID; if (childEleType != "text" && document.getElementById( childID )) { alert("Double child creation"); return "";}
var newEle = ( childEleType != "text" ? document.createElement(childEleType) : document.createTextNode(childTypeID) ); if (childEleType != "text") {newEle.setAttribute("id", childID);}
if (parentFrame != "body") { document.getElementById(parentFrame).appendChild( newEle );} else { document.body.appendChild( newEle );}
return childID;}
function childKill( childFrame ) { if ( !document.getElementById || !document.getElementById(childFrame) ) { alert("childKill:: Invalid child frame target! (" + childFrame+ ")"); return;}
var childNode = document.getElementById(childFrame); var parNode = childNode.parentNode; parNode.removeChild(childNode);}
function growDiv( eleID, upToWidth, upToHeight, speed, callback, timeout ) { if ( !document.getElementById || !document.getElementById(eleID) ) { alert("growDiv:: Invalid frame target! (" + eleID+ ")"); return;}
if (upToWidth === "" || typeof upToWidth == 'undefined' || upToHeight === "" || typeof upToHeight == 'undefined') { alert("growDiv:: Invalid dimensions specification!"); return;}
if (document.getElementById(eleID).style.display == "none") { document.getElementById(eleID).style.display = "block";}
if (speed === "" || typeof speed == 'undefined') {speed = 100;}
var element = document.getElementById( eleID ); if (element.style.width === "") {element.style.width = '1px';}
if (element.style.height === "") {element.style.height = '1px';}
var curWidth = parseInt(element.style.width, 10); var curHeight = parseInt(element.style.height, 10); if ( curWidth < upToWidth && curHeight < upToHeight) { var propWidth = curWidth + 0.2*upToWidth; var propHeight = curHeight + 0.2*upToHeight; element.style.width = ( propWidth > upToWidth ? upToWidth : propWidth ) + 'px'; element.style.height = ( propHeight > upToHeight ? upToHeight : propHeight ) + 'px'; setTimeout("growDiv( '" + eleID + "'," + upToWidth + "," + upToHeight + "," + speed + ", \"" + callback + "\", " + timeout + ")", speed);} else if (callback !== "" && typeof callback != 'undefined') { if (timeout === "" || typeof timeout == 'undefined') {timeout = 100;}
setTimeout(callback, timeout);}
}
function shrinkDiv( eleID, upToWidth, upToHeight, speed, callback, timeout ) { if ( !document.getElementById || !document.getElementById(eleID) ) { alert("shrinkDiv:: Invalid frame target!"); return;}
if (speed === "" || typeof speed == 'undefined') {speed = 50;}
var element = document.getElementById( eleID ); if (element.style.width === "" || element.style.height === "") { element.style.width = '0px'; element.style.height = '0px'; return;}
var curWidth = parseInt(element.style.width, 10); var curHeight = parseInt(element.style.height, 10); if ( curWidth > 0 && curHeight > 0) { var propWidth = curWidth - 0.25*upToWidth; var propHeight = curHeight - 0.25*upToHeight; element.style.width = ( propWidth > 0 ? propWidth : 0 ) + 'px'; element.style.height = ( propHeight > 0 ? propHeight : 0 ) + 'px'; setTimeout("shrinkDiv( '" + eleID + "'," + upToWidth + "," + upToHeight + "," + speed + ", \"" + callback + "\", " + timeout + ")", speed);} else if (callback !== "" && typeof callback != 'undefined') { if (document.getElementById(eleID).style.display == "block") { document.getElementById(eleID).style.display = "none";}
if (timeout === "" || typeof timeout == 'undefined') {timeout = 100;}
setTimeout(callback, timeout);}
}
function peakDiv( eleID, upToSize, fromLocation, speed, callback, timeout, percent, peakHide ) { if ( !document.getElementById || !document.getElementById(eleID) ) { alert("peakDiv:: Invalid frame target! (" + eleID+ ")"); return;}
if (upToSize === "" || typeof upToSize == 'undefined') { alert("peakDiv:: Invalid size specification!"); return;}
if (fromLocation === "" || typeof fromLocation == 'undefined' || fromLocation != "top" && fromLocation != "right"
&& fromLocation != "bottom" && fromLocation != "left" ) {fromLocation = "bottom";}
if (speed === "" || typeof speed == 'undefined') {speed = 50;}
if (peakHide === "" || typeof peakHide == 'undefined') {peakHide = 0;}
if (percent === "" || typeof percent == 'undefined') {percent = ( peakHide ? 1 : 0.1 );}
var element = document.getElementById( eleID ); var baseSide = "top"; if (fromLocation == "left" || fromLocation == "right") {baseSide = "left";}
if (element.style[baseSide] === "" || typeof element.style[baseSide] == 'undefined' ) {element.style[baseSide] = "1px";}
var inverted = (fromLocation == "bottom" || fromLocation == "right"); var scrollAmount = ( window.pageYOffset
? window.pageYOffset
: ( document.documentElement && document.documentElement.scrollTop
? document.documentElement.scrollTop
: document.body.scrollTop
) ); var pageSize = ( fromLocation == "bottom"
? ( window.innerHeight
? window.innerHeight
: (document.documentElement && document.documentElement.clientHeight
? document.documentElement.clientHeight
: document.body.clientHeight )
)
: ( fromLocation == "right"
? ( window.innerWidth
? window.innerWidth
: ( document.documentElement && document.documentElement.clientWidth
? document.documentElement.clientWidth
: document.body.clientWidth
)
)
: 0
) ); var baseLoc = parseInt( (baseSide == "top" ? scrollAmount : 0), 10 ) + parseInt( (inverted ? pageSize : 0), 10 ) - ( fromLocation == "left" || fromLocation == "top" ? upToSize-10 : 0) - ( fromLocation == "right" ? 15 : 0); if ( !peakHide && percent < 1 || peakHide && percent > 0 ) { element.style[baseSide] = baseLoc + percent*( inverted ? -upToSize : upToSize ) + 'px'; if (peakHide) {percent -= 0.1;}
else {percent += 0.1;}
setTimeout("peakDiv( '" + eleID + "'," + upToSize + ", '" + fromLocation + "'," + speed + ", \"" + callback + "\", " + timeout + ", " + percent + ", " + peakHide + ")", speed);} else { if (peakHide) { element.style.display = "none"; setTimeout( "childKill( '" + eleID + "' )", 100 );}
else if (callback !== "" && typeof callback != 'undefined') { if (timeout === "" || typeof timeout == 'undefined') {timeout = 100;}
if (baseSide == "top") { var followInt = setInterval("followEdge('" + eleID + "', '" + fromLocation + "'," + upToSize + ")", 1); setTimeout("clearInterval("+followInt+")", (timeout >= 50 ? timeout-50 : 10)); setTimeout(callback, timeout);}
else { setTimeout(callback, timeout);}
}
}
}
function hideDiv( eleID, upToSize, fromLocation, speed, callback, timeout ) { peakDiv( eleID, upToSize, fromLocation, speed, callback, timeout, 1, 1 );}
function followEdge( eleID, topBottom, offset ) { if ( !document.getElementById || !document.getElementById(eleID) ) { alert("peakDiv:: Invalid frame target! (" + eleID+ ")"); return;}
if (offset === "" || typeof offset == 'undefined') { alert("followBottom:: Invalid offset specification!"); return;}
var element = document.getElementById( eleID ); if (element.style.top === "" || typeof element.style.top == 'undefined' ) {element.style.top = "1px";}
if (topBottom === "" || typeof topBottom == 'undefined' || topBottom != "top") {topBottom = "bottom";}
var scrollAmount = ( window.pageYOffset
? window.pageYOffset
: ( document.documentElement && document.documentElement.scrollTop
? document.documentElement.scrollTop
: document.body.scrollTop
) ); var pageSize = ( window.innerHeight
? window.innerHeight
: (document.documentElement && document.documentElement.clientHeight
? document.documentElement.clientHeight
: document.body.clientHeight ) ); var baseLoc = parseInt( scrollAmount, 10 ) + parseInt( (topBottom == "bottom" ? pageSize : 0), 10 ) - ( topBottom == "top" ? offset-10 : 0); element.style.top = (baseLoc + ( topBottom == "bottom" ? -offset : offset )) + 'px';}
function qsParse(strQuery) { var assocAry = {}; if (strQuery === "" || typeof strQuery == 'undefined') { strQuery = window.location.search.substring(1);}
var aryPairs = strQuery.split("&"); var aryPair, i; for ( i = 0; i < aryPairs.length; ++i ) { aryPair = aryPairs[i].split("="); assocAry[ aryPair[0] ] = aryPair[1];}
return assocAry;}
function quickPeakMsg( message, popSide, delayTime, showTime ) { if (message === "" || typeof message == 'undefined') { alert("quickPeakMsg:: Invalid message!"); return;}
if (popSide === "" || typeof popSide == 'undefined' || popSide != "top" && popSide != "right"
&& popSide != "bottom" && popSide != "left" ) {popSide = "bottom";}
var side = (popSide == "left" || popSide == "right"); if (delayTime === "" || typeof delayTime == 'undefined') {delayTime = 1000;}
if (showTime === "" || typeof showTime == 'undefined') {showTime = 3000;}
var xx; childCreate( xx = childCreate( 'body', 'div', Math.floor(Math.random()*100) ), 'text', message ); document.getElementById(xx).setAttribute('class', "pointsPopper reg1p5"); document.getElementById(xx).setAttribute('className', "pointsPopper reg1p5"); if (side) { document.getElementById(xx).style.right = ''; document.getElementById(xx).style.top = '10px'; document.getElementById(xx).style.left = '-207px';}
var delay = function() { peakDiv(xx, (side ? 207 : 64), popSide, '', "hideDiv('" + xx + "', " +(side ? 207 : 64)+ ", '"+popSide+"')", showTime );}; setTimeout( delay, delayTime);}
function addEvent( type, func, target ) { var oldEvent, newEvent; if (target === "" || typeof target == 'undefined') { target = window;}
switch (type) { case "onload":
oldEvent = target.onload; break; case "onmouseover":
oldEvent = target.onmouseover; break; case "onmouseout":
oldEvent = target.onmouseout; break; case "onclick":
oldEvent = target.onclick; break; case "onmousedown":
oldEvent = target.onmousedown; break; case "onmouseup":
oldEvent = target.onmouseup; break;}
newEvent = function() { if (oldEvent) { oldEvent();}
func();}; switch (type) { case "onload":
target.onload = newEvent; break; case "onmouseover":
target.onmouseover = newEvent; break; case "onmouseout":
target.onmouseout = newEvent; break; case "onclick":
target.onclick = newEvent; break; case "onmousedown":
target.onmousedown = newEvent; break; case "onmouseup":
target.onmouseup = newEvent; break;}
}
function addLoadEvent(func, target) { addEvent( "onload", func, target );}
var queryObject = qsParse(); if ( queryObject.popMessage === "" || typeof queryObject.popMessage == 'undefined' ) { var msgText = ""; if (queryObject.popMsg == "postForumMsg") { msgText = "You just earned yourself 0.25 GAViCs by posting that message!";}
else if (queryObject.popMsg == "takeTest") { msgText = "You just earned yourself 0.25 GAViCs by taking that test!";}
else if (queryObject.popMsg == "buyCard") { msgText = "Congratulations!  You've successfully purchased a trading card!";}
else if (queryObject.popMsg == "buyPoster") { msgText = "Congratulations!  You've successfully purchased an official poster!";}
else if (queryObject.popMsg == "buyHpSpace") { msgText = "Congratulations!  You've successfully purchased homepage space!";}
if ( msgText !== "" ) { addLoadEvent( function() {quickPeakMsg( msgText );} );}
}
