function ExpandableFlashArea (id, fX, fY, eW, eH, iFF){
	var containerDiv;

	this.listeners = new Array ();
	this.iFrameFix = true;
	
	this.isExpanded =false;
    this.flashObj   = new Object();
	//-- the below variables are preset as per sony's request, so that population from interwoven will be simplified 
	this.setContainerDiv 	("expandableFlashContainer");
	this.setMinimisedWidth 	(692);
	this.setMinimisedHeight (355);
	this.setExpandedZIndex  (998);

	if (id != "" && id != null)
		this.setFlashObjID (id);

	if (fX != "" && fX != null)
		this.setXPos (fX);
		
	if (fY != "" && fY != null)
		this.setYPos (fY);	

	if (eW != "" && eW != null)
		this.setExpandedWidth (eW);	
		
	if (eH != "" && eH != null)
		this.setExpandedHeight (eH);		
		
		
	if (iFF == false)
		this.useIFrameFix (false);
	else
		this.useIFrameFix (true);
}



ExpandableFlashArea.prototype = {
	
		setUpContainer: function (){
		var containerDiv;
		var windowDivID;
		var containerDivID;
		var htmlCode;
		var windowStyles;
		var containerStyles;
		var containerZIndex;
		var divMediator;
		var $windowDiv;
		
		containerDiv 					= document.getElementById (this.containerDivID);
		if (containerDiv != null){
			this.divInnerHTML 				= containerDiv.innerHTML;

			
			if (this.flashExpandedWidth != null && 
				this.flashExpandedWidth != "undefined" && 
				this.flashExpandedWidth != "" &&
				this.flashExpandedWidth != this.flashMinimisedWidth &&
				this.flashExpandedHeight != null &&
				this.flashExpandedHeight != "undefined" &&
				this.flashExpandedHeight != "" &&
				this.flashExpandedHeight != this.flashMinimisedHeight){
				

				if (this.minimisedZIndex == null || this.minimisedZIndex == "" || this.minimisedZIndex == "undefined"){
					containerZIndex	= containerDiv.style.zIndex;
					
					if(containerZIndex	 != "")
						this.setMinimisedZIndex (containerZIndex);
					else
						this.setMinimisedZIndex (1);
				}
	
	
				
				
				containerDiv.style.position 	= "relative";
				containerDiv.style.width		= this.flashMinimisedWidth + "px";
				containerDiv.style.height		= this.flashMinimisedHeight + "px";
				
				windowDivID			= this.containerDivID + "_window";
				containerDivID		= this.containerDivID + "_flash_container";
				
				windowStyles	= "position:absolute; top:0px; 						   left:0px; 						 width:"+ this.flashMinimisedWidth +"px; height:"+ this.flashMinimisedHeight +"px; overflow:hidden;";
				containerStyles	= "position:absolute; top:"+ this.flashYPosition +"px; left:"+ this.flashXPosition +"px; width:"+ this.flashExpandedWidth +"px;  height:"+ this.flashExpandedHeight +"px;";
				
				
				htmlCode	 = "<div style='" + windowStyles + "' 		id='" + windowDivID + "'>";
				htmlCode	+= "<div style='" + containerStyles + "' 	id='" + containerDivID + "'>";
				htmlCode 	+= this.divInnerHTML ;
				htmlCode	+= "</div>";
				htmlCode	+= "</div>";
				containerDiv.innerHTML 	= htmlCode;
				
				divMediator = this;
				$windowDiv =$jq( "#" + containerDivID);
				
				$windowDiv.mouseover (function (e){
					divMediator.notifyFlash ("onMouseOver");							  
				});
				
				$windowDiv.mouseout (function (e){
					divMediator.notifyFlash ("onMouseOut");							  
				});
				
				
				$windowDiv.click (function (e){
					divMediator.notifyFlash ("onPress");							  
				});
				
			}
			
			if (this.iFrameFix)
				$jq('#' + this.containerDivID).bgiframe();
		}
		return containerDivID;
	},





	useIFrameFix:function (bool){
		if (bool != false)
			this.iFrameFix = true;
		else
			this.iFrameFix = false;
	},




	collapse: function (){
		var windowDiv;
		var flashContainerDiv;
		var $iframe;
		
		windowDiv 			= document.getElementById (this.containerDivID + "_window");
		flashContainerDiv	= document.getElementById (this.containerDivID + "_flash_container");
		
		windowDiv.style.top		= "0px";
		windowDiv.style.left	= "0px";
		windowDiv.style.width	= this.flashMinimisedWidth + "px";
		windowDiv.style.height	= this.flashMinimisedHeight + "px";
		document.getElementById (this.containerDivID).style.zIndex	= this.minimisedZIndex;
		
		flashContainerDiv.style.top		=  this.flashYPosition + "px";
		flashContainerDiv.style.left	=  this.flashXPosition + "px";	
		

		
		if (this.iFrameFix){
			$iframe	=	$jq ("#"+this.containerDivID +">.bgiframe");
			$iframe.css("width", 	this.flashMinimisedWidth);
			$iframe.css("height", 	this.flashMinimisedHeight);
			$iframe.css("top", 		0);
			$iframe.css("left", 	0);
		}
		
	this.isExpanded =false;
	},




	expand: function (){
		var windowDiv;
		var flashContainerDiv;
		var $iframe;

		windowDiv 			= document.getElementById (this.containerDivID + "_window");
		flashContainerDiv	= document.getElementById (this.containerDivID + "_flash_container");
		
		windowDiv.style.top		= this.flashYPosition + "px";
		windowDiv.style.left	= this.flashXPosition + "px";
		windowDiv.style.width	= this.flashExpandedWidth + "px";
		windowDiv.style.height	= this.flashExpandedHeight + "px";
		
		document.getElementById (this.containerDivID).style.zIndex	= this.expandedZIndex;
		
		flashContainerDiv.style.top		= "0px";
		flashContainerDiv.style.left	= "0px";	
		
		if (this.iFrameFix){
			$iframe	= $jq ("#"+this.containerDivID +">.bgiframe");
			$iframe.css("width", 	this.flashExpandedWidth);
			$iframe.css("height", 	this.flashExpandedHeight);
			$iframe.css("top", 		this.flashYPosition);
			$iframe.css("left", 	this.flashXPosition);
		}
		

		this.isExpanded = true;
	},
	
	
	
	
	isDivExpanded:function (){
		return this.isExpanded;
	},
	
	
	
	
	 registerFlashCallbackFunction: function (functionName){
		this.flashEventListener = functionName;
		this.listeners.push (functionName);
	},
	
	
	
	
	notifyFlash:function (eventName, optionalVal){
		var functionToCall;
		var i;
		var undefinedVar;
		/*
		if ( this.flashID != "" && this.flashID != "undefined" && this.flashID != null && this.flashID != undefinedVar ){
			
		}
		this.getFlashObjID()
		*/
		
		this.flashObj = this.getFlashObj();
		
		
		if (this.flashEventListener != "" && this.flashEventListener != "undefined" && this.flashEventListener != null){	
			for (i = 0; i < this.listeners.length ; ++i){
				this.flashObj[ this.listeners [i] ]( eventName, optionalVal );
			}
		}
		
	},
	
	getFlashObj:function (){
		var flashContainerDiv	= document.getElementById (this.containerDivID + "_flash_container");
		var flashObj;
		var undefinedVar;
		var flashID;
		var tmp;
		
		tmp = $jq (flashContainerDiv).find ('object') [0];
		if (tmp  != undefinedVar)
			flashID = tmp.id;
		else if (flashID  == undefinedVar)
			flashID = $jq (flashContainerDiv).find ('embed') [0].id;
		if (swfobject != undefinedVar ){
            if (swfobject.getObjectById != undefinedVar)
                flashObj = swfobject.getObjectById (flashID);
            else if (navigator.appName.indexOf("Microsoft") != -1) 
                flashObj =  window[flashID];
    		else
    			flashObj = document[flashID];
                
        }
        else if (navigator.appName.indexOf("Microsoft") != -1) 
        	flashObj =  window[flashID];
		else
			flashObj = document[flashID];
		

		return flashObj;
	},

	
	
	setFlashObjID :function (id){
		this.flashID = id;
	},
	
	
	
	setContainerDiv: function (divID){
		this.containerDivID = divID;
	},
	
	
	
	
	setMinimisedHeight: function (num){
		this.flashMinimisedHeight = num;	
	},
	
	
	
	
	setMinimisedWidth: function (num){
		this.flashMinimisedWidth = num;
	},
	
	

	
	setMinimisedZIndex: function (num){
		this.minimisedZIndex = num;
	},
	
	
	
	
	setExpandedWidth: function (num){
		this.flashExpandedWidth = num;
	},
	
	
	
	
	setExpandedHeight: function (num){
		this.flashExpandedHeight = num;	
	},
	
	
	
	
	setExpandedZIndex: function (num){
		this.expandedZIndex = num;
	},
	
	
	
	
	setXPos: function (num){
		this.flashXPosition = num;	
	},
	
	
	
	
	setYPos: function (num){
		this.flashYPosition = num;	
	}
	
}

jQuery(document).ready(function(){
	if((jQuery('#hubPageBanner').length == 1) && (navigator.appVersion.indexOf("Mac")!=-1)){
		jQuery('#modeldrop').hover(
			function(){
				//jQuery('#modeldrop li').append('<iframe id="iframeBlock" frameborder="0" style="width:160px; height:220px; position:absolute; margin-left:-10px;"></iframe>');
				jQuery('.procatselection').css({'z-index':'999'});
				jQuery('.ViewModel').css({'z-index':'3000'});
			},
			function(){
				jQuery('#iframeBlock').remove();
				jQuery('.ViewModel').css({'z-index':'1'});
			}
		);
	}
});
