//Script Module /08.2005/

/*Init-------------------------------------------------------------------------------------------*/
var wndPic;
var wndClip;
var wndTable;
var idnum = 0;
var dataList = Array();

/*Main-------------------------------------------------------------------------------------------*/

function SetFocus(elementName)
{
	var element;
	if (navigator.appName != "Netscape" && document.all) element = eval("document.all." + elementName);
	else element = document.getElementById(elementName);
	try { element.focus(); }
	catch (e) {}
	return true;
}

function ShowPic(imgSrc, imgWidth, imgHeight, title) {
	var wndWidth = imgWidth + 20;
	var wndHeight = imgHeight + 20;
	var wndLeft = 0;
	var wndTop = 0;
	if (screen) {
		wndLeft = Math.round((screen.width - wndWidth) / 2);
		wndTop = Math.round((screen.height - wndHeight) / 2);
	}	
	strParam = 'menubar=no,toolbar=no,resizable=no,scrollbars=no,status=no,width=' + wndWidth + ',height=' + wndHeight + ',top=' + wndTop + 
		',left=' + wndLeft;
	if (wndPic) wndPic.close();
	wndPic = window.open('', 'pic', strParam);
	if (wndPic) {
		wndPic.document.open();
		wndPic.document.write('<html><head><title>' + title + '</title></head><body bgcolor="white" style="margin: 0px; padding: 0px;"><table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center">');
		wndPic.document.write('<img src="' + imgSrc + '" width="' + imgWidth + '" height="' + imgHeight + '" />');
		wndPic.document.write('</td></tr></table></body></html>');
		wndPic.document.close();
		wndPic.focus();
	}
	return false;
}

