

function resize() {
	getRealSizeTO=setTimeout("getRealSize()",50)
}


function getRealSize() {
	if (main) {
		video_controls_height=0
		
		var s=main.findName("videoElement")
		var sourceWidth = s.width
		var sourceHeight = s.height
		var targetWidth = plugin.content.actualWidth
		var targetHeight = plugin.content.actualHeight
		var sourceWidthNatural = s.NaturalVideoWidth 
		var sourceHeightNatural = s.NaturalVideoHeight  
		
	   
		video_ratio=sourceWidthNatural/sourceHeightNatural
		display_ratio=targetWidth/(targetHeight-video_controls_height)
	   

		vbg=s.findName("videoBG")	
		pc=s.findName("PlayControls")
		vc=s.findName("volumeControl")
		me=s.findName("videoElement")
		bmbg=s.findName("bufferMsgBG")
		
		if(display_ratio>video_ratio) {

			me.width=targetWidth*(sourceWidthNatural/sourceHeightNatural)	
			me.height=(targetHeight)

			me["Canvas.Left"]=targetWidth/2-me.width/2
			me["Canvas.Top"]=0
		
		}
		else {
			me.width=targetWidth
			if (sourceWidthNatural&&sourceHeightNatural) me.height=targetWidth/(sourceWidthNatural/sourceHeightNatural)
			else me.height=me.width;
			
			me["Canvas.Left"]=0
			me["Canvas.Top"]=(targetHeight-video_controls_height)/2-me.height/2
		}

		
		
		pc["Canvas.Top"]=targetHeight-video_controls_height-50
		vbg.width=targetWidth
		vbg.height=targetHeight-video_controls_height
		bmbg.width=targetWidth
		bmbg.height=targetHeight
		
		

	/*
		if(targetWidth<290 && targetWidth>145) {		
			new_full_bar_width=targetWidth-80
			s.findName("TimeText2").opacity=1
		}
		
		if(targetWidth>145) {
			main.findName("PlayBG").width=targetWidth-65
			s.findName("ToBeLoadedPath").width=new_full_bar_width
			s.findName("LoadedPath").width= new_full_bar_width * me.downloadProgress
		}	
	*/

		new_full_bar_width=targetWidth-240
		main.findName("PlayBG").width=targetWidth-57
		
		s.findName("ToBeLoadedPath").width=new_full_bar_width
		s.findName("LoadedPath").width= new_full_bar_width * me.downloadProgress
		
		vc["Canvas.Left"]=new_full_bar_width+60
		objsArr["volumeSlider"].world_offset=32+vc["Canvas.Left"]  //32-left offset,60-init volume level
		
		main.opacity=1
	}	
}

