function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=765,height=545,scrollbars=yes');
return false;
}



function mail_ok(smail){

var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(smail.value.match(emailExp)){
		return true;
	}else{
		return false;
	}

}

function validate_finalizare(){

	

if (document.registerform.nume.value == '')
{
	alert ('Campul nume este obligatoriu');	
	return false;
}

if (document.registerform.prenume.value == '')
{
	alert ('Campul prenume este obligatoriu');	
	return false;
}

if (document.registerform.telefon.value == '')
{
	alert ('Campul telefon este obligatoriu');	
	return false;
}

if (document.registerform.email_register.value == '')
{
	alert ('Campul email este obligatoriu');	
	return false;
}

if (document.registerform.adresa.value == '')
{
	alert ('Campul adresa este obligatoriu');	
	return false;
}
if (document.registerform.oras.value == '')
{
	alert ('Campul oras este obligatoriu');	
	return false;
}

if (document.registerform.parola_register.value == '')
{
	alert ('Campul parola este obligatoriu');	
	return false;
}

if (document.registerform.parola_register1.value == '')
{
	alert ('Campul confirmare parola este obligatoriu');	
	return false;
}


if (document.registerform.parola_register.value != document.registerform.parola_register1.value)
{
	alert ('Parolele nu sint identice');	
	return false;
}



var mailu = document.registerform.email_register;
if (mail_ok(mailu) == false)
{
	alert('Adresa de email este incorecta.');
	return false;
}


return true;
}

function retrimite_parola(){

var mailu = document.loginform.email_login;
if (mail_ok(mailu) == false)
{
	alert('Adresa de email este incorecta.');
	return;
}


var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var str='retrimite_parola.php4?e=' + document.loginform.email_login.value;
xmlhttp.open("GET", str,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   alert(xmlhttp.responseText)
  }
 }
 xmlhttp.send(null)




}


function showhide_adresa(){

	var box = document.getElementById('adresa_diferita');
			
	//if (!box)
	//	return;
	box.style.display = document.registerform.livrare_diferita.checked ? "" : "none";
		
}

function showhide_factfirma(){
	var box = document.getElementById('factura_pe_firma');
			
	//if (!box)
	//	return;

	box.style.display = document.registerform.factura_firma.checked ? "" : "none";
}



function strpos (haystack, needle, offset) {
 var i = (haystack+'').indexOf(needle, (offset ? offset : 0));
    return i === -1 ? false : i;
}


function adauga_in_cos(){

var tmp = document.getElementById('roneuro').innerHTML;

//alert(strpos(tmp,'EUR.gif',5));

if (strpos(tmp,'EUR.gif',5)!= false)
{
	alert('Pentru a adauga in cos folositi calculatia in EURO.');
}
else
if (document.dimensiuniform.pretunitar_hidden.value == '0')
{
	alert('Apasati butonul CALCULEAZA');	
}
else 
	top.location = '/showbasket.php4';



}


function get_basket_content(){

//alert('hatz');

var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

//var str = 'get_finalizare.php4?check1=' + document.registerform.livrare_diferita.checked + 
//	'&check2=' + document.registerform.factura_firma.checked;

//var str = 'http://www.rezultate-loto.ro/printonline_test/showbasket.php4';

var str='http://www.print-online.ro/test/leightbox/index.html';

xmlhttp.open("GET", str,false);

xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
			var local = xmlhttp.responseText;	
			//alert(local);
			document.getElementById('basket_content').innerHTML = local;	
	}
   }

}

}

function validate_login_email() {

var elem = document.loginform.email_login;
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){

	var elem1 = document.loginform.password_login;
	if (elem1.value == '')
	{
		alert ('Campul parola nu poate fi nul.');
		return false;
	}
	 else 	
		return true;

	}else {



		alert ('Adresa de email nu este valida');

		return false;			



		}






}



function mess(message) {



	if (message != '' )

		alert(message);



}



function promotie() {



var result = confirm('Doriti sa adaugati promotia in SHOPPING CART ? ');



if ( result == true ) {



	var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var str = 'add_to_basket.php4?promotie=1';
xmlhttp.open("GET", str,true);

xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
			var local = xmlhttp.responseText;	
			alert(local);
			top.location = 'showbasket_full.php4';
	}
   }



}

