var posturl = "http://web02.postil.com/itemtrace.nsf/trackandtrace?OpenAgent&lang=HEB&location=SITE&itemcode="
var newwinapp = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=550,height=430,top=20,left=30"
 
//remove given sign from string and return the result
function removesign(thestring,thesign)
{
 var newstring = "";
 if (thestring.indexofthesign == -1)
  return thestring;
 else
 {
  for(i=0,j=0;i<=thestring.length;i++) if (thestring.charAt(i) != thesign)
   newstring = newstring+thestring.charAt(i)
  return newstring;
 }
}
 
function gotrace(itemcode)
{
 var urlstr  = "";

 itemcode = itemcode.toUpperCase();
//YY not in service!
 var i= itemcode.indexOf("YY");
 if (i!=-1){
  alert("YY לא ניתן לקבל מידע אודות דברי דואר רגילים גדולים שמספרם מתחיל באותיות ");
 }
 else{

 itemcode = removesign(itemcode,"-");
 itemcode = removesign(itemcode," ");
 
 if (itemcode.length==13 || itemcode.length==8)
  {
   urlstr = posturl + itemcode
   x=window.open(urlstr,"",newwinapp);
   x.focus();
  }
 else
  {
  alert('יש להקליד מספר מעקב תקין')
  }
 } 
} 