function ShowClip(clipSrc, title)
{
	var wndWidth = 700;
	var wndHeight = 500;
	var wndLeft = 0;
	var wndTop = 0;
	if (screen) {
		wndWidth = screen.width - 200;
		wndHeight = screen.height - 200;
		wndLeft = Math.round((screen.width - wndWidth) / 2);
		wndTop = Math.round((screen.height - wndHeight) / 2);
	}	
	strParam = 'menubar=no,toolbar=no,resizable=yes,scrollbars=no,status=no,width=' + wndWidth + ',height=' + wndHeight + ',top=' + wndTop + 
		',left=' + wndLeft;
	if (wndClip) wndClip.close();
	wndClip = window.open('', 'clip', strParam);
	if (wndClip) {
		wndClip.document.open();
		wndClip.document.write('<html><head><title>' + title + '</title></head><body bgcolor="white" style="margin: 0px; padding: 0px;"><table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center" valign="middle">');
		wndClip.document.write('<object id="clip" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="90%" width="90%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>');
		wndClip.document.write('<param name="_cx" value="4471">');
		wndClip.document.write('<param name="_cy" value="5477">');
		wndClip.document.write('<param name="FlashVars" value="">');
		wndClip.document.write('<param name="Movie" value="' + clipSrc + '">');
		wndClip.document.write('<param name="Src" value="' + clipSrc + '">');
		wndClip.document.write('<param name="WMode" value="Transparent">');
		wndClip.document.write('<param name="Play" value="-1">');
		wndClip.document.write('<param name="Loop" value="-1">');
		wndClip.document.write('<param name="Quality" value="High">');
		wndClip.document.write('<param name="SAlign" value="">');
		wndClip.document.write('<param name="Menu" value="-1">');
		wndClip.document.write('<param name="Base" value="">');
		wndClip.document.write('<param name="AllowScriptAccess" value="always">');
		wndClip.document.write('<param name="Scale" value="ShowAll">');
		wndClip.document.write('<param name="DeviceFont" value="0">');
		wndClip.document.write('<param name="EmbedMovie" value="0">');
		wndClip.document.write('<param name="BGColor" value="ffffff">');
		wndClip.document.write('<param name="SWRemote" value="">');
		wndClip.document.write('<param name="MovieData" value="">');
		wndClip.document.write('<param name="SeamlessTabbing" value="1">');
		wndClip.document.write('<embed src="' + clipSrc + '" quality="high" wmode="transparent" bgcolor="#ffffff"  width="' + (wndWidth - 20) + '" height="' + (wndHeight - 20) + '" name="clip" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
		wndClip.document.write('</object>');
		wndClip.document.write('</td></tr></table></body></html>');
		wndClip.document.close();
		wndClip.focus();
	}
	return false;	
}

function ShowTable(srcTable)
{
var wndWidth = 700;
	var wndHeight = 500;
	var wndLeft = 0;
	var wndTop = 0;
	if (screen) {
		wndWidth = screen.width - 200;
		wndHeight = screen.height - 200;
		wndLeft = Math.round((screen.width - wndWidth) / 2);
		wndTop = Math.round((screen.height - wndHeight) / 2);
	}	
	strParam = 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,status=no,width=' + wndWidth + ',height=' + wndHeight + ',top=' + wndTop + 
		',left=' + wndLeft;
	if (wndTable) wndTable.close();
	wndTable = window.open(srcTable, 'table', strParam);
	return false;
}

/*AddAccessories---------------------------------------------------------------------------------*/

function AddAccessories(index)
{
	if (navigator.appName != "Netscape" && document.all) AddAccessoriesIE(index);
	else AddAccessoriesNetscape(index);
}

//IE
function AddAccessoriesIE(index)
{	
	if (index == -1) return;
	var currow;
	currow = document.all.tbAccessories.rows.length;
	idnum++;
	var row;
	row = document.all.tbAccessories.insertRow(currow);
	row.id = 'row_' + idnum;
	row.insertCell(0);
	row.insertCell(1);
	row.insertCell(2);
	row.insertCell(3);
	row.insertCell(4);
	var val;
	val = document.all.ddlAccessories.options[index].value;
	row.cells[0].innerHTML = document.all.ddlAccessories.options[index].text;
	row.cells[1].align = 'right';
	row.cells[1].innerHTML = val;
	row.cells[2].align = 'right';
	row.cells[2].innerHTML = '<input type="text" name="count_' + idnum + '" id="count_' + idnum + '" value="1" size="1" maxlength="2" onchange="Calculate(\'' + idnum + '\')">';
	if (val.indexOf('*') != -1) val = val.substr(val.indexOf('*') + 1, val.indexOf('/') - 1);
	row.cells[3].align = 'right';
	row.cells[3].innerHTML = val;
	row.cells[4].align = 'center';
	row.cells[4].innerHTML = '<a href="#" onclick="DeleteAccessories(\'row_' + idnum + '\')" onfocus="this.blur()"><img src="/portal/images/ic_del.gif" border="0" width="20" height="20" title="' + unescape('%u0423%u0434%u0430%u043B%u0438%u0442%u044C') + '"></a>';
	if (document.all.ddlAccessories.options[index] != null) document.all.ddlAccessories.options[index] = null;
	if (document.all.ddlAccessories.options[0] != null) document.all.ddlAccessories.options[0].selected = true;
	SumAccessories();
	if (document.all.dvNext.style.display == 'none') document.all.dvNext.style.display = ''; 
	return false;
}

//Netscape
function AddAccessoriesNetscape(index)
{	
	if (index == -1) return;
	var currow;
	currow = document.getElementById('tbAccessories').rows.length;
	idnum++;
	var row;
	row = document.getElementById('tbAccessories').insertRow(currow);
	row.id = 'row_' + idnum;
	row.insertCell(0);
	row.insertCell(1);
	row.insertCell(2);
	row.insertCell(3);
	row.insertCell(4);
	var val;
	val = document.getElementById('ddlAccessories').options[index].value;
	row.cells[0].innerHTML = document.getElementById('ddlAccessories').options[index].text;
	row.cells[1].align = 'right';
	row.cells[1].innerHTML = val;
	row.cells[2].align = 'right';
	row.cells[2].innerHTML = '<input type="text" name="count_' + idnum + '" id="count_' + idnum + '" value="1" size="1" maxlength="2" onchange="Calculate(\'' + idnum + '\')">';
	if (val.indexOf('*') != -1) val = val.substr(val.indexOf('*') + 1, val.indexOf('/') - 1);
	row.cells[3].align = 'right';
	row.cells[3].innerHTML = val;
	row.cells[4].align = 'center';
	row.cells[4].innerHTML = '<a href="#" onclick="DeleteAccessories(\'row_' + idnum + '\')" onfocus="this.blur()"><img src="/portal/images/ic_del.gif" border="0" width="20" height="20" title="' + unescape('%u0423%u0434%u0430%u043B%u0438%u0442%u044C') + '"></a>';
	if (document.getElementById('ddlAccessories').options[index] != null) document.getElementById('ddlAccessories').options[index] = null;
	if (document.getElementById('ddlAccessories').options[0] != null) document.getElementById('ddlAccessories').options[0].selected = true;
	SumAccessories();
	if (document.getElementById('dvNext').style.display == 'none') document.getElementById('dvNext').style.display = ''; 
	return false;
}

/*SumAccessories---------------------------------------------------------------------------------*/

function SumAccessories()
{
	if (navigator.appName != "Netscape" && document.all) SumAccessoriesIE();
	else SumAccessoriesNetscape();
}

//IE
function SumAccessoriesIE()
{	
	var s = 0;
	var row;
	for (var idx = 1; idx < document.all.tbAccessories.rows.length; idx++)
	{
		row = document.all.tbAccessories.rows[idx];
		s = s + eval(row.cells[3].innerHTML); 
	}
	document.all.spSum.innerHTML = s;
}

//Netscape
function SumAccessoriesNetscape()
{	
	var s = 0;
	var row;
	for (var idx = 1; idx < document.getElementById('tbAccessories').rows.length; idx++)
	{		
		row = document.getElementById('tbAccessories').rows[idx];
		s = s + eval(row.cells[3].innerHTML); 
	}
	document.getElementById('spSum').innerHTML = s;
}

/*-----------------------------------------------------------------------------------------------*/

function Calculate(idnum)
{
	if (navigator.appName != "Netscape" && document.all) CalculateIE(idnum);
	else CalculateNetscape(idnum);
}

//IE
function CalculateIE(idnum)
{	
	var row = eval('document.all.row_' + idnum);
	var counter = eval('document.all.count_' + idnum);
	if ((counter.value > 0) && (counter.value <= 99) && (counter.value.indexOf(".") == -1))
	{
		var val = row.cells[1].innerHTML;
		if (val.indexOf('*') != -1) 
		{
			if (counter.value <= 3) val = val.substr(val.indexOf('*') + 1, val.indexOf('/') - 1);	
			else val = val.substr(val.indexOf('/') + 1, val.length - val.indexOf('/'));
		}
		row.cells[3].innerHTML = eval(val * counter.value);
	}
	else
	{
		alert(unescape('%u0417%u043D%u0430%u0447%u0435%u043D%u0438%u0435%20%u0432%20%u043F%u043E%u043B%u0435%20%22%u041A%u043E%u043B%u0438%u0447%u0435%u0441%u0442%u0432%u043E%22%20%u0434%u043E%u043B%u0436%u043D%u043E%20%u0431%u044B%u0442%u044C%20%u0446%u0438%u0444%u0440%u043E%u0432%u044B%u043C%20%u0438%20%u0446%u0435%u043B%u044B%u043C'));
		counter.value = 1;
	}
	SumAccessories();
	return;
}

//Netscape
function CalculateNetscape(idnum)
{
	var row = document.getElementById('row_' + idnum);
	var counter = document.getElementById('count_' + idnum);
	if ((counter.value > 0) && (counter.value <= 99) && (counter.value.indexOf(".") == -1))
	{
		var val = row.cells[1].innerHTML;
		if (val.indexOf('*') != -1) 
		{
			if (counter.value <= 3) val = val.substr(val.indexOf('*') + 1, val.indexOf('/') - 1);	
			else val = val.substr(val.indexOf('/') + 1, val.length - val.indexOf('/'));
		}
		row.cells[3].innerHTML = eval(val * counter.value);
	}
	else
	{
		alert(unescape('%D0%97%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%B2%20%D0%BF%D0%BE%D0%BB%D0%B5%20%22%D0%9A%D0%BE%D0%BB%D0%B8%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%BE%22%20%D0%B4%D0%BE%D0%BB%D0%B6%D0%BD%D0%BE%20%D0%B1%D1%8B%D1%82%D1%8C%20%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D1%8B%D0%BC%20%D0%B8%20%D1%86%D0%B5%D0%BB%D1%8B%D0%BC'));
		counter.value = 1;
	}
	SumAccessories();
	return;
}

/*DeleteAccessories------------------------------------------------------------------------------*/

function DeleteAccessories(rowid)
{
	if (navigator.appName != "Netscape" && document.all) DeleteAccessoriesIE(rowid);
	else DeleteAccessoriesNetscape(rowid);
}	

//IE
function DeleteAccessoriesIE(rowid)
{
	for (var idx = 1; idx < document.all.tbAccessories.rows.length; idx++)
		if (document.all.tbAccessories.rows[idx].id == rowid)
		{
			var row = document.all.tbAccessories.rows[idx];
			var opt = document.createElement('OPTION');
			opt.text = row.cells[0].innerHTML;
			opt.value = row.cells[1].innerHTML;
			document.all.ddlAccessories.options.add(opt);
			document.all.tbAccessories.deleteRow(idx);
			SortAccessories();
			break;
		}
	SumAccessories();	
	if ((document.all.tbAccessories.rows.length < 2) && (document.all.dvNext.style.display == '')) document.all.dvNext.style.display = 'none'; 
	return false;
}

//Netscape
function DeleteAccessoriesNetscape(rowid)
{
	for (var idx = 1; idx < document.getElementById('tbAccessories').rows.length; idx++)
	{
		if (document.getElementById('tbAccessories').rows[idx].id == rowid)
		{
			var row = document.getElementById('tbAccessories').rows[idx];
			var opt = document.createElement('OPTION');
			opt.text = row.cells[0].innerHTML;
			opt.value = row.cells[1].innerHTML;
			document.getElementById('ddlAccessories').options[document.getElementById('ddlAccessories').options.length] = opt;
			document.getElementById('tbAccessories').deleteRow(idx);
			SortAccessories();
			break;
		}
	}	
	SumAccessories();	
	if ((document.getElementById('tbAccessories').rows.length < 2) && (document.getElementById('dvNext').style.display == '')) document.getElementById('dvNext').style.display = 'none'; 
	return false;
}

/*SortAccessories--------------------------------------------------------------------------------*/

function SortAccessories()
{
	if (navigator.appName != "Netscape" && document.all) SortAccessoriesIE();
	else SortAccessoriesNetscape();
}

//IE
function SortAccessoriesIE()	
{
	var a = Array();
	for (var idx = 0; idx < document.all.ddlAccessories.options.length; idx++)
		a[idx] = document.all.ddlAccessories.options[idx].text + '=' + document.all.ddlAccessories.options[idx].value;
	for (var idx = 0; idx < a.length; idx++ )	document.all.ddlAccessories.options[0] = null;
	a.sort();
	for (var idx = 0; idx < a.length; idx++ )
	{
		var opt = document.createElement('OPTION');
		opt.text = a[idx].substr(0, a[idx].indexOf('=')); 
		opt.value = a[idx].substr(a[idx].indexOf('=') + 1, a[idx].length - a[idx].indexOf('='));
		document.all.ddlAccessories.options.add(opt);
	}
}

//Netscape
function SortAccessoriesNetscape()	
{
	var a = Array();
	for (var idx = 0; idx < document.getElementById('ddlAccessories').options.length; idx++)
		a[idx] = document.getElementById('ddlAccessories').options[idx].text + '=' + document.getElementById('ddlAccessories').options[idx].value;
	for (var idx = 0; idx < a.length; idx++ )	document.getElementById('ddlAccessories').options[0] = null;
	a.sort();
	for (var idx = 0; idx < a.length; idx++ )
	{
		var opt = document.createElement('OPTION');
		opt.text = a[idx].substr(0, a[idx].indexOf('=')); 
		opt.value = a[idx].substr(a[idx].indexOf('=') + 1, a[idx].length - a[idx].indexOf('='));
		document.getElementById('ddlAccessories').options[document.getElementById('ddlAccessories').options.length] = opt;
	}
}

/*FillDataList-----------------------------------------------------------------------------------*/

function FillDataList()
{
	if (navigator.appName != "Netscape" && document.all) FillDataListIE();
	else FillDataListNetscape();
}
	
//IE
function FillDataListIE()	
{	
	dataList.splice(0, dataList.length);
	var row;
	var idnum;
	var counter;
	for (var idx = 1; idx < document.all.tbAccessories.rows.length; idx++)
	{
		row = document.all.tbAccessories.rows[idx];
		idnum = row.id.substr(4, row.id.length - 4);
		counter  = eval('document.all.count_' + idnum);
		dataList[idx - 1] = row.cells[0].innerHTML + ':' + row.cells[1].innerHTML + ':' + counter.value + ':' + row.cells[3].innerHTML;
	}
}

//Netscape
function FillDataListNetscape()	
{	
	dataList.splice(0, dataList.length);
	var row;
	var idnum;
	var counter;
	for (var idx = 1; idx < document.getElementById('tbAccessories').rows.length; idx++)
	{
		row = document.getElementById('tbAccessories').rows[idx];
		idnum = row.id.substr(4, row.id.length - 4);
		counter  = document.getElementById('count_' + idnum);
		dataList[idx - 1] = row.cells[0].innerHTML + ':' + row.cells[1].innerHTML + ':' + counter.value + ':' + row.cells[3].innerHTML;
	}
}

/*MakePersonal-----------------------------------------------------------------------------------*/

function MakePersonal()
{
	FillDataList();
	if (navigator.appName != "Netscape" && document.all) MakePersonalIE();
	else MakePersonalNetscape();
}

//IE
function MakePersonalIE()
{	
	if (document.all.dvCalculate.style.display == '') document.all.dvCalculate.style.display = 'none';
	if (document.all.dvPersonal.style.display = 'none') document.all.dvPersonal.style.display = '';
	if (document.all.dvNext.style.display == '') document.all.dvNext.style.display = 'none';
	if (document.all.dvBackSubmit.style.display == 'none') document.all.dvBackSubmit.style.display = '';
	if (document.all.dvRemarkCalculator.style.display == '') document.all.dvRemarkCalculator.style.display = 'none';
	if (document.all.dvRemarkPersonal.style.display == 'none') document.all.dvRemarkPersonal.style.display = '';	
	var sum = 0;
	for (var idx = 0; idx < dataList.length; idx++)
	{
		var currow = document.all.tbAccessoriesPersonal.rows.length;
		var row = document.all.tbAccessoriesPersonal.insertRow(currow);
		row.insertCell(0);
		row.insertCell(1);
		row.insertCell(2);
		row.insertCell(3);
		re = /(.+):(.+):(.+):(.+)/g;
		row.cells[0].innerHTML = dataList[idx].replace(re, '$1');
		row.cells[1].align = 'right';
		row.cells[1].innerHTML = dataList[idx].replace(re, '$2');
		row.cells[2].align = 'right';
		row.cells[2].innerHTML = dataList[idx].replace(re, '$3');
		row.cells[3].align = 'right';
		row.cells[3].innerHTML = dataList[idx].replace(re, '$4');
		sum += eval(dataList[idx].replace(re, '$4'));
	}	
	document.all.spSumPersonal.innerHTML = sum;
	SetFocus('txName');
	return false;
}

//Netscape
function MakePersonalNetscape()
{	
	if (document.getElementById('dvCalculate').style.display == '') document.getElementById('dvCalculate').style.display = 'none';
	if (document.getElementById('dvPersonal').style.display = 'none') document.getElementById('dvPersonal').style.display = '';
	if (document.getElementById('dvNext').style.display == '') document.getElementById('dvNext').style.display = 'none';
	if (document.getElementById('dvBackSubmit').style.display == 'none') document.getElementById('dvBackSubmit').style.display = '';
	if (document.getElementById('dvRemarkCalculator').style.display == '') document.getElementById('dvRemarkCalculator').style.display = 'none';
	if (document.getElementById('dvRemarkPersonal').style.display == 'none') document.getElementById('dvRemarkPersonal').style.display = '';	
	var sum = 0;
	for (var idx = 0; idx < dataList.length; idx++)
	{
		var currow = document.getElementById('tbAccessoriesPersonal').rows.length;
		var row = document.getElementById('tbAccessoriesPersonal').insertRow(currow);
		row.insertCell(0);
		row.insertCell(1);
		row.insertCell(2);
		row.insertCell(3);
		re = /(.+):(.+):(.+):(.+)/g;
		row.cells[0].innerHTML = dataList[idx].replace(re, '$1');
		row.cells[1].align = 'right';
		row.cells[1].innerHTML = dataList[idx].replace(re, '$2');
		row.cells[2].align = 'right';
		row.cells[2].innerHTML = dataList[idx].replace(re, '$3');
		row.cells[3].align = 'right';
		row.cells[3].innerHTML = dataList[idx].replace(re, '$4');
		sum += eval(dataList[idx].replace(re, '$4'));
	}	
	document.getElementById('spSumPersonal').innerHTML = sum;
	SetFocus('txName');
	return false;
}

/*MakeCalculate----------------------------------------------------------------------------------*/

function MakeCalculate()
{
	if (navigator.appName != "Netscape" && document.all) MakeCalculateIE();
	else MakeCalculateNetscape();
}

//IE
function MakeCalculateIE()
{
	//clear tbAccessoriesPersonal
	var totalRow = document.all.tbAccessoriesPersonal.rows.length;
	for (var idx = 1; idx < totalRow; idx++) document.all.tbAccessoriesPersonal.deleteRow(1);
	if (document.all.dvCalculate.style.display == 'none') document.all.dvCalculate.style.display = '';
	if (document.all.dvPersonal.style.display == '') document.all.dvPersonal.style.display = 'none';
	if (document.all.dvNext.style.display == 'none') document.all.dvNext.style.display = '';
	if (document.all.dvBackSubmit.style.display == '') document.all.dvBackSubmit.style.display = 'none';
	if (document.all.dvRemarkCalculator.style.display == 'none') document.all.dvRemarkCalculator.style.display = '';
	if (document.all.dvRemarkPersonal.style.display == '') document.all.dvRemarkPersonal.style.display = 'none';
	return false;
}

//Netscape
function MakeCalculateNetscape()
{
	//clear tbAccessoriesPersonal
	var totalRow = document.getElementById('tbAccessoriesPersonal').rows.length;
	for (var idx = 1; idx < totalRow; idx++) document.getElementById('tbAccessoriesPersonal').deleteRow(1);
	if (document.getElementById('dvCalculate').style.display == 'none') document.getElementById('dvCalculate').style.display = '';
	if (document.getElementById('dvPersonal').style.display == '') document.getElementById('dvPersonal').style.display = 'none';
	if (document.getElementById('dvNext').style.display == 'none') document.getElementById('dvNext').style.display = '';
	if (document.getElementById('dvBackSubmit').style.display == '') document.getElementById('dvBackSubmit').style.display = 'none';
	if (document.getElementById('dvRemarkCalculator').style.display == 'none') document.getElementById('dvRemarkCalculator').style.display = '';
	if (document.getElementById('dvRemarkPersonal').style.display == '') document.getElementById('dvRemarkPersonal').style.display = 'none';
	return false;
}

/*SubmitCalculator-------------------------------------------------------------------------------*/

function SubmitCalculator()
{
	if (navigator.appName != "Netscape" && document.all) SubmitCalculatorIE();
	else SubmitCalculatorNetscape();
}

//IE
function SubmitCalculatorIE()	
{
	var flag = false;
	document.all.dvVdEMail.style.visibility = 'hidden';
	if (trim(document.all.txName.value) != '') document.all.spVdName.style.visibility = 'hidden';
	else
	{
		flag = true;
		document.all.spVdName.style.visibility = 'visible';
	}
	if (trim(document.all.txEmail.value) != '') 
	{
		document.all.spVdEmail.style.visibility = 'hidden';
		re = /[_a-zA-Z\d\-\.]+@([_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+)/g;
		if (re.test(document.all.txEmail.value)) document.all.dvVdEMail.style.visibility = 'hidden';
		else
		{
			flag = true;
			document.all.dvVdEMail.style.visibility = 'visible';
		}
	}
	else
	{
		flag = true;
		document.all.spVdEmail.style.visibility = 'visible';
	}
	if (!flag)
	{
		document.all.hdDataList.value = dataList;
		document.all.fmCalculator.submit();
		return true;
	}
}

//Netscape
function SubmitCalculatorNetscape()	
{
	var flag = false;
	document.getElementById('dvVdEMail').style.visibility = 'hidden';
	if (trim(document.getElementById('txName').value) != '') document.getElementById('spVdName').style.visibility = 'hidden';
	else
	{
		flag = true;
		document.getElementById('spVdName').style.visibility = 'visible';
	}
	if (trim(document.getElementById('txEmail').value) != '') 
	{
		document.getElementById('spVdEmail').style.visibility = 'hidden';
		re = /[_a-zA-Z\d\-\.]+@([_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+)/g;
		if (re.test(document.getElementById('txEmail').value)) document.getElementById('dvVdEMail').style.visibility = 'hidden';
		else
		{
			flag = true;
			document.getElementById('dvVdEMail').style.visibility = 'visible';
		}
	}
	else
	{
		flag = true;
		document.getElementById('spVdEmail').style.visibility = 'visible';
	}
	if (!flag)
	{
		document.getElementById('hdDataList').value = dataList;
		document.getElementById('fmCalculator').submit();
	}
}

/*cookie-----------------------------------------------------------------------------------------*/
function SetCookie(name, value) 
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) 
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
    
function GetCookie(name) 
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) 
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}
    