xmlhttp.send("") ;



}



}





function check_calculatie() {



return true;





/*

var a = document.getElementById('costtotal').innerHTML;



alert (a);

	if (a

	=='<p align="right" style="line-height: 10.26px; font-size: 10.26px; ">0 EUR</p>') {

	alert ('Calculatia este nula !');

	return false;

	}

else 

	return true;

*/

}




function clear_items() {


if (document.select. adresa_select.checked == false) {	


	window.location.reload( false );
	
	

	/*
	var xmlhttp;
		if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    		xmlhttp = new XMLHttpRequest();
		} else if (window.ActiveXObject) { // IE
    		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}

		var str = 'get_user_data.php4';
		xmlhttp.open("GET", str,true);

		*/
}
	else {
					
	document. checkout_select.oras.value='';	
	document. checkout_select.judet.value='';
	document. checkout_select.adresa.value='';
	document. checkout_select.telefon.value='';
	//document. checkout_select.mentiuni.value='';	
	
	document. checkout_select.nume.value='';
	document. checkout_select.prenume.value='';
	document. checkout_select.compania.value='';

	


	document.getElementById('compania').innerHTML = '<b>Compania:</b> &nbsp;  <input type="text" name="telefon" class="adresa_edit_mare" onkeyup = "refresh_adresa();">';
		
	}
}


function trimite_calc_pe_email(){

//alert (document.dimensiuniform.dimensiune.value);

//string manipulation get cost total from string
var costtotal = document.getElementById('costtotal').innerHTML ;
var left = costtotal.indexOf(">") ;
var right = costtotal.indexOf("</");
 var tmp = costtotal.substr(left+1,right-left-1) ;
var space_pos = tmp.indexOf(" ");
tmp = tmp.substr(0,space_pos);

var elem = document. trimite_calculatia.email_calculatie;
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		//return true;
		//alert ('email ok');	
			
		var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var checked = '';
var buzunar = '';
var suportcd = '';
var numarpagini = '';

//la carti de vizita
if  (document.dimensiuniform.prodid.value == 1)
if ( document.dimensiuniform.colturi_rotunjite.checked == true )
	checked = 'on';	

//la mape cu buzunar
if  (document.dimensiuniform.prodid.value == 6){

if ( document.dimensiuniform.buzunar.checked == true )
	buzunar = 'on';	
	
if ( document.dimensiuniform.suportcd.checked == true )
	suportcd = 'on';	
	
}

//la brosuri - cataloage
if  (document.dimensiuniform.prodid.value == 7) {
	numarpagini = document.dimensiuniform.numar_pagini.value;			
}

//prezentari cu spira
if  (document.dimensiuniform.prodid.value == 8){
	numarpagini = document.dimensiuniform.numar_pagini.value;
}


var str = 'trimite_mail.php4?email=' + document. trimite_calculatia.email_calculatie.value + 
'&prodid=' + document.dimensiuniform.prodid.value + '&dimensiuni=' + document.dimensiuniform.dimensiune.value +
	'&hartie=' + document.dimensiuniform.hartie.value + '&gramaj=' + document.dimensiuniform.gramaj.value +
	'&plastifiere=' + document.dimensiuniform.plastificare.value + '&tipar=' + document.dimensiuniform.tipar.value + 
	'&cantitate=' + document.dimensiuniform.cantitate.value + '&colturi_rotunjite=' + checked + '&buzunar2=' + buzunar +
	'&suportcd=' + suportcd + '&numarpagini=' + numarpagini +'&costtotal=' + tmp ;
	//+'&pretunitar=' + '' + 
	// + '&costtva=' + '' + 
	//+ '&totalproiect=' + '' ;

//alert (str);

/*
document.getElementById('pretunitar').innerHTML 	= '<p align="right">' + local[0].pretunitar_valuta + '</p>' ;
document.getElementById('costtotal').innerHTML 	= '<p align="right">' + local[0].costtotal + '</p>' ;
document.getElementById('costtva').innerHTML 		= '<p align="right">' + local[0].costtva + '</p>' ;
document.getElementById('totalproiect').innerHTML =   '<p align="right">' + local[0].totalproiect+ '</p>' ;
*/	
	
//alert(str);

xmlhttp.open("GET", str,false);

 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
			var local = xmlhttp.responseText;	
			//alert(local);
			if (local=='ok')
				alert('Calculatia a fost trimisa la adresa de email indicata!');
			else 
				//alert ('S-a ivit o eroare la trimiterea calculatiei');
				alert (local);	
			//document.getElementById('adresa_form').innerHTML = local;
		
		
	}
   }



}


