

//**************************************
// new window

function popper(thisUrl,thisWindow,thisWidth,thisHeight,thisTop,thisLeft)
  {
optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',top=' + thisTop + ',left=' + thisLeft + ',status=no,menubar=no,resizable=no,scrollbars=no');
mainWin = window.open(thisUrl,thisWindow,optionString);
  }

//***************************************************************************************
//*********kairysis meniu
//***************************************************************************************


function mySplit(s){
	s2 = s.split('|')
	return s2
}


function make_left_menu(submnu) {

	var l_mnu = '';
        var nws = '';

//	 l_mnu = '<center><a href="/kalediniai-laimetojai/" target="_top"><img src="/images/kalediniai-laimetojai.gif" border="0" alt=""></a></center> <br/>';
	l_mnu += '<table cellspacing="3" cellpadding="0" border="0" width="208">'+"\n";

	if (submnu.constructor == String) {
		alert("stringas: "+submnu);
	}

//	i=0

	i=1
	do {

		sub = (menus[i].constructor == Array) ? menus[i][0] : menus[i]
		mstl = (submnu==i) ? "menu-a" : "menu"

		s=mySplit(sub);

			l_mnu = l_mnu +

				'  <tr>' + "\n" +
				'    <td width="14" valign="top">&nbsp;</td>' + "\n" +
				'    <td width="14"><img src="/images/menu_bullet_1.gif" width="9" height="9"></td>' + "\n" +
				'    <td width="180" colspan="2">' + "\n";
                                //nws = (s[0]=="Vadybos apskaita") ? '<span class="spalva3"> [nauja]</span> ':'';
				if (s[1])
					l_mnu = l_mnu + '    <a href="' + s[1] + '"  class="' + mstl + '">' + s[0] + nws + '</a></td>' + "\n";
				else
					l_mnu = l_mnu + '    <span class="verdana11b">' + s[0] + '</span></td>' + "\n";


			l_mnu = l_mnu +
				'  </tr>' + "\n" +
				'  <tr>' + "\n" +
				'    <td width="14" valign="top"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +
				'    <td width="194" colspan="3" background="/images/menu_dotline.gif"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +

				'  </tr>' + "\n";

//		alert( Math.round( ( (submnu-Math.floor(submnu)) * 10) ) )
//		alert(submnu % 10)

		if (menus[i].constructor == Array){

			l_mnu = l_mnu + left_menu_space(4);

			j=1;
			do {

				img = "/images/menu_bullet_2.gif"
				stl = ((Math.round( (submnu-Math.floor(submnu)) * 100) == j)&&(Math.round(submnu) == i)) ? "smenu-a" : "smenu"

//				alert(submnu+" "+desimtosios+" "+Math.floor(submnu))
//				alert(desimtosios)

				s=mySplit(menus[i][j]);

				if (s[1] == null) {
					;
				}
				else {

					l_mnu = l_mnu +

					'  <tr>' +
					'    <td width="14" valign="top">&nbsp;</td>' +
					'    <td width="14" valign="top">&nbsp;</td>' +
					'    <td width="12"><img border="0" src="' + img + '" width="8" height="7"></td>' +
					'    <td width="168"><a href="' + s[1] + '" class="' + stl + '">' + s[0] + '</a></td>' + "\n" +
				'  </tr>' + "\n" +
				'  <tr>' + "\n" +
				'    <td width="14" valign="top"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +
				'    <td width="14" valign="top"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +
				'    <td width="12" valign="top"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +
				'    <td width="168" background="/images/menu_dotline.gif"><img src="/images/trans.gif" width="1" height="1" border="0" alt=""></td>' + "\n" +
				'  </tr>' + "\n";

					l_mnu = l_mnu + left_menu_space(4);

				}

				j = j + 1;

			} while (menus[i][j] != null)

			l_mnu = l_mnu + left_menu_space(10);

		}

		else {

			l_mnu = l_mnu + left_menu_space(10);

		}

		i = i + 1;

	} while (menus[i] != null)

	l_mnu = l_mnu + left_menu_space(5);

	l_mnu = l_mnu +
		'</table>';


//	alert(l_mnu)

	document.writeln(l_mnu);
}

function left_menu_space(pix) {

//	spc =	'  <tr><td width="208" colspan="4" valign="top">&nbsp;</td></tr>';
	spc =	'';
	return spc;

}
function OpenMain(){
         window.opener.location="sms_game.php";
         window.close();

}

function SearchFields()
{
var t = document.archyvas;
var str = t.search.value
str = str.replace(/\s+/g,"+");
window.location = "amz.php?do=1"+ "&AuthorID=" + t.AuthorID.value +  "&RubID=" + t.RubID.value +  "&search=" + str

}
 
function CustomerNo(id)
{
	var o1 = "";
	//alert('oo');
	for( var i=1; i < 8; i++)
	{
		o1 = document.getElementById(i+"asm")
		o1.style.display = "none";
	}
	for( var i=1; i <= id; i++)
	{
		o1 = document.getElementById(i+"asm")
		o1.style.display= "";	
		
	}
}
function checkSubmit() 
{  
	var dc = document.getElementById('errtext');
	var retval = true;
	dc.innerHTML = '';
	dc.innerHTML = '<font color="red"><b>DĖMESIO ! Rasta netikslumų, <br> patikrinkite suvestą informaciją:  <br><br>';
	dc.innerHTML += '<ul>';

	if(!document.registracija.ccode.value.match(/^\d{7}$|^\d{9}|^\d{11}$/))
	{
		dc.innerHTML += '<li>įmonės kodą</li>';
		document.getElementById("tccode").style.color = "red";
		retval = false
	}
	else
		document.getElementById("tccode").style.color = "black";
	var flds = {"cname": "įmonės pavadinimą",	
				"caddress": "įmonės adresą",	
				"cpvm" :"PVM mokėtojo kodą (jeigu neturite padėkite brūkšniuką)",	
				"ctel":  "telefoną"}	
				//"caccount": "ats. sąskaitos numerį",	
				//"cbank":"banko pavadinimą",	
				//"cbankc":"banko kodą"
	//"cfax": "faksą (jeigu neturite padėkite brūkšniuką)",
	var tmp;
	for (var field in flds)
	{	
		tmp = "document.registracija." + field + ".value";

		if (eval(tmp) =='' || eval(tmp)== 0 ||  eval(tmp)== null) 
			{
				
				document.getElementById("t"+field).style.color = "red";
				dc.innerHTML +='<li>'+flds[field] +'</li>';
				retval = false;
			}
			else
			{
				document.getElementById("t"+field).style.color = "black";
			
			}
	}
	if(retval == false)
	{			
		document.getElementById('rname0').focus();
		document.getElementById('rname0').select();
	}
	dc.innerHTML += '</ul></b></font>';
	return retval;
}
function openPopUp(thisUrl,thisWindow,thisWidth,thisHeight)
  {
  optionString = ('width=' + thisWidth + ',height=' + thisHeight + ',status=no,menubar=no,resizable=yes,scrollbars=yes');
  mainWin = window.open(thisUrl,thisWindow,optionString);
    }

// "JavaScript" slepimo pabaiga -->

