//----------------- show  data --------------------

function showuserdata(page,hislogin)
{
var urlis=page+"?loginis="+hislogin;
newwnd = window.open(urlis ,"cl", "toolbar=0,resizable=1,status=0,menubar=0,scrollbars=1,left=120,top=5,width=500,height=520");
newwnd.focus();
}

//---------- delete or not delete ---------------
function del()
  {
    var tmp=confirm("Are You sure You want to delete ?");
     if(!tmp)
       return false;
     else
       return true; 
 }




//----------------------- check text fields in the form without email-------------
function validate_form_no_email(nameofForm) //get name of form and email field
{
var rez=1;
//var ctr="document."+nameofForm+".length";
//alert(eval(ctr));
var ctr="document."+nameofForm;

var bad=new Array;  //create new array with bad (empty) fields
var j=0;
len=eval(ctr+".length");
for(i=0;i<len;i++)
 {
   aa_type=ctr + ".elements["+i+"].type";
   aa_value=ctr + ".elements[" + i + "].value"
  if (eval(aa_type) =="text")   //if type of field is 'text'
   {
    var pat="_nes";    // pattern 
    arr=ctr + ".elements[" + i + "].name";  //arr has name of field
	//   arr.split(pat); 
	//   arr=document.myform.elements[i].name; 
    ar=eval(arr+".split(pat)[0]");
      if (ar !=eval(arr))
         if(eval(ctr + ".elements[" + i + "].value") == "")
	       bad[j++]=ar;
	      
    }	

  else if (eval(aa_type) =="select-one")   //if type of field is 'select'
   {

    var pat="_selnes";    // pattern 
    arr=ctr + ".elements[" + i + "].name";  //arr has name of field
    ar=eval(arr+".split(pat)[0]");
      if (ar !=eval(arr))
         if(eval(ctr + ".elements[" + i + "].value") == "nothing")    //if value of select field is nothing
	       bad[j++]=ar;
	      
    }	

  }
 len=bad.length;
 if (len !=0) //if array bad not empty
  {
   var message="Please fill next field(s):";
   for (i=0;i<len;i++)
    {
    pat="zz";    // remove 'zz' from all fields
    bad[i]=bad[i].split(pat)[0];
     message+="\n - ";
     message+=bad[i];
     }

   alert (message);
   return false;
  }
 return true;

}



function validate_form_search(nameofForm) //get name of form 
{

var rez=1;
var ctr="document."+nameofForm;
var bad=new Array;  //create new array with bad (empty) fields
var j=0;
len=eval(ctr+".length");
for(i=0;i<len;i++)
 {
   aa_type=ctr + ".elements["+i+"].type";
   aa_value=ctr + ".elements[" + i + "].value"
  if (eval(aa_type) =="text" || eval(aa_type) =="file")   //if type of field is 'text' or 'file'
   {
    var pat="is";    // pattern 
    arr=ctr + ".elements[" + i + "].name";  //arr has name of field
    ar=eval(arr+".split(pat)[0]");
      if (ar !=eval(arr))
         if(eval(ctr + ".elements[" + i + "].value")=="")
	       bad[j++]=ar;
   }	

  else if (eval(aa_type) =="select-one" )   //if type of field is 'select'
   {

    var pat="is";    // pattern 
    arr=ctr + ".elements[" + i + "].name";  //arr has name of field
    ar=eval(arr+".split(pat)[0]");
      if (ar !=eval(arr))
         if(eval(ctr + ".elements[" + i + "].value") == "nothing")    //if value of select field is nothing
	       bad[j++]=ar;
    }	
  }

 len=bad.length;
// alert(len);
 if (len !=0) //if array bad not empty
  {
   var message="Please fill next field(s):";
   for (i=0;i<len;i++)
    {
     message+="\n - ";
     message+=bad[i];
     }
   alert (message);
   return false;
  }
 return true;
}

//********************* end check text fields in the form without email*******

// ------- help window opens --------
 function helpme(help1) 
{
if  (help1==1)
    window.open("help1.htm" ,"help_me", "toolbar=0,resizable=1,status=0,scrollbars=0,menubar=0,left=260,top=110,width=290,height=170");
}
// ----------- end help window -------

// --------------- check if feedback form is correct ----------
function checkfeedback()
{
if (document.feedback.visitoremail.value=="" || document.feedback.visitoremail.value.indexOf ('@')==-1 || document.feedback.visitoremail.value.indexOf ('.')==-1 )
  {
alert("Email is incorrect or absent");
document.feedback.visitoremail.focus();
return false;
  }
else if (document.feedback.visitorname.value=="" )
  {
alert("Name is absent");
document.feedback.visitorname.focus();
return false;
  }

else
return true;
}

// --------- end feedback form --------------

// --------- cart submit form ---------------

function mycart(){
window.open('_blank' ,"windName", "toolbar=0,resizable=0,status=0,menubar=0,scrollbars=0,left=220,top=150,width=200,height=180");
}


//--------- end cart submit form ------------

// ---------- print pages ------------
function printIt(page,hislogin) 
{ 
	showuserdata(page,hislogin);
	newwnd.focus(); 
	newwnd.print(); 
} 
// ------------- print pages -----------------


