// ..................................................................................
//	 DEFAULT dMS FUNCTION # start
// ..................................................................................

d 				= document;
w				= window;
IE7				= 0;

/////////////////////////////////////////////////////////////////////////////////////
//	DEFAULT dMS-SCRIPT
/////////////////////////////////////////////////////////////////////////////////////

function JS_function()
	{
alert('Javascript says : hello, world...');
	}

/////////////////////////////////////////////////////////////////////////////////////
//	WRITE MAIL - SEARCH ENGINE SAFETY
/////////////////////////////////////////////////////////////////////////////////////

TheMail			= new Array();
TheMail[1]		= 'email';
TheMail[2]		= 'info'+'@'+'dmotion'+'.com';

function Mail(WhichMail)
	{
d.write ('<a href="mailto:'+TheMail[2]+'" title=" '+TheMail[1]+' ">'+TheMail[WhichMail]+'</a>');
	}

// ..................................................................................
//	 DEFAULT dMS FUNCTION # end
// ..................................................................................

/////////////////////////////////////////////////////////////////////////////////////
//	IMAGE PRELOADER
/////////////////////////////////////////////////////////////////////////////////////

dMSimage		= new Array();
dMSimage[1]		= new Image();
dMSimage[1].src	= 'img/whiteback.png';

/////////////////////////////////////////////////////////////////////////////////////
//	 WRITE SHADOWLAYER, SEO-FRIENDLY
/////////////////////////////////////////////////////////////////////////////////////