function DeleteCookie (name) 
{
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

/*aux--------------------------------------------------------------------------------------------*/
function trim(s)
{
	return s.replace(/^\s*(.+?)\s*$/, "$1");
}
/*applicability----------------------------------------------------------------------------------*/

var iex;
var nav;
var obj;

function Init()
{
	iex = (document.all); 
	nav = !iex;
	obj = (nav) ? document.getElementById('dvViewData') : document.all.dvViewData; 
	if (nav) document.captureEvents(Event.MOUSEMOVE); 
	document.onmousemove = getMouse;
}

function getMouse(e)
{
	var x = (nav) ? e.pageX : event.x + document.body.scrollLeft; 
	var y = (nav) ? e.pageY : event.y + document.body.scrollTop; 
	obj.style.left = x - 2; 
	obj.style.top = y + 20;
}

function ViewBriefData(data)
{
	var re = new RegExp('`' , 'g');
	var content = '&nbsp;' + data.replace(re, '&nbsp;<br>&nbsp;');
	obj.innerHTML = content;
	obj.style.visibility = 'visible';
}

function HideBriefData()
{
	obj.innerHTML = '';
	obj.style.visibility = 'hidden';
	window.status = '';
}

function InitResize()
{
	window.onresize = ProgressPosition;
	ProgressPosition();
	return true; 
}

function ProgressPosition()
{
	var left = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth;
	var top = document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight;
	document.getElementById("dvProgress").style.left = left / 2 - 102 + "px";
	document.getElementById("dvProgress").style.top = top / 2 + "px";
	return true;
}

/*Poll-------------------------------------------------------------------------------------------*/

var innerHTML = '';

function initPoll()
{
	//DeleteCookie ('PollMarks');
	//if (GetCookie('PollMarks')) innerHTML = document.getElementById('dvPoll').innerHTML = '';
	if (GetCookie('PollMarks') == null) document.getElementById('dvPoll').style.display = 'block';
}

function CheckPoll(ctrlFirst, ctrlRegion)
{
	if (document.getElementById(ctrlFirst) && document.getElementById(ctrlRegion))
	{
		if (document.getElementById(ctrlFirst).value == -1)
		{
			innerHTML = document.getElementById('dvPoll').innerHTML;
			document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorFirst').value + '</div><br>';
			setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
		}
		else 
		{
			if (document.getElementById(ctrlRegion).value == -1)
			{
				innerHTML = document.getElementById('dvPoll').innerHTML;
				document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorRegion').value + '</div><br>';
				setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
			}
			else
			{
				if (GetCookie('PollMarks'))
				{
					innerHTML = document.getElementById('dvPoll').innerHTML;
					document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorIP').value + '</div><br>';
					setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
				}
				else
				{
					var expiry = new Date();
					expiry.setTime(expiry.getTime() + 365*24*60*60*1000);
					SetCookie('PollMarks', '1', expiry);
					//document.getElementById('__aspnetForm').submit();
					document.getElementById('myPoll_fmPoll').submit();
				}
			}
		}	
	}
}

function CheckSameFirst()
{
	if ((document.getElementById('myPoll_ddlFirst').value != '-1') && 
		((document.getElementById('myPoll_ddlFirst').value == document.getElementById('myPoll_ddlSecond').value) ||
		(document.getElementById('myPoll_ddlFirst').value == document.getElementById('myPoll_ddlThird').value)))
	{
		document.getElementById('myPoll_ddlFirst').value = '-1';
		innerHTML = document.getElementById('dvPoll').innerHTML;
		document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorMark').value + '</div><br>';
		setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
	}
}

function CheckSameSecond()
{
	if ((document.getElementById('myPoll_ddlSecond').value != '-1') && 
		((document.getElementById('myPoll_ddlSecond').value == document.getElementById('myPoll_ddlFirst').value) ||
		(document.getElementById('myPoll_ddlSecond').value == document.getElementById('myPoll_ddlThird').value)))
	{
		document.getElementById('myPoll_ddlSecond').value = '-1';
		innerHTML = document.getElementById('dvPoll').innerHTML;
		document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorMark').value + '</div><br>';
		setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
	}
}

function CheckSameThird()
{
	if ((document.getElementById('myPoll_ddlThird').value != '-1') &&
		((document.getElementById('myPoll_ddlThird').value == document.getElementById('myPoll_ddlFirst').value) ||
		(document.getElementById('myPoll_ddlThird').value == document.getElementById('myPoll_ddlSecond').value)))
	{
		document.getElementById('myPoll_ddlThird').value = '-1';
		innerHTML = document.getElementById('dvPoll').innerHTML;
		document.getElementById('dvPoll').innerHTML = '<div class="poll_error">' + document.getElementById('hdErrorMark').value + '</div><br>';
		setTimeout("document.getElementById('dvPoll').innerHTML = innerHTML", 3000);
	}
}
/*flash------------------------------------------------------------------------------------------*/

function initFlashObj() 
{
  theObjects = document.getElementsByTagName("object");
  for (var i = 0; i < theObjects.length; i++) { theObjects[i].outerHTML = theObjects[i].outerHTML; }
}
/*-----------------------------------------------------------------------------------------------*/