var price = 0;

var price_bank_card = 0;
var price_USD_WMZ = 0;
var price_USD_WMR = 0;
var price_USD_WME = 0;
var price_USD_WMU = 0;

var price_WMZ_pay_WMZ = 0;
var price_WMZ_pay_WMR = 0;
var price_WMZ_pay_WMU = 0;

var price_elecsnet = 0;
var price_other = 0;

function order()
{
	var sel = document.getElementById('packService');

	if (sel.selectedIndex =='0')
	{
		document.getElementById('firstStyle').style.display='block';
		document.getElementById('secondStyle').style.display='none';
		document.getElementById('thirdStyle').style.display='none';
		document.getElementById('star2').style.display='block';
		document.getElementById('star3').style.display='none';
		price = Price_smart;
		document.getElementById('prod_id').value = 'smart';
	}
	if (sel.selectedIndex =='1')
	{
		document.getElementById('firstStyle').style.display='none';
		document.getElementById('secondStyle').style.display='block';
		document.getElementById('thirdStyle').style.display='none';
		document.getElementById('star2').style.display='none';
		document.getElementById('star3').style.display='none';
		price = Price_unique;
		document.getElementById('prod_id').value = 'unique';
	}
	if (sel.selectedIndex =='2')
	{
		document.getElementById('firstStyle').style.display='none';
		document.getElementById('secondStyle').style.display='none';
		document.getElementById('thirdStyle').style.display='block';
		document.getElementById('star2').style.display='none';
		document.getElementById('star3').style.display='block';
		price = Price_prestige;
		document.getElementById('prod_id').value = 'prestige';
	}

	set_prices ();
	show_prices ();
}

function set_prices ()
{
	price_bank_card = price;
	price_USD_WMZ = price;
	price_USD_WMR = parseInt(price * KursUSD_WMR * 100) / 100;
	price_USD_WME = parseInt(price * KursUSD_WME * 100) / 100;
	price_USD_WMU = parseInt(price * KursUSD_WMU * 100) / 100;

	price_WMZ_pay_WMZ = price;
	price_WMZ_pay_WMR = parseInt(price * KursUSD_WMR * 100) / 100;
	price_WMZ_pay_WMU = parseInt(price * KursUSD_WMU * 100) / 100;

	price_elecsnet = parseInt(price * KursUSD_WMR * elecsnet * 100) / 100;
	price_other = parseInt(price * KursUSD_WMR * 100) / 100;
}


function show_prices ()
{
	if ((document.getElementById('browser').getAttribute('name')) == 'ie')
	{
		document.getElementById('bank_span').innerText = price_bank_card;
		document.getElementById('yad_text_price').innerText = price_USD_WMR;
		document.getElementById('swmz').innerText = price_USD_WMZ;
		document.getElementById('swmr').innerText = price_USD_WMR;
		document.getElementById('swme').innerText = price_USD_WME;
		document.getElementById('swmu').innerText = price_USD_WMU;
		document.getElementById('swmz_z').innerText = price_WMZ_pay_WMZ;
		document.getElementById('swmz_e').innerText = price_USD_WME;
		document.getElementById('swmz_r').innerText = price_WMZ_pay_WMR;
		document.getElementById('swmz_u').innerText = price_WMZ_pay_WMU;
		document.getElementById('yad_s').innerText = price_USD_WMR;
		document.getElementById('selex').innerText = price_elecsnet;
		document.getElementById('snal').innerText = price_other;
	}
	else
	{
		document.getElementById('bank_span').innerHTML = price_bank_card;
		document.getElementById('yad_text_price').innerHTML = price_USD_WMR;
		document.getElementById('swmz').innerHTML = price_USD_WMZ;
		document.getElementById('swmr').innerHTML = price_USD_WMR;
		document.getElementById('swme').innerHTML = price_USD_WME;
		document.getElementById('swmu').innerHTML = price_USD_WMU;
		document.getElementById('swmz_z').innerHTML = price_WMZ_pay_WMZ;
		document.getElementById('swmz_e').innerHTML = price_USD_WME;
		document.getElementById('swmz_r').innerHTML = price_WMZ_pay_WMR;
		document.getElementById('swmz_u').innerHTML = price_WMZ_pay_WMU;
		document.getElementById('yad_s').innerHTML = price_USD_WMR;
		document.getElementById('selex').innerHTML = price_elecsnet;
		document.getElementById('snal').innerHTML = price_other;
	}
}


function show_path()
{
	var zpath = window.document.location + '';
	var zproduct = zpath.substr(zpath.lastIndexOf('=')+1, zpath.length);

	switch (zproduct) {
	case 'smart':
		document.getElementById('packService').selectedIndex = '0';
		order();
		break;
	case 'unique':
		document.getElementById('packService').selectedIndex = '1';
		order();
		break;
	case 'prestige':
		document.getElementById('packService').selectedIndex = '2';
		order();
		break;
	default:
		document.getElementById('packService').selectedIndex = '0';
		order();
		break;
	}
}

function show_ym ()
{
	document.getElementById('your_method').style.display = 'block';
	document.getElementById('zform1').action = '/cgi-bin/formmail/formmail.cgi';
}

function hide_ym ()
{
	document.getElementById('your_method').style.display = 'none';
	document.getElementById('yad_text').style.display = 'none';
	document.getElementById('formid_id').value = 'otherpay';
	document.getElementById('zform1').action = '/cgi-bin/pay.cgi';
}

function show_yad ()
{
	document.getElementById('your_method').style.display = 'none';
	document.getElementById('yad_text').style.display = 'block';
	document.getElementById('formid_id').value = 'yandexpay';
	document.getElementById('zform1').action = '/cgi-bin/formmail/formmail.cgi';
}


function show_pop ()
{
	var scroll_top = getBodyScrollTop();
	if (scroll_top >= 300)
	{
		scroll_top = (scroll_top + 10);
	}
	else
	{
		scroll_top = 370;
	}

	var cl_width = getClientWidth();
	if (cl_width >= 665)
	{
		scroll_left = (cl_width - 665)/2;
	}
	else
	{
		scroll_left = 10;
	}

	document.getElementById('prpop1').innerHTML = price_USD_WMR;
	document.getElementById('prpop2').innerHTML = price_USD_WMR;

	document.getElementById('pop_wnd').style.left = scroll_left+'px';
	document.getElementById('pop_wnd').style.top = scroll_top+'px';
	document.getElementById('pop_wnd').style.display = 'block';
}

function show_pop2 ()
{
	var scroll_top = getBodyScrollTop();
	if (scroll_top >= 300)
	{
		scroll_top = (scroll_top + 10);
	}
	else
	{
		scroll_top = 370;
	}

	var cl_width = getClientWidth();
	if (cl_width >= 665)
	{
		scroll_left = (cl_width - 665)/2;
	}
	else
	{
		scroll_left = 10;
	}

	document.getElementById('prpop3').innerHTML = price_USD_WMR;

	document.getElementById('pop_wnd2').style.left = scroll_left+'px';
	document.getElementById('pop_wnd2').style.top = scroll_top+'px';
	document.getElementById('pop_wnd2').style.display = 'block';
}

function getBodyScrollTop()
{
  return self.pageYOffset || 
    (document.documentElement && document.documentElement.scrollTop) || 
    (document.body && document.body.scrollTop);
}

function getClientWidth()
{  
 return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;  
}


function close_pop ()
{
	document.getElementById('pop_wnd').style.display = 'none';
}

function close_pop2 ()
{
	document.getElementById('pop_wnd2').style.display = 'none';
}
