d 				= document;
Enlargement 	= 0;
IE7				= 0;

/////////////////////////////////////////////////////////////////////////////////////
//	 FADE IN THE dMS-HYPERLINK AFTER PAGE-LOAD
/////////////////////////////////////////////////////////////////////////////////////

dMScolor 	= 1;
FadeSpeed	= 35;
FadeDelay	= 500;
LoadFade	= new Array();

LoadFade[1]	= '#66a871';	// start | link color
LoadFade[2]	= '#62a56d';
LoadFade[3]	= '#61a36c';
LoadFade[4]	= '#5ea169';
LoadFade[5]	= '#5c9f67';
LoadFade[6]	= '#599c64';
LoadFade[7]	= '#569960';
LoadFade[8]	= '#51955c';
LoadFade[9]	= '#4d9158';
LoadFade[10]= '#488c53';
LoadFade[11]= '#42874d';
LoadFade[12]= '#3d8248';
LoadFade[13]= '#387e43';
LoadFade[14]= '#347a3f';
LoadFade[15]= '#30763b';
LoadFade[16]= '#2d7438';
LoadFade[17]= '#2b7236';
LoadFade[18]= '#297034';
LoadFade[19]= '#286f33';	// neutral | grass color

function LoadFader1(LoadTXT)
	{
OrgTXT 											= d.getElementById("loading").innerHTML;
d.getElementById("loading").innerHTML 			= '<span id="loading2">'+LoadTXT+'</span><span id="loading3">'+OrgTXT+'</span>';
d.getElementById("loading").style.visibility 	= 'visible';
	}

