﻿//Common setting functions
function fnSetDisplayTheme()
	{
	var oBackgroundColor = document.getElementById("ddlScreenColor").value;
	var oForegroundColor = document.getElementById("ddlFontColor").value;
	
	var otxtText		= document.getElementById("txtText");
	
	otxtText.style.backgroundColor = oBackgroundColor;
	otxtText.style.color = oForegroundColor;
	
	}


function fnSetDisplaySize()
	{
	//main textarea setting
	var oddlWindowSize	= document.getElementById("ddlWindowSize");
	var otxtText		= document.getElementById("txtText");
	
	var WindowSize = oddlWindowSize.value;
	
	if(WindowSize =="SE2E")
		{
		otxtText.style.width=SE2EScreenSize.Width +"px";
		otxtText.style.height=SE2EScreenSize.Height +"px";
		
		document.getElementById("txtWindowWidth").value	= SE2EScreenSize.Width;
		document.getElementById("txtWindowHeight").value= SE2EScreenSize.Height;
		}
		
	if(WindowSize =="SML")
		{
		otxtText.style.width=SmallScreenSize.Width +"px";
		otxtText.style.height=SmallScreenSize.Height +"px";
		
		document.getElementById("txtWindowWidth").value	= SmallScreenSize.Width;
		document.getElementById("txtWindowHeight").value= SmallScreenSize.Height;
		}
	if(WindowSize =="MDM")
		{
		otxtText.style.width=MediumScreenSize.Width +"px";
		otxtText.style.height=MediumScreenSize.Height +"px";
		
		document.getElementById("txtWindowWidth").value	= MediumScreenSize.Width;
		document.getElementById("txtWindowHeight").value= MediumScreenSize.Height;
		}
	if(WindowSize =="LRG")
		{
		otxtText.style.width=LargeScreenSize.Width +"px";
		otxtText.style.height=LargeScreenSize.Height +"px";
		
		document.getElementById("txtWindowWidth").value	= LargeScreenSize.Width;
		document.getElementById("txtWindowHeight").value= LargeScreenSize.Height;
		}
	}


	
function fnSetDisplayFont()
	{
	var FontFamiliy = document.getElementById("ddlFontFamiliy").value;
	var FontSize = document.getElementById("ddlFontSize").value;
	var FontAlign = document.getElementById("ddlFontAlign").value;
	var FontWeight = document.getElementById("chkFontBold");
	
	var otxtText		= document.getElementById("txtText")
	
	otxtText.style.fontFamily	= FontFamiliy;
	otxtText.style.fontSize		= FontSize +"px";
	otxtText.style.textAlign	= FontAlign;
		
	if(FontWeight.checked)
		{
		otxtText.style.fontWeight	= FontWeight.value;
		}
	else
		{
		otxtText.style.fontWeight ="normal";
		}
	}


function fnInitialSetting()
	{
	fnSetDisplayTheme();
	fnSetDisplaySize();
	fnSetDisplayFont();
	// alert( (parseInt(window.screen.width)/2);  
	
	}
	
function fnOpenPrompter()
	{
	
	var WindowWidth = parseInt(window.screen.width);
	var ClientWidth =	parseInt(document.getElementById("celAbout").offsetWidth) + 
						parseInt(document.getElementById("txtText").offsetWidth) +
						parseInt(document.getElementById("celSetting").offsetWidth);
	
	var WindowLeft = ((WindowWidth - ClientWidth)/2) + parseInt(document.getElementById("celAbout").offsetWidth);
	
	var url ="frmTextScroller.htm";
	var openWindowWindowWidth	=parseInt(document.getElementById("txtWindowWidth").value);
	var openWindowWindowHeight	=parseInt(document.getElementById("txtWindowHeight").value) + 25;
	
	var WindowFeatures = 'left='+WindowLeft+',top=100,resizable,titlebar=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,'+
						 'width='+ openWindowWindowWidth + ',' +
						 'height=' + openWindowWindowHeight;
	
	//url = url +"?"+ UserPrefrence;

	window.open(url,"TextPrompter",WindowFeatures);

	}	
	
SE2EScreenSize=
	{
	Width :"370",
	Height: "500"
	};
	
SmallScreenSize=
	{
	Width :"400",
	Height: "400"
	};
				
MediumScreenSize=
	{
	Width : "500",
	Height: "500"
	};
	
LargeScreenSize=
	{
	Width : "800",
	Height: "600"
	};
	