xmlhttp.send("") ;

		
		
	}else{
		alert('Adresa de email nu are un format corect !');
		elem.focus();
		return false;
	}
}


function register_ok() {

if ( document.registerform.nume.value == '' ) {
		alert ('Trebuie completat campul Nume !') ;
		return false;
}

if ( document.registerform.prenume.value == '' ) {
		alert ('Trebuie completat campul Prenume !') ;
		return false;
}


var elem = document. registerform.email_register;
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		//return true;
	}else{
		alert('Adresa de email nu are un format corect !');
		elem.focus();
		return false;
	}

if ( document.registerform.parola_register.value.length < 6 ) {
	
		alert ('Parola trebuie sa aiba minim 6 caratere !') ;
		return false;


}

if  (document.registerform.parola_register.value != document.registerform.parola_register1.value)
	{
		alert ('Parolele nu coincid') ;
		return false;
	}
	


return true;

}



function atipicOK(){

var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var str = 'post_lucrare_atipica.php4';
xmlhttp.open("GET", str,false);

xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
			var local = xmlhttp.responseText;	
			alert(local);	
	}
   }



}

xmlhttp.send("") ;

var sURL = unescape(window.location.pathname);
window.location.href = sURL;
//alert('done');
}

function refresh_atipic(){
var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var str = 'refresh_atipic.php4?dim_L=' + document.atipic.dim_L.value + '&dim_l=' + document.atipic.dim_l.value +
		'&hartie=' + document.atipic.hartie.value  + '&gramaj=' + document.atipic.gramaj.value + '&tipar=' + document.atipic.tipar.value +
		'&plastifiere=' + document.atipic.plastifiere.value	+ '&biguri=' + document.atipic.biguri.value + '&perfor=' + document.atipic.perfor.value
		+ '&inseriere=' + document.atipic.inseriere.value + '&observatii=' + document.atipic.observatii.value + '&compania=' + document.atipic.compania.value + 
		'&nume=' + document.atipic.nume.value + '&email=' + document.atipic.email.value + '&telefon=' + document.atipic.telefon.value
		+ '&legare=' + document.atipic.legare.value  + '&cantitate=' + document.atipic.cantitate.value;

xmlhttp.open("GET", str,false);
					
xmlhttp.send("") ;
}


function refresh_adresa(){
var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var str = 'refresh_adresa.php4?adresa=' + document.checkout_select.adresa.value + '&oras=' + document.checkout_select.oras.value +
		 '&cod=' + document.checkout_select.cod.value +  '&judet=' + document.checkout_select.judet.value + 
		'&persoana_contact=' + document.checkout_select.persoana_contact.value +  '&telefon=' + document.checkout_select.telefon.value +
		 '&mentiuni=' + document.checkout_select.mentiuni.value   ;


xmlhttp.open("GET", str,false);
					
xmlhttp.send("") ;
}



function pop(url){

var Popup = Class.create();
Popup.prototype = 
{
  initialize: function(options)
  {
    this.options = {
      url: '#',
      width: 323,
      height: 400
    }
    Object.extend(this.options, options || {});
    window.open(this.options.url, '', 'width='+this.options.width+',height='+this.options.height);
  }
}

new Popup({url:url});

}

function load_png(divname,width,height,png_name,offset) {

var brow=((navigator.appName) +
(parseInt(navigator.appVersion)));

if(brow == "Microsoft Internet Explorer4") {
	var img_ ='<DIV ID=\"oDiv\" STYLE=\"position:relative; left:' +offset+ 'px; width:'+width+';height:'+height+';filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'imagini\/' +png_name+ '\' , sizingMethod=\'scale\');" > <\DIV> ' ;
	document.getElementById(divname).innerHTML = img_  ;	
} else {
	var img_ = '<input type="image" src=imagini/' + png_name+ ' width='+width+' border=0 >';
	document.getElementById(divname).innerHTML = img_  ;
	}

}

