var iMarginSize = 5;
var SamiOn = 1;
function ReSize(){
	//get current browser resolution
	iCurrentResWidth = window.document.body.clientWidth;
	iCurrentResHeight = window.document.body.clientHeight;
	iLeftColumnWidth = 256;
	iRightColumnWidth = iCurrentResWidth - iLeftColumnWidth;
	var iMarkerTop;
	var iRightColumnHeight;
	
	if (parseInt(Logo1.style.height) == 0){
		iMarkerTop = parseInt(MediaPlayer.style.height) + parseInt(Controls.style.height);
	} else {
		iMarkerTop = parseInt(MediaPlayer.style.height) + parseInt(Controls.style.height) + LogoOne.height;
	}
	if (parseInt(Logo2.style.height) == 0){
		iRightColumnHeight = Slide.height + parseInt(PPTSlides.style.height)
	} else {
		iRightColumnHeight = parseInt(Slide.height) + parseInt(Sami.style.height) + parseInt(LogoTwo.height);
	}
	
	var iMarkerHeight;
	//alert(iRightColumnHeight);
	if (iCurrentResHeight < iRightColumnHeight){
		if ((iCurrentResHeight - 3) > iMarkerTop) {
			iMarkerHeight = iRightColumnHeight - iMarkerTop + 15;
			MarkerList.style.height = iMarkerHeight;
		}	

	} else {
		if ((iCurrentResHeight - 5) > iMarkerTop) {
			iMarkerHeight = (iCurrentResHeight - 5) - iMarkerTop;
			MarkerList.style.height = iMarkerHeight;
		}
	}
	
	SlideSizer();
	PositionBufferStat();
	PositionStudiosLogo();

}

function SlideSizer(){
	if ((iCurrentResWidth - iLeftColumnWidth) < 400 && (iCurrentResWidth - iLeftColumnWidth) > 186){
		SlideTD.style.textAlign = "left";
		Slide.width = (iCurrentResWidth - iLeftColumnWidth) - iMarginSize;
		Slide.height = Slide.width / 1.33333333333;
	} else if ((iCurrentResWidth - iLeftColumnWidth) > 399){
		SlideTD.style.textAlign = "center";
		Slide.width = 400;
		Slide.height = 300;
	} else {
		Slide.width = 192;
		Slide.height = 144;
	}
	
	SlideCatcher.style.height = Slide.height;
	SlideCatcher.style.width = Slide.width;
	
	if (PPTSlides.style.display != "none"){
		Sami.style.width = Slide.width - parseInt(PPTSlides.style.width);		
	} else {
		Sami.style.width = Slide.width;
	}
}

function PositionBufferStat(){
	BufferStat.style.left = (iCurrentResWidth - parseInt(BufferStat.style.width)) / 2;
	BufferStat.style.top = (iCurrentResHeight - parseInt(BufferStat.style.height)) / 2;
}

function PositionStudiosLogo(){
	StudiosLogo.style.left = (iCurrentResWidth - parseInt(StudiosLogo.style.width));
	StudiosLogo.style.top = (iCurrentResHeight - parseInt(StudiosLogo.style.height));
	
}

function Buffering(){
	if (BufferStat.style.display == "none"){
	    BufferStat.style.display = "";
	} else {
    	BufferStat.style.display = "none";
	}

}

function ReSizePlayer(){
	if (MPlay1.ImageSourceHeight == 0) {
		MediaPlayer.style.display = "none";
		MediaPlayer.style.height = 0;
		MediaPlayer.style.width = 0;
		MarkerList.style.width = 256;
		submarkers.style.width = 200;
	} else if (MPlay1.ImageSourceWidth == 176){
		MediaPlayer.style.width = 256;
		MediaPlayer.style.height = 144;
		submarkers.style.width = 200;
	} else if (MPlay1.ImageSourceWidth == 320){
		MediaPlayer.style.width = 350;
		MediaPlayer.style.height = 240;
		submarkers.style.width = 330;
	}

}

function SamiOnOff(){
	if (SamiOn == 1){
		SamiOn = 0;
		cconoff.src = "images/ccon.jpg"
		Sami.innerText = ""
	} else {
		SamiOn = 1;
		cconoff.src= "images/ccoff.jpg"
		Sami.innerText = "please wait..."
	}
}