
 



 //document target | gameURL | which game | sw1 paramiters
function Inbox_dcr(myDoc,url,id,dirVars, check, shock )
{
	
	this.gameWidth = myGameWidth;
	this.gameHeight = myGameHeight;
	this.myDirSW1 = dirVars;
	
	this.doc = myDoc;
	
	
	this.gameURL = url;
	 
	 
	 this.gameID = id;
	this.src =  this.gameID+".dcr";
	 if(check){ 
		this.tShockwaveFound = shock; 
	 
		if(this.tShockwaveFound){
			this.displayContent();
		}else{
			this.displayNoShockwave();
		}
	 }else{
	 
		 this.buildContent();
	 }
}
Inbox_dcr.prototype.getContent = function()
{
return this.myString;	
}
Inbox_dcr.prototype.buildContent = function()
{
 
  	var tag = new DirTag(this.src,this.gameURL, this.gameWidth ,this.gameHeight, false, this.gameID);
	tag.setBgcolor("000000");
	tag.setDirvars(this.myDirSW1);
	this.myString = tag.toString(); 
	 
}
Inbox_dcr.prototype.displayContent = function()
{
 
  	var tag = new DirTag(this.src,this.gameURL, this.gameWidth ,this.gameHeight, false, this.gameID);
	tag.setBgcolor("000000");
	tag.setDirvars(this.myDirSW1);
	tag.write(this.doc); 
	 
}

Inbox_dcr.prototype.displayNoShockwave = function(){
	
	var oc = new OtherContent(this.gameURL);
	this.doc.write(oc.getAlternate());
}




///////////////////////////////////////////////////////////////////////////////////////////////////////
//If there is no shockwave 
////////////////////////////////////////////////////////////////////////////////////////////////////////
function OtherContent(url)
{
	this.gameURL = url;
}
OtherContent.prototype.getAlternate = function(){
	var alternateContent = '<table width="200" border="0" cellpadding="0"><tr><td align="center"><a href="javascript:forceShockwave();"><img src="'+this.gameURL+'images/noShockwavelogo.jpg" width="754" height="208" border="0" align="middle" scr="images/noShockwavelogo.jpg"/></a></td></tr><tr><td height="50" align="center">you need shockwave to play the 3D game.</td></tr><tr><td height="50" align="center"><a href="javascript:forceShockwave();">Click here</font></a> to download and play the game.</td></tr><tr><td height="50" align="center"> Or, if that does not work <a href="http://www.adobe.com/go/getshockwave/">click here</a> to install Adobe Shockwave Player</td></tr></table>';
	
	return alternateContent ;  // insert non-flash content
}

/////////////////////////////////////////////////////////////////////////////////////////////////////
///draw the dcr  thanks to >> Valentin Schmidt
//////////////////////////////////////////////////////////////////////////////////////////////////////
function DirTag(src,url, width, height, forceReloadFlag, tID)
{
	
	
    this.src       = url+src;
	this.gUrl       = url ;
    if (forceReloadFlag) this.src += '?'+Math.random();
    this.width     = width;
    this.height    = height;
    this.version   = '10,0,0,0';
    this.id        = null;
    this.bgcolor   = 'ffffff';
	this.stretch   = 'meet';
    this.dirVars = null;
	this.pID = tID;
}

/**
 * Sets the Director Shockwave version used in the Director Shockwave tag.
 */
DirTag.prototype.setVersion = function(v)
{
    this.version = v;
}

/**
 * Sets the ID used in the Director Shockwave tag.
 */
DirTag.prototype.setId = function(id)
{
    this.id = id;
}

/**
 * Sets the background color used in the Director Shockwave tag.
 */
DirTag.prototype.setBgcolor = function(bgc)
{
    this.bgcolor = bgc;
}

/**
 * Sets any variables to be passed into the Director Shockwave content, as externalParamValue("sw1")..("sw9").
   maximum 9 args supported
 */
DirTag.prototype.setDirvars = _setDirvars;
function _setDirvars(){
    this.dirVars = _setDirvars.arguments;
}
	
/**
 * Get the Director Shockwave tag as a string. 
 */
DirTag.prototype.toString = function()
{
	 	
    var ieWin = (/Win/.test(navigator.userAgent) && navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var DirTag = new String();
    if (ieWin)
    {
        DirTag += '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" ';
        if (this.id != null)
        {
            DirTag += 'id="'+this.id+'" ';
        }
        DirTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version='+this.version+'" ';
        DirTag += 'width="'+this.width+'" ';
        DirTag += 'height="'+this.height+'">';
        DirTag += '<param name="src" value="'+this.src+'"/>';
        DirTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
		 DirTag += '<param name="swStretchStyle" value="'+this.stretch+'"/>';
        if (this.dirVars != null){
        	var len = Math.min(this.dirVars.length, 8);
        	for (i=0;i<len;i++)
        		DirTag += '<param name="sw'+(i+1)+'" value="'+this.dirVars[i]+'"/>';
        }
        DirTag += '</object>';
    }
    else
    {
        DirTag += '<embed src="'+this.src+'" ';
        DirTag += 'bgcolor="#'+this.bgcolor+'" ';
        DirTag += 'width="'+this.width+'" ';
        DirTag += 'height="'+this.height+'" ';
		 DirTag += 'swStretchStyle=' +this.stretch;
        DirTag += 'type="application/x-director" ';
        if (this.dirVars != null){
        	var len = Math.min(this.dirVars.length, 8);
        	for (i=0;i<len;i++)
            DirTag += 'sw'+(i+1)+'="'+this.dirVars[i]+'" ';
        }
        if (this.id != null)
        {
            DirTag += 'name="'+this.id+'" ';
        }
        DirTag += 'pluginspage="http://www.macromedia.com/shockwave/download/">';
        DirTag += '</embed>';
		
		
		
		 
    }
	
	
	//add in the tag proxy swf for local connection
	DirTag += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1" height="1" id="myFlash">'; 
	DirTag += '<param name="movie" value="'+this.gUrl+'dirproxy.swf?pID='+ this.pID +'" />' ;
		DirTag += '<embed src= "'+this.gUrl+'dirproxy.swf?pID='+ this.pID +'" width="1" height="1" name="myFlash" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>' ;
	
	
	 
	
    return DirTag;
}

/**
 * Write the Director Shockwave tag out. Pass in a reference to the document to write to. 
 */
DirTag.prototype.write = function(doc)
{
  doc.write(this.toString());
}

///////////////////////////////////////////////////////////////////////////////////////////////
// JavaScript Document loading avenger
//cloud address
var gameURL = "http://cdn.cloudfiles.mosso.com/c111282/";
var gameID = "jeep";
 
function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="'+ jsFile + '"></script>'); 
} 
//IncludeJavaScript(gameURL+"Inbox_dcr.js"); 
function forceShockwave (){
	
	var dcr = new Inbox_dcr( document, gameURL, gameID ,"", false, 1);
 
	document.getElementById('content').innerHTML = dcr.getContent();
}


  
//document.write(myDirSW1);


var dcr = new Inbox_dcr( document, gameURL, gameID ,myDirSW1, true,tShockwaveFound);