The whole js code:
$(document).ready(function () {
var question = 0 ;
var prize = 0 ;
var Qrandomized = 0 ;
var Prandomized = 0 ;
var temp_prize = 0 ;
var answer = 0 ; // When Answer Is 1 The correct answer is no, 2 is yes
var yes_used = 0 ;
var no_used = 0 ;
var correct_incorrect = 0 ;
var finished = 0 ;
var email = 0 ;
$('#q31').hide() ;
$('.action-btn').hide();
/*
=================================================================================================
Bolds the current value of the state drop down (should be sd).
Then everytime the value changes it is also bolded.
=================================================================================================
*/
$('#q13 select').css('font-weight','bold');
$('#q13 select').css('color','black');
$('#q13 select').blur(function() {
$('#q13 select').css('font-weight','bold');
$('#q13 select').css('color','black');
});
/*
=================================================================================================
=================================================================================================
*/
/*
=================================================================================================
Bolds the current value of the country drop down (should be united states).
Then everytime the value changes it is also bolded.
=================================================================================================
*/
$('#q15 select').css('font-weight','bold');
$('#q15 select').css('color','black');
$('#q15 select').blur(function(){
$('#q15 select').css('font-weight','bold');
$('#q15 select').css('color','black');
});
/*
=================================================================================================
=================================================================================================
*/
/*
=================================================================================================
Bolds the current value of the age drop down (Should be blank).
Then everytime the value changes it is also bolded.
=================================================================================================
*/
$('#q24 select').css('font-weight','bold');
$('#q24 select').css('color','black');
$('#q24 select').blur(function(){
$('#q24 select').css('font-weight','bold');
$('#q24 select').css('color','black');
});
/*
=================================================================================================
=================================================================================================
*/
function insert_image( ) {
/*
Step 2
============================= Prizes ===============================
1 = Prize Is Available
0 = Prize Is Unavailable
====================================================================
*/
var back_scratcher = 1 ;
var coin_case = 1 ;
var contact_holder = 1 ;
var eraser = 1 ;
var koozie = 0 ;
var letter_opener = 0 ;
var lint_brush = 0 ;
var magnifying_card = 0 ;
var ruler = 0 ;
var screen_sweeper = 0 ;
var measuring_spoon = 0 ;
var mood_straws = 0 ;
// =====================================================================
/*
================================================================================================================================================================================================================================================================================================================================
Step 3
Prize Array
================================================================================================================================================================================================================================================================================================================================
*/
var prizes = new Array ( 12 ) ;
prizes [ 0 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Back Scratcher.jpg" height = 250px width = 250px title = "Your Prize Is A Back Scratcher" /><br><br<font size = "8" color = "black"><br>Back Scratcher</div></center>' ;
prizes [ 1 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Coin Case.jpg" height = 250px width = 250px title = "Your Prize Is A Coin Case" /><br><br<font size = "8" color = "black"><br>Coin Case</center>' ;
prizes [ 2 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Contact Holder.jpg" height = 250px width = 250px title = "Your Prize Is A Contact Lense Holder" /><br><br<font size = "8" color = "black"><br>Contact Holder</div></center>' ;
prizes [ 3 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Eraser.jpg" height = 250px width = 250px title = "Your Prize Is An Eraser" /><br><br<font size = "8" color = "black"><br>Eraser</div></center>' ;
prizes [ 4 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Koozie.jpg" height = 250px width = 250px title = "Your Prize Is A Koozie" /><br><br<font size = "8" color = "black"><br>Koozie</div></center>' ;
prizes [ 5 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Letter Opener.jpg" height = 250px width = 250px title = "Your Prize Is A Letter Opener" /><br><br<font size = "8" color = "black"><br>Letter Opener</div></center>' ;
prizes [ 6 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Lint Brush.jpg" height = 250px width = 250px title = "Your Prize Is A Lint Brush" /><br><br<font size = "8" color = "black"><br>Lint Brush</div></center>' ;
prizes [ 7 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Magnifying Card.jpg" height = 250px width = 250px title = "Your Prize Is A Magnifying Card" /><br><br<font size = "8" color = "black"><br>Magnifying Card</div></center>' ;
prizes [ 8 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Ruler.jpg" height = 250px width = 250px title = "Your Prize Is A Ruler" /><br><br<font size = "8" color = "black"><br>Ruler</div></center>' ;
prizes [ 9 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Screen Sweeper.jpg" height = 250px width = 250px title = "Your Prize Is A Screen Sweeper" /><br><br<font size = "8" color = "black"><br>Screen Sweeper</div></center>' ;
prizes [ 10 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Measuring Spoon.jpg" height = 250px width = 250px title = "Your Prize Is A Measuring Spoon" /><br><br<font size = "8" color = "black"><br>Measuring Spoon</div></center>' ;
prizes [ 11 ] = '<center><div id = "pic"><font size = "8" color = "black">Your Prize:<br><img src = "http://atpr1lftest/Forms/img/Fair Promo Pics/Mood Straws.jpg" height = 250px width = 250px title = "Your Prize Is A Mood Straw" /><br><br<font size = "8" color = "black"><br>Mood Straw</div></center>' ;
/*
===============================================================================================
Step 3
===============================================================================================
*/
if ( back_scratcher == 0 &&
coin_case == 0 &&
contact_holder == 0 &&
eraser == 0 &&
koozie == 0 &&
letter_opener == 0 &&
lint_brush == 0 &&
magnifying_card == 0 &&
ruler == 0 &&
screen_sweeper == 0 &&
measuring_spoon == 0 &&
mood_straws == 0
) {
$( '<br><center><font style = "font-size: 32px;">No Prizes Are Available</center><br><br>' ).insertAfter( '#q23' ) ;
}
/*
===============================================================================================
Step 3
===============================================================================================
*/
else {
if ( back_scratcher == 0 ) {
prizes[0] = "0" ;
}
if ( coin_case == 0 ) {
prizes[1] = "0" ;
}
if ( contact_holder == 0 ) {
prizes[2] = "0" ;
}
if ( eraser == 0 ) {
prizes[3] = "0" ;
}
if ( koozie == 0 ) {
prizes[4] = "0" ;
}
if ( letter_opener == 0 ) {
prizes[5] = "0" ;
}
if ( lint_brush == 0 ) {
prizes[6] = "0" ;
}
if ( magnifying_card == 0 ) {
prizes[7] = "0" ;
}
if ( ruler == 0 ) {
prizes[8] = "0" ;
}
if ( screen_sweeper == 0 ) {
prizes[9] = "0" ;
}
if ( measuring_spoon == 0 ) {
prizes[10] = "0" ;
}
if ( mood_straws == 0 ) {
prizes[11] = "0" ;
}
/*
===============================================================================================
Step 4
===============================================================================================
*/
temp_prize = Math.floor( ( Math.random( ) * 12 ) ) ;
while ( prizes [ temp_prize ] == "0" ) {
temp_prize = Math.floor( ( Math.random( ) * 12 ) ) ;
}
$('<br><br>'+prizes[ temp_prize ]+'<br><br>').insertAfter('#q30');
}
}
function get_question () {
var age = $('#Field24').val() ;
var Questions12 = new Array (5) ;
Questions12 [0] = 'After signing up for a contest to win a trip to an amusement park online, the website asks you for your name and address for a chance to win the prize trip. Should you submit your personal information online?' ;
Questions12 [1] = 'You are very angry at a friend. Should you text or e-mail a rude message to your friend telling them that you are angry? ' ;
Questions12 [2] = 'A website asks you to enter your phone number. Should you give the website your number?' ;
Questions12 [3] = 'A website asks you if you are 18 or older. If you answer YES, even though you are not 18, are your parents liable for any charges?' ;
Questions12 [4] = 'If there is an emergency and there is no adult around to help you, should you call 911 for help?' ;
var Answers12 = new Array (5) ;
Answers12 [0] = 'Never give out your personal information online. Always ask a parent first. The contest may be fake. You do not want unknown people online to have your personal information.' ;
Answers12 [1] = 'You should not send a rude message to your friend. The message can be misunderstood and just as hurtful as your friend was to you. Ask for help and find another way to work through the problem.' ;
Answers12 [2] = 'Do not give out your personal information to unknown people online. Websites do not have the right to ask kids for a phone number. Find an adult or parent and ask them when it is okay to give out this type of information.' ;
Answers12 [3] = 'If you are a minor (under 18), and lie about your age, your parents are liable for your online activity.' ;
Answers12 [4] = 'If there is an emergency, always dial 911 for help immediately. The police, ambulance, and other law enforcement will come to help.' ;
var Pictures12 = new Array (5) ;
Pictures12 [0] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/120.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures12 [1] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/121.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures12 [2] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/122.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures12 [3] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/123.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures12 [4] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/124.jpg" height = 250px width = 250px title = ""</div></center>' ;
var Questions13 = new Array (9) ;
Questions13 [0] = 'You are browsing the internet when a window pops up and tells you the website is secure. You notice there the website address does not start with “https” and there is no “lock” icon at the bottom of the broswer. Is the website secure?' ;
Questions13 [1] = 'Credit card companies often pursue college freshmen students to sign up for a credit card. Is it true that the average college freshmen student who owns a credit card has an average credit card debt of $1,200?' ;
Questions13 [2] = 'Are high school students considered to be an easy target by credit card companies?' ;
Questions13 [3] = 'If you post another’s personal information online without their permission, are you liable for posting their information online?' ;
Questions13 [4] = 'You meet an unknown person online. They are very friendly and would like to meet you in person. Should you meet person?' ;
Questions13 [5] = 'Does the average teenager send over 50 text messages per day?' ;
Questions13 [6] = 'If you delete personal information and personal pictures that you posted online, are the personal information and pictures really deleted from the internet?' ;
Questions13 [7] = 'If you buy an “AS IS” vehicle at a dealership and the next day the cars engine blows out, does the dealership have to give you your money back?' ;
Questions13 [8] = 'After downloading what you thought was “free” music from the internet to make a CD, you receive a threatening letter explaining that you owe up to thousands of dollars in royalty fees. Are you liable?' ;
var Answers13 = new Array (9) ;
Answers13 [0] = 'If the website address does not start with “https” and there is no “lock” icon at the bottom of the browser, close the web page immediately. A URL addresses starting with “https” (pay attention to the “s”) and the “lock” icon at the bottom of a browser confirms that you are on a secure website such as home banking. ' ;
Answers13 [1] = 'Credit cards are easy for young adults to sign up for and seam very appealing with great rates and rewards. Taking out multiple credit cards can result in late fees and very high accumulated interest debt owed to the credit company. This is known as a “credit hole”.' ;
Answers13 [2] = 'Credit card companies are luring young consumers by requiring them to pay only the minimum payment, usually around 2% of the balance. Even if students are carrying a large debt burden, they often to do perceive the 2% payment as problematic since it is not a significant portion of their income. Paying the minimum amount each month may take years to pay off and will result in much more interest paid to the credit card company in the long run.' ;
Answers13 [3] = 'You are liable sharing another’s personal information online. Under the Data Protection act, you can be prosecuted for posting another’s personal information online without their permission.' ;
Answers13 [4] = 'Never meet an unknown person online. If you are asked uncomfortable questions and are pushed to meet, report the person to your local police department at www.cybertipline.com.Before you decide to meet someone, do your research. Ask whether any of your friends know the person, and see what background you can dig up through online search engines. If you decide to meet someone from online, be smart about it. Meet in a public place, during the day, with friends you trust. Tell an adult or responsible sibling where you are going and when you expect to be back. Trust your cut if you have suspicions.' ;
Answers13 [5] = 'The average teenager does send at least 50 text messages per day, 5 times the typical adult (who, on average, text 10 times a day).' ;
Answers13 [6] = 'All information and pictures that you send to the internet may always be on the internet saved on web servers or personal computers permanently even if you think they are deleted.' ;
Answers13 [7] = 'The signage stated “AS IS” on the contract, which means the dealership is no longer responsible for the vehicle and does not have to refund you the purchase price. The South Dakota Lemon Law only applies to new vehicles.' ;
Answers13 [8] = 'Downloading “free” music from the internet is illegal. Music is copyrighted material and the music industry companies can and will come after you for royalty fees. Use a safe music website to listen and/or purchase music such as iTunes, Pandora, Spotify, etc.' ;
var Pictures13 = new Array (9) ;
Pictures13 [0] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/130.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [1] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/131.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [2] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/132.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [3] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/133.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [4] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/134.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [5] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/135.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [6] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/136.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [7] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/137.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures13 [8] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/138.jpg" height = 250px width = 250px title = ""</div></center>' ;
var Questions18 = new Array (9) ;
Questions18 [0] = 'Is it accurate that the average amount of time it takes to recover and “clean up” from a negative credit history may take up to 7 years. ' ;
Questions18 [1] = 'If you buy an “AS IS” vehicle at a dealership and the next day the cars enginge blows out, does the dealership have to give you your money back?' ;
Questions18 [2] = 'You purchased a new shirt at a retail store and a couple days later you decide to return the shirt with your receipt to get a refund. The retailer’s refund policy states that they do not refund for clothing purchases. Is the retailer obligated to return your money?' ;
Questions18 [3] = 'You just moved out of a place that you were renting and would like to receive the deposit you put down when the lease began. I was told the landlord has up to 4 weeks, or 30 days to return my deposit. Is this true?' ;
Questions18 [4] = 'Does the Lemon Law apply to new and used vehicles?' ;
Questions18 [5] = 'Does a debt collector have the right to contact you before 8AM or after 9PM without your consent?' ;
Questions18 [6] = 'In door-to-door sales, does the seller have to provide you a 3-Day Right to Cancel?' ;
Questions18 [7] = 'If you decide to purchase from a telemarketer, does the telemarketer have to provide a written confirmation with full terms of the purchase agreement?' ;
Questions18 [8] = 'Is there a limit on the interest rates that a payday/title loan company can charge?' ;
var Answers18 = new Array (9) ;
Answers18 [0] = 'The length of time it takes to “clean up” from a poor credit history largely depends on the damage done. A few late payments can result in a significant drop in credit score. Larger credit issues such as collection accounts, charge-offs, and bankruptcy can take much longer to recover from. Negative credit can stay on your report for up to 7 years and 10 year for bankruptcy.' ;
Answers18 [1] = 'The signage stated “AS IS” on the contract, which means the dealership is no longer responsible for the vehicle and does not have to refund you the purchase price. The South Dakota Lemon Law only applies to new vehicles.' ;
Answers18 [2] = 'Some retail stores allow returns, but no law requires a business to accept returned products. Check the business’s return/refund policy before making a purchase especially when purchasing electronic goods. The policy may be located on the receipt.' ;
Answers18 [3] = 'The landlord has up to two weeks to return the deposit, or provide you with a a written statement explaining why the deposit is being withheld.' ;
Answers18 [4] = 'The South Dakota Lemon Law applies to only NEW vehicles. For more information regarding the criteria that must be met in order for the vehicle to be deemed a LEMON, please contact Consumer Protection at 1-800-300-1986.' ;
Answers18 [5] = 'A third party debt collector can only contact you between 8AM and 9PM unless you agree otherwise. However, a creditor can call you at any time.' ;
Answers18 [6] = 'In South Dakota, door-to-door sellers must provide a 3-day right to cancel on the contract. The sellers must also provide a cancellation notice form.' ;
Answers18 [7] = 'Unless the telemarketer agrees to a “No Questions Asked Full Refund Policy”, they must provide a written confirmation with full terms of the purchase agreement.' ;
Answers18 [8] = 'South Dakota Usury Laws allow payday lenders to charge any interest rate or fees. In most cases, these rates/fees are extremely high, but are blinding once the contract is signed by the borrower.' ;
var Pictures18 = new Array (9) ;
Pictures18 [0] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/180.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [1] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/181.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [2] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/182.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [3] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/183.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [4] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/184.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [5] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/185.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [6] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/186.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [7] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/187.jpg" height = 250px width = 250px title = ""</div></center>' ;
Pictures18 [8] = '<center><div id = "pic2"><img src = "http://atpr1lftest/Forms/img/Fair Question Pics/188.jpg" height = 250px width = 250px title = ""</div></center>' ;
var question ;
if ( age == 12 ) {
question = Math.floor( ( Math.random( ) * 5 ) ) ;
if ( question == 0 ) {
answer = 1 ;
}
else if ( question == 1 ) {
answer = 1 ;
}
else if ( question == 2 ) {
answer = 1 ;
}
else if ( question == 3 ) {
answer = 2 ;
}
else if ( question == 4 ) {
answer = 2 ;
}
$('#q22 textarea').val(Questions12[question]);
$('#q22 textarea').attr('readonly','true');
$(Pictures12 [ question ] ).insertAfter('#q22');
$('#q30 textarea').val(Answers12[question]);
$('#q30 textarea').attr('readonly','true');
}
else if ( age == 13 ) {
question = Math.floor( ( Math.random( ) * 9 ) ) ;
if ( question == 0 ) {
answer = 1 ;
}
else if ( question == 1 ) {
answer = 2 ;
}
else if ( question == 2 ) {
answer = 2 ;
}
else if ( question == 3 ) {
answer = 2 ;
}
else if ( question == 4 ) {
answer = 1 ;
}
else if ( question == 5 ) {
answer = 2 ;
}
else if ( question == 6 ) {
answer = 1 ;
}
else if ( question == 7 ) {
answer = 1 ;
}
else if ( question == 8 ) {
answer = 2 ;
}
$('#q22 textarea').val(Questions13[question]);
$('#q22 textarea').attr('readonly','true');
$(Pictures13 [ question ] ).insertAfter('#q22');
$('#q30 textarea').val(Answers13[question]);
$('#q30 textarea').attr('readonly','true');
}
else if ( age == 18 ) {
question = Math.floor( ( Math.random( ) * 9 ) ) ;
if ( question == 0 ) {
answer = 2 ;
}
else if ( question == 1 ) {
answer = 1 ;
}
else if ( question == 2 ) {
answer = 1 ;
}
else if ( question == 3 ) {
answer = 1 ;
}
else if ( question == 4 ) {
answer = 1 ;
}
else if ( question == 5 ) {
answer = 1 ;
}
else if ( question == 6 ) {
answer = 2 ;
}
else if ( question == 7 ) {
answer = 2 ;
}
else if ( question == 8 ) {
answer = 1 ;
}
$('#q22 textarea').val(Questions18[question]);
$('#q22 textarea').attr('readonly','true');
$(Pictures18 [ question ] ).insertAfter('#q22');
$('#q30 textarea').val(Answers18[question]);
$('#q30 textarea').attr('readonly','true');
}
}
/*
The JQuery script from laserfiche which masks a telephone number using the scheme (999)999-9999.......................................................................................................
......................................................................................................................................................................................................
*/
(function(g){
"function"===typeof define&&define.amd?define(["jquery"],g):g(window.jQuery||window.Zepto)
})
(function(g){
var y=function(a,f,d){
var k=this,x;a=g(a);
f="function"===typeof f?f(a.val(),void 0,a,d):f;k.init=function(){
d=d||{};
k.byPassKeys=[9,16,17,18,36,37,38,39,40,91];
k.translation={
0:{
pattern:/\d/
},9:{
pattern:/\d/,optional:!0
},"#":{
pattern:/\d/,recursive:!0
},A:{
pattern:/[a-zA-Z0-9]/
},S:{
pattern:/[a-zA-Z]/
}
};
k.translation=g.extend({},k.translation,d.translation);
k=g.extend(!0,{},k,d);
a.each(function(){
!1!==d.maxlength&&a.attr("maxlength",f.length);
d.placeholder&&a.attr("placeholder",d.placeholder);
a.attr("autocomplete","off");
c.destroyEvents();
c.events();
var b=c.getCaret();
c.val(c.getMasked());
c.setCaret(b+c.getMaskCharactersBeforeCount(b,!0))
})
};
var c = {
getCaret:function(){
var b;b=0;
var e=a.get(0),c=document.selection,e=e.selectionStart;
if(c&&!~navigator.appVersion.indexOf("MSIE 10"))b=c.createRange(),b.moveStart("character",a.is("input")?-a.val().length:-a.text().length),b=b.text.length;
else if(e||"0"===e)b=e;
return b
},setCaret:function(b){
if(a.is(":focus")){
var e;
e=a.get(0);
e.setSelectionRange?e.setSelectionRange(b,b):e.createTextRange&&(e=e.createTextRange(),e.collapse(!0),e.moveEnd("character",b),e.moveStart("character",b),e.select())
}
},events:function(){
a.on("keydown.mask",function(){x=c.val()});
a.on("keyup.mask",c.behaviour);
a.on("paste.mask drop.mask",function(){
setTimeout(function(){
a.keydown().keyup()},100)
});
a.on("change.mask",function(){
a.data("changeCalled",!0)
});
a.on("blur.mask",
function(b){
b=g(b.target);
b.prop("defaultValue")!==b.val()&&(b.prop("defaultValue",b.val()),b.data("changeCalled")||b.trigger("change"));
b.data("changeCalled",!1)
});
a.on("focusout.mask",function(){
d.clearIfNotMatch&&c.val().length<f.length&&c.val("")
})
},destroyEvents:function(){
a.off("keydown.mask keyup.mask paste.mask drop.mask change.mask blur.mask focusout.mask").removeData("changeCalled")
},val:function(b){
var e=a.is("input");return 0<arguments.length?e?a.val(b):a.text(b):e?a.val():a.text()
},getMaskCharactersBeforeCount:function(b,e){
for(var a=0,c=0,d=f.length;c<d&&c<b;c++)k.translation[f.charAt(c)]||(b=e?b+1:b,a++);
return a
},determineCaretPos:function(b,a,d,h){
return k.translation[f.charAt(Math.min(b-1,f.length-1))]?Math.min(b+d-a-h,d):c.determineCaretPos(b+1,a,d,h)},behaviour:function(b){
b=b||window.event;
var a=b.keyCode||b.which;
if(-1===g.inArray(a,k.byPassKeys)){
var d=c.getCaret(),f=c.val(),n=f.length,l=d<n,p=c.getMasked(),m=p.length,q=c.getMaskCharactersBeforeCount(m-1)-c.getMaskCharactersBeforeCount(n-1);
p!==f&&c.val(p);
!l||65===a&&b.ctrlKey||(8!==a&&46!==a&&(d=c.determineCaretPos(d,n,m,q)),c.setCaret(d));
return c.callbacks(b)
}
},getMasked:function(b){
var a=[],g=c.val(),h=0,n=f.length,l=0,p=g.length,m=1,q="push",s=-1,r,u;d.reverse?(q="unshift",m=-1,r=0,h=n-1,l=p-1,u=function(){
return-1<h&&-1<l}):(r=n-1,u=function(){
return h<n&&l<p});
for(;u();){
var v=f.charAt(h),w=g.charAt(l),t=k.translation[v];
if(t)w.match(t.pattern)?(a[q](w),t.recursive&&(-1===s?s=h:h===r&&(h=s-m),r===s&&(h-=m)),h+=m):t.optional&&(h+=m,l-=m),l+=m;
else {
if(!b)a[q](v);
w===v&&(l+=m);h+=m
}
}
b=f.charAt(r);
n!==p+1||k.translation[b]||a.push(b);
return a.join("")},callbacks:function(b){
var e=c.val(),g=c.val()!==x;
if(!0===g&&"function"===typeof d.onChange)d.onChange(e,b,a,d);
if(!0===g&&"function"===typeof d.onKeyPress)d.onKeyPress(e,b,a,d);
if("function"===typeof d.onComplete&&e.length===f.length)d.onComplete(e,b,a,d)
}
};
k.remove=function(){
var a=c.getCaret(),d=c.getMaskCharactersBeforeCount(a);
c.destroyEvents();
c.val(k.getCleanVal()).removeAttr("maxlength");
c.setCaret(a-d)};
k.getCleanVal=function(){
return c.getMasked(!0)
};
k.init()};
g.fn.mask=function(a,f){
this.unmask();
return this.each(function(){
g(this).data("mask",new y(this,a,f))
})
};
g.fn.unmask=function(){
return this.each(function(){
try {
g(this).data("mask").remove()
}catch(a){}
})
};
g.fn.cleanVal=function(){
return g(this).data("mask").getCleanVal()
};
g("*[data-mask]").each(function(){
var a=g(this),f={};
"true"===a.attr("data-mask-reverse")&&(f.reverse=!0);
"false"===a.attr("data-mask-maxlength")&&(f.maxlength=!1);
"true"===a.attr("data-mask-clearifnotmatch")&&(f.clearIfNotMatch=!0);
a.mask(a.attr("data-mask"),f);
})
});
// Mask the input using the masking function above
$(".phone input").mask("+1(999)999-9999");
/*
..................................................................................................................................................................................................
..................................................................................................................................................................................................
*/
// When finished is checked ============================================
$('#q27 input').click( function () {
if(question == 0 ){
get_question () ;
question = 1 ;
}
if ( prize == 0 ) {
$('#pic').show();
prize = 1 ;
if ( correct_incorrect == 1 ) {
$('#q31').show();
}
}
else {
$('#pic').hide() ;
prize = 0 ;
if(correct_incorrect == 1 ){
$('#q31').hide() ;
}
}
if ( correct_incorrect == 0 ){
correct_incorrect = 1 ;
}
if ( finished == 0 ) {
$('#q7').hide() ;
$('#q8').hide() ;
$('#q25').hide() ;
$('#q26').hide() ;
$('#q11').hide() ;
$('#q13').hide() ;
$('#q14').hide() ;
$('#q15').hide() ;
$('#q17').hide() ;
$('#q24').hide() ;
$('#q18').hide() ;
$('#q19').hide() ;
finished = 1 ;
}
else if ( finished == 1 ) {
$('#q7').show() ;
$('#q8').show() ;
$('#q25').show() ;
$('#q26').show() ;
$('#q11').show() ;
$('#q13').show() ;
$('#q14').show() ;
$('#q15').show() ;
$('#q17').show() ;
$('#q24').show() ;
$('#q18').show() ;
$('#q19').show() ;
finished = 0 ;
}
});
// =====================================================================
// When answer is selected =============================================
$('#q23 input').click(function() {
$('#pic2').hide();
var user_answer = $('input[id^=Field23]:checked').val();
if ( user_answer != answer ) {
$( '#q31 input' ).val( 'YOU ARE INCORRECT!' ) ;
$('#q31 input').attr('readonly','true');
$('#q31 input').css('color','red');
$('#q31 input').css('margin-left','17%');
$('#q31').show();
}
else if ( user_answer == answer ) {
$( '#q31 input' ).val( 'YOU ARE CORRECT!' ) ;
$('#q31 input').attr('readonly','true');
$('#q31 input').css('color','green');
$('#q31 input').css('margin-left','20%');
$('#q31').show();
}
if ( Prandomized == 0 ) {
insert_image() ;
Prandomized = 1 ;
}
$('#q22').hide();
$('#q23').hide();
$('.action-btn').show();
});
// =====================================================================
});
I can explain anything, I will also post the form preview with the css id's