function LoadFader2(FadeCount)
	{
d.getElementById("loading2").style.color=LoadFade[dMScolor];
d.title = d.title; // opera 10.5 bug... needs to refresh sómething...

	if(FadeCount == 1)
		{
	if(dMScolor < 19){dMScolor+=1;setTimeout("LoadFader2(1)",FadeSpeed);}
	else{d.getElementById("loading2").innerHTML = '<span id="loading4">'+OrgTXT+'</span>';FadeCount = 2;}
		}
	
	if(FadeCount == 2)
		{
	if(dMScolor > 1){dMScolor-=1;setTimeout("LoadFader2(2)",FadeSpeed);}
	else{FadeCount = 0;}
		}

	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	 SHOW | HIDE SITE-CONTENT
/////////////////////////////////////////////////////////////////////////////////////

Display		= new Array();
Display[0]	= 'none';
Display[1]	= 'block';
Display[2]	= 'none';

function ShowHide(Division,DisplayType,BigOne,XtraTxt)
	{
Color		= new Array();
Color[0]	= '#595222'; 	// scoreboard NOT active
Color[1]	= '#fff';		// scoreboard IS active
Color[2]	= '#fff';
Color[3]	= '#fff';
Color[4]	= '#fff';
Color[5]	= '#fff';
Color[6]	= '#fff';
Color[7]	= '#fff';

// main score-board
	if(Division == 'score')
		{
	if(Enlargement)								d.getElementById('Enlarge').style.display		= Display[DisplayType+1];
	if(d.getElementById("XtraClose") != null)	d.getElementById('XtraClose').style.display 	= Display[DisplayType+1];
												d.getElementById('ImgContent').style.display 	= Display[DisplayType+1];
												d.getElementById('ScoreCrown').style.display 	= Display[DisplayType];
	if(DisplayType == 1)
			{
		ScoreBorder = d.getElementById("ScoreBorder1").style.borderColor;
		d.getElementById("ScoreBorder1").style.borderColor = '#fff';
		d.getElementById("ScoreBorder2").style.borderColor = '#fff';
		OrgTxt 		= d.getElementById('TxtContent').innerHTML;
		for (i=0; i<XtraTxt.length; i++)XtraTxt = XtraTxt.replace('*', '"');
		for (i=0; i<XtraTxt.length; i++)XtraTxt = XtraTxt.replace('{', '<');
		for (i=0; i<XtraTxt.length; i++)XtraTxt = XtraTxt.replace('}', '>');
		d.getElementById('TxtContent').innerHTML = XtraTxt;
			}

	if(DisplayType == 0)
			{
		d.getElementById('TxtContent').innerHTML = OrgTxt;
		d.getElementById("ScoreBorder1").style.borderColor = ScoreBorder;
		d.getElementById("ScoreBorder2").style.borderColor = ScoreBorder;
			}

	}

// enlarge content
	if(Division == 'BigOne')
		{

	if(d.getElementById("BigOneContent"))d.getElementById("BigOneContainer").style.display = Display[DisplayType];

	if(DisplayType == 1)
			{
		location.href 									= '#top';
		d.body.style.overflow 							= 'hidden';
		d.getElementById("BigOnePreload").src			= BigOne;
			}
		else if(IE7 != 1)
			{
		d.body.style.overflow 							= 'auto';
			}
		}

// small score-board
	if(Division.substr(0,5) == 'Score')
		{
			xOffsetTMP	= (Division.substr(6)-1)*125;
			xOffset		= '-'+xOffsetTMP+'px'
			if(xOffsetTMP == '0')xOffset = '0';

		if(DisplayType == 1)
			{
		d.getElementById('Book_'+Division.substr(6)).style.color 				= Color[1*Division.substr(6)];
		d.getElementById('Book_'+Division.substr(6)).style.backgroundPosition	= xOffset+' 117px';
		if(XtraTxt != '')d.getElementById('ScoreCrown').style.backgroundPosition= XtraTxt+' -75px';
			}
		else
			{
		d.getElementById('Book_'+Division.substr(6)).style.color 				= Color[0];
		d.getElementById('Book_'+Division.substr(6)).style.backgroundPosition	= xOffset+' 0';
		if(XtraTxt != '')d.getElementById('ScoreCrown').style.backgroundPosition= XtraTxt+' 0';
			}

		}

// show | hide the requested division
if(d.getElementById(Division))d.getElementById(Division).style.display = Display[DisplayType];

	}

/////////////////////////////////////////////////////////////////////////////////////
//	 SHOW THE WEBCAM POPUP-WINDOW
/////////////////////////////////////////////////////////////////////////////////////

// popupblocker test engine...
function Cam(Language)
   {
WindowHeight = 370;
CanvasHeight = window.screen.height; // d.body.clientHeight
WinTop		 = Math.floor((CanvasHeight-WindowHeight)/2)-100;

WindowWidth  = 750;
CanvasWidth	 = window.screen.width; // d.body.clientWidth
WinLeft		 = Math.floor((CanvasWidth-WindowWidth)/2);

CamWin = window.open('http://dCAMZ.com/?b=010&i=dmz&l='+Language,'dCAMZ','height=' + WindowHeight + ',width=' + WindowWidth + ',alwaysLowered=1,alwaysRaised=0,channelmode=0,dependent=1,directories=0,fullscreen=0,hotkeys=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=1,toolbar=0,z-lock=0,screenX=1,screenY=1,left=' + WinLeft + ',top=' + WinTop);

CamWin.focus();
	}

/////////////////////////////////////////////////////////////////////////////////////
//	 SHOW THE CHAPTER-THUMBZ
/////////////////////////////////////////////////////////////////////////////////////

function ShowThumbz1(ThumbTotal,TheThumb)
	{
TheTime = 300;if(TheThumb != 1)TheTime = 150;
NewThumbTotal = ThumbTotal;NewThumb = TheThumb;
setTimeout("ShowThumbz2(NewThumbTotal,NewThumb)",TheTime);
	}
	
function ShowThumbz2(ThumbTotal,TheThumb)
	{
d.getElementById('ChapterImg_'+TheThumb).style.visibility 		= 'visible';
d.getElementById('ChapterShadow_'+TheThumb).style.visibility 	= 'visible';
TheThumb++;
	if(TheThumb < ThumbTotal+1)ShowThumbz1(ThumbTotal,TheThumb);
	else{setTimeout('LoadFader2(1)',FadeDelay);}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    WRITE MAIL - SEARCH ENGINE SAFETY
/////////////////////////////////////////////////////////////////////////////////////

function WriteMail(CallerID)
	{
if(CallerID == '1'){d.getElementById("dMSmail").innerHTML = '<a href="mailto:info'+'@'+'dmotion'+'.com" title="contact info'+'@'+'dmotion'+'.com" style="border:0;">info'+'@'+'dmotion'+'.com'+'</a>';}
else{d.write('<a href="mailto:info'+'@'+'dmotion'+'.com" title="contact info'+'@'+'dmotion'+'.com" style="border:0;">email</a>');}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    HIGHLIGHT THE CLOSE | ENLARGE-ICON
/////////////////////////////////////////////////////////////////////////////////////

function Enlarge(Status,Icon)
	{
yOffset		= new Array();
yOffset[0]	= 0;
yOffset[1]	= '-45px';
if(Icon && Icon == 'Enlarge')	d.getElementById(Icon).style.backgroundPosition = '0 '+yOffset[Status];
if(Icon && Icon == 'Disappear')	d.getElementById(Icon).style.backgroundPosition = '72px '+yOffset[Status];
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	MAKE THE ENLARGE-BUTTON ACTIVE....
/////////////////////////////////////////////////////////////////////////////////////

function ShowEnlarge()
	{
	if(Enlargement)
		{
	d.getElementById("Enlarge").style.display 	 = 'block';
	d.getElementById("EnlargeTMP").style.display = 'none';
	d.getElementById("ImgContent").style.cursor	 = 'pointer';
		}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	PRELOAD THE BIG-IMAGE
/////////////////////////////////////////////////////////////////////////////////////

Preloaded = 0;

function Preloader()
	{
d.getElementById("PreloadContainer").innerHTML = '<img src="img/common/pix.gif" alt="" id="BigOnePreload" onload="Preload();" />';
	}

function Preload()
	{
Preloaded++;
//alert('preload is loaded... '+Preloaded+'x');
	if(Preloaded == 2)
		{
	d.getElementById("BigOnePreload").style.width	= '850px';
	d.getElementById("BigOnePreload").style.height	= '510px';

	d.getElementById('BigOneFader').style.display	= 'block';
	ImageFader 										= 10;
	FadeImage();
		}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	START - FADE THE IMAGE IN | OUT...
/////////////////////////////////////////////////////////////////////////////////////


function FadeImage()
	{
if(d.body.filters)d.getElementById('BigOneFader').style.filter	= 'alpha(opacity='+(ImageFader*10)+');';
else{d.getElementById('BigOneFader').style.opacity				= ImageFader/10;}
// alert(ImageFader/10);
ImageFader -= 1;if(ImageFader > -1)setTimeout("FadeImage()",10);
	}

/////////////////////////////////////////////////////////////////////////////////////
//    ACTIVATE THE ANUAL EASTER-EGG
/////////////////////////////////////////////////////////////////////////////////////

var flashinstalled  = 0;
var flashversion    = 0;
MSDetect            = "false";

if (navigator.plugins && navigator.plugins.length)
{
	x = navigator.plugins["Shockwave Flash"];
	if (x)
	{
		flashinstalled = 2;
		if (x.description)
		{
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	}
	else
		flashinstalled = 1;
	if (navigator.plugins["Shockwave Flash 2.0"])
	{
		flashinstalled = 2;
		flashversion = 2;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
	MSDetect = "true";

//////////////////////

d.writeln('<script language="VBScript" type="text/vbscript">');
d.writeln('on error resume next');
d.writeln('If MSDetect = "true" Then');
d.writeln('For i = 2 to 6');
d.writeln('If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then');
d.writeln('Else');
d.writeln('flashinstalled = 2');
d.writeln('flashversion = i');
d.writeln('End If');
d.writeln('Next');
d.writeln('End If');
d.writeln('If flashinstalled = 0 Then');
d.writeln('flashinstalled = 1');
d.writeln('End If');
d.writeln('</script>');

//////////////////////

function Easter(CallerID)
	{
if(flashinstalled == 2)
	{
// active the easter-egg movie after page is loaded
if(CallerID == 1)d.getElementById('EasterWrapper').innerHTML = '<object type="application/x-shockwave-flash" data="_content/img/01_00_01_01_02_03_4.swf" width="340" height="50" id="Easter" align="left"><param name="movie" value="_content/img/01_00_01_01_02_03_4.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /></object>';
// write the easter-egg container
if(CallerID == 2)d.write ('<div class="Easter" id="EasterWrapper"></div>');
// the actual easter-egg itself
if(CallerID == 3){ShowHide('BigOne',1,'_content/img/01_00_01_01_02_02_2.jpg','');d.getElementById('EasterWrapper').style.display = 'none';}
	}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    ANIMATED EYEZ - NO FLASH NEEDED...
/////////////////////////////////////////////////////////////////////////////////////

EyeDelay 		= Math.floor(Math.random()*5);
EyeDelay 		= (1000*EyeDelay)+6000;
EyezWideShut	= 1;
// d.title 		= EyeDelay;

function Eyez4U(ShowHide)
	{
d.getElementById("Eyez4U").style.display = Display[ShowHide];
if(ShowHide == 1)NewShowHide = 0;else{NewShowHide = 1;}
EyezDelay = 350;if(EyezWideShut == 2)EyezDelay = 1500;
if(EyezWideShut < 4){setTimeout("Eyez4U("+NewShowHide+")",EyezDelay);EyezWideShut++;}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    SEARCH FOR A SPECIFIC KEYWORD
/////////////////////////////////////////////////////////////////////////////////////

function FooterTags(CallerID)
	{	
for (i=0; i<CallerID.length; i++)CallerID = CallerID.replace("*", "\"");
d.getElementById("query").value = CallerID;
d.getElementById("FooterTagsMenu").style.visibility = 'hidden';
SearchStart(1);
d.getElementById("searchform").submit();
	}

TagVisible = 0;	

function ShowTags(TagTotal)
	{
d.getElementById("tag_"+TagVisible).style.display = 'block';
TagVisible++;TagTotalNew = TagTotal;
if(TagVisible < TagTotal)setTimeout('ShowTags(TagTotalNew)',10);
else{TagVisible = 0;}
	}

/////////////////////////////////////////////////////////////////////////////////////
//    SHUT YOUR MOUTH, CHINESE BOY!
/////////////////////////////////////////////////////////////////////////////////////

// SearchOffset = 20;

function SearchBalloon()
	{
d.getElementById('SearchBalloon').style.display = 'none';
//SearchOffset -= 2;
//d.getElementById('SearchBalloon').style.marginTop = SearchOffset+'px';
//if(SearchOffset > 7){setTimeout('SearchBalloon()',2);}else{d.getElementById('SearchBalloon').style.display = 'none';}
	}