	function qwe()
	{alert('qwe');return false;}
	function changeCountryH()
	{
		document.getElementById("AddressForm").submit();
	}

	function open_window(link,w,h) //opens new window
	{
		var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'newWin',win);
		newWin.focus();
	}
function OpenBox(fldid)
{
	var el=document.getElementById(fldid);	
	if(el.style.display=='block')
	{
		el.style.display='none';
	}
	else
	{
		el.style.display='block';		
	}
}

function OpenCart(evt,productID)
{
open_window('cart.php?addproduct='+productID,400,300);
noContm(evt);
}
function noContm(evt)
{

	evt.cancelBubble=true;
	try{
		evt.preventDefault();}
	catch(e){
		evt.returnValue=false;}
}
	function open_printable_version(link) //opens new window
	{
		var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'perintableWin',win);
		newWin.focus();
	}
	function confirmDelete(id, ask, url) //confirm order delete
	{
		temp = window.confirm(ask);
		if (temp) //delete
		{
			window.location=url+id;
		}
	}
	function confirmUnsubscribe(str) //unsubscription confirmation
	{
		temp = window.confirm(str);
		if (temp) //delete
		{
			window.location="index.php?killuser=yes";
		}
	}

/*
newsletter subscription form validation
    function validate()
    {
        if (document.subscription_form.email.value.length<1)
        {
            alert("{ERROR_INPUT_EMAIL}");
            return false;
        }
        if (document.subscription_form.email.value == 'Email')
        {
            alert("{ERROR_INPUT_EMAIL}");
            return false;
        }
        return true;
    }*/
	function validate_disc1(str1,str2) // review form verification
	{
		if (document.formD.nick.value.length<1)
		{
			alert(str1);
			return false;
		}

		if (document.formD.topic.value.length<1)
		{
			alert(str1);
			return false;
		}

		return true;
	}
/*    function validate_search()
    {

        if (document.Sform.price1.value!="" && ((document.Sform.price1.value < 0) || isNaN(document.Sform.price1.value)))
        {
            alert("{$smarty.const.ERROR_INPUT_PRICE}");
            return false;
        }
        if (document.Sform.price2.value!="" && ((document.Sform.price2.value < 0) || isNaN(document.Sform.price2.value)))
        {
            alert("{$smarty.const.ERROR_INPUT_PRICE}");
            return false;
        }

        return true;
    }*/
/*

	function _formatPrice( _price )
	{

		_pointIndex = -1;
		for( i=0; i< _price.length; i++ )
			if ( _price.charAt(i) == '.' )
			{
				_pointIndex = i;
				break;
			}

		if (  _pointIndex == -1 )
			_price = _price + ".00";
		else if (  _price.length-1 - _pointIndex == 1  )
			_price = _price + "0";

		_res = "";

		i=0;
		for( i=_price.length-1; i >= 0; i-- )
		{
			if ( _price.charAt(i) == '.' )
				break;
			else
				_res = _price.charAt(i) + _res;
		}

		_res = "." + _res;

		i--;
		_digitCounter = 0;
		for( ; i>=0; i-- )
		{
			_digitCounter ++;
			_res = _price.charAt(i) + _res;
			if ( _digitCounter == 3 && i != 0 )
			{
				_res = "," + _res;
				_digitCounter = 0;
			}

		}

		return _res;

	}

*/
		var ComparedProducts1 = new Array();
		
		function PacketIntoHiddenValue1()
		{

			str = '';
			for(i=0; i<ComparedProducts1.length; i++)
				str += ComparedProducts1[i] + ' ';
			document.getElementById("ComparisonHidden1").value = str;

			if ( str != '' )
				document.getElementById("ComparisonForm1").submit();
		}

		var ComparedProducts2 = new Array();
		
		function PacketIntoHiddenValue2()
		{
			str = '';
			for(i=0; i<ComparedProducts2.length; i++)
				str += ComparedProducts2[i] + ' ';
			document.getElementById("ComparisonHidden2").value = str;

			if ( str != '' )
				document.getElementById("ComparisonForm2").submit();
		}
	function _categoryChangedHandler()
	{
		if (document.getElementById("categorySelect").value != 0)
		window.location = 'index.php?categoryID=' + 
			document.getElementById("categorySelect").value +
			'&search_with_change_category_ability=yes';
	}
	
function ComparisonZ(productID)
{
	var _checked = document.getElementById("CompCh_"+productID).checked;
	var _index = -1;
	for(i=0; i<ComparedProducts1.length; i++)
	{
		if ( ComparedProducts1[i] == productID )
		{
			_index = i;
			break;
		}
	}
	if ( _checked )
	{
		if ( _index == -1 )
		{
			ComparedProducts1.push( productID );
			ComparedProducts2.push( productID );
		}
	}
	else
	{
		if ( _index != -1 )
		{
			ComparedProducts1.splice( _index, 1 );
			ComparedProducts2.splice( _index, 1 );
		}
	}
}
function select_address_radio_button_hanler(val)
{
	if (val == 1)
		val = false;
	else
		val = true;
if(document.getElementById("receiver_first_name"))
	document.getElementById("receiver_first_name").disabled = val;
if(document.getElementById("receiver_last_name"))
	document.getElementById("receiver_last_name").disabled = val;
if(document.getElementById("countryID"))	
	document.getElementById("countryID").disabled = val;
if(document.getElementById("state"))	
	document.getElementById("state").disabled = val;
if(document.getElementById("zip"))	
	document.getElementById("zip").disabled = val;
if(document.getElementById("city"))
	document.getElementById("city").disabled = val;
if(document.getElementById("address"))
	document.getElementById("address").disabled = val;
}
