
var NN=(navigator.appName=="Netscape")

//--------------- Special function ---------------
function changePortion(sel_elem,old_ind,page_url) {
 var ind=sel_elem.selectedIndex;
 if (ind!=old_ind)
   location.href=page_url+sel_elem.options[ind].value
 }

function showSeller(seller) {
 makePullDn("","seller.phtml?seller="+seller,480,450)
 }
function showTovar(tovar) {
 makePullDn("","tovar.phtml?tovar="+tovar,480,450)
 }
function showFirma_org(firma_org) {
 makePullDn("","firma_org.phtml?firma_org="+firma_org,480,450)
 }
function showVistav(vistav) {
 makePullDn("","vistavka.phtml?vistav="+vistav,480,450)
 }


//--------------- Make Pull-Down Window ---------------
function makePullDn(name,source,width,height) {
 var win_prop="location=no,toolbar=no,directories=no,menubar=yes,status=yes,"+
	"scrollbars=yes,resizable=yes,dependent=no,width="+width+",height="+height
 if (window.screen)
   win_prop+=",screenX="+Math.floor((screen.width-width)/2)+",screenY="+Math.floor((screen.height-height)/2)
 return open(source,name,win_prop)
 }

//--------------- Check a string for a int value -------------
function checkStrInt(chkstr) {
 var maskstr="0123456789"
 var len=chkstr.length
 if (! len) return false
 for (var i=0; i<len; i++) {
   var n=maskstr.indexOf(chkstr.charAt(i))
   if (n==-1) break
   }
 return (i==len)
 }
 
//--------------- Check a string for a date value -------------
function checkStrDate(chkstr) {
 var curr_char
 var len=chkstr.length
 if (len!=10) return(false)
 for(var i=0; i<len; i++ ) {
   curr_char=chkstr.charAt(i)
   if ((i==2)||(i==5)) { 
     if (curr_char!='-') return(false) }
   else {
     if ((curr_char<'0')||(curr_char>'9')) return(false) }
   }
 var dd=chkstr.substring(0,2)
 var mm=chkstr.substring(3,5)
 var yy=chkstr.substring(6,10)
 if ((mm=='00')||(mm>'12')||(dd=='00')||(dd>'31')||(yy<'1970')) return(false)
 return(true)
 }

//--------------- Converting --------------------------------------
var lowmaskstr="qwertyuiopasdfghjklzxcvbnm_ÊÃÕËÅÎÇÛÝÚÈÆÙ×ÁÐÒÏÌÄÖÜÑÞÓÍÉÔØÂÀß"
var uppmaskstr="QWERTYUIOPASDFGHJKLZXCVBNM_êãõëåîçûýúèæù÷áðòïìäöüñþóíéôøâàÿ"

//--------------- Convert to upper case ------------------------
function StrToUpper(oldstr) {
 var curr_char
 var newstr=""
 var len=oldstr.length
 var index
 for (var i=0; i<len; i++) {
   curr_char=oldstr.charAt(i)
   index=lowmaskstr.indexOf(curr_char)
   if (index==-1) newstr+=curr_char
   else newstr+=uppmaskstr[index]
   }
 return newstr
 }

//--------------- Convert to lower case ------------------------
function StrToLower(oldstr) {
 var curr_char
 var newstr=""
 var len=oldstr.length
 var index
 for (var i=0; i<len; i++) {
   curr_char=oldstr.charAt(i)
   index=uppmaskstr.indexOf(curr_char)
   if (index==-1) newstr+=curr_char
   else newstr+=lowmaskstr[index]
   }
 return newstr
 }

