// definisanje promenljivih var cena_ram; var cena_chip; var cena_disk1; var cena_disk2; var cena_protok; var temp_server_price=0; var addon_write_final; var server_konfig; function SetField(fld,val) { document.getElementById(fld).value=val; } function ShowField(fld) { document.getElementById(fld).style.display = 'block'; } function HideField(fld) { document.getElementById(fld).style.display = 'none'; } function ChooseOS() { if (document.getElementById('os').value == 'linux') { document.getElementById('lin-verzija').style.display='inline'; document.getElementById('win-verzija').style.display='none'; document.getElementById('win-desc').style.display='none'; document.getElementById("control-panel").options[1].disabled = false; document.getElementById('windows-software').style.display='none'; } else { document.getElementById('lin-verzija').style.display='none'; document.getElementById('win-verzija').style.display='inline'; document.getElementById('win-desc').style.display='inline'; document.getElementById("control-panel").options[1].disabled = true; if (document.getElementById('control-panel').selectedIndex = 1) document.getElementById('control-panel').selectedIndex=0; document.getElementById('windows-software').style.display='inline'; } } function ChangeClassValue(className,newvalue){ var elemArray = document.getElementsByClassName(className); for(var i = 0; i < elemArray.length; i++){ document.getElementsByClassName(className)[i].className = className + ' ' + newvalue; } } function DisableRAM(val) { if (val>1) { document.getElementById("sel_ram").options[4].disabled = false; document.getElementById("sel_ram").options[5].disabled = false; // document.getElementById("sel_ram").options[6].disabled = false; } else { if (document.getElementById("sel_ram").value>4) { document.getElementById("sel_ram").value=4; // SetPartValues('ram_cena','ram_name','cena_ram','ram',4); } document.getElementById("sel_ram").options[4].disabled = true; document.getElementById("sel_ram").options[5].disabled = true; // document.getElementById("sel_ram").options[6].disabled = true; } } function scrollToAnchor(aid,num){ var aTag = $("a[name='"+ aid +"']"); $('html,body').animate({scrollTop: aTag.offset().top+num},'slow'); } function SelectPackage(n) { HideField('arrow'); td1='td1'+n; td2='td2'+n; td3='td3'+n; td4='td4'+n; td5='td5'+n; td6='td6'+n; td7='td7'+n; ChangeClassValue('tdbelo','bela-bela'); ChangeClassValue('tdsivo','siva-bela'); document.getElementById(td1).className='tdbelo naslov-orange'; document.getElementById(td2).className='tdsivo siva-orange'; document.getElementById(td3).className='tdbelo bela-orange'; document.getElementById(td4).className='tdsivo siva-orange'; document.getElementById(td5).className='tdbelo bela-orange'; document.getElementById(td6).className='tdsivo siva-orange'; document.getElementById(td7).className='tdbelo bela-orange'; SetField('konfig',n); if (n == "a") { SetField('chip',chip_name[1]); SetField('disk1',drive_name[1]); SetField('disk2',0); SetField('ram',ram_name[2]); SetField('protok','1 TB'); SetField('mes_cena','121'); SetField('num_cores',4); SetField('num_cpu',1); cena_chip=chip_price[1]; cena_ram=ram_price[2]; cena_disk1=drive_price[1]; cena_disk2=0; cena_protok=12; document.getElementById('server_spec').innerHTML="— CPU: Xeon E3 (4 jezgra)
— RAM: 8GB
— Disk: 2 x 500GB SATA
— Protok: 1TB"; } else if (n == "b") { SetField('chip',chip_name[2]); SetField('disk1',drive_name[2]); SetField('disk2',0); SetField('ram',ram_name[3]); SetField('protok','1 TB'); SetField('mes_cena','189'); SetField('num_cores',6); SetField('num_cpu',1); cena_chip=chip_price[2]; cena_ram=ram_price[3]; cena_disk1=drive_price[2]; cena_disk2=0; cena_protok=12; document.getElementById('server_spec').innerHTML="— CPU: Xeon E5 (6 jezgra)
— RAM: 16GB
— Disk: 2 x 1TB SATA
— Protok: 1TB"; } else if (n == "c") { SetField('chip',chip_name[3]); SetField('disk1',drive_name[2]); SetField('disk2',drive_name[2]); SetField('ram',ram_name[4]); SetField('protok','2 TB'); SetField('mes_cena','285'); SetField('num_cores',12); SetField('num_cpu',2); cena_chip=chip_price[3]; cena_ram=ram_price[4]; cena_disk1=drive_price[2]; cena_disk2=drive_price[2]; cena_protok=17; document.getElementById('server_spec').innerHTML="— CPU: 2 x Xeon E5 (12 jezgra)
— RAM: 32GB
— Disk: 4 x 1TB SATA
— Protok: 2TB"; } else { ram_temp=document.getElementById('sel_ram').value; chip_temp=document.getElementById('sel_processor').value; disk1_temp=document.getElementById('sel_disk1').value; disk2_temp=document.getElementById('sel_disk2').value; protok_temp=document.getElementById('sel_protok').value; disk_all_temp = drive_short[disk1_temp]; if (disk2_temp!=0) disk_all_temp=disk_all_temp+" + "+drive_short[disk2_temp]; document.getElementById('server_spec').innerHTML="— CPU: "+chip_short[chip_temp]+"
— RAM: "+ram_name[ram_temp]+"
— Disk: "+disk_all_temp+"
— Protok: "+protok_temp+"TB"; if (chip_temp == 1) { SetField('num_cores',4); SetField('num_cpu',1); } else if (chip_temp == 2) { SetField('num_cores',6); SetField('num_cpu',1); } else { SetField('num_cores',12); SetField('num_cpu',2); } cena_chip=chip_price[chip_temp]; cena_ram=ram_price[ram_temp]; cena_disk1=drive_price[disk1_temp]; if (disk2_temp!=0) { cena_disk2=drive_price[disk2_temp]; } else { cena_disk2=0; } cena_protok=protok_temp*5+7; SetField('chip',chip_name[chip_temp]); SetField('disk1',drive_name[disk1_temp]); if (disk2_temp!=0) { SetField('disk2',drive_name[disk2_temp]); } else { SetField('disk2',0); } SetField('ram',ram_name[ram_temp]); SetField('protok',protok_temp+' TB'); SetField('mes_cena',temp_server_price); } cena_ram=Math.round(cena_ram/7); cena_chip=Math.round(cena_chip/7); cena_disk1=Math.round(cena_disk1/7)*2; cena_disk2=Math.round(cena_disk2/7)*2; // cena_protok temp_server_price=Math.round(cena_ram+cena_chip+cena_disk1+cena_disk2)+cena_protok; SetField('mes_cena',temp_server_price); // document.getElementById("cena_mesec1").innerHTML=temp_server_price; document.getElementById("cena_mesec2").innerHTML=temp_server_price; ShowField('dodatne-usluge'); if (document.getElementById('disk2').value!=0) { document.getElementById("raid").options[2].disabled = false; document.getElementById("raid").options[3].disabled = false; } else { document.getElementById("raid").options[2].disabled = true; document.getElementById("raid").options[3].disabled = true; if (document.getElementById('raid').selectedIndex > 1) document.getElementById('raid').selectedIndex=1; } AddonStuff(); scrollToAnchor('dodatno',-5); } // example - SetPartValues(ram_cena,ram_name,cena_ram,ram,1); function SetPartValues() { konfig=document.getElementById('konfig').value; set_ram=document.getElementById('sel_ram').value; set_chip=document.getElementById('sel_processor').value; set_disk1=document.getElementById('sel_disk1').value; set_disk2=document.getElementById('sel_disk2').value; set_protok=document.getElementById('sel_protok').value; cena_ram=Math.round(ram_price[set_ram]/7); cena_chip=Math.round(chip_price[set_chip]/7); cena_disk1=Math.round(drive_price[set_disk1]/7)*2; if (set_disk2!=0) { cena_disk2=Math.round(drive_price[set_disk2]/7)*2; } else { cena_disk2=0; } cena_protok=set_protok*5+7; temp_server_priceD=Math.round(cena_ram+cena_chip+cena_disk1+cena_disk2)+cena_protok; // temp_server_price=Math.round((cena_ram+cena_chip+cena_disk1+cena_disk2)*0.9)+cena_protok; SetField('mes_cena',temp_server_price); document.getElementById("cena_mesec1").innerHTML=temp_server_priceD; if (konfig == "d") { temp_server_price=temp_server_priceD; document.getElementById("cena_mesec2").innerHTML=temp_server_price; if (document.getElementById('sel_disk2').value!=0) { document.getElementById("raid").options[2].disabled = false; document.getElementById("raid").options[3].disabled = false; } else { document.getElementById("raid").options[2].disabled = true; document.getElementById("raid").options[3].disabled = true; if (document.getElementById('raid').selectedIndex > 1) document.getElementById('raid').selectedIndex=1; } disk_all_temp = drive_short[set_disk1]; if (set_disk2!=0) disk_all_temp=disk_all_temp+" + "+drive_short[set_disk2]; document.getElementById('server_spec').innerHTML="— CPU: "+chip_short[set_chip]+"
— RAM: "+ram_name[set_ram]+"
— Disk: "+disk_all_temp+"
— Protok: "+set_protok+"TB"; AddonStuff(); } } // RAM ram_price=[]; ram_price[1] = 65; ram_price[2] = 105; ram_price[3] = 195; ram_price[4] = 395; ram_price[5] = 800; ram_price[6] = 1600; ram_price[7] = 3200; ram_name=[]; ram_name[1] = "4GB"; ram_name[2] = "8GB"; ram_name[3] = "16GB"; ram_name[4] = "32GB"; ram_name[5] = "64GB"; ram_name[6] = "128GB"; ram_name[7] = "256GB"; // Processori + barebone chip_price=[]; chip_price[1] = 590; // Xeon E3 (HSW-R 4Core+HT E3-1231V3 3.4G 8M 5GT/s DMI) + 512L-200B + 30 (300) chip_price[2] = 920; // Xeon E5 (Haswell 6C E5-2603V3 1.6G 15M 6.4GT/s QPI) + 1RU šasija 4xHotSwap drive bays chip_price[3] = 1160; // 2x Xeon E5 (Haswell 6C E5-2603V3 1.6G 15M 6.4GT/s QPI) + 1RU šasija 4xHotSwap drive bays chip_name=[]; chip_name[1] = "Xeon E3 4-core + 512L-200B"; chip_name[2] = "Xeon E5 6-core + 1RU 4xHotSwap drive bays"; chip_name[3] = "2 x Xeon E5 12-core + 1RU 4xHotSwap drive bays"; chip_short=[]; chip_short[1] = "Xeon E3 (4 jezgra)"; chip_short[2] = "Xeon E5 (6 jezgra)"; chip_short[3] = "2 x Xeon E5 (12 jezgra)"; // Diskovi (racuna se sve puta 2) drive_price=[]; drive_price[1] = 90; drive_price[2] = 130; drive_price[3] = 185; drive_price[4] = 285; drive_price[5] = 340; drive_price[6] = 640; drive_name=[]; drive_name[1] = "WD 3.5 500GB SATA 6Gb/s 7.2K RPM 64M RE4"; drive_name[2] = "Seagate 3.5 1TB SATA 6Gb/s 7.2K RPM 128M Megalodon"; drive_name[3] = "WD 3.5 2TB SAS 6Gb/s 7.2K RPM 32M"; drive_name[4] = "WD 3.5 4TB SAS 6Gb/s 7.2K RPM 32M"; drive_name[5] = "Intel DC S3500 300GB, SATA 6Gb/s, MLC 2.5 7.0mm, 20nm"; drive_name[6] = "Intel DC S3500 600GB, SATA 6Gb/s, MLC 2.5 7.0mm, 20nm"; drive_short=[]; drive_short[1] = "2 x 500GB SATA"; drive_short[2] = "2 x 1TB SATA"; drive_short[3] = "2 x 2TB SATA"; drive_short[4] = "2 x 4TB SATA"; drive_short[5] = "2 x 300GB SSD"; drive_short[6] = "2 x 600GB SSD"; // addons addon_panel_name=[]; addon_panel_name[1] = "cPanel"; addon_panel_name[2] = "Plesk Web Pro Edition"; addon_panel_name[3] = "Plesk Web Host Edition"; addon_panel_price=[]; addon_panel_price[1] = 50; addon_panel_price[2] = 18; addon_panel_price[3] = 40; addon_backup_name=[]; addon_backup_name[1] = "10 GB"; addon_backup_name[2] = "50 GB"; addon_backup_name[3] = "100 GB"; addon_backup_name[4] = "500 GB"; addon_backup_name[5] = "1 TB"; addon_backup_price=[]; addon_backup_price[1] = 3; addon_backup_price[2] = 9; addon_backup_price[3] = 18; addon_backup_price[4] = 70; addon_backup_price[5] = 120; addon_win_name=[]; addon_win_name[1] = "Windows Server Standard"; addon_win_name[2] = "Windows Server Essentials"; addon_win_name[3] = "Windows Server Datacenter"; addon_win_price=[]; addon_win_price[1] = 25; addon_win_price[2] = 25; addon_win_price[3] = 140; addon_sql_name=[]; addon_sql_name[1] = "SQL Server Express"; addon_sql_name[2] = "SQL Server Web Edition"; addon_sql_name[3] = "SQL Server Standard"; addon_sql_name[4] = "SQL Server Enterprise"; addon_sql_price=[]; addon_sql_price[1] = 0; addon_sql_price[2] = 15; addon_sql_price[3] = 140; addon_sql_price[4] = 520; var cena_os; var cena_ipadresa; var cena_backup; var cena_panel; var cena_sql; var cena_sal_rds; var cena_sal_officestd; var cena_sal_officepro; function AddonStuff() { addon_write=""; addon_price=""; num_cores=document.getElementById('num_cores').value; num_cpu=document.getElementById('num_cpu').value; raid=document.getElementById('raid').value; backup=document.getElementById('backup').value; ipaddress=document.getElementById('ipaddress').value; // os + software os=document.getElementById('os').value; lin_verzija=document.getElementById('lin-verzija').value; win_verzija=document.getElementById('win-verzija').value; control_panel=document.getElementById('control-panel').value; mssql=document.getElementById('mssql').value; // licence rds=document.getElementById('rds').value; office_standard=document.getElementById('office-standard').value; office_pro=document.getElementById('office-pro').value; addon_write=addon_write+"
— "+raid; addon_price=addon_price+"
0 EUR"; cena_ipadresa=(ipaddress-1)*2; addon_write=addon_write+"
— IP adrese ("+ipaddress+")"; addon_price=addon_price+"
"+cena_ipadresa+" EUR"; if (backup!=0) { cena_backup=addon_backup_price[backup]; addon_write=addon_write+"
— Backup ("+addon_backup_name[backup]+")"; addon_price=addon_price+"
"+addon_backup_price[backup]+" EUR"; } else { cena_backup=0; } if (os == "linux") { addon_write=addon_write+"
— Linux / FreeBSD"; if (lin_verzija != 0) addon_write=addon_write+" ("+lin_verzija+")"; addon_price=addon_price+"
0 EUR"; } if ((os == "windows") && (win_verzija!=0)) { cena_os=addon_win_price[win_verzija]*num_cpu; addon_write=addon_write+"
— "+addon_win_name[win_verzija]+" ("+num_cpu+" CPU)"; addon_price=addon_price+"
"+cena_os+" EUR"; } else { cena_os=0; } if ((os == "windows") && (mssql!=0)) { cena_sql=addon_sql_price[mssql]*(num_cores/2); addon_write=addon_write+"
— "+addon_sql_name[mssql]+" ("+num_cores+" cores)"; addon_price=addon_price+"
"+cena_sql+" EUR"; } else { cena_sql=0; } if (control_panel!=0) { cena_panel=addon_panel_price[control_panel]; addon_write=addon_write+"
— "+addon_panel_name[control_panel]; addon_price=addon_price+"
"+addon_panel_price[control_panel]+" EUR"; } else { cena_panel=0; } if (rds!=0) { cena_sal_rds=rds*7; addon_write=addon_write+"
— SAL: "+rds+" x Windows RDS"; addon_price=addon_price+"
"+cena_sal_rds+" EUR"; } else { cena_sal_rds=0; } if (office_standard!=0) { cena_sal_officestd=office_standard*7; addon_write=addon_write+"
— SAL: "+office_standard+" x Office Standard"; addon_price=addon_price+"
"+cena_sal_officestd+" EUR"; } else { cena_sal_officestd=0; } if (office_pro!=0) { cena_sal_officepro=office_pro*7; addon_write=addon_write+"
— SAL: "+office_pro+" x Office Pro"; addon_price=addon_price+"
"+cena_sal_officepro+" EUR"; } else { cena_sal_officepro=0; } document.getElementById('dodatne_name').innerHTML=addon_write; if (addon_price!="") { document.getElementById('dodatne_price').innerHTML=addon_price; } else { document.getElementById('dodatne_price').innerHTML="0 EUR"; } addon_write_final=addon_write; dodatna_cena_suma=cena_os+cena_ipadresa+cena_backup+cena_panel+cena_sql+cena_sal_rds+cena_sal_officestd+cena_sal_officepro; // alert(dodatna_cena_suma); // alert(temp_server_price); ukupno_cena_temp=temp_server_price+dodatna_cena_suma; // document.getElementById('ukupno_cena').innerHTML=ukupno_cena_temp; // porez_cena_temp=Math.round(ukupno_cena_temp*0.2,2); // document.getElementById('porez_cena').innerHTML=porez_cena_temp; porez_cena_temp=0; document.getElementById('suma_12').innerHTML=porez_cena_temp+ukupno_cena_temp; document.getElementById('suma_24').innerHTML=Math.round((porez_cena_temp+ukupno_cena_temp)*0.9); } function ToTheForm() { document.getElementById('orderformishere').style.display='block'; server_konfig=document.getElementById('server_spec').innerHTML; dodatne_usluge=document.getElementById('dodatne_name').innerHTML; server_konfig=server_konfig.replace(/
/gi, "\n"); dodatne_usluge=dodatne_usluge.replace(/
/gi, "\n"); hosting_forma.document.getElementById('element_9').value=server_konfig; hosting_forma.document.getElementById('element_10').value=dodatne_usluge; // hosting_forma.document.getElementById('element_11').value=document.getElementById('ukupno_cena').innerHTML+" EUR"; hosting_forma.document.getElementById('element_12').value=document.getElementById('suma_12').innerHTML+" EUR"; hosting_forma.document.getElementById('element_13').value=document.getElementById('suma_24').innerHTML+" EUR"; hosting_forma.document.getElementById('li_9').style.display='none'; hosting_forma.document.getElementById('li_10').style.display='none'; // hosting_forma.document.getElementById('li_11').style.display='none'; hosting_forma.document.getElementById('li_12').style.display='none'; hosting_forma.document.getElementById('li_13').style.display='none'; scrollToAnchor('izbor2',-1); }