var ComparedProducts1 = new Array();
var ComparedProducts2 = new Array();

function open_window(link,w,h)
{var win="width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";newWin=window.open(link,'newWin',win);newWin.focus();}
function open_printable_version(link)
{var win="menubar=no,location=no,resizable=yes,scrollbars=yes";newWin=window.open(link,'perintableWin',win);newWin.focus();}
function confirmDelete(id,ask,url)
{temp=window.confirm(ask);if(temp)
{window.location=url+id;}}
function confirmUnsubscribe()
{temp=window.confirm('{/literal}{$smarty.const.QUESTION_UNSUBSCRIBE}{literal}');if(temp)
{window.location="index.php?killuser=yes";}}
function validate()
{if(document.subscription_form.email.value.length<1)
{alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");return false;}
if(document.subscription_form.email.value=='Email')
{alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");return false;}
return true;}
function validate_disc()
{if(document.formD.nick.value.length<1)
{alert("Заполните поле Имя");return false;}
if(document.formD.body.value.length<1)
{alert("Заполните поле Текст");return false;}
return true;}
function validate_search()
{if(document.Sform.price1.value!=""&&((document.Sform.price1.value<0)||isNaN(document.Sform.price1.value)))
{alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");return false;}
if(document.Sform.price2.value!=""&&((document.Sform.price2.value<0)||isNaN(document.Sform.price2.value)))
{alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");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;}
function PacketIntoHiddenValue1()
{str='';for(i=0;i<ComparedProducts1.length;i++)
str+=ComparedProducts1[i]+' ';document.ComparisonForm1.ComparisonHidden1.value=str;if(str!='')
document.ComparisonForm1.submit();}
function PacketIntoHiddenValue2()
{str='';for(i=0;i<ComparedProducts2.length;i++)
str+=ComparedProducts2[i]+' ';document.ComparisonForm2.ComparisonHidden2.value=str;if(str!='')
document.ComparisonForm2.submit();}
function Comparison(prd_id)
{var doc_check_box_id='ComparisonCheckBox_'+prd_id;var check_box=document.getElementById(doc_check_box_id);_checked=check_box.checked;_index=-1;for(i=0;i<ComparedProducts1.length;i++)
if(ComparedProducts1[i]==prd_id)
{_index=i;break;}
if(_checked)
{if(_index==-1)
{ComparedProducts1.push(prd_id);ComparedProducts2.push(prd_id);}}
else
{if(_index!=-1)
{ComparedProducts1.splice(_index,1);ComparedProducts2.splice(_index,1);}}}
