-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_restricted_offerSheet.php
1550 lines (1441 loc) · 80.7 KB
/
edit_restricted_offerSheet.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php include('Connections/settings.php'); ?>
<?php include("includes/sessionInfo.php") ?>
<?php include("includes/functions.php") ?>
<?php include("includes/langfile.php") ?>
<?php include("includes/langs.php") ?>
<?php include("includes/langs_stats.php") ?>
<?php
switch ($lang){
case 'en':
$l_OfferTitle = "Edit Offer Sheet";
$l_PlayerRatings = "Player Ratings";
$l_SalaryDistribution = "Salary Distribution";
$l_SalaryPerYear = "Salary Per Year";
$l_SendOffer = "Send Offer";
$l_Offer = "Offer Sheet";
$l_True = "True";
$l_False = "False";
$l_CONTRACTLENGTH = "Contract Length";
$l_NoPermission = "You don't have permission to negotiate a contract with this player!";
$l_rejectFinal = "This player has indicated he has no interest in signing a contract extension with your team.";
$l_rejectWait = "The agent asks that you take 24 hours to think over a new offer. So come back in 24 hours.";
$l_AgentBargain = "Bargain with agent";
$l_AskingPrice = "Asking price";
$l_ContractAccepted = "Contract accepted";
$l_years = "years";
$l_perSeason = "per season";
$l_NegStatus = "Negotiations status";
$l_Neg1 = "You have not made any offers.";
$l_Neg2 = "You have made ";
$l_Neg3 = " offer. ";
$l_Neg4 = "You can make up to ";
$l_Neg5 = "more offers. ";
$l_Neg6 = "Contract extension talks have broke off and the player wishes to test the free agency market.";
$l_OfferContract = "Contract extension";
$l_Signed = "Signed Extension";
$l_Odds1 = "<h4>You have a ";
$l_Odds2 = ", he will resign with your team. </h4><em style='padding-left:135px; font-size:11px'>The site will generate a random number between 1 and 100. If the number is between 1 and ";
$l_Odds3 = ", he will sign the contract.</em>";
$l_YouOdds = "Your Odds";
$l_OfferDeclined = "OFFER DECLINED";
$l_FinScore1 = "Your final score of";
$l_FinScore2 = "is greater than the odds of";
$l_FinScore3 = "% beat the odds of";
$l_OfferAccepted = "OFFER ACCEPTED";
$l_Bonus = "Signing Bonus";
$l_SalaryCap = "Salary Cap";
$l_NextSeason = "Current Payroll";
$l_AvailableFunds = "Available Funds For Payroll";
$l_CurrentSalary = "Requested Contract";
$ContractDetails = "Contract Details";
$ContractOptions = "Contract Options";
$AgentAskingPrice = "of agents asking price";
$AgentFeedback = "Agent Feedback";
$clientMoraleLow = "My client is unhappy with the team right now.";
$clientMoraleHight = "My client is extremely happy with the team. right now.";
$clientMoraleMed = "My client is currently happy with his status with the team.";
$clientConcerned = "%item1 is concerned about his ice time with his position with the franchise next season.";
$ufaElegable = "This contract offer will extend past my client's UFA eligablity.";
$ExpectedSalary = "My client is expecting to make <strong>at least $%item1</strong>.";
$ExtensionAttemptsText = "You have made <strong>%item1 contract extension offer(s)</strong>. You have up to <strong>%item2 more</strong> opportunities remaining.";
$AlreadySigned = "You have already signed this player to a contract extension.";
$AlreadySentOffer = "You have already made a contract extension offer today. Please wait 24 hours before making another offer.";
$l_NoneTxt = "None";
$l_Even = "Even";
$l_FrontLoad = "Front-Load";
$l_IncludeText = "Include";
$NoRightsToPlayer = "You don't have negotiation rights witht his player. You can not make any contract extension offers.";
$l_SigningBonus = "Signing Bonus";
$l_SigningBonusDetails = "10% of Contract";
$SummaryText1 = 'The player feels that his market value would at least warrant a <strong><span class="YearTxt1">%item1</span>-year</strong> contract worth a total of <strong>$<span class="TotalSalaryTxt">%item2</span></strong>, which equals <strong>$<span class="YearlySalaryTxt">%item3</span></strong> per season.';
$SummaryText2 = 'You are offering <strong>%item1-year</strong> old %item2 the following contract: The contract runs over <strong><span class="YearTxt">1</span></strong> guaranteed years. The total guaranteed value of the contract is <strong>$<span class="YourTotalSalaryTxt">%item3</span></strong>, which equals an average value of <strong>$<span class="YourYearlySalaryTxt">%item4</span></strong> per season.';
$SummaryText3 = 'Included in this contract is a <strong>$<span class="BonusTxt">0</span></strong> signing bonus that will count against the salary cap.';
$SummaryText4 = 'You have <strong>$<span class="RemainingCap">%item1</span></strong> left for player contracts this season. You have <strong>$<span class="RemainingCap">%item2</span></strong> currently sent out it offers.<br><br>You have <strong>$<span class="RemainingCap">%item3</span></strong> remaining. The owner has given approval of this deal, so you may submit the offer to the player.';
$SummaryText5 = 'You have <strong>$<span class="RemainingCap">%item1</span></strong> left for player contracts this season. You have <strong>$<span class="RemainingCap">%item2</span></strong> currently sent out it offers.<br><br>You have <strong>$<span class="RemainingCap">%item3</span></strong> remaining.The owner will not approve this deal until you free up some salary cap. room.';
$l_resignOdds = "RESIGNING ODDS";
$l_sendOffer = "Send Offer";
$l_totalContract = "Total Contract";
$l_summary = "SUMMARY";
$l_NoTradeCopy = "In addition, you are giving him a <strong>no trade</strong> clause with his contract.";
$AverageSalaryHigh = "<span style=\"color:green\">Your current offer sheet is <strong>higher</strong> than what the average offer sheet that we have recieved from other general managers.</span>";
$AverageSalaryLow = "<span style=\"color:red\">Your current offer sheet is <strong>lower</strong> than what the average offer sheet that we have recieved from other general managers.</span>";
$AverageSalaryAvg = "Your current offer sheet is <strong>about the same</strong> as the average offer sheet that we have recieved from other general managers.";
$l_comp1 = "None";
$l_comp2 = "Third-round choice";
$l_comp3 = "Second-round choice";
$l_comp4 = "First-round and third-round choice";
$l_comp5 = "First-round, second-round and third-round choice";
$l_comp6 = "Two first-round choices, one second and one third round choices";
$l_comp7 = "Four 1st round picks";
$l_CompNote = "The team offering the compensation must have their picks available prior for the deal to go through. The team owning the players rights will have up to 7 days to match the offer or they can choose to receive the compensation.";
$l_CompNote2 = "If your team does not have the compensation prior to this offer, then the offer will become void.";
$l_NewSalary = "New Salary (Per Season)";
$l_Compensation = '<strong><span class="CompensationTxt"></span></strong> will be sent as compensation.';
$l_CurrentOffers = "Current Offers";
break;
case 'fr':
$l_OfferTitle = "Éditez l'offre";
$l_PlayerRatings = "Stat de joueur";
$l_SalaryDistribution = "Distribution de salaire";
$l_SalaryPerYear = "Salaire par an";
$l_SendOffer = "Envoyez l'offre";
$l_Offer = "Offre";
$l_True = "Vrai";
$l_False = "Faux";
$l_CONTRACTLENGTH = "Longueur de contrat";
$l_NoPermission = "Vous n'avez pas la permission d'être en pourparlers un contrat avec ce joueur!";
$l_rejectFinal = "Ce joueur a indiqué qu'il n'a aucun intérêt en signant une extension de contrat avec votre équipe.";
$l_rejectWait = "L'agent demande que vous prenez 24 heures pour penser au-dessus d'une nouvelle offre. Ainsi revenu en 24 heures.";
$l_AgentBargain= "Negocier avec l'agent";
$l_AskingPrice = "Prix demandé";
$l_ContractAccepted = "Le contrat acceptent";
$l_years = "années";
$l_perSeason = "par saison";
$l_NegStatus = "Statut de négociations";
$l_Neg1 = "Vous n'avez fait aucune proposition.";
$l_Neg2 = "Vous avez fait ";
$l_Neg3 = " offre. ";
$l_Neg4 = "Vous pouvez composer à ";
$l_Neg5 = "plus offre. ";
$l_Neg6 = "L'extension de contrat que les entretiens ont a interrompu et le joueur souhaite examiner le marché d'agence libre.";
$l_OfferContract = "Extension de contrat";
$l_Signed = "Extension de signée";
$l_Odds1 = "<h4>Vous avez ";
$l_Odds2 = ", il démissionnera avec votre équipe. </h4><em style='padding-left:135px; font-size:11px'>L'emplacement produira d'un à nombre aléatoire entre 1 et 100. Si le nombre est entre 1 et";
$l_Odds3 = ", il signée avec votre équipe.</em>";
$l_YouOdds = "Votre chance";
$l_OfferDeclined = "L'OFFRE A REJETà";
$l_FinScore1 = "Vos points finaux de";
$l_FinScore2 = "est plus grande que la chance de";
$l_FinScore3 = "% gagnez la chance de";
$l_OfferAccepted = "L'OFFRE A ACCEPTà";
$l_Bonus = "Bonification de contrat";
$l_SalaryCap = "Limite de salaire";
$l_NextSeason = "Les saisons suivantes ont projeté le livre de paie";
$l_AvailableFunds = "Fonds disponibles pour le livre de paie";
$l_CurrentSalary = "Contrat demandé";
$ContractDetails = "Détails de contrat";
$ContractOptions = "Options de contrat";
$AgentAskingPrice = "du prix demandé d'agents";
$AgentFeedback = "Rétroaction d'agent";
$clientMoraleLow = "Mon client est peu satisfait de l'équipe en ce moment.";
$clientMoraleHight = "Mon client est extrêmement heureux avec l'équipe. en ce moment.";
$clientMoraleMed = "Mon client est actuellement heureux avec son statut avec l'équipe.";
$clientConcerned = "%item1 est préoccupé par son temps de glace par sa position par la concession la saison prochaine.";
$ufaElegable = "Cette offre de contrat se prolongera après mon client' ; eligablity de UFA.";
$ExpectedSalary = "Mon client compte faire au moins $%item1.";
$ExtensionAttemptsText = "Vous avez déjà fait les propositions <strong>%item1</strong>. Vous avez <strong>%item2</strong> plus de rester d'occasions.";
$AlreadySigned = "Vous avez déjà signé ce joueur à une extension de contrat.";
$AlreadySentOffer = "Vous avez déjà fait une extension de contrat offrir aujourd'hui. Veuillez attendre 24 heures avant de faire une autre proposition.";
$l_NoneTxt = "Aucun";
$l_Even = "Even";
$l_FrontLoad = "Avant-Charge";
$l_IncludeText = "Incluez";
$NoRightsToPlayer = "Vous n'avez pas des droits de négociation avec son joueur. Vous ne pouvez faire aucune propositions d'extension de contrat.";
$l_SigningBonus = "Bonification de signature";
$l_SigningBonusDetails = "10% du contrat";
$SummaryText1 = 'Le joueur estime que sa valeur marchande justifierait au moins a <strong><span class="YearTxt1">%item1</span>- année</strong> contrat en valeur l un total de <strong>$<span class="TotalSalaryTxt">%item2</span></strong>, qui égale<strong>$<span class="YearlySalaryTxt">%item3</span></strong> par saison.';
$SummaryText2 = 'Vous offrez <strong>%item1-year</strong> vieux %item2 le contrat suivant : Le contrat fonctionne plus de <strong><span class="YearTxt">1</span></strong> années garanties. Toute la valeur garantie du contrat est <strong>$<span class="YourTotalSalaryTxt">%item3</span></strong>, de ce qu\'égale une valeur <strong>$<span class="YourYearlySalaryTxt">%item4</span></strong> par saison.';
$SummaryText3 = 'Inclus dans ce contrat est a <strong>$<span class="BonusTxt">0</span></strong> bonification de signature qui comptera contre la limite de salaire.';
$SummaryText4 = 'Vous avez <strong>$<span class="RemainingCap">%item1</span></strong> la gauche pour le joueur contracte la saison prochaine. You have <strong>$<span class="RemainingCap">%item2</span></strong> currently sent out it offers.<br><br>You have <strong>$<span class="RemainingCap">%item3</span></strong> remaining. <span style="color:green;">Le propriétaire a donné l\'approbation de cette affaire, ainsi vous pouvez soumettre l\'offre au joueur.</span>';
$SummaryText5 = 'Vous avez <strong>$<span class="RemainingCap">%item1</span></strong> la gauche pour le joueur contracte la saison prochaine. You have <strong>$<span class="RemainingCap">%item2</span></strong> currently sent out it offers.<br><br>You have <strong>$<span class="RemainingCap">%item3</span></strong> remaining. Le propriétaire n\'approuvera pas cette affaire jusqu\'à ce que vous libériez vers le haut une certaine pièce de limite de salaire.';
$l_resignOdds = "Chance de prolongation";
$l_sendOffer = "Envoyez l'offre";
$l_totalContract = "Contrat total";
$l_summary = "Résumé";
$l_NoTradeCopy = "En outre, vous lui avez donné une <strong>clause du commerce de non</strong> avec son contrat.";
$AverageSalaryHigh = "<span style=\"color:green\">Your current offer sheet is <strong>higher</strong> than what the average offer sheet that we have recieved from other general managers.</span>";
$AverageSalaryLow = "<span style=\"color:red\">Your current offer sheet is <strong>lower</strong> than what the average offer sheet that we have recieved from other general managers.</span>";
$AverageSalaryAvg = "Your current offer sheet is <strong>about the same</strong> as the average offer sheet that we have recieved from other general managers.";
$l_comp1 = "Aucun";
$l_comp2 = "Choix Troisième rond";
$l_comp3 = "Choix secondaire";
$l_comp4 = "Premier round et choix troisième rond";
$l_comp5 = "Choix de premier rond, secondaire et troisième rond";
$l_comp6 = "Deux choix de premier round, une seconde et un tiers de choix ronds";
$l_comp7 = "Quatre premier sélections de rond";
$l_CompNote = "L'équipe offrant la compensation doit avoir leurs sélections disponibles antérieurement pour que l'affaire intervienne. L'équipe possédant les droits de joueurs aura jusqu'à 7 jours pour assortir l'offre ou ils peuvent choisir de recevoir la compensation.";
$l_CompNote2 = "Si votre équipe n'a pas la compensation avant cette offre, alors l'offre deviendra vide.";
$l_NewSalary = "Nouveau salaire (par saison)";
$l_Compensation = '<strong><span class="CompensationTxt"></span></strong> will be sent as compensation.';
$l_CurrentOffers = "Current Offers";
break;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_edit"])) && ($_POST["MM_edit"] == "form")) {
$tmpNoTradeSalary = 0;
if($_POST['notrade'] == 1){$tmpNoTradeSalary = $_POST['newsal'];}
$insertSQL = sprintf("UPDATE playerscontractoffers set Contract=%s,Salary1=%s,Salary2=%s,Salary3=%s,Salary4=%s,Salary5=%s,Salary6=%s,Salary7=%s,Salary8=%s,Salary9=%s,Salary10=%s, NoTrade=%s, Bonus=%s, NoTradeSalary=%s, ContractType=%s, Compensation=%s WHERE PR_ID=%s",
GetSQLValueString($_POST['contract'], "double"),
GetSQLValueString($_POST['YearSalary1'], "int"),
GetSQLValueString($_POST['YearSalary2'], "int"),
GetSQLValueString($_POST['YearSalary3'], "int"),
GetSQLValueString($_POST['YearSalary4'], "int"),
GetSQLValueString($_POST['YearSalary5'], "int"),
GetSQLValueString($_POST['YearSalary6'], "int"),
GetSQLValueString($_POST['YearSalary7'], "int"),
GetSQLValueString($_POST['YearSalary8'], "int"),
GetSQLValueString($_POST['YearSalary9'], "int"),
GetSQLValueString($_POST['YearSalary10'], "int"),
GetSQLValueString($_POST['notradefin'], "text"),
GetSQLValueString($_POST['bonusfin'], "int"),
GetSQLValueString($_POST['bargain'], "int"),
GetSQLValueString($_POST['distribute'], "int"),
GetSQLValueString($_POST['Compensation'], "text"),
GetSQLValueString($_POST['id'], "int"));
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$insertSQL = sprintf("INSERT INTO participation (DateCreated,Team,Season_ID,Type) values (%s,%s,%s,%s)",
GetSQLValueString(strftime('%Y-%m-%d', strtotime('now')), "date"),
GetSQLValueString($_SESSION['U_Team'], "text"),
GetSQLValueString($_SESSION['current_SeasonID'], "int"),
GetSQLValueString("Transactions", "text"));
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$updateGoTo = $_POST['location'];
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$PID_GetPlayer = "82";
if (isset($_GET['player'])) {
$PID_GetPlayer = (get_magic_quotes_gpc()) ? $_GET['player'] : addslashes($_GET['player']);
}
$GetType = "player";
if (isset($_GET['type'])) {
$GetType = (get_magic_quotes_gpc()) ? $_GET['type'] : addslashes($_GET['type']);
}
$GetTarget = "1";
if (isset($_GET['target'])) {
$GetTarget = (get_magic_quotes_gpc()) ? $_GET['target'] : addslashes($_GET['target']);
}
if($GetTarget == 1){
$tmpLocation = "rfa-free-agents_w_offer.php";
} else if($GetTarget == 2){
$tmpLocation = "rfa-free-agents_decide.php";
}
$Contract_ID = "0";
if (isset($_GET['id'])) {
$Contract_ID = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
$Contract_Step = "0";
if (isset($_GET['contract'])) {
$Contract_Step = (get_magic_quotes_gpc()) ? $_GET['contract'] : addslashes($_GET['contract']);
}
$query_GetWebInfo = sprintf("SELECT * FROM config");
$GetWebInfo = mysql_query($query_GetWebInfo, $connection) or die(mysql_error());
$row_GetWebInfo = mysql_fetch_assoc($GetWebInfo);
$SalaryCap=$row_GetWebInfo['SalaryCap'];
$MinimumPlayerSalary=$row_GetWebInfo['MinimumPlayerSalary'];
$MaximumPlayerSalary=$row_GetWebInfo['MaximumPlayerSalary'];
$TradeDeadlineDay=$row_GetWebInfo['TradeDeadlineDay'];
$PlayerAI=$row_GetWebInfo['PlayerAI'];
$UFA=$row_GetWebInfo['UFA'];
$AvgerageSalary=$row_GetWebInfo['AvgerageSalary'];
$WaiverSalaryExemption=$row_GetWebInfo['WaiverSalaryExemption'];
if ($GetType == 'goalie'){
$query_GetPlayer = sprintf("SELECT P.*, '5' as Position FROM goalies as P WHERE P.Number=%s", $PID_GetPlayer);
$GetPlayer = mysql_query($query_GetPlayer, $connection) or die(mysql_error());
$row_GetPlayer = mysql_fetch_assoc($GetPlayer);
$totalRows_GetPlayer = mysql_num_rows($GetPlayer);
$query_GetAvg = sprintf("SELECT AVG(Salary1) as Salary, AVG(SK) as SK, AVG(DU) as DU, AVG(EN) as EN, AVG(SZ) as SZ, AVG(AG) as AG, AVG(RB) as RB, AVG(SC) as SC, AVG(HS) as HS, AVG(RT) as RT, AVG(PC) as PC, AVG(PS) as PS, AVG(EX) as EX, AVG(LD) as LD, AVG(PO) as PO FROM goalies WHERE Retired=0 AND SK > 50 AND DU > 50 AND EN > 40 AND SZ > 50 AND AG > 50 AND RB > 50 AND SC > 50 AND PS AND LD > 50 AND EX > 50");
$GetAvg = mysql_query($query_GetAvg, $connection) or die(mysql_error());
$row_GetAvg = mysql_fetch_assoc($GetAvg);
$totalRows_GetAvg = mysql_num_rows($GetAvg);
$OverallRate = $row_GetPlayer['Overall'] - 10;
$SK_MOD=0.85;
$DU_MOD=1.10;
$EN_MOD=1.00;
$SZ_MOD=1.10;
$AG_MOD=0.85;
$RB_MOD=1.05;
$SC_MOD=0.90;
$HS_MOD=0.75;
$RT_MOD=0.85;
$PC_MOD=0.80;
$PS_MOD=0.75;
$EX_MOD=0.50;
$LD_MOD=0.50;
$BASE_MOD_1 = 1.15;
$BASE_MOD_2 = 1.1;
$BASE_MOD_3 = 1.05;
$BASE_MOD_4 = 1;
$INCREMENT=0.075;
if($row_GetPlayer['Salary1'] < $MinimumPlayerSalary) { $tmpSalary = $MinimumPlayerSalary; } else {$tmpSalary = $row_GetPlayer['Salary1']; }
$WEIGHTED_AVE_RATE = ((($row_GetAvg['SK'] * $SK_MOD) + ($row_GetAvg['DU'] * $DU_MOD) + ($row_GetAvg['EN'] * $EN_MOD) + ($row_GetAvg['SZ'] * $SZ_MOD) + ($row_GetAvg['AG'] * $AG_MOD) + ($row_GetAvg['RB'] * $RB_MOD) + ($row_GetAvg['SC'] * $SC_MOD) + ($row_GetAvg['HS'] * $HS_MOD) + ($row_GetAvg['RT'] * $RT_MOD) + ($row_GetAvg['PC'] * $PC_MOD) + ($row_GetAvg['PS'] * $PS_MOD) + ($row_GetAvg['EX'] * $EX_MOD) + ($row_GetAvg['LD'] * $LD_MOD)) / 13);
$PLAYER_AVE_RATE = ((($row_GetPlayer['SK'] * $SK_MOD) + ($row_GetPlayer['DU'] * $DU_MOD) + ($row_GetPlayer['EN'] * $EN_MOD) + ($row_GetPlayer['SZ'] * $SZ_MOD) + ($row_GetPlayer['AG'] * $AG_MOD) + ($row_GetPlayer['RB'] * $RB_MOD) + ($row_GetPlayer['SC'] * $SC_MOD) + ($row_GetPlayer['HS'] * $HS_MOD) + ($row_GetPlayer['RT'] * $RT_MOD) + ($row_GetPlayer['PC'] * $PC_MOD) + ($row_GetPlayer['PS'] * $PS_MOD) + ($row_GetPlayer['EX'] * $EX_MOD) + ($row_GetPlayer['LD'] * $LD_MOD)) / 13);
$FINAL_BASE_RATE = $PLAYER_AVE_RATE / $WEIGHTED_AVE_RATE;
if($row_GetPlayer['PO'] > 90){ $POTENTIAL_MOD = 1.25;
} else if($row_GetPlayer['PO'] >= 85 && $row_GetPlayer['PO'] < 90){ $POTENTIAL_MOD = 1.2;
} else if($row_GetPlayer['PO'] >= 80 && $row_GetPlayer['PO'] < 85){ $POTENTIAL_MOD = 1.15;
} else if($row_GetPlayer['PO'] >= 75 && $row_GetPlayer['PO'] < 80){ $POTENTIAL_MOD = 1.1;
} else if($row_GetPlayer['PO'] >= 70 && $row_GetPlayer['PO'] < 75){ $POTENTIAL_MOD = 1.075;
} else if($row_GetPlayer['PO'] >= 65 && $row_GetPlayer['PO'] < 70){ $POTENTIAL_MOD = 1.05;
} else if($row_GetPlayer['PO'] >= 60 && $row_GetPlayer['PO'] < 65){ $POTENTIAL_MOD = 1.025;
} else { $POTENTIAL_MOD = 1;}
if($FINAL_BASE_RATE < 0.9) { $FINAL_BASE_RATE = 0.9; }
$YEAR_1_MOD = abs(($BASE_MOD_1 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_2_MOD = abs(($BASE_MOD_2 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_3_MOD = abs(($BASE_MOD_3 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_4_MOD = abs(($BASE_MOD_4 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
if(abs($YEAR_1_MOD * $AvgerageSalary) < $MinimumPlayerSalary){
$tmpSalaryMod = $MinimumPlayerSalary;
} else {
$tmpSalaryMod = abs($YEAR_1_MOD * $AvgerageSalary);
}
if($tmpSalary > $tmpSalaryMod){
$BONUS = floor(($tmpSalary - $AvgerageSalary) * 0.2);
} else {
$BONUS = 0;
}
$YEAR_1_SALARY = round(floor(abs($YEAR_1_MOD * $AvgerageSalary) + ($BONUS * 1)),-3);
$YEAR_2_SALARY = round(floor(abs($YEAR_2_MOD * $AvgerageSalary) + ($BONUS * 0.95)),-3);
$YEAR_3_SALARY = round(floor(abs($YEAR_3_MOD * $AvgerageSalary) + ($BONUS * 0.9)),-3);
$YEAR_4_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.85)),-3);
$YEAR_5_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.8)),-3);
$YEAR_6_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.75)),-3);
$YEAR_7_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.7)),-3);
$YEAR_8_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.65)),-3);
$YEAR_9_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.6)),-3);
$YEAR_10_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.5)),-3);
$SalaryIncrement = 1 + ((($row_GetPlayer['PO'] * .25) + ($row_GetPlayer['Overall'] * .75))/100);
if ($YEAR_1_SALARY < $MinimumPlayerSalary) { $YEAR_1_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 1); }
if ($YEAR_2_SALARY < $MinimumPlayerSalary) { $YEAR_2_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.95); }
if ($YEAR_3_SALARY < $MinimumPlayerSalary) { $YEAR_3_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.90); }
if ($YEAR_4_SALARY < $MinimumPlayerSalary) { $YEAR_4_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.85); }
if ($YEAR_5_SALARY < $MinimumPlayerSalary) { $YEAR_5_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.8); }
if ($YEAR_6_SALARY < $MinimumPlayerSalary) { $YEAR_6_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.75); }
if ($YEAR_7_SALARY < $MinimumPlayerSalary) { $YEAR_7_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.7); }
if ($YEAR_8_SALARY < $MinimumPlayerSalary) { $YEAR_8_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.65); }
if ($YEAR_9_SALARY < $MinimumPlayerSalary) { $YEAR_9_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.6); }
if ($YEAR_10_SALARY < $MinimumPlayerSalary) { $YEAR_10_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.5); }
$TOTAL_SALARY = $YEAR_1_SALARY + $YEAR_2_SALARY + $YEAR_3_SALARY + $YEAR_4_SALARY + $YEAR_5_SALARY + $YEAR_6_SALARY + $YEAR_7_SALARY + $YEAR_8_SALARY + $YEAR_9_SALARY + $YEAR_10_SALARY;
}else{
$query_GetPlayer = sprintf("SELECT P.* FROM players as P WHERE P.Number=%s", $PID_GetPlayer);
$GetPlayer = mysql_query($query_GetPlayer, $connection) or die(mysql_error());
$row_GetPlayer = mysql_fetch_assoc($GetPlayer);
$totalRows_GetPlayer = mysql_num_rows($GetPlayer);
$query_GetAvg = sprintf("SELECT AVG(Salary1) as Salary, AVG(CK) as CK, AVG(FG) as FG, AVG(DI) as DI, AVG(SK) as SK, AVG(ST) as ST, AVG(EN) as EN, AVG(DU) as DU, AVG(PH) as PH, AVG(FO) as FO, AVG(PA) as PA, AVG(SC) as SC, AVG(DF) as DF, AVG(PS) as PS, AVG(EX) as EX, AVG(LD) as LD, AVG(PO) as PO FROM players WHERE Retired=0 AND CK > 50 AND FG > 50 AND DI > 40 AND SK > 50 AND ST > 50 AND EN > 50 AND DU > 50 AND PH > 50 AND FO > 50 AND PA > 50 AND SC > 50 AND DF > 50 AND PS > 50 AND LD > 50 AND EX > 50");
$GetAvg = mysql_query($query_GetAvg, $connection) or die(mysql_error());
$row_GetAvg = mysql_fetch_assoc($GetAvg);
$totalRows_GetAvg = mysql_num_rows($GetAvg);
$OverallRate = $row_GetPlayer['Overall'];
if($row_GetPlayer['Salary1'] < $MinimumPlayerSalary) { $tmpSalary = $MinimumPlayerSalary; } else {$tmpSalary = $row_GetPlayer['Salary1']; }
if ($row_GetPlayer['Position'] > 0 && $row_GetPlayer['Position'] < 4){
$CK_MOD=0.65;
$FG_MOD=0.50;
$DI_MOD=0.50;
$SK_MOD=0.50;
$ST_MOD=0.80;
$EN_MOD=0.80;
$DU_MOD=0.70;
$PH_MOD=0.80;
$FO_MOD=0.65;
$PA_MOD=1.10;
$SC_MOD=1.30;
$DF_MOD=1.10;
$PS_MOD=0.60;
$EX_MOD=0.50;
$LD_MOD=0.50;
} else {
$CK_MOD=0.90;
$FG_MOD=0.50;
$DI_MOD=0.60;
$SK_MOD=0.75;
$ST_MOD=0.80;
$EN_MOD=0.80;
$DU_MOD=1.10;
$PH_MOD=0.80;
$FO_MOD=0.20;
$PA_MOD=1.05;
$SC_MOD=1.00;
$DF_MOD=1.30;
$PS_MOD=0.20;
$EX_MOD=0.50;
$LD_MOD=0.50;
}
$BASE_MOD_1 = 1.15;
$BASE_MOD_2 = 1.1;
$BASE_MOD_3 = 1.05;
$BASE_MOD_4 = 1;
$INCREMENT=0.12;
$WEIGHTED_AVE_RATE = ((($row_GetAvg['CK'] * $CK_MOD) + ($row_GetAvg['FG'] * $FG_MOD) + ($row_GetAvg['DI'] * $DI_MOD) + ($row_GetAvg['SK'] * $SK_MOD) + ($row_GetAvg['ST'] * $ST_MOD) + ($row_GetAvg['EN'] * $EN_MOD) + ($row_GetAvg['DU'] * $DU_MOD) + ($row_GetAvg['PH'] * $PH_MOD) + ($row_GetAvg['FO'] * $FO_MOD) + ($row_GetAvg['PA'] * $PA_MOD) + ($row_GetAvg['SC'] * $SC_MOD) + ($row_GetAvg['DF'] * $DF_MOD) + ($row_GetAvg['PS'] * $PS_MOD) + ($row_GetAvg['EX'] * $EX_MOD) + ($row_GetAvg['LD'] * $LD_MOD)) / 15);
$PLAYER_AVE_RATE = ((($row_GetPlayer['CK'] * $CK_MOD) + ($row_GetPlayer['FG'] * $FG_MOD) + ($row_GetPlayer['DI'] * $DI_MOD) + ($row_GetPlayer['SK'] * $SK_MOD) + ($row_GetPlayer['ST'] * $ST_MOD) + ($row_GetPlayer['EN'] * $EN_MOD) + ($row_GetPlayer['DU'] * $DU_MOD) + ($row_GetPlayer['PH'] * $PH_MOD) + ($row_GetPlayer['FO'] * $FO_MOD) + ($row_GetPlayer['PA'] * $PA_MOD) + ($row_GetPlayer['SC'] * $SC_MOD) + ($row_GetPlayer['DF'] * $DF_MOD) + ($row_GetPlayer['PS'] * $PS_MOD) + ($row_GetPlayer['EX'] * $EX_MOD) + ($row_GetPlayer['LD'] * $LD_MOD)) / 15);
$FINAL_BASE_RATE = $PLAYER_AVE_RATE / $WEIGHTED_AVE_RATE;
if($row_GetPlayer['PO'] > 90){ $POTENTIAL_MOD = 1.25;
} else if($row_GetPlayer['PO'] >= 85 && $row_GetPlayer['PO'] < 90){ $POTENTIAL_MOD = 1.2;
} else if($row_GetPlayer['PO'] >= 80 && $row_GetPlayer['PO'] < 85){ $POTENTIAL_MOD = 1.15;
} else if($row_GetPlayer['PO'] >= 75 && $row_GetPlayer['PO'] < 80){ $POTENTIAL_MOD = 1.1;
} else if($row_GetPlayer['PO'] >= 70 && $row_GetPlayer['PO'] < 75){ $POTENTIAL_MOD = 1.075;
} else if($row_GetPlayer['PO'] >= 65 && $row_GetPlayer['PO'] < 70){ $POTENTIAL_MOD = 1.05;
} else if($row_GetPlayer['PO'] >= 60 && $row_GetPlayer['PO'] < 65){ $POTENTIAL_MOD = 1.025;
} else { $POTENTIAL_MOD = 1;}
if($FINAL_BASE_RATE < 0.9) { $FINAL_BASE_RATE = 0.9; }
$YEAR_1_MOD = abs(($BASE_MOD_1 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_2_MOD = abs(($BASE_MOD_2 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_3_MOD = abs(($BASE_MOD_3 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
$YEAR_4_MOD = abs(($BASE_MOD_4 + (($FINAL_BASE_RATE-1)*100)*$INCREMENT)*$POTENTIAL_MOD);
if(abs($YEAR_1_MOD * $AvgerageSalary) < $MinimumPlayerSalary){
$tmpSalaryMod = $MinimumPlayerSalary;
} else {
$tmpSalaryMod = abs($YEAR_1_MOD * $AvgerageSalary);
}
if($tmpSalary > $tmpSalaryMod){
$BONUS = floor(($tmpSalary - $AvgerageSalary) * 0.2);
} else {
$BONUS = 0;
}
$YEAR_1_SALARY = round(floor(abs($YEAR_1_MOD * $AvgerageSalary) + ($BONUS * 1)),-3);
$YEAR_2_SALARY = round(floor(abs($YEAR_2_MOD * $AvgerageSalary) + ($BONUS * 0.95)),-3);
$YEAR_3_SALARY = round(floor(abs($YEAR_3_MOD * $AvgerageSalary) + ($BONUS * 0.9)),-3);
$YEAR_4_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.85)),-3);
$YEAR_5_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.8)),-3);
$YEAR_6_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.75)),-3);
$YEAR_7_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.7)),-3);
$YEAR_8_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.65)),-3);
$YEAR_9_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.6)),-3);
$YEAR_10_SALARY = round(floor(abs($YEAR_4_MOD * $AvgerageSalary) + ($BONUS * 0.5)),-3);
$SalaryIncrement = 1 + ((($row_GetPlayer['PO'] * .25) + ($row_GetPlayer['Overall'] * .75))/100);
if ($YEAR_1_SALARY < $MinimumPlayerSalary) { $YEAR_1_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 1); }
if ($YEAR_2_SALARY < $MinimumPlayerSalary) { $YEAR_2_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.95); }
if ($YEAR_3_SALARY < $MinimumPlayerSalary) { $YEAR_3_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.90); }
if ($YEAR_4_SALARY < $MinimumPlayerSalary) { $YEAR_4_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.85); }
if ($YEAR_5_SALARY < $MinimumPlayerSalary) { $YEAR_5_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.8); }
if ($YEAR_6_SALARY < $MinimumPlayerSalary) { $YEAR_6_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.75); }
if ($YEAR_7_SALARY < $MinimumPlayerSalary) { $YEAR_7_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.7); }
if ($YEAR_8_SALARY < $MinimumPlayerSalary) { $YEAR_8_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.65); }
if ($YEAR_9_SALARY < $MinimumPlayerSalary) { $YEAR_9_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.6); }
if ($YEAR_10_SALARY < $MinimumPlayerSalary) { $YEAR_10_SALARY = $MinimumPlayerSalary * ($SalaryIncrement * 0.5); }
$TOTAL_SALARY = $YEAR_1_SALARY + $YEAR_2_SALARY + $YEAR_3_SALARY + $YEAR_4_SALARY + $YEAR_5_SALARY + $YEAR_6_SALARY + $YEAR_7_SALARY + $YEAR_8_SALARY + $YEAR_9_SALARY + $YEAR_10_SALARY;
}
$PlayerName=$row_GetPlayer['Name'];
$Position=$row_GetPlayer['Position'];
$currentSalary=$tmpSalary;
$CurrentPayroll = getTeamPayroll($_SESSION['U_ID'],1, $connection, $WaiverSalaryExemption);
$CurrentOffers = getTeamOffers($_SESSION['U_ID'],$connection, $WaiverSalaryExemption);
$PlayerPos = "Forward";
if ($GetType == 'goalie'){
$PlayerPos = "Goalie";
} else {
if ($row_GetPlayer['PosC'] == "True" || $row_GetPlayer['PosC'] == "Vrai" || $row_GetPlayer['PosLW'] == "True" || $row_GetPlayer['PosC'] == "Vrai" || $row_GetPlayer['PosRW'] == "True" || $row_GetPlayer['PosC'] == "Vrai"){
$PlayerPos = "Forward";
} else if ($row_GetPlayer['PosD'] == "True" || $row_GetPlayer['PosD'] == "Vrai"){
$PlayerPos = $l_Defence;
}
}
if($OverallRate > 70 && $row_GetPlayer['Age'] < 36 && $row_GetPlayer['Age'] >= $UFA){
$expectedYears = 4;
$expectedTotal = $YEAR_4_SALARY * 4;
$expectedSalary = $YEAR_4_SALARY;
} else if($OverallRate > 70 && $row_GetPlayer['Age'] > 39){
$expectedYears = 1;
$expectedTotal = $YEAR_1_SALARY;
$expectedSalary = $YEAR_1_SALARY;
} else if($OverallRate > 70 && $row_GetPlayer['Age'] > 35){
$expectedYears = 2;
$expectedTotal = $YEAR_2_SALARY * 2;
$expectedSalary = $YEAR_2_SALARY * 2;
} else if($OverallRate < 60){
$expectedYears = 1;
$expectedTotal = $YEAR_1_SALARY;
$expectedSalary = $YEAR_1_SALARY;
} else if($OverallRate > 70 && $row_GetPlayer['Age'] < $UFA){
$expectedYears = 4;
$expectedTotal = $YEAR_4_SALARY;
$expectedSalary = $YEAR_4_SALARY;
if($row_GetPlayer['Age'] + 4 >= $UFA){
$expectedYears = 3 - (($row_GetPlayer['Age']+4) - $UFA);
}
if($expectedYears == 1 || $expectedYears == 0){
$expectedYears = 1;
$expectedTotal = $YEAR_1_SALARY;
$expectedSalary = $YEAR_1_SALARY;
} else if($expectedYears == 2){
$expectedTotal = $YEAR_2_SALARY;
$expectedSalary = $YEAR_2_SALARY;
} else {
$expectedTotal = $YEAR_3_SALARY;
$expectedSalary = $YEAR_3_SALARY;
}
} else {
$expectedYears = 2;
$expectedTotal = $YEAR_2_SALARY * 2;
$expectedSalary = $YEAR_2_SALARY;
}
$GetContract = mysql_query("SELECT * FROM playerscontractoffers WHERE PR_ID=".$Contract_ID, $connection) or die(mysql_error());
$row_GetContract = mysql_fetch_assoc($GetContract);
$tmpTxtItems = array("%item1","%item2","%item3");
$updatedTxtItems = array(number_format($SalaryCap - $CurrentPayroll,0), number_format($CurrentOffers + $row_GetContract['Salary1'],0), number_format($SalaryCap - $CurrentPayroll - $CurrentOffers + $row_GetContract['Salary1'],0));
$SummaryText4 = str_replace($tmpTxtItems, $updatedTxtItems, $SummaryText4);
$tmpTxtItems = array("%item1","%item2","%item3");
$updatedTxtItems = array(number_format($SalaryCap - $CurrentPayroll,0), number_format($CurrentOffers + $row_GetContract['Salary1'],0), number_format($SalaryCap - $CurrentPayroll - $CurrentOffers + $row_GetContract['Salary1'],0));
$SummaryText5 = str_replace($tmpTxtItems, $updatedTxtItems, $SummaryText5);
$query_GetAvgSalary = sprintf("SELECT AVG(Salary1 + Salary2 + Salary3 + Salary4 + Salary5 + Salary6 + Salary7 + Salary8 + Salary9 + Salary10 + bonus) as Salary FROM playerscontractoffers WHERE Player='%s'", $row_GetPlayer['Number']);
$GetAvgSalary = mysql_query($query_GetAvgSalary, $connection) or die(mysql_error());
$row_GetAvgSalary = mysql_fetch_assoc($GetAvgSalary);
$totalRows_GetAvgSalary = mysql_num_rows($GetAvgSalary);
if($totalRows_GetAvgSalary == 0 || $row_GetAvgSalary['Salary'] == ""){
$GetAvgSalary = 0;
} else {
$GetAvgSalary = $row_GetAvgSalary['Salary'];
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><?php echo $l_OfferTitle; ?> - <?php echo $_SESSION['SiteName'] ; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/reset.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/html5.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/menu.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery.accessible-news-slider.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery-ui-1.8.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/header.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/tipsy.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/bubbletip.css" />
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jcarousellite_1.0.1c4.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/formly.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.pop.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.tipsy.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/ui.core.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-ui-1.8.custom.min.js"></script>
<!--[if lte IE 9]>
<script src="<?php echo $_SESSION['DomainName']; ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<script type="text/javascript">
$(function(){
var BASE_1_SALARY = <?php echo $YEAR_1_SALARY;?>;
var BASE_2_SALARY = <?php echo $YEAR_2_SALARY;?>;
var BASE_3_SALARY = <?php echo $YEAR_3_SALARY;?>;
var BASE_4_SALARY = <?php echo $YEAR_4_SALARY;?>;
var BASE_5_SALARY = <?php echo $YEAR_5_SALARY;?>;
var BASE_6_SALARY = <?php echo $YEAR_6_SALARY;?>;
var BASE_7_SALARY = <?php echo $YEAR_7_SALARY;?>;
var BASE_8_SALARY = <?php echo $YEAR_8_SALARY;?>;
var BASE_9_SALARY = <?php echo $YEAR_9_SALARY;?>;
var BASE_10_SALARY = <?php echo $YEAR_10_SALARY;?>;
var YEAR_1_SALARY = BASE_1_SALARY;
var YEAR_2_SALARY = BASE_1_SALARY;
var YEAR_3_SALARY = BASE_1_SALARY;
var YEAR_4_SALARY = BASE_1_SALARY;
var YEAR_5_SALARY = BASE_1_SALARY;
var YEAR_6_SALARY = BASE_1_SALARY;
var YEAR_7_SALARY = BASE_1_SALARY;
var YEAR_8_SALARY = BASE_1_SALARY;
var YEAR_9_SALARY = BASE_1_SALARY;
var YEAR_10_SALARY = BASE_1_SALARY;
var UFA = <?php echo $UFA;?>;
var AGE = <?php echo $row_GetPlayer['Age'];?>;
var MORALE = <?php echo $row_GetPlayer['MO'];?>;
var AVERAGEOFFER = <?php echo $GetAvgSalary;?>;
var currentDistribute = 0;
var currentNoTrade = 0;
var bargain = 1;
var salaryCapRemaining = <?php echo (($SalaryCap * 1.05) - $CurrentPayroll - $CurrentOffers + $row_GetContract['Salary1']); ?>;
var expectedTotal = <?php echo $expectedTotal;?>;
var MinimumPlayerSalary = <?php echo $MinimumPlayerSalary;?>;
$('#UFAText').hide();
$('#NoTrade').hide();
$('#ExpectedText').hide();
$('#BonusText').hide();
resetSalary();
updateOffer();
$('#bargain').change(function() {
resetSalary();
if(currentDistribute == 1){
distributeSalary();
} else {
updateOffer();
}
});
$('#yearsoff').change(function() {
resetSalary();
if(currentDistribute == 1){
distributeSalary();
} else {
updateOffer();
}
});
$("input[name=distribute]:radio").click(function() {
if($(this).val() == '1') {
distributeSalary();
currentDistribute = 1;
} else {
currentDistribute = 0;
resetSalary();
updateOffer();
}
});
$("input[name=notrade]:radio").click(function() {
resetSalary();
if(currentNoTrade == 1){
currentNoTrade = 0;
} else {
currentNoTrade = 1;
}
if(currentDistribute == 1){
distributeSalary();
}
updateOffer();
});
$('#bonus').change(function() {
resetSalary();
if(currentDistribute == 1){
distributeSalary();
} else {
updateOffer();
}
});
function resetSalary(){
if($('#yearsoff').val() == 1){
YEAR_1_SALARY = BASE_1_SALARY;
} else if($('#yearsoff').val() == 2){
YEAR_1_SALARY = BASE_2_SALARY;
YEAR_2_SALARY = BASE_2_SALARY;
} else if($('#yearsoff').val() == 3){
YEAR_1_SALARY = BASE_3_SALARY;
YEAR_2_SALARY = BASE_3_SALARY;
YEAR_3_SALARY = BASE_3_SALARY;
} else if($('#yearsoff').val() == 4){
YEAR_1_SALARY = BASE_4_SALARY;
YEAR_2_SALARY = BASE_4_SALARY;
YEAR_3_SALARY = BASE_4_SALARY;
YEAR_4_SALARY = BASE_4_SALARY;
} else if($('#yearsoff').val() == 5){
YEAR_1_SALARY = BASE_5_SALARY;
YEAR_2_SALARY = BASE_5_SALARY;
YEAR_3_SALARY = BASE_5_SALARY;
YEAR_4_SALARY = BASE_5_SALARY;
YEAR_5_SALARY = BASE_5_SALARY;
} else if($('#yearsoff').val() == 6){
YEAR_1_SALARY = BASE_6_SALARY;
YEAR_2_SALARY = BASE_6_SALARY;
YEAR_3_SALARY = BASE_6_SALARY;
YEAR_4_SALARY = BASE_6_SALARY;
YEAR_5_SALARY = BASE_6_SALARY;
YEAR_6_SALARY = BASE_6_SALARY;
} else if($('#yearsoff').val() == 7){
YEAR_1_SALARY = BASE_7_SALARY;
YEAR_2_SALARY = BASE_7_SALARY;
YEAR_3_SALARY = BASE_7_SALARY;
YEAR_4_SALARY = BASE_7_SALARY;
YEAR_5_SALARY = BASE_7_SALARY;
YEAR_6_SALARY = BASE_7_SALARY;
YEAR_7_SALARY = BASE_7_SALARY;
} else if($('#yearsoff').val() == 8){
YEAR_1_SALARY = BASE_8_SALARY;
YEAR_2_SALARY = BASE_8_SALARY;
YEAR_3_SALARY = BASE_8_SALARY;
YEAR_4_SALARY = BASE_8_SALARY;
YEAR_5_SALARY = BASE_8_SALARY;
YEAR_6_SALARY = BASE_8_SALARY;
YEAR_7_SALARY = BASE_8_SALARY;
YEAR_8_SALARY = BASE_8_SALARY;
} else if($('#yearsoff').val() == 9){
YEAR_1_SALARY = BASE_9_SALARY;
YEAR_2_SALARY = BASE_9_SALARY;
YEAR_3_SALARY = BASE_9_SALARY;
YEAR_4_SALARY = BASE_9_SALARY;
YEAR_5_SALARY = BASE_9_SALARY;
YEAR_6_SALARY = BASE_9_SALARY;
YEAR_7_SALARY = BASE_9_SALARY;
YEAR_8_SALARY = BASE_9_SALARY;
YEAR_9_SALARY = BASE_9_SALARY;
} else if($('#yearsoff').val() == 10){
YEAR_1_SALARY = BASE_10_SALARY;
YEAR_2_SALARY = BASE_10_SALARY;
YEAR_3_SALARY = BASE_10_SALARY;
YEAR_4_SALARY = BASE_10_SALARY;
YEAR_5_SALARY = BASE_10_SALARY;
YEAR_6_SALARY = BASE_10_SALARY;
YEAR_7_SALARY = BASE_10_SALARY;
YEAR_8_SALARY = BASE_10_SALARY;
YEAR_9_SALARY = BASE_10_SALARY;
YEAR_10_SALARY = BASE_10_SALARY;
}
if($('input[name=distribute]:radio:checked').val() == 1) {
distributeSalary();
currentDistribute = 1;
} else {
currentDistribute = 0;;
}
}
function distributeSalary(){
var $DIST_SALARY_1 = 0;
var $DIST_SALARY_2 = 0;
var $DIST_SALARY_3 = 0;
var $DIST_SALARY_4 = 0;
var $DIST_SALARY_5 = 0;
var $DIST_SALARY_6 = 0;
var $DIST_SALARY_7 = 0;
var $DIST_SALARY_8 = 0;
var $DIST_SALARY_9 = 0;
var $DIST_SALARY_10 = 0;
if($('#yearsoff').val() == 1){
$DIST_SALARY_1=YEAR_1_SALARY;
} else if($('#yearsoff').val() == 2){
$DIST_SALARY_1=(YEAR_2_SALARY * 1.1);
$DIST_SALARY_2=(YEAR_2_SALARY * 0.9);
} else if($('#yearsoff').val() == 3){
$DIST_SALARY_1=(YEAR_3_SALARY * 1.1);
$DIST_SALARY_2=(YEAR_3_SALARY * 1.0);
$DIST_SALARY_3=(YEAR_3_SALARY * 0.9);
} else if($('#yearsoff').val() == 4){
$DIST_SALARY_1=(YEAR_4_SALARY * 1.2);
$DIST_SALARY_2=(YEAR_4_SALARY * 1.1);
$DIST_SALARY_3=(YEAR_4_SALARY * 0.9);
$DIST_SALARY_4=(YEAR_4_SALARY * 0.8);
} else if($('#yearsoff').val() == 5){
$DIST_SALARY_1=(YEAR_5_SALARY * 1.2);
$DIST_SALARY_2=(YEAR_5_SALARY * 1.1);
$DIST_SALARY_3=(YEAR_5_SALARY * 1.0);
$DIST_SALARY_4=(YEAR_5_SALARY * 0.9);
$DIST_SALARY_5=(YEAR_5_SALARY * 0.8);
} else if($('#yearsoff').val() == 6){
$DIST_SALARY_1=(YEAR_6_SALARY * 1.3);
$DIST_SALARY_2=(YEAR_6_SALARY * 1.2);
$DIST_SALARY_3=(YEAR_6_SALARY * 1.1);
$DIST_SALARY_4=(YEAR_6_SALARY * 0.9);
$DIST_SALARY_5=(YEAR_6_SALARY * 0.8);
$DIST_SALARY_6=(YEAR_6_SALARY * 0.7);
} else if($('#yearsoff').val() == 7){
$DIST_SALARY_1=(YEAR_7_SALARY * 1.3);
$DIST_SALARY_2=(YEAR_7_SALARY * 1.2);
$DIST_SALARY_3=(YEAR_7_SALARY * 1.1);
$DIST_SALARY_4=(YEAR_7_SALARY * 1.0);
$DIST_SALARY_5=(YEAR_7_SALARY * 0.9);
$DIST_SALARY_6=(YEAR_7_SALARY * 0.8);
$DIST_SALARY_7=(YEAR_7_SALARY * 0.7);
} else if($('#yearsoff').val() == 8){
$DIST_SALARY_1=(YEAR_8_SALARY * 1.4);
$DIST_SALARY_2=(YEAR_8_SALARY * 1.3);
$DIST_SALARY_3=(YEAR_8_SALARY * 1.2);
$DIST_SALARY_4=(YEAR_8_SALARY * 1.1);
$DIST_SALARY_5=(YEAR_8_SALARY * 0.9);
$DIST_SALARY_6=(YEAR_8_SALARY * 0.8);
$DIST_SALARY_7=(YEAR_8_SALARY * 0.7);
$DIST_SALARY_7=(YEAR_8_SALARY * 0.6);
} else if($('#yearsoff').val() == 9){
$DIST_SALARY_1=(YEAR_9_SALARY * 1.4);
$DIST_SALARY_2=(YEAR_9_SALARY * 1.3);
$DIST_SALARY_3=(YEAR_9_SALARY * 1.2);
$DIST_SALARY_4=(YEAR_9_SALARY * 1.1);
$DIST_SALARY_5=(YEAR_9_SALARY * 1.0);
$DIST_SALARY_6=(YEAR_9_SALARY * 0.9);
$DIST_SALARY_7=(YEAR_9_SALARY * 0.8);
$DIST_SALARY_8=(YEAR_9_SALARY * 0.7);
$DIST_SALARY_9=(YEAR_9_SALARY * 0.6);
} else if($('#yearsoff').val() == 10){
$DIST_SALARY_1=(YEAR_10_SALARY * 1.5);
$DIST_SALARY_2=(YEAR_10_SALARY * 1.4);
$DIST_SALARY_3=(YEAR_10_SALARY * 1.3);
$DIST_SALARY_4=(YEAR_10_SALARY * 1.2);
$DIST_SALARY_5=(YEAR_10_SALARY * 1.1);
$DIST_SALARY_6=(YEAR_10_SALARY * 0.9);
$DIST_SALARY_7=(YEAR_10_SALARY * 0.8);
$DIST_SALARY_8=(YEAR_10_SALARY * 0.7);
$DIST_SALARY_9=(YEAR_10_SALARY * 0.6);
$DIST_SALARY_10=(YEAR_10_SALARY * 0.5);
}
YEAR_1_SALARY=Math.round($DIST_SALARY_1 / 1000) * 1000;
YEAR_2_SALARY=Math.round($DIST_SALARY_2 / 1000) * 1000;
YEAR_3_SALARY=Math.round($DIST_SALARY_3 / 1000) * 1000;
YEAR_4_SALARY=Math.round($DIST_SALARY_4 / 1000) * 1000;
YEAR_5_SALARY=Math.round($DIST_SALARY_5 / 1000) * 1000;
YEAR_6_SALARY=Math.round($DIST_SALARY_6 / 1000) * 1000;
YEAR_7_SALARY=Math.round($DIST_SALARY_7 / 1000) * 1000;
YEAR_8_SALARY=Math.round($DIST_SALARY_8 / 1000) * 1000;
YEAR_9_SALARY=Math.round($DIST_SALARY_9 / 1000) * 1000;
YEAR_10_SALARY=Math.round($DIST_SALARY_10 / 1000) * 1000;
updateOffer();
}
function updateOffer() {
var TOTAL_SALARY = <?php echo $YEAR_1_SALARY;?>;
var YEAR_1 = "<?php echo ($_SESSION['current_Season']+1)."-".substr($_SESSION['current_Season']+2, -2);?>";
var YEAR_2 = "<?php echo ($_SESSION['current_Season']+2)."-".substr($_SESSION['current_Season']+3, -2);?>";
var YEAR_3 = "<?php echo ($_SESSION['current_Season']+3)."-".substr($_SESSION['current_Season']+4, -2);?>";
var YEAR_4 = "<?php echo ($_SESSION['current_Season']+4)."-".substr($_SESSION['current_Season']+5, -2);?>";
var YEAR_5 = "<?php echo ($_SESSION['current_Season']+5)."-".substr($_SESSION['current_Season']+6, -2);?>";
var YEAR_6 = "<?php echo ($_SESSION['current_Season']+6)."-".substr($_SESSION['current_Season']+7, -2);?>";
var YEAR_7 = "<?php echo ($_SESSION['current_Season']+7)."-".substr($_SESSION['current_Season']+8, -2);?>";
var YEAR_8 = "<?php echo ($_SESSION['current_Season']+8)."-".substr($_SESSION['current_Season']+9, -2);?>";
var YEAR_9 = "<?php echo ($_SESSION['current_Season']+9)."-".substr($_SESSION['current_Season']+10, -2);?>";
var YEAR_10 = "<?php echo ($_SESSION['current_Season']+10)."-".substr($_SESSION['current_Season']+11, -2);?>";
var YEAR_1_SALARY_DEMAND = 0;
var YEAR_2_SALARY_DEMAND = 0;
var YEAR_3_SALARY_DEMAND = 0;
var YEAR_4_SALARY_DEMAND = 0;
var YEAR_5_SALARY_DEMAND = 0;
var YEAR_6_SALARY_DEMAND = 0;
var YEAR_7_SALARY_DEMAND = 0;
var YEAR_8_SALARY_DEMAND = 0;
var YEAR_9_SALARY_DEMAND = 0;
var YEAR_10_SALARY_DEMAND = 0;
if($('#bargain').val() == 6){
bargain = 1.0;
} else if($('#bargain').val() == 5){
bargain = 0.9;
} else if($('#bargain').val() == 4){
bargain = 0.8;
} else if($('#bargain').val() == 3){
bargain = 0.7;
} else if($('#bargain').val() == 2){
bargain = 0.6;
} else if($('#bargain').val() == 1){
bargain = 0.5;
} else if($('#bargain').val() == 7){
bargain = 1.1;
} else if($('#bargain').val() == 8){
bargain = 1.2;
} else if($('#bargain').val() == 9){
bargain = 1.3;
} else if($('#bargain').val() == 10){
bargain = 1.4;
} else if($('#bargain').val() == 11){
bargain = 1.5;
} else if($('#bargain').val() == 12){
bargain = 1.75;
} else if($('#bargain').val() == 13){
bargain = 2;
}
if($('#yearsoff').val() == 1){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = 0;
YEAR_3_SALARY_DEMAND = 0;
YEAR_4_SALARY_DEMAND = 0;
YEAR_5_SALARY_DEMAND = 0;
YEAR_6_SALARY_DEMAND = 0;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(1);
document.contract_form.contract.value=1;
} else if($('#yearsoff').val() == 2){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = 0;
YEAR_4_SALARY_DEMAND = 0;
YEAR_5_SALARY_DEMAND = 0;
YEAR_6_SALARY_DEMAND = 0;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(2);
document.contract_form.contract.value=2;
} else if($('#yearsoff').val() == 3){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = 0;
YEAR_5_SALARY_DEMAND = 0;
YEAR_6_SALARY_DEMAND = 0;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(3);
document.contract_form.contract.value=3;
} else if($('#yearsoff').val() == 4){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = Math.round(YEAR_4_SALARY * bargain / 1000) * 1000;
YEAR_5_SALARY_DEMAND = 0;
YEAR_6_SALARY_DEMAND = 0;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(4);
document.contract_form.contract.value=4;
} else if($('#yearsoff').val() == 5){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = Math.round(YEAR_4_SALARY * bargain / 1000) * 1000;
YEAR_5_SALARY_DEMAND = Math.round(YEAR_5_SALARY * bargain / 1000) * 1000;
YEAR_6_SALARY_DEMAND = 0;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(5);
document.contract_form.contract.value=5;
} else if($('#yearsoff').val() == 6){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = Math.round(YEAR_4_SALARY * bargain / 1000) * 1000;
YEAR_5_SALARY_DEMAND = Math.round(YEAR_5_SALARY * bargain / 1000) * 1000;
YEAR_6_SALARY_DEMAND = Math.round(YEAR_6_SALARY * bargain / 1000) * 1000;
YEAR_7_SALARY_DEMAND = 0;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(6);
document.contract_form.contract.value=6;
} else if($('#yearsoff').val() == 7){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = Math.round(YEAR_4_SALARY * bargain / 1000) * 1000;
YEAR_5_SALARY_DEMAND = Math.round(YEAR_5_SALARY * bargain / 1000) * 1000;
YEAR_6_SALARY_DEMAND = Math.round(YEAR_6_SALARY * bargain / 1000) * 1000;
YEAR_7_SALARY_DEMAND = Math.round(YEAR_7_SALARY * bargain / 1000) * 1000;
YEAR_8_SALARY_DEMAND = 0;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;
$(".YearTxt").html(7);
document.contract_form.contract.value=7;
} else if($('#yearsoff').val() == 8){
YEAR_1_SALARY_DEMAND = Math.round(YEAR_1_SALARY * bargain / 1000) * 1000;
YEAR_2_SALARY_DEMAND = Math.round(YEAR_2_SALARY * bargain / 1000) * 1000;
YEAR_3_SALARY_DEMAND = Math.round(YEAR_3_SALARY * bargain / 1000) * 1000;
YEAR_4_SALARY_DEMAND = Math.round(YEAR_4_SALARY * bargain / 1000) * 1000;
YEAR_5_SALARY_DEMAND = Math.round(YEAR_5_SALARY * bargain / 1000) * 1000;
YEAR_6_SALARY_DEMAND = Math.round(YEAR_6_SALARY * bargain / 1000) * 1000;
YEAR_7_SALARY_DEMAND = Math.round(YEAR_7_SALARY * bargain / 1000) * 1000;
YEAR_8_SALARY_DEMAND = Math.round(YEAR_8_SALARY * bargain / 1000) * 1000;
YEAR_9_SALARY_DEMAND = 0;
YEAR_10_SALARY_DEMAND = 0;