var flashArray = new Array();
flashArray[0] = "";
// Breite + Höhe für Bilder
var cw = 80;
var ch = 70;
// vordefinierte Breite + Höhe für Flash je nach LayoutType
var cw5 = 285;
var ch5 = 120;
var cw6 = 180;
var ch6 = 150;
var cw8 = 300;
var ch8 = 200;
var xo = 0;
var xo = 0;
var fw = 180;
var mfw = 320;
var fh = 116;
var mfh = 190;
//TOOLTIP STYLING
var c1 = "#EEEEEE";
var c2 = "#FFFFE0";
var c3 = "Verdana, Arial, Helvetica";
var c4 = "#0000DE";
var c5 = "#0000DE";
var c6 = "#008000";
var c7 = "#008000";
var c8 = "none";
var c9 = "underline";
var ca = "none";
var cb = "underline";
var tdw = 300;
var tw = 276;
if(navigator.appName == "Netscape"){
//document.write("");
}
function f1(oID, pN, pV){
document.getElementById(oID).style[pN] = pV;
}
function f2(objectID, pN, pV){
document.getElementById(objectID)[pN] = pV;
}
function f3(objectID, pN){
return document.getElementById(objectID).style[pN];
}
function f4(objectID, pN){
return document.getElementById(objectID)[pN];
}
var hideID = 0;
var lnum = 0;
var yn=1;
var txo = 10;
var tyo = 1;
var dragID = 0;
var isMacFF = ((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1));
function f5(string){
window.status = string;
return true;
}
function f6(){
window.status = '';
return true;
}
function f7(ele,dir)
{
(dir=="x") ? pos = ele.offsetLeft : pos = ele.offsetTop;
tempEle = ele.offsetParent;
while(tempEle != null)
{
pos += (dir=="x") ? tempEle.offsetLeft : tempEle.offsetTop;
tempEle = tempEle.offsetParent;
}
return pos;
}
function f8(){
if(window.pageYOffset != null) {
return window.pageYOffset;
} else {
return document.body.scrollTop;
}
}
function f9(){
if(window.pageXOffset != null){
return window.pageXOffset;
} else {
return document.body.scrollLeft;
}
}
function f10(arg1){
f11();
}
function f11(){
f1('contextAdedBox', 'visibility', 'hidden');
clearInterval(hideID);
f5(' ');
f2('contextAdedBox', 'innerHTML', "");
}
function f12(){
clearInterval(hideID);
}
function f13(){
if(whichDrag == ""){
clearInterval(hideID);
hideID = setInterval(f11, 1250);
//THIN DOUBLE UNDERLINE
linkRefString = "link" + lnum;
//f1(linkRefString, 'borderBottomWidth', '1px');
}
//TURN OFF AUDIO
f15();
}
function f14(creativeurl){
window.open(creativeurl);
}
function f15(){
try {
if(window.document.myFlashMovie)
window.document.myFlashMovie.SetVariable("jsAudioAdjust", "AUDIO_OFF");
} catch(err) {
}
}
function f16(){
try {
if(window.document.myFlashMovie)
window.document.myFlashMovie.SetVariable("jsAudioAdjust", "AUDIO_ON");
} catch(err) {
}
}
function f17(tooltipRef, idString){
//TURN ON AUDIO
f16();
var browserType = navigator.appName;
switch(browserType){
case('Netscape'):
tooltipRef.style.MozOpacity = 1.0;
break;
case('Microsoft Internet Explorer'):
// document.getElementById(idString).style.filter = "alpha(opacity=100)";
break;
default:
document.getElementById(idString).style.opacity = 1;
}
if(yn != 9){
for(var x=1;x<7;x++){
var tempID = "cZn" + x;
document.getElementById(tempID).style.background = c2;
}
}
//enlarge flash
if(yn == 7){
clearInterval(mfd);
f21();
}
}
function f18(tooltipRef, idString){
//TURN OFF AUDIO
f15();
var browserType = navigator.appName;
switch(browserType){
case('Netscape'):
tooltipRef.style.MozOpacity = 1.0;
break;
case('Microsoft Internet Explorer'):
//document.getElementById(idString).style.filter = "alpha(opacity=95)";
break;
default:
document.getElementById(idString).style.opacity = 1.0;
}
if(yn != 9){
for(var x=1;x<7;x++){
var tempID = "cZn" + x;
document.getElementById(tempID).style.background = c1;
}
}
//shrink flash
//clearInterval(mfd);
//mfd = setTimeout('f22()', fsd);
}
// - (growing tooltip code) -------------------------------
function f19(objectName,startW,endW,startH,endH,growTime){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.growID == "number")clearInterval(objectRef.growID);
var time = growTime*1000;//duration of the blend in miliseconds
var steps = 50*growTime;//steps in the animation (should be framerate*("var time" in seconds))
var growWArray = new Array();
var growHArray = new Array();
//calculate changes in x and y coordinates
var growDeltaW = (endW - startW)/steps;
var growDeltaH = (endH - startH)/steps;
for(x=0; x<=steps; x++){
growWArray.push(Math.round(startW + (x * growDeltaW)));
growHArray.push(Math.round(startH + (x * growDeltaH)));
}
//animate grow using an inner function
objectRef.growStep = 0;
objectRef.nameString = objectName;
var growInterval = time/steps;
objectRef.growID = setInterval(growFunction,growInterval);
var selfReference = objectRef;
function growFunction(){
selfReference.growStep++;
if(selfReference.growStep <= steps){
//resize object
var tempW = growWArray[selfReference.growStep] + "px";
var tempH = growHArray[selfReference.growStep] + "px";
f1(selfReference.nameString, 'width', tempW);
f1(selfReference.nameString, 'height', tempH);
} else {
//account for remainder in case "step" is not a whole-number value
var tempW = endW + "px";
var tempH = endH + "px";
f1(selfReference.nameString, 'width', tempW);
f1(selfReference.nameString, 'height', tempH);
clearInterval(selfReference.growID);
}
}
};
function f20(objectName){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.growID == "number")clearInterval(objectRef.growID);
};
var fsd = 250; //milliseconds to delay the flash minimize animation
var mfd = 0; //initialize timeout variable used for minimizing animation
var oth = 0; //initialize height of tooltip variable, captured once tooltip has formed
var adn = .25; //length in seconds of the FULL shrink/gorw animation
var mtw = mfw + 15; //the 15 reflects padding between the flash and edge of tooltip
var mfpw = fw + (mtw-tdw);
function f21(){
//make tooltip grow only if myFlashMovie exists/ flash has been detected.
if(document.getElementById('myFlashMovie') != null) {
f20('contextAdedBox');
f20('placeholderDiv');
f20('myFlashMovie');
var currentTooltipWidth = parseInt(f4('contextAdedBox', 'offsetWidth'));//275;
var currentPlaceholderWidth = parseInt(f4('placeholderDiv', 'offsetWidth'));//125;
var currentPlaceholderHeight = parseInt(f4('placeholderDiv', 'offsetHeight'));//104;
var currentFlashWidth = parseInt(f4('myFlashMovie', 'offsetWidth'));//125;
var currentFlashHeight = parseInt(f4('myFlashMovie', 'offsetHeight'));//104;
//adjust duration so that grow/shrink rate stays constant (determine time based on how much FLASH needs to grow, NOT the tooltip itself)
var t = ((mfw - currentFlashWidth) / (mfw - fw)) * adn;
//temp workaround Mac/FF
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
f19('contextAdedBox',currentTooltipWidth, mtw, oth, oth, t);
f19('placeholderDiv',currentPlaceholderWidth, mfpw, currentPlaceholderHeight, mfh-15, t);
f19('myFlashMovie', currentFlashWidth, mfw, currentFlashHeight, mfh, t);
} else {
f1('contextAdedBox', 'width', mtw + 'px');
f1('contextAdedBox', 'height', oth + 'px');
f1('placeholderDiv', 'width', mfpw + 'px');
f1('placeholderDiv', 'height', mfh-15 + 'px');
f1('myFlashMovie', 'width', mfw + 'px');
f1('myFlashMovie', 'height', mfh + 'px');
}
}
}
function f22(){
if(document.getElementById('myFlashMovie') != null) {
f20('contextAdedBox');
f20('placeholderDiv');
f20('myFlashMovie');
var currentTooltipWidth = parseInt(f4('contextAdedBox', 'offsetWidth'));
var currentPlaceholderWidth = parseInt(f4('placeholderDiv', 'offsetWidth'));
var currentPlaceholderHeight = parseInt(f4('placeholderDiv', 'offsetHeight'));
var currentFlashWidth = parseInt(f4('myFlashMovie', 'offsetWidth'));
var currentFlashHeight = parseInt(f4('myFlashMovie', 'offsetHeight'));
//adjust duration so that grow/shrink rate stays constant (determine time based on how much FLASH needs to grow, NOT the tooltip itself)
var t = ((currentFlashWidth - fw) / (mfw - fw)) * adn;
//temp workaround Mac/FF
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
f19('contextAdedBox', currentTooltipWidth, tdw, oth, oth, t);
f19('placeholderDiv', currentPlaceholderWidth, fw, currentPlaceholderHeight, fh, t);
f19('myFlashMovie', currentFlashWidth, fw, currentFlashHeight, fh, t);
} else {
f1('contextAdedBox', 'width', tdw + 'px');
f1('contextAdedBox', 'height', oth + 'px');
f1('placeholderDiv', 'width', fw + 'px');
f1('placeholderDiv', 'height', fh + 'px');
f1('myFlashMovie', 'width', fw + 'px');
f1('myFlashMovie', 'height', fh + 'px');
}
}
}
// --------------------------------------------------
//DRAGGABLE TOOLTIP ROUTINES
// --------------------------------------------------
document.onmousemove = f26;
document.onmouseup = f29;
document.onmousedown = f23;
var ro = null;
var mouseOffset = null;
var mouseIsDown = false;
var whichDrag = ""
function f23(){
mouseIsDown = true;
}
function f24(target, ev){
ev = ev || window.event;
var docPos = f25(target);
var mousePos = f27(ev);
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}
function f25(e){
var left = 0;
var top = 0;
while (e.offsetParent){
left += e.offsetLeft;
top += e.offsetTop;
e = e.offsetParent;
}
left += e.offsetLeft;
top += e.offsetTop;
return {x:left, y:top};
}
function f26(ev){
ev = ev || window.event;
if(mouseIsDown){
if(ro){
var mousePos = f27(ev);
whichDrag = ro;
//ro.style.position = 'absolute';
ro.style.top = mousePos.y - mouseOffset.y + "px";
ro.style.left = mousePos.x - mouseOffset.x + "px";
return false;
}
}
return true;
}
function f27(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
function f28(object){
object.onmousedown = function(){
ro = this;
}
}
function f29(){
mouseIsDown = false;
ro = null;
}
var makeDragInit = false;
function f30(item, handle){
if(!item) return;
handle.onmousedown = function(ev){
ro = item;
mouseOffset = f24(item, ev);
return false;
}
}
//------------------------------------------------------
function f31(indexNum, layoutType, title, tooltipbodytext, anzeigeUrl, destinationUrl, creativeUrl, paramTypeArray, paramNameArray, paramValueArray, preis, currency, searchurl , _fh, _fw, _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8, _c9, _ca, _cb){
f32(_fh, _fw, _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8, _c9, _ca, _cb);
whichDrag = "";
var titleText = title;
var tooltipText = tooltipbodytext;
var destinationUrlText = destinationUrl;
//define the id to display a AD
var linkRefString = "link" + indexNum;
var linkRef = document.getElementById(linkRefString);
//clear hide delay
clearInterval(hideID);
//update global link number variable
lnum = indexNum;
yn = layoutType;
//truncate text
if(tooltipText.length > 100) tooltipText = tooltipText.substring(0,100) + "...";
if(titleText.length > 35) titleText = titleText.substring(0,35) + "...";
if(destinationUrlText.length > 35) destinationUrlText = destinationUrlText.substring(0,35) + "...";
//DISPLAY TIP TITLE IN STATUS BAR --updated to better accomidate escaped chars
statusVar = titleText;
f5(statusVar);
//COMPOSE TIP
var ds = '';
ds += '
';
ds += ''
ds += '| '
// Firefox-PC Bug: Tooltip does not fully return to original size onMouseOut
// ---> added "!important" hack so that IE gets overflow:hidden while all others get overflow:visible
// alternately you could use this - "overflow:visible;_overflow:hidden;" IE will read through the underscore
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += '';
ds += ' | '
ds += '
'
ds += ''
ds += ''
//SELECT TOOLTIP LAYOUT TYPE_____________________________________________________
switch(layoutType){
//Context Aded Bild Links
case(2):
ds += ''
ds += ''
ds += ''
// ds += ' '
ds += ' '
ds += ' | '
ds += ''
ds += '' + titleText + ''
ds += '' + tooltipText + ''
ds += ' | '
ds += ' '
ds += ''
ds += '| ' + anzeigeUrl + ' | '
ds += ' '
ds += ' '
break;
//Context Aded Bild Oben
case(3):
ds += ''
ds += ''
ds += ''
// ds += ' '
ds += ' '
ds += ' | '
ds += ' '
ds += ''
ds += '| '
ds += '' + titleText + ''
ds += '' + tooltipText + ''
ds += '' + anzeigeUrl + ''
ds += ' | '
ds += ' '
ds += ' '
break;
//Context Aded Bild rechts
case(4):
ds += ''
ds += ''
ds += '| '
ds += '' + titleText + ''
ds += '' + tooltipText + ''
if(preis > 0){
ds += 'ab ' + preis + ' ' + currency + ''
}
ds += ' | '
ds += ''
// ds += ' '
ds += ' '
ds += ' | '
ds += ' '
ds += ''
if(searchurl.length > 10 )
{
ds += '| ' + anzeigeUrl + ' | '
ds += 'ähnliche Angebote | '
}else {
ds += '' + anzeigeUrl + ' | '
}
ds += ' '
ds += ' '
break;
//Flash Context Aded Billboard
case(5):
ds += ''
ds += ''
ds += '| '
ds += ' '
ds += 'Flash plug-in was not detected.'
ds += ' '
ds += ' | '
ds += ' '
ds += ''
ds += '| '
ds += '' + titleText + ''
ds += '' + tooltipText + ''
ds += '' + anzeigeUrl + ''
ds += ' | '
ds += ' '
ds += ' '
break;
//Flash Context Aded Brand Box
case(6):
ds += ''
ds += ''
ds += '| '
ds += '' + titleText + ''
ds += '' + tooltipText + ''
ds += ' | '
ds += ''
ds += ' '
ds += 'Flash plug-in was not detected.'
ds += ' '
ds += ' | '
ds += ' '
ds += ''
ds += '| ' + anzeigeUrl + ' | '
ds += ' '
ds += ' '
break;
//Flash widscreem
case(7):
ds += ''
ds += ''
ds += '| '
ds += '' + titleText + ''
ds += '' + tooltipText + ''
ds += ' | '
ds += ''
// flash placeholder - (new) -----
ds += ' '
ds += 'Flash plug-in was not detected.'
ds += ' '
// --------------------------------
ds += ' | '
ds += ' '
ds += ''
ds += '| ' + anzeigeUrl + ' | '
ds += ' '
ds += ' '
break;
//Flash Freeform
case(8):
ds += ''
ds += 'Flash plug-in was not detected.'
ds += ' '
break;
//Context Aded Basic
default:
ds += ''
break;
}
//_____________________________________________________
ds += ' | '
ds += '
'
ds += ''
ds += '| '
ds += ''
ds += ''
ds += ''
ds += ''
ds += ''
ds += ''
ds += ' | '
ds += '
'
ds += '
'
ds += 'Advertisement
'
ds += '';
//FLASH DIV - (new) -----------------
if(layoutType == 7){
ds +='Flash was not detected
'
}
//-----------------------------------
//RENDER TIP
f2('contextAdedBox', 'innerHTML', ds);
//RENDER FLASH JE Flash Art andere
if(yn == 5 ){
var fo = new FlashObject(creativeUrl, "myFlashMovie", cw5, ch5, "6", "#EEEEEE");
//set wmode everywhere except in Firefox on a Mac
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
fo.addParam("wmode", "transparent");
}
fo = f33(fo,paramTypeArray, paramNameArray, paramValueArray);
fo.addParam("scale", "exactfit");
fo.addParam("swLiveConnect","true");
fo.addVariable("pageRef",window.location.hostname);
fo.write("flashcontent");
}else if( yn == 6 ){
var fo = new FlashObject(creativeUrl, "myFlashMovie", cw6, ch6, "6", "#EEEEEE");
//set wmode everywhere except in Firefox on a Mac
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
fo.addParam("wmode", "transparent");
}
fo = f33(fo,paramTypeArray, paramNameArray, paramValueArray);
fo.addParam("scale", "exactfit");
fo.addParam("swLiveConnect","true");
fo.addVariable("pageRef",window.location.hostname);
fo.write("flashcontent");
}else if(yn == 8){
var fo = new FlashObject(creativeUrl, "myFlashMovie", cw8, ch8, "6", "#EEEEEE");
//set wmode everywhere except in Firefox on a Mac
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
fo.addParam("wmode", "transparent");
}
fo = f33(fo,paramTypeArray, paramNameArray, paramValueArray);
fo.addParam("scale", "exactfit");
fo.addParam("swLiveConnect","true");
fo.addVariable("pageRef",window.location.hostname);
fo.write("flashcontent");
}else if(yn == 9){
var fo = new FlashObject(creativeUrl, "myFlashMovie", cw, ch, "8", "#EEEEEE");
//set wmode everywhere except in Firefox on a Mac
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
fo.addParam("wmode", "transparent");
}
fo.addParam("scale", "exactfit");
fo.addParam("swLiveConnect","true");
fo.addVariable("pageRef",window.location.hostname);
fo.write("flashcontent");
}else if(layoutType == 7){
var fo = new FlashObject(flashArray[lnum], "myFlashMovie", fw, fh, "6", "#EEEEEE");
//set wmode everywhere except in Firefox on a Mac
if ( !((navigator.userAgent.indexOf('Firefox') > -1) && (navigator.platform.indexOf('Mac') > -1)) ){
fo.addParam("wmode", "transparent");
}
fo.addParam("swLiveConnect","true");
fo.addParam("allowScriptAccess","always");
fo.addVariable("pageRef",window.location.hostname);
//PASS THROUGH START AND END WIDTH AND HEIGHT OF FLASH
fo.addVariable("wMin",fw);
fo.addVariable("hMin",fh);
fo.addVariable("wMax",mfw);
fo.addVariable("hMax",mfh);
fo.write("flashcontent");
}
//DYNAMICALLY SET OPACITY FOR BROWSERS OTHER THAN NETSCAPE
var browserType = navigator.appName;
switch(browserType){
case('Netscape'):
//document.contextAdedBox.style.MozOpacity = .95;
break;
case('Microsoft Internet Explorer'):
//document.getElementById('cadedt1').style.filter = "alpha(opacity=100)";
break;
default:
// document.getElementById('cadedt1').style.opacity = 1.00;
}
//RESIZE TOOLTIP BOX
var tempWidth = tdw + "px";
f1('contextAdedBox', 'width', tempWidth);
//POSITION TOOL TIP
var toolTipBoxWidth = f4('contextAdedBox', 'offsetWidth')
var toolTipBoxHeight = f4('contextAdedBox', 'offsetHeight');
var linkPosX = f7(linkRef,'x') + txo;
var linkPosY = f7(linkRef,'y') - toolTipBoxHeight + tyo;
//Account for page scrolling. Reposition tooltip as neccesary
if((f9() + document.body.clientWidth) < (linkPosX + toolTipBoxWidth)){
var tempOffset = (linkPosX + toolTipBoxWidth) - (f9() + document.body.clientWidth);
linkPosX -= tempOffset + 6;
}
if(f8() > linkPosY){
var tempName = document.getElementById("link" + lnum);
var tempOffset = tempName.offsetHeight;
linkPosY += toolTipBoxHeight - (2*tyo) + tempOffset + 4;
}
//allow for manual positioning override
linkPosX += xo;
linkPosY += xo;
//Make it happen
var linkPosXString = linkPosX + "px";
var linkPosYString = linkPosY + "px";
if ( !(navigator.userAgent.indexOf('Safari') > -1) ){
f1('contextAdedBox', 'left', linkPosXString);
f1('contextAdedBox', 'top', linkPosYString);
}else {
f1('contextAdedBox', 'left', linkPosXString);
f1('contextAdedBox', 'top', linkPosYString);
}
//THICK DOUBLE UNDERLINE
//f1(linkRefString, 'borderBottomWidth', '3px');
//REVEAL TIP
f1('contextAdedBox', 'visibility', 'visible');
//log tooltip height for resetting later on --(new)7-17-06
oth = parseInt(f4('contextAdedBox', 'offsetHeight'));
//ENABLE DRAG
f30(document.getElementById('contextAdedBox'), document.getElementById('tooltipHandle'));
f30(document.getElementById('contextAdedBox'), document.getElementById('handleCopy'));
}
function f32(_fh, _fw, _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8, _c9, _ca, _cb){
fh = _fh;
fw = _fw;
c1 = _c1;
c2 = _c2;
c3 = _c3;
c4 = _c4;
c5 = _c5;
c6 = _c6;
c7 = _c7;
c8 = _c8;
c9 = _c9;
ca = _ca;
cb = _cb;
}
function f33(fo, pt, pn, pv){
if (pt != null && pn != null && pv != null){
for (i=0; i < pt.length;i++){
if (pt[i] == 1){
fo.setAttribute(pn[i], pv[i]);
}
else if (pt[i] == 2){
fo.addParam(pn[i], pv[i]);
}
}
}
return fo;
}
function f34(param)
{
alert(param);
}//SCREEN ELEMENT CLASS
function ScreenElement(){
//properties
this.name = "DRD ScreenElement";
//initialization
}
ScreenElement.getXPosition = function(el) {
xPos = el.offsetLeft;
tempEl = el.offsetParent;
while (tempEl != null) {
xPos += tempEl.offsetLeft;
tempEl = tempEl.offsetParent;
}
return xPos;
}
ScreenElement.getYPosition = function(el) {
yPos = el.offsetTop;
tempEl = el.offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}
return yPos;
}
//COLOR CLASS
function Color(){
//properties
this.name = "DRD Color";
//initialization
}
Color.combineRGB = function(red,green,blue){
var RGB = (red<<16) | (green<<8) | blue;
return RGB;
};
Color.splitRGB = function(colorHexValue){
var output = new Object();
output.red = (colorHexValue >> 16) & 0xFF;
output.green = (colorHexValue >> 8) & 0xFF;
output.blue = colorHexValue & 0xFF;
return output;
};
Color.fromString = function(colorString){
var colorCode;
var hexColorString;
var hexColor;
// Firefox/Netscape tweak. they use rgb(0,0,0) vs #000000
if(colorString.indexOf('rgb') != -1){
colorCode = colorString.substring(4,colorString.length-1);
var colorCodeArray = colorCode.split(",");
hexColor = Color.combineRGB(colorCodeArray[0], colorCodeArray[1], colorCodeArray[2]);
} else {
colorCode = colorString.substring(1,colorString.length);
hexColorString = "0x" + colorCode;
hexColor = parseInt(hexColorString);
}
return hexColor;
}
Color.toString = function(colorNum){
function decConvertToBase(num, base){
var newNum="";
var result=num;
var remainder=0;
while (result>0){
result=Math.floor(num/base);
remainder=num%base;
num=result;
if (remainder>=10){
if (remainder==10) remainder='A';
if (remainder==11) remainder='B';
if (remainder==12) remainder='C';
if (remainder==13) remainder='D';
if (remainder==14) remainder='E';
if (remainder==15) remainder='F';
}
// append the next remainder to the beginning of the string
newNum=""+remainder+newNum;
};
return newNum;
}
return decConvertToBase(colorNum, 16);
}
//PHYSICS CLASS
function Physics(){
//properties
this.name = "DRD Physics";
//initialization
};
Physics.GRAVITY = 9.8; //meters per second per second
Physics.GRAVITY_PIXELS = 2500; //pixels per second per second
Physics.getProjectileDisplacement = function(v, a, t){
var result = v * t + .5 * a * Math.pow(t,2);
return result;
};
//GEOMETRY CLASS
function Geometry(){
//properties
this.name = "DRD Geometry";
//initialization
};
Geometry.degreesToRadians = function(degrees){
return (degrees / 180) * Math.PI;
};
Geometry.radiansToDegrees = function(radians){
return (radians / Math.PI) * 180;
};
Geometry.distanceFormula = function(x1,y1,x2,y2){
return Math.sqrt(Math.pow((x2 - x1),2) + Math.pow((y2 - y1),2));
};
Geometry.midPoint = function(x1,y1,x2,y2){
var resultObj = new Object();
resultObj.x = (x1 + x2) / 2;
resultObj.y = (y1 + y2) / 2;
return resultObj;
};
Geometry.pointToPolar = function(x,y){
var resultObj = new Object();
resultObj.vector = Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
resultObj.theta = this.radiansToDegrees(Math.atan(y/x));
return resultObj;
};
Geometry.polarToPoint = function(r,theta) {
var resultObj = new Object();
theta = this.degreesToRadians(theta);
resultObj.x = r * Math.cos(theta);
resultObj.y = r * Math.sin(theta);
return resultObj;
};
function changeStyle(objectID, propertyName, propertyValue){
document.getElementById(objectID).style[propertyName] = propertyValue;
};
function changeProperty(objectID, propertyName, propertyValue){
document.getElementById(objectID)[propertyName] = propertyValue;
};
function getStyleValue(objectID, propertyName){
return document.getElementById(objectID).style[propertyName];
};
function getPropertyValue(objectID, propertyName){
return document.getElementById(objectID)[propertyName];
};
function colorBlend(objectName, propertyName, startColor, endColor, blendSeconds){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.colorBlendID == "number") clearInterval(objectRef.colorBlendID);//clear interval just incase we invoke a blend before another has finished
var time = blendSeconds*1000;//duration of the blend in miliseconds
var steps = 30*blendSeconds;//steps in the animation (should be framerate*("var time" in seconds))
var startColorSplit = Color.splitRGB(startColor);
var endColorSplit = Color.splitRGB(endColor);
var redArray = new Array();
var greenArray = new Array();
var blueArray = new Array();
//calculate red blend
var redIncr = (endColorSplit.red - startColorSplit.red)/steps;
for(x=0; x<=steps; x++){
redArray.push(Math.round(startColorSplit.red + (x * redIncr)));
}
//calculate green blend
var greenIncr = (endColorSplit.green - startColorSplit.green)/steps;
for(x=0; x<=steps; x++){
greenArray.push(Math.round(startColorSplit.green + (x * greenIncr)));
}
//calculate blue blend
var blueIncr = (endColorSplit.blue - startColorSplit.blue)/steps;
for(x=0; x<=steps; x++){
blueArray.push(Math.round(startColorSplit.blue + (x * blueIncr)));
}
//animate blend using an inner function
objectRef.blendStep = 0;
objectRef.nameString = objectName;
objectRef.propString = propertyName;
var blendInterval = time/steps;
objectRef.colorBlendID = setInterval(blendFunction,blendInterval);
var selfReference = objectRef;
function blendFunction(){
selfReference.blendStep++;
if(selfReference.blendStep <= steps){
var tempColor = "#" + Color.toString(Color.combineRGB(redArray[selfReference.blendStep],greenArray[selfReference.blendStep],blueArray[selfReference.blendStep]));
changeStyle(selfReference.nameString, objectRef.propString, tempColor);
} else {
var tempColor = "#" + Color.toString(endColor);
changeStyle(selfReference.nameString, objectRef.propString, tempColor);
clearInterval(selfReference.colorBlendID);
}
}
};
function killColorBlend(objectName){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.slideID== "number")clearInterval(objectRef.colorBlendID);
};
function slide(objectName,startX,endX,startY,endY,slideTime){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.slideID== "number")clearInterval(objectRef.slideID);
var time = slideTime*1000;//duration of the blend in miliseconds
var steps = 30*slideTime;//steps in the animation (should be framerate*("var time" in seconds))
var slideXArray = new Array();
var slideYArray = new Array();
//calculate changes in x and y coordinates
var slideDeltaX = (endX - startX)/steps;
var slideDeltaY = (endY - startY)/steps;
for(x=0; x<=steps; x++){
slideXArray.push(Math.round(startX + (x * slideDeltaX)));
slideYArray.push(Math.round(startY + (x * slideDeltaY)));
}
//animate slide using an inner function
objectRef.slideStep = 0;
objectRef.nameString = objectName;
var slideInterval = time/steps;
objectRef.slideID = setInterval(slideFunction,slideInterval);
var selfReference = objectRef;
function slideFunction(){
selfReference.slideStep++;
if(selfReference.slideStep <= steps){
//reposition object!!
var tempX = slideXArray[selfReference.slideStep] + "px";
var tempY = slideYArray[selfReference.slideStep] + "px";
changeStyle(selfReference.nameString, 'left', tempX);
changeStyle(selfReference.nameString, 'top', tempY);
} else {
//account for remainder in case "step" is not a whole-number value
var tempX = endX + "px";
var tempY = endY + "px";
changeStyle(selfReference.nameString, 'left', tempX);
changeStyle(selfReference.nameString, 'top', tempY);
clearInterval(selfReference.slideID);
}
}
};
function killSlide(objectName){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.slideID == "number")clearInterval(objectRef.slideID);
};
function accelerationSlide(objectName,startX,endX,startY,endY,easeDirection,slideTime){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.accelerationSlideID == "number")clearInterval(objectRef.accelerationSlideID);
var time = slideTime*1000;//duration of the blend in miliseconds
var steps = 30*slideTime;//steps in the animation (should be framerate*("var time" in seconds))
var slideXArray = new Array();
var slideYArray = new Array();
//calculate changes in x and y coordinates
var xDistance = (endX - startX);
var yDistance = (endY - startY);
//determine direction
var xMod = 1;
var yMod = 1;
var slideDeltaX = Math.pow(xDistance,1/steps);
var slideDeltaY = Math.pow(yDistance,1/steps);
if (xDistance < 0) {
slideDeltaX = Math.pow(-xDistance,1/steps);
xMod = -1;
}
if (yDistance < 0) {
slideDeltaY = Math.pow(-yDistance,1/steps);
yMod = -1;
}
for(x=0; x<=steps; x++){
if(easeDirection == "out"){
slideXArray.push(Math.floor(endX - (xMod*(Math.pow(slideDeltaX,steps-x)))));
slideYArray.push(Math.round(endY - (yMod*(Math.pow(slideDeltaY,steps-x)))));
} else {
slideXArray.push(Math.round(startX + (xMod*(Math.pow(slideDeltaX,x)))));
slideYArray.push(Math.round(startY + (yMod*(Math.pow(slideDeltaY,x)))));
}
}
//animate slide using an inner function
objectRef.slideStep = 0;
objectRef.nameString = objectName;
var slideInterval = time/steps;
objectRef.accelerationSlideID = setInterval(accelerationSlideFunction,slideInterval);
var selfReference = objectRef;
function accelerationSlideFunction(){
selfReference.slideStep++;
if(selfReference.slideStep <= steps){
//reposition object!!
var tempX = slideXArray[selfReference.slideStep] + "px";
var tempY = slideYArray[selfReference.slideStep] + "px";
changeStyle(selfReference.nameString, 'left', tempX);
changeStyle(selfReference.nameString, 'top', tempY);
} else {
//account for remainder in case "step" is not a whole-number value
var tempX = endX + "px";
var tempY = endY + "px";
changeStyle(selfReference.nameString, 'left', tempX);
changeStyle(selfReference.nameString, 'top', tempY);
clearInterval(selfReference.accelerationSlideID);
}
}
};
function killAccelerationSlide(objectName){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.accelerationSlideID == "number") clearInterval(objectRef.accelerationSlideID);
};
function bounce(objectName,startY,endY){
var objectRef = document.getElementById(objectName);
//killBounce(objectName);
objectRef.bouncing = true;
var bounceYArray = new Array();
//calculate duration of drop
var dropDistance = endY - startY;
var acceleration = Physics.GRAVITY_PIXELS;
var dropTime = Math.sqrt(dropDistance/(.5 * acceleration));
var time = dropTime * 1000; //converted to milliseconds
var steps = 30 * dropTime;
for(x=0; x<=steps; x++){
var t = (x/steps)*dropTime;
var a = Physics.GRAVITY_PIXELS;
var v = 0;
var deltaY = Physics.getProjectileDisplacement(v, a, t);
bounceYArray.push(startY + deltaY);
}
//animate bounce using an inner function
objectRef.bounceStep = 0;
var bounceInterval = time/steps;
objectRef.bounceID = setInterval(bounceFunction,bounceInterval);
objectRef.nameString = objectName;
var selfReference = objectRef;
function bounceFunction(){
selfReference.bounceStep++;
if(selfReference.bounceStep <= steps){
//selfReference._y = bounceYArray[selfReference.bounceStep];
var tempYString = bounceYArray[selfReference.bounceStep] + "px";
changeStyle(selfReference.nameString, 'top', tempYString);
} else {
//selfReference._y = endY;//account for remainder in case "step" is not a whole-number value
var tempYString = endY + "px";
changeStyle(selfReference.nameString, 'top', tempYString);
clearInterval(selfReference.bounceID);
rebound();
}
}
function rebound(){
//calculate duration of rebound
var reboundDistance = (endY - startY)/2;
var acceleration = Physics.GRAVITY_PIXELS;
var dropTime = Math.sqrt(reboundDistance/(.5 * acceleration));
var time = dropTime * 1000; //converted to milliseconds
var steps = 30 * dropTime;
var reboundArray = new Array();
for(x=0; x<=steps; x++){
var t = (x/steps)*dropTime;
var a = Physics.GRAVITY_PIXELS;
var v = 0;
var deltaY = Physics.getProjectileDisplacement(v, a, t);
reboundArray.push((endY - reboundDistance)+deltaY);
}
reboundArray.reverse();
//animate rebound using an inner-inner function
selfReference.reboundStep = 0;
var reboundInterval = time/steps;
selfReference.reboundID = setInterval(reboundFunction,reboundInterval);
function reboundFunction(){
selfReference.reboundStep++;
if(selfReference.reboundStep <= steps){
//selfReference._y = reboundArray[selfReference.reboundStep];
var tempYString = reboundArray[selfReference.reboundStep] + "px";
changeStyle(selfReference.nameString, 'top', tempYString);
} else {
//selfReference._y = endY-reboundDistance;//account for remainder in case "step" is not a whole-number value
var tempYString = (endY-reboundDistance) + "px";
changeStyle(selfReference.nameString, 'top', tempYString);
clearInterval(selfReference.reboundID);
bound(endY, selfReference.nameString);
}
}
}
function bound(endY, thisName){
var thisRef = document.getElementById(thisName);
//only make it bound if the distance is greater than 1 pixel (needs to stop bouncing eventually)
//if(thisRef._y+1 >= endY){
var tempY = ScreenElement.getYPosition(thisRef)
if(tempY+1 >= endY){
//end it
//thisRef._y = endY;
changeStyle(thisName, 'top', endY);
thisRef.bouncing = false;
killBounce(thisName);
} else {
//make it bounce!!
bounce(thisName,tempY,endY);
}
}
};
function killBounce(objectName){
var objectRef = document.getElementById(objectName);
if(typeof objectRef.bounceID == "number") clearInterval(objectRef.bounceID);
if(typeof objectRef.reboundID == "number") clearInterval(objectRef.reboundID);
};/**
* SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
* legal reasons.
*/
if(typeof deconcept=="undefined"){
var deconcept=new Object();
}
if(typeof deconcept.util=="undefined"){
deconcept.util=new Object();
}
if(typeof deconcept.SWFObjectUtil=="undefined"){
deconcept.SWFObjectUtil=new Object();
}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.getElementById){
return;
}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){
this.setAttribute("swf",_1);
}
if(id){
this.setAttribute("id",id);
}
if(w){
this.setAttribute("width",w);
}
if(h){
this.setAttribute("height",h);
}
if(_5){
this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));
}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){
this.addParam("bgcolor",c);
}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){
this.setAttribute("redirectUrl",_a);
}
};
deconcept.SWFObject.prototype={
setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},
getAttribute:function(_10){
return this.attributes[_10];
},
addParam:function(_11,_12){
this.params[_11]=_12;
},
getParams:function(){
return this.params;
},
addVariable:function(_13,_14){
this.variables[_13]=_14;
},
getVariable:function(_15){
return this.variables[_15];
},
getVariables:function(){
return this.variables;
},
getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){
_16.push(key+"="+_18[key]);
}
return _16;
},
getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_19="