function submit_newsletter() {

var elem = document.newsletter_form.email_newsletter;

var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		alert('Va multumim !');
		return true;
	}else{
		alert('Adresa de email nu este corecta !');
		elem.focus();
		return false;
	}

	
	return true;

} 


function disable_items() {

//document.getElementById('adresa_form').firstChild.data = 'aha';
//document.all.precaption.innerText = document.forms[0].caption.value;
//document.getElementById('precaption').innerText = document.forms[0].caption.value;
//the line seems to work in both browsers as well..
//alert(document.checkout_select.adresa.value);


var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

var str = 'adresa_show.php4?checked_address=' + document.select.adresa_select.checked ;
//alert (str);
	
xmlhttp.open("GET", str , true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
		if (document.select.adresa_select.checked == true) {
			var local = xmlhttp.responseText;	
			document.getElementById('adresa_form').innerHTML = local;
		}else { //unchecked
			document.getElementById('adresa_form').innerHTML = '';				
		}

		
	}
   }



}

						
xmlhttp.send("") ;

}


function getUrlVars(variable){

var vars = [], hash;

var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');


for(var i = 0; i < hashes.length; i++){

	hash = hashes[i].split('=');


	if (hash[0] == variable){
		return (hash[1]);
	}
}
}  


function agree(msg){

if (confirm(msg)) {
       return true;
     }
     else { 
		 return false 
		}
   }


function test(){

alert(document.dimensiuniform.cantitate.value);

}


function calculatie1(){

document.getElementById('roneuro').disabled=true;
	
try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

var str = 'change_calculatie.php4';

//Well, instead of using request.open("uri", "GET", true) you could use request.open("uri", "GET", false) to make it a synchronous call and have the scripting 

//environment wait until the document is received.





var brow=((navigator.appName) +

(parseInt(navigator.appVersion)));

//alert (brow);



if (brow == 'Netscape5')

	xmlhttp.open("GET", str,true);

else 

	xmlhttp.open("GET", str,false);


 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   	

	var calc = '';

	var calculatie ='';


	var calculatie = xmlhttp.responseText ;

	//alert(calculatie);

	if (calculatie == 'RON')
		calc = 'EUR';
	else
		calc = 'RON';



document.getElementById('roneuro').innerHTML  = '<img style="cursor:pointer;" src="imagini/'+ calc +'.gif" alt="RON/EURO" height="15" border="0" onclick="calculatie1()" valign="middle">';	


	  }
 }
 xmlhttp.send(null);

	

calculatie();



document.getElementById('roneuro').disabled=false;
}

function calculatie(){

//alert ('test');



var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}


//var productid  =  getUrlVars('prodid');

var checked = '';
var buzunar = '';
var suportcd = '';
var numarpagini = '';

//la carti de vizita
if  (document.dimensiuniform.prodid.value == 1){

if (parseInt(document.dimensiuniform.cantitate.value)<100){
	alert('Numarul de carti de vizita trebuie sa fie minim 100');
	exit;
}

if ( document.dimensiuniform.colturi_rotunjite.checked == true )
	checked = 'on';	
}	

//la mape cu buzunar
if  (document.dimensiuniform.prodid.value == 6){

if ( document.dimensiuniform.buzunar.checked == true )
	buzunar = 'on';	
	
if ( document.dimensiuniform.suportcd.checked == true )
	suportcd = 'on';	
	
}

//la brosuri - cataloage
if  (document.dimensiuniform.prodid.value == 7) {
	
	numarpagini = document.dimensiuniform.numar_pagini.value;
	
	if  (numarpagini % 4 != 0 ) {
	alert ('Numarul de pagini trebuie sa fie multiplu de 4 !');		
	exit;
	}
			
}

//prezentari cu spira
if  (document.dimensiuniform.prodid.value == 8){
	numarpagini = document.dimensiuniform.numar_pagini.value;

		
	if  (numarpagini % 2 != 0 ) {
	alert ('Numarul de pagini trebuie sa fie multiplu de 2 !');
	exit;		
	}


}

