


var Fat={make_hex:function(r,g,b)
{r=r.toString(16);if(r.length==1)r='0'+r;g=g.toString(16);if(g.length==1)g='0'+g;b=b.toString(16);if(b.length==1)b='0'+b;return"#"+r+g+b;},fade_all:function()
{var a=document.getElementsByTagName("*");for(var i=0;i<a.length;i++)
{var o=a[i];var r=/fade-?(\w{3,6})?/.exec(o.className);if(r)
{if(!r[1])r[1]="";if(o.id)Fat.fade_element(o.id,null,null,"#"+r[1]);}}},fade_element:function(id,fps,duration,from,to)
{if(!fps)fps=30;if(!duration)duration=3000;if(!from||from=="#")from="#FFFF33";if(!to)to=this.get_bgcolor(id);var frames=Math.round(fps*(duration/1000));var interval=duration/frames;var delay=interval;var frame=0;if(from.length<7)from+=from.substr(1,3);if(to.length<7)to+=to.substr(1,3);var rf=parseInt(from.substr(1,2),16);var gf=parseInt(from.substr(3,2),16);var bf=parseInt(from.substr(5,2),16);var rt=parseInt(to.substr(1,2),16);var gt=parseInt(to.substr(3,2),16);var bt=parseInt(to.substr(5,2),16);var r,g,b,h;while(frame<frames)
{r=Math.floor(rf*((frames-frame)/frames)+rt*(frame/frames));g=Math.floor(gf*((frames-frame)/frames)+gt*(frame/frames));b=Math.floor(bf*((frames-frame)/frames)+bt*(frame/frames));h=this.make_hex(r,g,b);setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')",delay);frame++;delay=interval*frame;}
setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')",delay);},set_bgcolor:function(id,c)
{var o=document.getElementById(id);o.style.backgroundColor=c;},get_bgcolor:function(id)
{var o=document.getElementById(id);while(o)
{var c;if(window.getComputedStyle)c=window.getComputedStyle(o,null).getPropertyValue("background-color");if(o.currentStyle)c=o.currentStyle.backgroundColor;if((c!=""&&c!="transparent")||o.tagName=="BODY"){break;}
o=o.parentNode;}
if(c==undefined||c==""||c=="transparent")c="#FFFFFF";var rgb=c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);if(rgb)c=this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));return c;}}
function hostingQuoteUpdate()
{var price,q,quant,unit;var subtotal=0;var vat=0;var total=0;var items=new Array('base','ips','ssl','bw','mb','db','backup_wfs','backup_wdb','backup_dfs','backup_ddb');for(var i in items)
{unit=document.getElementById('unit_'+items[i]).value;q=document.getElementById('quant_'+items[i]);if(typeof(q.value)=='undefined')
{quant=q.options[q.selectedIndex].value;}
else
{quant=q.value;}
price=document.getElementById('price_'+items[i]);price.value=(unit*quant).toFixed(2);subtotal=subtotal+(unit*quant);}
subtotal=subtotal.toFixed(2);vat=(subtotal*0.15).toFixed(2);total=(parseFloat(subtotal)+parseFloat(vat)).toFixed(2);document.getElementById('subtotal').value=subtotal;document.getElementById('vat').value=vat;document.getElementById('total').value=total;hostingQuoteCheckDeps();}
function hostingQuoteCheckDeps()
{var changes=false;var e_quant_ips=document.getElementById('quant_ips');var e_quant_ssl=document.getElementById('quant_ssl');var e_quant_mb=document.getElementById('quant_mb');var e_quant_db=document.getElementById('quant_db');var e_quant_backup_wfs=document.getElementById('quant_backup_wfs');var e_quant_backup_wdb=document.getElementById('quant_backup_wdb');var e_quant_backup_dfs=document.getElementById('quant_backup_dfs');var e_quant_backup_ddb=document.getElementById('quant_backup_ddb');var quant_ips=e_quant_ips.options[e_quant_ips.selectedIndex].value;var quant_ssl=e_quant_ssl.options[e_quant_ssl.selectedIndex].value;var quant_mb=e_quant_mb.options[e_quant_mb.selectedIndex].value;var quant_db=e_quant_db.options[e_quant_db.selectedIndex].value;var quant_backup_wfs=e_quant_backup_wfs.options[e_quant_backup_wfs.selectedIndex].value;var quant_backup_wdb=e_quant_backup_wdb.options[e_quant_backup_wdb.selectedIndex].value;var quant_backup_dfs=e_quant_backup_dfs.options[e_quant_backup_dfs.selectedIndex].value;var quant_backup_ddb=e_quant_backup_ddb.options[e_quant_backup_ddb.selectedIndex].value;if(quant_ssl>quant_ips)
{alert('You must have a dedicated IP address for each SSL instance\n\nThe quantity of IP addresses has been updated');e_quant_ips.selectedIndex=quant_ssl;changes=true;}
if(quant_backup_wfs>quant_mb)
{alert('You can\'t backup more than the total disk space of the account.\nReducing backup provision to match selected disk space.');e_quant_backup_wfs.selectedIndex=quant_mb;changes=true;}
if(quant_backup_dfs>quant_mb)
{alert('You can\'t backup more than the total disk space of the account.\nReducing backup provision to match selected disk space.');e_quant_backup_dfs.selectedIndex=quant_mb;changes=true;}
if(quant_backup_wdb>quant_db)
{alert('You can\'t backup more than the total number of databases.\nReducing backup provision to match selected number of databases.');e_quant_backup_wdb.selectedIndex=quant_db;changes=true;}
if(quant_backup_ddb>quant_db)
{alert('You can\'t backup more than the total number of databases.\nReducing backup provision to match selected number of databases.');e_quant_backup_ddb.selectedIndex=quant_db;changes=true;}
if(quant_backup_wfs>0&&quant_backup_dfs>0)
{alert('You can\'t choose both daily and weekly filesystem backups.\n');e_quant_backup_wfs.selectedIndex=0;e_quant_backup_dfs.selectedIndex=0;changes=true;}
if(quant_backup_wdb>0&&quant_backup_ddb>0)
{alert('You can\'t choose both daily and weekly database backups.\n');e_quant_backup_wdb.selectedIndex=0;e_quant_backup_ddb.selectedIndex=0;changes=true;}
if(changes)hostingQuoteUpdate();}
function hostingQuoteValidate(f)
{if(f.domain.value=='')
{alert('Please enter the domain name of the site to be hosted');f.domain.focus();return false;}
if(f.name.value=='')
{alert('Please enter your name');f.name.focus();return false;}
if(f.email.value=='')
{alert('Please enter your email address');f.email.focus();return false;}}
validateContactForm=function()
{f=document.forms.contact;if(f.contact_name.value=='')
{alert("Please enter your name");f.contact_name.focus();Fat.fade_element("contact_name",30,3000,'#112d54');return false;}
if(f.contact_email.value=='')
{alert("Please enter your email address");f.contact_email.focus();Fat.fade_element("contact_email",30,3000,'#112d54');return false;}
if(f.contact_msg.value=='')
{alert("Please enter a message");f.contact_msg.focus();Fat.fade_element("contact_msg",30,3000,'#112d54');return false;}
return true;}
if(document.forms.contact)document.forms.contact.onsubmit=validateContactForm;if(document.getElementById('hosting_quote'))
{window.onload=hostingQuoteUpdate;document.getElementById('quant_ips').onchange=hostingQuoteUpdate;document.getElementById('quant_ssl').onchange=hostingQuoteUpdate;document.getElementById('quant_bw').onchange=hostingQuoteUpdate;document.getElementById('quant_mb').onchange=hostingQuoteUpdate;document.getElementById('quant_db').onchange=hostingQuoteUpdate;document.getElementById('quant_backup_wfs').onchange=hostingQuoteUpdate;document.getElementById('quant_backup_wdb').onchange=hostingQuoteUpdate;document.getElementById('quant_backup_dfs').onchange=hostingQuoteUpdate;document.getElementById('quant_backup_ddb').onchange=hostingQuoteUpdate;}