function ShadowTXT()
	{
d.getElementById('shadow').innerHTML = shadowTXT;
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	 SHOW | HIDE SEND2AFIEND
/////////////////////////////////////////////////////////////////////////////////////

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

Overflow	= new Array();
Overflow[0]	= 'auto';
Overflow[1]	= 'hidden';

function Send2aFiend(CallerID)
	{
d.getElementById('sendcontainer').style.display	= Display[CallerID];
d.getElementById('whiteback').style.display 	= Display[CallerID];
d.body.style.overflow 							= Overflow[CallerID];
if(CallerID == 1){d.getElementById("top").scrollIntoView(true);d.getElementById("required_1").focus();}
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	 PRELOAD SOME IMAGES...
/////////////////////////////////////////////////////////////////////////////////////

NextPrev	= new Array();
NextPrev[1]	= 'prev';
NextPrev[2]	= 'next';

TheCoords	= new Array();
TheCoords[1]= '-688px -53px';
TheCoords[2]= '-749px -53px';

function DisabledButt(CallerID)
	{
if(d.getElementById(NextPrev[CallerID]))d.getElementById(NextPrev[CallerID]).style.backgroundPosition = TheCoords[CallerID];	
	}

function DisabledTXT(WhichTXT)
	{
WhichTXT.style.color = '#444';		
	}

/////////////////////////////////////////////////////////////////////////////////////
//    SEARCH FOR A SPECIFIC KEYWORD
/////////////////////////////////////////////////////////////////////////////////////

function Tags(CallerID)
	{	
for (i=0; i<CallerID.length; i++)CallerID = CallerID.replace("*", "\"");
d.getElementById("query").value = CallerID;
d.getElementById("MenuChild_3").style.visibility = 'hidden';
SearchStart(1);
d.getElementById("searchform").submit();
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    OPEN SHARE-FUNCTIONS IN POP-UP
/////////////////////////////////////////////////////////////////////////////////////

function dMShare(TheLink)
	{
PopUp			= false;

PopUpHeight 	= 500;
ScreenHeight 	= window.screen.height; // d.body.clientHeight
PopUpTop	 	= 10;					// Math.floor((ScreenHeight-PopUpHeight)/2)-100;

PopUpWidth  	= 900;
ScreenWidth	 	= window.screen.width;	// d.body.clientWidth
PopUpLeft	 	= 10;					// Math.floor((ScreenWidth-PopUpWidth)/2);

PopVar			= 'toolbar=no,location=no,menubar=no,scrollbars=yes,width='+PopUpWidth+',height='+PopUpHeight+',resizable=yes,status=no,left='+PopUpLeft+',top='+PopUpTop;

try{PopUp = window.open(TheLink.href,'dMShare',PopVar);}
catch(e){};if(PopUp)try{PopUp.focus()}catch(e){};return !!PopUp;
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//    TOOL-TIP AT SHOP-CONFIRMATION
/////////////////////////////////////////////////////////////////////////////////////

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

DetailsWait		= new Array();
DetailsWait[0]	= 1500;
DetailsWait[1]	= 200;

function OrderDetails1(CallerID)
	{
DetailStatus 	= CallerID;
setTimeout("OrderDetails2("+CallerID+")",DetailsWait[CallerID]);
	}
	
function OrderDetails2(CallerID)
	{
if(CallerID == 0 && DetailStatus != 1)d.getElementById("orderdetails").style.display = ShowDetails[CallerID]; 
if(CallerID == 1)d.getElementById("orderdetails").style.display = ShowDetails[CallerID];
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//		ENLARGE IMAGE AT ONCE
/////////////////////////////////////////////////////////////////////////////////////

ZoomCursorExt = '';

function MaxImg(CallerID,OrgWidth,OrgHeight)
	{
/////////////////////////////////////////////////////////////////////////////////////
if(CallerID!=0)								// show the image
/////////////////////////////////////////////////////////////////////////////////////
	{
x=OrgWidth;y=OrgHeight;MaxWidthHeight		 	 = GetDimensions(x,y);
MarginTop									 	 = Math.floor((MaxHeight-NewHeight)/2);
d.body.style.overflow						 	 = 'hidden';
d.getElementById("MaxImg").innerHTML 		 	 = '<img src="_content/img/'+CallerID+'" alt="" id="MaxImage" '+MaxWidthHeight+' border="0" style="cursor:'+ZoomCursorExt+'zoom-out;" />';
d.getElementById("MaxImage").style.marginTop 	 = MarginTop+'px';
d.getElementById("MaxImg").innerHTML 			+= '<img src="img/pix.gif" alt=" x " title=" x " id="MaxImgClose" align="top" border="0" />';
d.getElementById("MaxImgClose").style.marginTop  = (MarginTop-4)+'px';
d.getElementById("MaxImg").style.display	 	 = 'block';
d.getElementById("top").scrollIntoView(true);
	}
/////////////////////////////////////////////////////////////////////////////////////
else										// hide the image
/////////////////////////////////////////////////////////////////////////////////////
	{
d.getElementById("MaxImg").style.display	 	 = 'none';
d.getElementById("MaxImg").innerHTML 		 	 = '';
d.body.style.overflow						 	 = 'auto';
	}
/////////////////////////////////////////////////////////////////////////////////////
	}

function GetDimensions(OrgWidth,OrgHeight)
	{
/////////////////////////////////////////////////////////////////////////////////////
if(typeof w.innerWidth == 'undefined')		// all IE browsers
/////////////////////////////////////////////////////////////////////////////////////
	{
MaxWidth 	= d.documentElement.clientWidth;
MaxHeight 	= d.documentElement.clientHeight;
	}
/////////////////////////////////////////////////////////////////////////////////////
 else										// non-IE browsers
/////////////////////////////////////////////////////////////////////////////////////
 	{
MaxWidth 	= w.innerWidth;
MaxHeight	= w.innerHeight;
	}
/////////////////////////////////////////////////////////////////////////////////////
ImgRatio	= OrgWidth/OrgHeight;
DivRatio	= MaxWidth/MaxHeight;
/////////////////////////////////////////////////////////////////////////////////////
if(OrgWidth>OrgHeight)						// landscape-images
/////////////////////////////////////////////////////////////////////////////////////
	{
ScaleKey 	= MaxHeight/OrgHeight;if(DivRatio<=ImgRatio)ScaleKey = MaxWidth/OrgWidth;
	}	
/////////////////////////////////////////////////////////////////////////////////////
else										// portrait-images
/////////////////////////////////////////////////////////////////////////////////////
	{
ScaleKey 	= MaxWidth/OrgWidth;if(ImgRatio<=DivRatio)ScaleKey = MaxHeight/OrgHeight;
	}	
/////////////////////////////////////////////////////////////////////////////////////
NewWidth	= Math.floor(OrgWidth*ScaleKey);
NewHeight	= Math.floor(OrgHeight*ScaleKey);
NewWidth	= (NewWidth/100)*95;			// add some space around the image
NewHeight	= (NewHeight/100)*95;
/////////////////////////////////////////////////////////////////////////////////////
return 'width="'+NewWidth+'" height="'+NewHeight+'"';
/////////////////////////////////////////////////////////////////////////////////////
	}
	
/////////////////////////////////////////////////////////////////////////////////////
//	 OPEN TWITTR IN NEW WINDOW
/////////////////////////////////////////////////////////////////////////////////////

function TwittBirdt()
	{
window.open('http://deathgrunt.com/twitter');
	}

/////////////////////////////////////////////////////////////////////////////////////
//	 SELF CLOSE WINDOW FOR EXTERNAL DISLIKES
/////////////////////////////////////////////////////////////////////////////////////

dislikeclose = 6;

function DisLikeClose()
	{
dislikeclose -= 1;
if(dislikeclose>-1){d.getElementById("disliketimer").innerHTML = dislikeclose;setTimeout("DisLikeClose()",1000);}
else{setTimeout("self.close()",1500);}
	}


/////////////////////////////////////////////////////////////////////////////////////
//	 HIDE HOMEPAGE IMAGE FOR FADER (needed for previews and quickdials)
/////////////////////////////////////////////////////////////////////////////////////

function BackOff()
	{
d.write('<style>#homepage_container{background:#222 url("img/back.jpg") -250px -124px no-repeat;}.image_break{visibility:hidden;}</style>');		
	}
