/**
 * In The Name of Allah, The Most Gracious, The Most Merciful
 * Version 6.1
 */
function SetScreen()
{
	if (TD = xGetElementById("tdForm"))
	{
		ScreenWidth = screen.width;
		ScreenHeight = screen.height;
		if (ScreenWidth >= 1024)
		{
			TD.height = "350px";
		}
	}
}
function PageLoading()
{
	SetScreen();
	PageStyle = xGetElementById("lnkStyle");
	Scripts = xGetElementsByTagName("script");
	IsForm = false;
	for (var i = 0; i < Scripts.length; i++)
	{
		if (Scripts[i].src.indexOf('js/form.js') != -1)
		{
			IsForm = true;
		}
	}

	if (((typeof FormLoading_) !== 'undefined' ) && FormLoading_)
	{
		FormLoading_();
	}
	else
	{
	}
}
function GoTo(URL)
{
	window.location = URL;
	//document.forms[0].action = URL;
	//document.forms[0].submit();
}

function GoToNew(URL)
{
	var NewWindow = window.open(URL);
	//NewWindow.location = URL;
}

function GoToNewBlank(URL)
{
	var NewWindow = window.open(URL, "", "left=40,top=30,width=800,height=600,status=1,scrollbars=1,menubar=0,toolbar=0,resizable=0");
}

function GoToNewBlankWithSize(URL, Width, Height)
{
	ScreenHeight = screen.availHeight;
	ScreenWidth = screen.availWidth;

	var Left = Math.floor((ScreenWidth - Width) / 2);
	var Top = Math.floor((ScreenHeight - Height) / 2);

	var NewWindow = window.open(URL, "", "left=" + Left + ",top=" + Top + ",width=" + Width + ",height=" + Height + ",status=1,scrollbars=1,menubar=0,toolbar=0,resizable=0");
}

function NewWindow(URL, Target, Width, Height, Top, Left, Resizable, MenuBar, ScrollBars, ToolBar, Status)
{
	return goToWindow(URL, Target, Width, Height, Top, Left, Resizable, MenuBar, ScrollBars, ToolBar, Status);
}

function goToWindow(URL, Target, Width, Height, Top, Left, Resizable, MenuBar, ScrollBars, ToolBar, Status) {
	var StatusText = '';

	if (!(Target && Target.length > 0))
	{Target = null;}

	if (Width)
	{StatusText += ',width=' + Width;}
	else
	{StatusText += ',width=800';}

	if (Height)
	{StatusText += ',height=' + Height;}
	else
	{StatusText += ',height=600';}

	if (Top)
	{StatusText += ',top=' + Top;}
	else
	{StatusText += ',top=30';}

	if (Left)
	{StatusText += ',left=' + Left;}
	else
	{StatusText += ',left=40';}

	if (Resizable)
	{StatusText += ',resizable=' + Resizable;}
	else
	{StatusText += ',resizable=yes';}

	if (MenuBar)
	{StatusText += ',menubar=' + MenuBar;}
	else
	{StatusText += ',menubar=no';}

	if (ScrollBars)
	{StatusText += ',scrollbars=' + ScrollBars;}
	else
	{StatusText += ',scrollbars=yes';}

	if (ToolBar)
	{StatusText += ',toolbar=' + ToolBar;}
	else
	{StatusText += ',toolbar=no';}

	if (Status)
	{StatusText += ',status=' + Status;}
	else
	{StatusText += ',status=no';}

	if (StatusText.length > 0)
	{
		StatusText = StatusText.substr(1);
	}

	var NewWindow_ = window.open(URL, Target, StatusText);
}

function trim(str)
{
	if (typeof(str) == "string")
	{
		return str.replace(/^\s*|\s*$/,"");
	}
//	return str.replace(/(^ +| +$)/, "");
}

function Close()
{
	window.close()
}
