
function window_open(pageToLoad,winName,width,height,center,menubar)
{

	var saw = screen.availWidth;
	var sah = screen.availHeight;
	var sw = screen.width;
	var sh = screen.height;


	var xposition = 0;
	var yposition = 0;
	var winwidth = 100;
	var winheight = 100;

	popupwin = null;
	if(width == 0)
	{
		winwidth = saw - 10;
	} else {
		winwidth = width;
	}
	if (height == 0)
	{
		winheight = sah - 40;
	} else {
		winheight = height;
	}
	if (center == 1 || center == true)
	{
	  xposition = (screen.width - winwidth) * 0.5;
	  yposition = (screen.height - winheight) * 0.5;
	  //if(height != 0) yposition = 50 ;
	}

	args = "width=" + winwidth + ","
	+ "height=" + winheight + ","
	+ "location=0,"
	+ "menubar=" + menubar + ","
	+ "resizable=1,"
	+ "scrollbars=1,"
	+ "status=1,"
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	// firefoxim
	+ "screenx=" + xposition + ","
	+ "screeny=" + yposition + ","

	// msie
	+ "left=" + xposition + ","
	+ "top=" + yposition;

	if (pageToLoad != '')
	{
	  popupwin=window.open(pageToLoad,winName,args);
	} else {
	  popupwin = window.open("",winName,args );
	}

	if (popupwin != null)
	{
	  popupwin.name = winName;

	  if(popupwin.opener == null)
		{
		   popupwin.opener = self;
	  }
	  popupwin.focus();
	}
}

function btn_submit()
{
	window_open('https://www.e-klase.e-klase.lv/auth/index.php','w_main',500,500,1,0);
	//popup('','w_main',);
	document.getElementById("frmLogin").submit();
	//document.location.href="index.php";

}

function goToEklase()
{
	window_open('http://login.e-klase.lv/default.aspx?login=1&m=1','w_main',0,0,0,0);
}
function request_password()
{
	window_open('https://login.e-klase.lv/ParentAccessRegistration/','w_pass',500,500,1,0);
}

function request_information()
{
	window_open('../templates/e-klase_access_info.html','w_info',500,500,1,0);
}

function changeColor()
{  
intervalID = setInterval(flashText, 1000);
}

function flashText()
{
  var elem = document.getElementById("cmdLogin");

  if (elem.style.color == 'red')
  {
    elem.style.color = 'white';
  }
  else
  {
    elem.style.color = 'red';
  }
}