// Kaspersky Punkt NET JS Script Library

// Pop-up window
function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
	var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
	var int_windowTop = (screen.height - a_int_windowHeight) / 2;
	var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
	var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
	if (parseInt(navigator.appVersion) >= 4) {
		obj_window.window.focus();
	}
}

// Modificare cont
function updateModificareCont(value) {
	if(value == 'persoana_fizica') {
		document.getElementById("modificare_cont_persoana_fizica").style.display = 'block';
		document.getElementById("modificare_cont_persoana_juridica").style.display = 'none';
	}
	if(value == 'persoana_juridica') {
		document.getElementById("modificare_cont_persoana_fizica").style.display = 'none';
		document.getElementById("modificare_cont_persoana_juridica").style.display = 'block';
	}
}

//Modificare pret
function modiPret(d_radio, d_select, d_pret_div, d_preturi_ar, d_nr_users, d_nr_ani, d_curs_val) {
	//radio value
	if(d_radio.length != 'undefined')
		d_radio_length = d_radio.length;
	else
		d_radio_length = 1;
	
	d_radio_value = 0;
	for(i = 0; i<d_radio_length; i++) {
		if(d_radio[i].checked)
			d_radio_value = d_radio[i].value;
	}
	
	//select value
	d_select_value = d_select.value;
	
	//get current pret
	var preturi_mat = [];
	crt = -1;	
	for(i = 0; i < d_nr_users; i++) {
		preturi_mat[i] = [];
		for(j = 0; j < d_nr_ani; j++) {
			crt++;
			preturi_mat[i][j] = d_preturi_ar[crt];
		}
	}
	
	pret = preturi_mat[d_select_value][d_radio_value]*d_curs_val*1.19;
	pret = '<h2>'+pret.toFixed(2)+' RON</h2>';
	
	//change div pret
	if (document.getElementById) {
		x = document.getElementById(d_pret_div);
		x.innerHTML = '';
		x.innerHTML = pret;
	} else if (document.all) {
		x = document.all[d_pret_div];
		x.innerHTML = pret;
	} else if (document.layers) {
		x = document.layers[d_pret_div];
		x.document.open();
		x.document.write(pret);
		x.document.close();
	}
}

//Display switch
function display_switch(arg) {
	obj		= document.getElementById(arg);
	display	= obj.style.display;
	if(display == 'none')
		obj.style.display = '';
	if(display == '')
		obj.style.display = 'none';
	return false;
}