/* @param {Object} params The constructor params */
 
getPackageForName( "com.forddirect.ng.widgets.avrplayer" ).VRPlayer = function(el, jsInstance) {
	this.FLASHID = "360Player"
	this.widgetId = "" ;
	this.jsInstance = jsInstance;
	this.el = el;

	/*
	* This function initializes the widget. 
	* @param {Object} initParams The object is as follows -
	*      {
	*         "widgetId":String                The id of the widget used for book-keeping
	*         "src":String                     The URL of the widget swf file
	*         "xVal":String                    The absolute x co-ordinate of the widget
	*         "yVal":String                    The absolute y co-ordinate of the widget
	*         "depth":String                   The depth of the widget
	*      }
	*/
	this.init = function( initParams ){
		if(typeof initParams == "undefined" ){
			initParams = "";
		}
		
		var oData = new Object();
		oData = this.TheData 
		oData.stageHeight=340
		oData.stageWidth=760
		initParams = "xmlPath=" + oData.path + "" + "&asset=" + oData.asset + "&exterior=" + oData.exterior + "&interior=" + oData.interior + "&background=" + oData.background + "&instanceName=" + this.jsInstance + oData.background + "&stageWidth=" + oData.stageWidth + "&stageHeight=" + oData.stageHeight
		//alert( initParams);
		__flashFramework.loadFlashMovie( this.el, this.FLASHID, "/scripts/widgets/flash360/flash/fordvehicles360_as2.swf" , 760 , 340 , this.jsInstance , initParams);
	}

	this.onInitComplete = function(params){
		mContentActivity("home: 360 popup");
		this.update();
	}

	/* @param {Object} oData */
	this.update = function(){
		var oData = new Object();
		oData = this.TheData
		oData.stageHeight=340
		oData.stageWidth=760
		// Special asset path to the as2 swf
		//oData.swfpath ="/scripts/widgets/flash360/flash/fordvehicles360_as2.swf"
		
		//alert(oData.path + "  AND " + oData.asset + " " + oData.frame  +  " " + oData.exterior +  " " + oData.interior+  " " + oData.background);
		
		__flashFramework.thisMovie(this.FLASHID)["eventHandler"]( "update", oData , "onUpdateComplete");
	}

	this.onUpdateComplete = function(params){
		//alert('trim change')
		//mContentActivity("home: colorizer: trim");
	}
	

	/* This function unloads the widget from the page and resets the widget data. */
	this.unload = function( ){
		//alert("unload");
		__flashFramework.thisMovie(this.FLASHID)["unloadWidget"](this.widgetId);
	}
	
	/* This function hides the UI widget keeping all the widget data intact. */
	this.hide = function( ){
		//alert("hide");
		__flashFramework.thisMovie(this.FLASHID)["eventHandler"]( "hide" ,firedData);
	}
	
	/* This function unhides the UI widget keeping all the widget data intact.*/
	this.unhide = function( ){
		//alert("unhide");
		__flashFramework.thisMovie(this.FLASHID)["eventHandler"]("unhide" ,firedData);
	}

	/* The Flash is listening for the last argument */
	this.new360 = function(oInput){
		//alert("new360 with callback to onUpdateComplete  "  + oInput.id)
		__flashFramework.thisMovie(this.FLASHID)["eventHandler"]("new360" ,oInput , "onUpdateComplete");
	}
	
	
	this.stop360 = function(){
		var o = new Object();
		o.dummy = ""
		__flashFramework.thisMovie(this.FLASHID)["eventHandler"]("stop360", o, null)
	}
	
	/* JS Methods Fired from within Flash */
	this.onColorChipChange = function(params){
		if (params.metrics == "ext"){
			//alert("ext")
			mContentActivity("home: colorizer: exterior",'','');
		}
		if (params.metrics == "int"){
			//alert("int")
			mContentActivity("home: colorizer: interior",'','');
		}	
	}
	
	this.onRotationChange = function(params){
		//alert("onRotationChange "); 
		mContentActivity("home: 360 rotate");
	}	
}