var str = 'calcul_oferta.php4?prodid=' + document.dimensiuniform.prodid.value + '&dimensiuni=' + document.dimensiuniform.dimensiune.value +
	'&hartie=' + document.dimensiuniform.hartie.value + '&gramaj=' + document.dimensiuniform.gramaj.value +
	'&plastifiere=' + document.dimensiuniform.plastificare.value + '&tipar=' + document.dimensiuniform.tipar.value + 
	'&cantitate=' + document.dimensiuniform.cantitate.value + '&colturi_rotunjite=' + checked + '&buzunar2=' + buzunar +
	'&suportcd=' + suportcd + '&numarpagini=' + numarpagini ;
	

//alert(str);

xmlhttp.open("GET", str,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
  
	if (xmlhttp.status!=404) {
		var local=new Function("return "+xmlhttp.responseText)();
		//alert("Code - Name\n"+local[0].id+' - '+local[0].name);
			
		//alert(xmlhttp.responseText);

		//document.write('<link rel="stylesheet" type="text/css" href="index.css" >');
		var tmp = local[0].pretunitar_valuta;
		var space_pos = tmp.indexOf(" ");
		tmp = tmp.substr(0,space_pos);
		
		document.dimensiuniform.pretunitar_hidden.value = tmp ;
			
		document.getElementById('pretunitar').innerHTML 	=  local[0].pretunitar_valuta ;
		document.getElementById('costtotal').innerHTML 		=  local[0].costtotal ;
		document.getElementById('costtva').innerHTML 		=  local[0].costtva  ;

		document.getElementById('totalproiect').innerHTML =  local[0].totalproiect ;
	
		document.getElementById('cotatie100').innerHTML =  '<p align="right">' +local[0].cotatie100 + '</p>';
		document.getElementById('cotatie200').innerHTML =  '<p align="right">' +local[0].cotatie200 + '</p>';
		document.getElementById('cotatie300').innerHTML =  '<p align="right">' +local[0].cotatie300 + '</p>';

		document.getElementById('pretunitar100').innerHTML =  '<p align="right">' +local[0].pretunitar100+ '</p>';
		document.getElementById('pretunitar200').innerHTML =  '<p align="right">' +local[0].pretunitar200+ '</p>';
		document.getElementById('pretunitar300').innerHTML =  '<p align="right">' +local[0].pretunitar300 + '</p>';

		document.getElementById('costtotal100').innerHTML =  '<p align="right">' +local[0].costtotal100+ '</p>';
		document.getElementById('costtotal200').innerHTML =  '<p align="right">' +local[0].costtotal200 + '</p>';
		document.getElementById('costtotal300').innerHTML =  '<p align="right">' +local[0].costtotal300+ '</p>';

		document.getElementById('tva100').innerHTML =   '<p align="right">' +printf('%.2f',  local[0].costtotal100  * 0.19) + '</p>';
		document.getElementById('tva200').innerHTML =  '<p align="right">' + printf('%.2f',  local[0].costtotal200  * 0.19) + '</p>';
		document.getElementById('tva300').innerHTML =  '<p align="right">' + printf('%.2f',  local[0].costtotal300  * 0.19)+ '</p>';

		document.getElementById('total100').innerHTML =  '<p align="right">' +printf('%.2f',local[0].pretunitar * local[0].cotatie100 +
														 (local[0].pretunitar *local[0].cotatie100 * 0.19) )+ '</p>';
		document.getElementById('total200').innerHTML =  '<p align="right">' +printf('%.2f',local[0].pretunitar * local[0].cotatie200 +
														 (local[0].pretunitar *local[0].cotatie200 * 0.19) )+ '</p>';
		document.getElementById('total300').innerHTML =  '<p align="right">' +printf('%.2f',local[0].pretunitar * local[0].cotatie300 +
														 (local[0].pretunitar *local[0].cotatie300 * 0.19) )+ '</p>';

		//alert('Discount: '+local[0].val_discount + ' Euro');
	}
	
		//document.getElementById('jeap').innerHTML = xmlhttp.responseText ;
  }



 }
 xmlhttp.send("") ;
//alert (productid);

}



