
//*******************************************************************************************
function countprice(formObj,title,rate,abbr)
{
 targetform=formObj;
 //strUSDprice=new String(targetform.all[title+"hidden"].value);	alert(strUSDprice);
 strUSDprice=new String(targetform.elements[title+"hidden"].value);	
 num=Math.round(parseFloat(strUSDprice.replace(",","")) * rate);
 if (isNaN(num)) 
 	{
	 targetform.elements[title].value = "";
 	} 
 else 
 	 {
 	  str= new String(num);	
 	  if (num >= 1000)
 	  	 {
 	  	  targetform.elements[title].value = str.substring(0,str.length-3)+","+str.substring(str.length-3,str.length);
 	  	 }
 	  else
 	  	{
 	  	 targetform.elements[title].value = str;	 
 	  	}
 	  		  
 	 }
 return;	 
}
//******************************************************************************************
function DropAllPrices(targetform)
{
 //if (document.images[targetform.name+"icon"])   document.images["icon"].src="images/blank.gif";
 //if (document.images[targetform.name+"icon1"])  document.images["icon1"].src="images/blank.gif";	
 if (document.images["icon"])  document.images["icon"].src="images/blank.gif";
 if (document.images["icon1"]) document.images["icon1"].src="images/blank.gif";	
 for (i=0; i<targetform.length; i++) { 
      if (targetform.elements[i].type=="text") targetform.elements[i].value="";
 } 
}

//******************************************************************************************
function CalculatePrices(which)
{
 targetform=which.form;
 
 if ("0"==which.options[which.selectedIndex].value)
    {
    	 //ShowLayer("hideprices",1);
    	 DropAllPrices(targetform);
    	 return;
    }
 //ShowLayer("hideprices",0);
 
 var str = new String(which.options[which.selectedIndex].value);

 var rate=parseFloat(str.substring(0,str.indexOf(";")));
 str=str.substr(str.indexOf(";")+1);
 var id=str.substring(0,str.indexOf(";"));
 var abbr=str.substr(str.indexOf(";")+1);
 

 if (document.images["icon"])  document.images["icon"].src="getfile.pl?id="+id+"&type=currency";
 if (document.images["icon1"]) document.images["icon1"].src="getfile.pl?id="+id+"&type=currency";

srcstring="getfile.pl?id="+id+"&type=currency";
for (i=0; i<document.images.length; i++)
	{
	 with (document.images[i])
	 	  {
	 	  	 if (name.substring(0,13)=="travellericon")
	 	  	 	{
	 	  	 	 src=srcstring;
	 	  	 	}
	 	  }		
	}	
 if (targetform.elements["abbr"]) targetform.elements["abbr"].value=abbr;
 if (targetform.elements["abbr1"]) targetform.elements["abbr1"].value=abbr;
 
for (i=0; i<targetform.length; i++)
	{
	 with (targetform.elements[i])
	 	  {
	 	  	 if (name.substring(0,13)=="travellerabbr")
	 	  	 	{
	 	  	 	 value=abbr;
	 	  	 	}
	 	  }		
	}	
 


for (i=0; i<targetform.length; i++) { //document.forms[0])  {
	with (targetform.elements[i]) 
		 {
	if (type=="text" && name!="abbr" && name!="abbr1" && name.substring(0,13)!="travellerabbr")  {
			countprice(targetform, name, rate, abbr);
		}
	}
}


}

		

