
 



 //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.myRND =  "r"+( Math.random());
	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,this.myRND);
	tag.setBgcolor("ffffff");
	tag.setDirvars(this.myDirSW1, this.myRND);
	this.myString = tag.toString(); 
	 
}
Inbox_dcr.prototype.displayContent = function()
{
 
  	var tag = new DirTag(this.src,this.gameURL, this.gameWidth ,this.gameHeight, false, this.gameID,this.myRND);
	tag.setBgcolor("ffffff");
	tag.setDirvars(this.myDirSW1, this.myRND);
	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="750" border="0" cellpadding="0" background="http://www.gamenet.com/img/snowparty.png"><tr><td align="center"></td></tr><tr><td height="50" align="center"><font size="3"  face="Arial" ><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p><strong>SNOW PARTY - You need the latest shockwave to play this 3D game.</strong></p></font></td></tr><tr>  <td height="50" align="center"><a href="http://www.gamenet.com/gamenetclick.php?p=2927&c=148&s=Snowparty_NoShock" target="_blank"><img src="http://www.gamenet.com/img/transparent-back-logo.png" width="300" height="90" border="none"/></a></td></tr><tr><td height="55" align="center"><font size="3" face="Arial" ><p><strong><a href="http://www.gamenet.com/gamenetclick.php?p=2927&c=148&s=Snowparty_NoShock" target="_blank">Play More Online Games</a> at GAMENET.COM<br /> &nbsp;</strong></p></font></td></tr><tr>  <td height="50" align="center"><font size="3" face="Arial" ></font></td></tr><tr>  <td height="50" align="center"><font size="3" face="Arial" ><strong><a href="javascript:forceShockwave();">Click here</a> to get shockwave and play this SNOWPARTY game</strong></font></td></tr><tr><td height="50" align="center"><font size="3" face="Arial" ><strong>Or, if that does not work <a href="http://www.adobe.com/go/getshockwave/" target="_blank">click here</a> to install Adobe Shockwave Player</strong></font></td></tr><tr><td height="22">&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table>';

	return alternateContent ;  // insert non-flash content
}

/////////////////////////////////////////////////////////////////////////////////////////////////////
///draw the dcr  thanks to >> Valentin Schmidt
//////////////////////////////////////////////////////////////////////////////////////////////////////
function DirTag(src,url, width, height, forceReloadFlag, tID, arnd)
{
	
	this.myrnd = arnd;
    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 +'&rnd='+this.myrnd +'" />' ;
		DirTag += '<embed src= "'+this.gUrl+'dirproxy.swf?pID='+ this.pID +'&rnd='+this.myrnd +'" width="1" height="1" name="myFlash" swLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>' ;
	
	//DirTag +=this.dirVars[0];
	 
	
    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

var gameURL = "http://www.gamenet.com/snowparty/";
var gameID = "snowparty008";
 
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 ,myDirSW1, false, 1);
 
	document.getElementById('content').innerHTML = dcr.getContent();
}


  
 


var dcr = new Inbox_dcr( document, gameURL, gameID ,myDirSW1, true,tShockwaveFound);