/* Function printf(format_string,arguments...)
 * Javascript emulation of the C printf function (modifiers and argument types 
 *    "p" and "n" are not supported due to language restrictions)
 *
 * Copyright 2003 K&L Productions. All rights reserved
 * http://www.klproductions.com 
 *
 * Terms of use: This function can be used free of charge IF this header is not
 *               modified and remains with the function code.
 * 
 * Legal: Use this code at your own risk. K&L Productions assumes NO resposibility
 *        for anything.
 ********************************************************************************/
function printf(fstring)
  { var pad = function(str,ch,len)
      { var ps='';
        for(var i=0; i<Math.abs(len); i++) ps+=ch;
        return len>0?str+ps:ps+str;
      }
    var processFlags = function(flags,width,rs,arg)
      { var pn = function(flags,arg,rs)
          { if(arg>=0)
              { if(flags.indexOf(' ')>=0) rs = ' ' + rs;
                else if(flags.indexOf('+')>=0) rs = '+' + rs;
              }
            else
                rs = '-' + rs;
            return rs;
          }
        var iWidth = parseInt(width,10);
        if(width.charAt(0) == '0')
          { var ec=0;
            if(flags.indexOf(' ')>=0 || flags.indexOf('+')>=0) ec++;
            if(rs.length<(iWidth-ec)) rs = pad(rs,'0',rs.length-(iWidth-ec));
            return pn(flags,arg,rs);
          }
        rs = pn(flags,arg,rs);
        if(rs.length<iWidth)
          { if(flags.indexOf('-')<0) rs = pad(rs,' ',rs.length-iWidth);
            else rs = pad(rs,' ',iWidth - rs.length);
          }    
        return rs;
      }
    var converters = new Array();
    converters['c'] = function(flags,width,precision,arg)
      { if(typeof(arg) == 'number') return String.fromCharCode(arg);
        if(typeof(arg) == 'string') return arg.charAt(0);
        return '';
      }
    converters['d'] = function(flags,width,precision,arg)
      { return converters['i'](flags,width,precision,arg); 
      }
    converters['u'] = function(flags,width,precision,arg)
      { return converters['i'](flags,width,precision,Math.abs(arg)); 
      }
    converters['i'] =  function(flags,width,precision,arg)
      { var iPrecision=parseInt(precision);
        var rs = ((Math.abs(arg)).toString().split('.'))[0];
        if(rs.length<iPrecision) rs=pad(rs,' ',iPrecision - rs.length);
        return processFlags(flags,width,rs,arg); 
      }
    converters['E'] = function(flags,width,precision,arg) 
      { return (converters['e'](flags,width,precision,arg)).toUpperCase();
      }
    converters['e'] =  function(flags,width,precision,arg)
      { iPrecision = parseInt(precision);
        if(isNaN(iPrecision)) iPrecision = 6;
        rs = (Math.abs(arg)).toExponential(iPrecision);
        if(rs.indexOf('.')<0 && flags.indexOf('#')>=0) rs = rs.replace(/^(.*)(e.*)$/,'$1.$2');
        return processFlags(flags,width,rs,arg);        
      }
    converters['f'] = function(flags,width,precision,arg)
      { iPrecision = parseInt(precision);
        if(isNaN(iPrecision)) iPrecision = 6;
        rs = (Math.abs(arg)).toFixed(iPrecision);
        if(rs.indexOf('.')<0 && flags.indexOf('#')>=0) rs = rs + '.';
        return processFlags(flags,width,rs,arg);
      }
    converters['G'] = function(flags,width,precision,arg)
      { return (converters['g'](flags,width,precision,arg)).toUpperCase();
      }
    converters['g'] = function(flags,width,precision,arg)
      { iPrecision = parseInt(precision);
        absArg = Math.abs(arg);
        rse = absArg.toExponential();
        rsf = absArg.toFixed(6);
        if(!isNaN(iPrecision))
          { rsep = absArg.toExponential(iPrecision);
            rse = rsep.length < rse.length ? rsep : rse;
            rsfp = absArg.toFixed(iPrecision);
            rsf = rsfp.length < rsf.length ? rsfp : rsf;
          }
        if(rse.indexOf('.')<0 && flags.indexOf('#')>=0) rse = rse.replace(/^(.*)(e.*)$/,'$1.$2');
        if(rsf.indexOf('.')<0 && flags.indexOf('#')>=0) rsf = rsf + '.';
        rs = rse.length<rsf.length ? rse : rsf;
        return processFlags(flags,width,rs,arg);        
      }  
    converters['o'] = function(flags,width,precision,arg)
      { var iPrecision=parseInt(precision);
        var rs = Math.round(Math.abs(arg)).toString(8);
        if(rs.length<iPrecision) rs=pad(rs,' ',iPrecision - rs.length);
        if(flags.indexOf('#')>=0) rs='0'+rs;
        return processFlags(flags,width,rs,arg); 
      }
    converters['X'] = function(flags,width,precision,arg)
      { return (converters['x'](flags,width,precision,arg)).toUpperCase();
      }
    converters['x'] = function(flags,width,precision,arg)
      { var iPrecision=parseInt(precision);
        arg = Math.abs(arg);
        var rs = Math.round(arg).toString(16);
        if(rs.length<iPrecision) rs=pad(rs,' ',iPrecision - rs.length);
        if(flags.indexOf('#')>=0) rs='0x'+rs;
        return processFlags(flags,width,rs,arg); 
      }
    converters['s'] = function(flags,width,precision,arg)
      { var iPrecision=parseInt(precision);
        var rs = arg;
        if(rs.length > iPrecision) rs = rs.substring(0,iPrecision);
        return processFlags(flags,width,rs,0);
      }
    farr = fstring.split('%');
    retstr = farr[0];
    fpRE = /^([-+ #]*)(\d*)\.?(\d*)([cdieEfFgGosuxX])(.*)$/;
    for(var i=1; i<farr.length; i++)
      { fps=fpRE.exec(farr[i]);
        if(!fps) continue;
        if(arguments[i]!=null) retstr+=converters[fps[4]](fps[1],fps[2],fps[3],arguments[i]);
        retstr += fps[5];
      }
    return retstr;
  }
/* Function printf() END */


function gojson(page) {

var xmlhttp=false;

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

xmlhttp.open("GET", page,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   //alert(xmlhttp.responseText)
   //document.write(xmlhttp.responseText);

	if (xmlhttp.status!=404) {
		var local=new Function("return "+xmlhttp.responseText)();
		alert("Code - Name\n"+local[0].id+' - '+local[0].name);
	}
		//document.getElementById('jeap').innerHTML = xmlhttp.responseText ;
  }



 }
 xmlhttp.send("") ;



} 


function getPage (url) {




//Well, instead of using request.open("uri", "GET", true) you could use request.open("uri", "GET", false) to make 
//it a synchronous call and have the scripting 
//environment wait until the document is received.

/*
var brow=((navigator.appName) +(parseInt(navigator.appVersion)));
//alert (brow);

if (brow == 'Netscape5')
	xmlhttp.open("GET", url,true);
else 
	xmlhttp.open("GET", url,false);

xmlhttp.onreadystatechange=function() {
  alert (xmlhttp.readyState.toStr());
  if (xmlhttp.readyState==4) 
	  if (xmlhttp.status!=404){ 
		alert(xmlhttp.responseText) ;
  }
}
*/


/*


var xhr = false;
//this is the Microsoft browser compatible instantiation
//xhr = new ActiveXObject("Microsoft.XMLHTTP");

//var xmlhttp;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
    xhr = new ActiveXObject("Microsoft.XMLHTTP");
}

if (!xhr) {
alert ('XMLHttpRequest failed to instantiate');
return false;
}
xhr.onreadystatechange = statusCheck;
xhr.open ('GET', url, true);
xhr.send (null);
}

function statusCheck() {
var status = "XmlHttpRequest_Status: " + xhr.status;
var state = "XmlHttpRequest_readyState: " + xhr.readyState;
var headers = "XmlHttpRequest_getallResponseHeaders(): " + 
xhr.getAllResponseHeaders();
var txt = "XmlHttpRequest_statusText: " + xhr.statusText
if (xhr.readyState == 4) {
if (xhr.status == 200) {
	//alert(xhr.responseText);
	//document.getElementById("email_login").innerHTML =(xhr.responseText);
	return xhr.responseText;
} else {
alert ('There was a problem with the request.');
}
}
*/
}