function IsNumeric(sText)
{var ValidChars="0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++)
{Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1)
{IsNumber=false;}}
return IsNumber;}
function startLoading(){Element.show('mainAreaLoading');Element.hide('mainAreaInternal');}
function finishLoading(){Element.show('mainAreaInternal');setTimeout("Effect.toggle('mainAreaLoading');",0);}
function loadContent(months,sum,recent){startLoading();new Ajax.Updater('mainAreaInternal','tbi_calc.php',{method:'post',postBody:'MONTHS='+months+'&SUM='+sum+'&RECENT='+recent+''});finishLoading();}
function startLoading_avl(){Element.show('mainAreaLoading_avl');Element.hide('mainAreaInternal_avl');}
function finishLoading_avl(){Element.show('mainAreaInternal_avl');setTimeout("Effect.toggle('mainAreaLoading_avl');",0);}
function loadContent_avl(av_productCode,av_name,av_phone,av_mail,av_price,av_comment,av_type,av_security_code){if(av_name==''||av_phone==''||av_mail==''||av_price==''||av_security_code==''){alert('Моля попълнете всички задължителни полета!');}else if(IsNumeric(av_price)==false){alert('Въвели сте невалидна стойност на полето количество!');}else{startLoading_avl();new Ajax.Updater('mainAreaInternal_avl','ajax_requests/price_request.php',{method:'post',postBody:'RQ_PRODUCTCODE='+av_productCode+'&RQ_NAME='+av_name+'&RQ_PHONE='+av_phone+'&RQ_MAIL='+av_mail+'&RQ_COMMENT='+av_comment+'&RQ_PRICE='+av_price+'&RQ_TYPE='+av_type+'&security_code='+av_security_code+''});finishLoading_avl();}}
function startLoading_req(){Element.show('mainAreaLoading_req');Element.hide('mainAreaInternal_req');}
function finishLoading_req(){Element.show('mainAreaInternal_req');setTimeout("Effect.toggle('mainAreaLoading_req');",0);}
function loadContent_req(rq_productCode,rq_name,rq_phone,rq_mail,rq_price,rq_comment,rq_type,security_code){if(rq_name==''||rq_phone==''||rq_mail==''||rq_price==''||security_code==''){alert('Моля попълнете всички задължителни полета!');}else if(IsNumeric(rq_price)==false){alert('Въвели сте невалидна стойност на полето цена!');}else{startLoading_req();new Ajax.Updater('mainAreaInternal_req','ajax_requests/price_request.php',{method:'post',postBody:'RQ_PRODUCTCODE='+rq_productCode+'&RQ_NAME='+rq_name+'&RQ_PHONE='+rq_phone+'&RQ_MAIL='+rq_mail+'&RQ_COMMENT='+rq_comment+'&RQ_PRICE='+rq_price+'&RQ_TYPE='+rq_type+'&security_code='+security_code+''});finishLoading_req();}}
function startLoading_bonus(){Element.show('mainAreaLoading_bonus');Element.hide('mainAreaInternal_bonus');}
function finishLoading_bonus(){Element.show('mainAreaInternal_bonus');setTimeout("Effect.toggle('mainAreaLoading_bonus');",0);}
function loadContent_bonus(bonus_productCode,bonus_name,bonus_phone,bonus_mail,bonus_type,bonus_security_code){if(bonus_name==''||bonus_phone==''||bonus_mail==''||bonus_security_code==''){alert('Моля попълнете всички задължителни полета!');}else{startLoading_req();new Ajax.Updater('mainAreaInternal_bonus','ajax_requests/price_request.php',{method:'post',postBody:'RQ_PRODUCTCODE='+bonus_productCode+'&RQ_NAME='+bonus_name+'&RQ_PHONE='+bonus_phone+'&RQ_MAIL='+bonus_mail+'&RQ_TYPE='+bonus_type+'&security_code='+bonus_security_code+''});finishLoading_req();}}
function startLoading_cat(){Element.show('mainAreaLoading_cat');Element.hide('mainAreaInternal_cat');}
function finishLoading_cat(){Element.show('mainAreaInternal_cat');setTimeout("Effect.toggle('mainAreaLoading_cat');",0);}
function loadContent_cat(prodid,catid){startLoading_cat();new Ajax.Updater('mainAreaInternal_cat','promo_div.php',{method:'post',postBody:'PRODID='+prodid+'&CATID='+catid+''});finishLoading_cat();}
function startLoading1(){Element.show('mainAreaLoading1');Element.hide('mainAreaInternal1');}
function finishLoading1(){Element.show('mainAreaInternal1');setTimeout("Effect.toggle('mainAreaLoading1');",0);}
function loadContent1(prodid,catid){startLoading1();new Ajax.Updater('mainAreaInternal1','promo_div.php',{method:'post',postBody:'PRODID='+prodid+'&CATID='+catid+''});finishLoading1();}
function startLoading2(){Element.show('mainAreaLoading2');Element.hide('mainAreaInternal2');}
function finishLoading2(){Element.show('mainAreaInternal2');setTimeout("Effect.toggle('mainAreaLoading2');",0);}
function loadContent2(prodid,catid){startLoading2();new Ajax.Updater('mainAreaInternal2','promo_div.php',{method:'post',postBody:'PRODID='+prodid+'&CATID='+catid+''});finishLoading2();}
function loadGraph(){var frm=document.getElementById('post_form');if(frm){frm.submit();ifr.src=ifr.src;ifr.contentWindow.location.replace(ifr.src);}}
function onlyNumbers(evt){var e=event||evt;var charCode=e.which||e.keyCode;if(charCode==46||(charCode>47&&charCode<58))return true;return false;}
