<?php include('base.js.php'); ?>
function newWinEx(url,z)
{
   features='resizable=yes,scrollbars=yes,status=yes,titlebar=yes,top=0,left=0,height=' +
         (screen.availHeight-48) + ',width=' + (screen.availWidth-8);

   switch (z)
   {
	case 1:
		targetwin='ishopm';
		break;
	case 2:
		targetwin='ishopui';
		break;
	default:
		targetwin='_blank';
		break;
	}

   owin=window.open(url, targetwin, features);
   owin.focus();
}
function setLoginType()
{
   //var i=document.getElementById('login_type').selectedIndex;
   var i=document.forms[0].LGTYPE[0].checked?0:1;
   if (i<=0)
      goAdminInput();
   else
      goUserInput();
}
function goAdminInput()
{
   document.forms[0].RESELID.value='';
   showHide(document.getElementById('admin_login'),1);
   showHide(document.getElementById('user_login'),0);
}
function goUserInput()
{
   document.forms[0].LPATH.value='';
   showHide(document.getElementById('admin_login'),0);
   showHide(document.getElementById('user_login'),1);
}
function zero2(x)
{
	var s2zero=x.toString();

   if (s2zero.length<2)
   	s2zero='0'+s2zero;

   return s2zero;
}
function clear_form()
{
   var f1=document.forms[0];
   var co1=f1.elements;
   var i,n=co1.length;
   for (i=0;i<n;i++) {
      if (co1[i].type=='text' || co1[i].type=='password')
         co1[i].value='';
   }
}
function newWin2()
{
   features='resizable=no,scrollbars=yes,status=yes,titlebar=yes,top=0,left=0,height=' +
         (screen.availHeight-48) + ',width=' + (screen.availWidth-8);
	targetwin='ishopm';
   owin=window.open('', targetwin, features);
   document.forms[0].target=targetwin;
   document.forms[0].submit();
   clear_form();
   owin.focus();
}
function secure_login()
{
   clear_form();
   var i=0; //document.forms[0].LGTYPE[0].checked?0:1;
   var url='https://'+location.hostname+'/ishop/ishop_login.php?LOGIN_TYPE='+i;
   location.href=url;
}
function unsecure_login()
{
   clear_form();
   var i=document.forms[0].LGTYPE[0].checked?0:1;
   var url='http://'+location.hostname+'/ishop/ishop_m2.php?LOGIN_TYPE='+i;
   document.body.onbeforeunload=bodyUnloading;
   location.href=url;
}
function goSecureLogin()
{
   document.getElementById('lpath').style.visibility='hidden';
	document.getElementById('passwd').style.visibility='hidden';
	//document.getElementById('reselid').style.visibility='hidden';
	//document.getElementById('repass').style.visibility='hidden';
   showHide(document.getElementById('normlogin'),0);
   showHide(document.getElementById('seculogin'),1);
}
function goUnsecLogin()
{
   /*
   document.getElementById('lpath').style.visibility='visible';
	document.getElementById('passwd').style.visibility='visible';
	*/
	document.getElementById('lpath').style.display='inline';
	document.getElementById('passwd').style.display='inline';
	
   showHide(document.getElementById('seculogin'),0);
   showHide(document.getElementById('normlogin'),1);
}
function resetDB() 
{
   var fx=-1;
   if (arguments.length>0)
      fx=arguments[0];

   var f1=document.forms[0];
   f1.target='';
   f1.FUNCTION.value=fx;
   document.body.onbeforeunload=bodyUnloading;
   f1.submit();
}
