
﻿
var VDNAQuiz={config:{skin:{containerId:"VDNAQuiz_container",imgPath:"/img/embed/img/",brandsContainerId:"brands-container",bg_color:"#000000",statement_image_border_thickness:"2",statement_image_border_color:"#DDDDDD",statement_font_family:"Georgia, Arial",statement_font_weight:"bold",statement_font_size:"22",statement_font_colour:"#FFFFFF",progress_bar_height:'15',progress_bar_color:'#FFFFFF'},quiz:{moduleArr:false,moduleId:0,schemaVersion:0,responseId:"",quizResultPage:(window.location.href.indexOf("quiz")!=-1)?"/results":"/travel-quiz/results",thisResultPage:"",statements:[],choices:[],eventsLibUrl:"/vdna.events.js"},results:{feedbackSchemaId:"",functions:{getUserFeedbackProcessfunction:"",getSharedResponseProcessfunction:"",getLastResponseProcessfunction:""}},brands:{selectedBrand:-1,suspiciousBrands:true,clickedBrand:0,active:false,imgPath:"/img/embed/img/brands/",selectedBrands:[],names:{tech:{dell:{label:"Dell",img:"dell_logo.png"},atandt:{label:"AT&amp;T",img:"att_logo.png"},tmobile:{label:"T-Mobile",img:"tmobile_logo.png"},verizon:{label:"Verizon",img:"verizon_logo.png"},apple:{label:"Apple",img:"apple_logo.png"}},car_rentals:{hertz:{label:"Hertz",img:"hertz_logo.png"},alamo:{label:"Alamo",img:"alamo_logo.png"},holiday_autos:{label:"Holiday Autos",img:"holidayauto_logo.png"},thrifty:{label:"Thrifty",img:"thrifty_logo.png"},sixt:{label:"SIXT",img:"sixt_logo.png"}},airlines:{virgin_atlantic:{label:"Virgin Atlantic",img:"virginatlantic_logo.png"},british_airways:{label:"British Airways",img:"britishairways_logo.png"},easyjet:{label:"Easyjet.com",img:"easyjet_logo.png"},ryanair:{label:"Ryanair",img:"ryanair_logo.png"},delta:{label:"Delta",img:"delta_logo.png"}},online_players:{kayak:{label:"Kayak",img:"kayak_logo.png"},orbitz:{label:"Orbitz",img:"orbitz_logo.png"},trip_advisor:{label:"Trip Advisor",img:"tripadvisor_logo.png"},travelocity:{label:"Travelocity",img:"travelocity_logo.png"},expedia:{label:"Expedia",img:"expedia_logo.png"}},hotel_chains:{marriott:{label:"Marriott",img:"marriott_logo.png"},ibis:{label:"Ibis",img:"ibis_logo.png"},le_meridien:{label:"Le Meridien",img:"lemeridien_logo.png"},hilton:{label:"Hilton",img:"hilton_logo.png"},best_western:{label:"Best Western",img:"bestwestern_logo.png"}},traditional_travel_agents:{lastminute:{label:"Lastminute",img:"lastminute_logo.png"},kuoni:{label:"Kuoni",img:"kuoni_logo.png"},thomas_cook:{label:"Thomas Cook",img:"thomascook_logo.png"},virgin_holidays:{label:"Virgin Holidays",img:"virgin_logo.png"},sta_travel:{label:"STA Travel",img:"sta_logo.png"}}},selects:{tech:{google:"Google",o2:"O2",Sony:"Sony"},car_rentals:{avis:"Avis",budget:"Budget",easy_car:"Easy Car",enterprise:"Enterprise"},airlines:{american_airlines:"American Airlines",emirates:"Emirates",jet_blue:"JetBlue",klm:"KLM",quantas:"Quantas",singapore_airlines:"Singapore Airlines",united:"United"},online_players:{ebookers:"Ebookers",opodo:"Opodo",priceline:"Priceline"},hotel_chains:{conrad:"Conrad",holiday_inn:"Holiday Inn",hyatt:"Hyatt",intercontinental:"Intercontinental",mandarin_oriental:"Mandarin Oriental",radisson:"Radisson",sheraton:"Sheraton",sofitel:"Sofitel"},traditional_travel_agents:{airtours:"Airtours",first_choice:"First Choice",hayes_and_jarvis:"Hayes and Jarvis",libra:"Libra"}}},gateway:{url:"http://gateway-lite.visualdna.com/vdna_api.php",defaultParams:"&api_key="+VDNA_apiKey+"&sig="+VDNA_hash+"&v=1&format=json&pass_id=1"},misc:{jQuerySrc:"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"},tracking:{isActive:false,Ba4:"",Ba5:"",Ba6:"",Ba11:"",Ba13:"",Ba18:"",Ba20:"",Ba23:"",Ba24:"",Ba25:"",Ba26:"",Ba27:""}},runtime:{moduleStarted:false,tStart:new Date(),pages:[]},init:function(params)
{if(typeof(jQuery)=="undefined")
{VDNAQuiz.util.require(VDNAQuiz.config.misc.jQuerySrc);}
VDNAQuiz.updateConfig(params);if(VDNAQuiz.util.urlParam("response_id")!=false)
{VDNAQuiz.config.quiz.responseId=VDNAQuiz.util.urlParam("response_id");VDNAQuiz.htmlize.results();return false;}
if(VDNAQuiz.config.tracking.isActive)
{VDNAQuiz.util.require(VDNAQuiz.config.quiz.eventsLibUrl);}
VDNAQuiz.style.add();VDNAQuiz.htmlize.container();setTimeout("VDNAQuiz.gateway.getModuleData()",1000);},updateConfig:function(params)
{if(params.quiz.id)
{VDNAQuiz.config.quiz.moduleId=params.quiz.id;}
if(params.quiz.schemaVersion)
{VDNAQuiz.config.quiz.schemaVersion=params.quiz.schemaVersion;}
if(params.results.feedbackSchemaId)
{VDNAQuiz.config.results.feedbackSchemaId=params.results.feedbackSchemaId;}
if(params.results.functions)
{for(var t in params.results.functions)
{VDNAQuiz.config.results.functions[t]=params.results.functions[t];}}
if(params.skin)
{for(var t in VDNAQuiz.config.skin)
{if(params.skin[t])
{VDNAQuiz.config.skin[t]=params.skin[t];}}}
if(params.tracking)
{for(var t in params.tracking)
{VDNAQuiz.config.tracking[t]=params.tracking[t];}}
if(params.quiz.moduleArr)
{VDNAQuiz.config.quiz.moduleArr=params.quiz.moduleArr;}},gateway:{getModuleData:function()
{if(VDNAQuiz.config.quiz.moduleArr!=false)
{VDNAQuiz.gateway.parseModuleData(VDNAQuiz.config.quiz.moduleArr);}
else
{var callUrl=VDNAQuiz.config.gateway.url+"?method=api.soa.mss.getModuleByUID&param1="+VDNAQuiz.config.quiz.moduleId+"&param2="+VDNAQuiz.config.quiz.schemaVersion+VDNAQuiz.config.gateway.defaultParams+"&callback=?";jQuery.getJSON(callUrl,VDNAQuiz.gateway.parseModuleData);}},parseModuleData:function(response)
{var moduleJson=response.moduleSchema;var imageSource=moduleJson["@attributes"].defaultImageSource;var statements=moduleJson.statements.statement;var maxImages=0;var sequenceNumber=0;var st=[];jQuery.each(statements,function(key,val){if(typeof(val["@attributes"].sequenceNumber)!==undefined&&val["@attributes"].sequenceNumber!=null)
{sequenceNumber=val["@attributes"].sequenceNumber;}
else
{sequenceNumber++;}
st[sequenceNumber]={title:val.label['@value'],ident:val["@attributes"].ident,choices:[]};if(val.choices.choice.length>maxImages)
{maxImages=val.choices.choice.length;}
jQuery.each(val.choices.choice,function(ckey,choice){st[sequenceNumber].choices.push({ident:choice["@attributes"].ident,img:imageSource+"/"+choice["@attributes"].fileName})});});var isFiltred=false;while(isFiltred==false)
{isFiltred=true;var i=0;jQuery.each(st,function(key,val){if(val===undefined)
{isFiltred=false;st.splice(i,1);}
i++;});}
VDNAQuiz.config.quiz.statements=VDNAQuiz.util.sortArrayByKeys(st);VDNAQuiz.htmlize.quiz();},setUserResponse:function()
{if(VDNAQuiz.config.brands.active!=true)
{jQuery(".instructions").html("");var container_html='<div style="padding: 40px;text-align:center;">';container_html+='<p><strong>Please hold on whilst we load your quiz results</strong></p></br>';container_html+='<img style="margin: 20px auto 0 auto;" src="'+VDNAQuiz.config.skin.imgPath+'load.gif" alt="loading..." /></div>';container_html+='</div>';jQuery("#"+VDNAQuiz.config.skin.containerId).html(container_html);}
var choiceXml=VDNAQuiz.util.makeChoiceXML(VDNAQuiz.config.quiz.choices);var callUrl=VDNAQuiz.config.gateway.url+"?method=api.soa.us.storeResponse&param1="+choiceXml+VDNAQuiz.config.gateway.defaultParams+"&callback=?";jQuery.getJSON(callUrl,function(response)
{if(response['@attributes'].stat=="ok")
{VDNAQuiz.config.quiz.responseId=response.response.uid['@value'];VDNA_FlashGetUserID(response.response.user['@attributes'].uuid);if(VDNAQuiz.config.brands.active==true)
{$('#pagefinish').hide();VDNAQuiz.htmlize.brands();}
else
{VDNAQuiz.config.quiz.thisResultPage=VDNAQuiz.config.quiz.quizResultPage+'?response_id='+VDNAQuiz.config.quiz.responseId;VDNA_Redirect(VDNAQuiz.config.quiz.thisResultPage,'_self');}}});}},style:{add:function()
{var brands=VDNAQuiz.config.brands.names;var css='';css+='#VDNAQuiz_container div,#VDNAQuiz_container ul,#VDNAQuiz_container li,#VDNAQuiz_container h1,#VDNAQuiz_container h2,#VDNAQuiz_container h3,#VDNAQuiz_container form,#VDNAQuiz_container input,#VDNAQuiz_container p{margin:0;padding:0;}#VDNAQuiz_container img {border:0;}#VDNAQuiz_container address{font-style:normal;font-weight:normal;}#VDNAQuiz_container li{list-style:none;}#VDNAQuiz_container h1,#VDNAQuiz_container h2,#VDNAQuiz_container h3{font-size:100%;font-weight:normal;}#VDNAQuiz_container input,#VDNAQuiz_container select{font-family:inherit;font-size:inherit;font-weight:inherit;}#VDNAQuiz_container input,#VDNAQuiz_container select {*font-size:100%;}';css+='#VDNAQuiz_container{margin:auto auto;padding:0;border:0;height:624px;width:899px;text-align:center;color:#FFFFFF;background:'+VDNAQuiz.config.skin.bg_color+';font-family:Helvetica, Arial, sans-serif;}#VDNAQuiz_container iframe,div,ul,li,form{margin:0;padding:0;border:0;}#VDNAQuiz_container img{display:block;}#VDNAQuiz_container #c{width:632px;margin:0 auto;text-align:left;position:relative;}#VDNAQuiz_container .summary{width:632px;margin-left:auto;margin-right:auto;}#VDNAQuiz_container .page,.hide{display:none;}#VDNAQuiz_container .s{position:left:37px;width:632px;margin-bottom:15px}#VDNAQuiz_container #choose-one {position:absolute;left:466px;top:132px;font-size:.8125em;color:#fff;opacity:0;width:auto;white-space:nowrap;text-transform:uppercase;}#VDNAQuiz_container .s h3{color:'+VDNAQuiz.config.skin.statement_font_colour+';font-size:'+VDNAQuiz.config.skin.statement_font_size+'px;font-family:'+VDNAQuiz.config.skin.statement_font_family+';font-weight:'+VDNAQuiz.config.skin.statement_font_weight+';margin-top:0;padding-top:25px;}#VDNAQuiz_container .q{width:632px;height:500px;left:2px;}#VDNAQuiz_container .p{width:610px;height:'+VDNAQuiz.config.skin.progress_bar_height+'px;overflow:hidden;border:solid 1px #666;-moz-border-radius:3px;-webkit-border-radius:3px;padding:2px;}#VDNAQuiz_container .p .progress{width:100%;display:block;height:'+VDNAQuiz.config.skin.progress_bar_height+'px;}#VDNAQuiz_container .p .progress span{height:'+VDNAQuiz.config.skin.progress_bar_height+'px;display:block;background-color:'+VDNAQuiz.config.skin.progress_bar_color+';}#VDNAQuiz_container #f{width:632px;height:304px;position:absolute;left:0;top:184px;z-index:3;}#VDNAQuiz_container #f p{font-size:1.4em;width:19em;margin:4em auto 0 auto;color:#fff;}#VDNAQuiz_container ul{list-style:none;width: 632px;}#VDNAQuiz_container li{float:left;margin:0;display:inline;cursor:pointer;text-align:center;}#VDNAQuiz_container li div{position:relative;width:158px;height:158px;}#VDNAQuiz_container li span{display:none;position:absolute;width:158px;height:158px;top:0;left:0;z-index:1;margin: 0 auto;}#VDNAQuiz_container li span img{position:relative;left:0;top:0;z-index:1;width:155px;height:155px;display:block;margin:0 auto;}#VDNAQuiz_container li a img {border: '+VDNAQuiz.config.skin.statement_image_border_thickness+'px '+VDNAQuiz.config.skin.statement_image_border_color+' solid;position:absolute;top:6px;left:6px;z-index:2;width:138px;height:138px;cursor:pointer;}#VDNAQuiz_container #flash-message{height:580px;width:632px;position:relative;z-index:1;text-align:center;background-color:#000;margin-left:auto;margin-right:auto;font-size:14px}#VDNAQuiz_container #flash-message p{color:#fff;font-size:1.2em;line-height:130%;margin:0 auto;width:600px;padding-top:2.5em;}#VDNAQuiz_container #flash-message img{margin:40px auto 0 auto;}#VDNAQuiz_container h3.sm{font-size:1.4em;}#VDNAQuiz_container #flash-box{width:632px;position:absolute;z-index:100;top:197px;left:14px;}#VDNAQuiz_container #flash{position: absolute;top:0;left:0;z-index:101;}';css+='#VDNAQuiz_container #brands-container{width:890px;margin-right:auto;margin-left:auto;}#VDNAQuiz_container .brands-row{width:899px;position:relative}#VDNAQuiz_container .brands-row .brand{width:145px; height:74px;display:inline;position:relative;float:left;margin: 0 4px 0 0;background:url('+VDNAQuiz.config.skin.imgPath+'new-brands-bg.gif) 0 0 no-repeat;cursor:pointer;}#VDNAQuiz_container .brands-row .fade{filter:alpha(opacity=20);-moz-opacity:0.2;-khtml-opacity:0.2;opacity:0.2;}#VDNAQuiz_container * html .brands-row .fade select{background-color:#333;color:#666;}#VDNAQuiz_container #brands-container .brands-row .over{background-position: 0 -74px;}#VDNAQuiz_container #brands-container .brands-row .on{background-position:0 -148px;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity:1;opacity:1;}#VDNAQuiz_container .brands-row .brand .brand-image{background-color:transparent;background-position:center center;background-repeat:no-repeat;height:74px;width:145px;cursor:pointer;}#VDNAQuiz_container .brands-row .brand .brand-image label{display:none;}#VDNAQuiz_container .brands-row .brand .check{position:absolute;left:0;top:0;visibility:hidden;}#VDNAQuiz_container #brands-container .clear{clear:both;height:4px;font-size:0px;overflow: hidden;line-height:0;}#VDNAQuiz_container #save-vdna{text-align:right;margin-bottom:10px;}#VDNAQuiz_container #save-vdna label img{display:inline;vertical-align: middle;}#VDNAQuiz_container .brands-row .form .inner{margin:10px;}#VDNAQuiz_container .brands-row select{color:#333;font-family:"Trebuchet MS", Trebuchet, Lucida Sans Unicode, Lucida Grande, Lucida Sans, Arial, sans-serif;font-size:.6875em;width:121px;padding: 2px 0 3px 0;float:left;margin-bottom:8px;display:block;}#VDNAQuiz_container .brands-row .form p{display:block;font-family:"Trebuchet MS", Trebuchet, Lucida Sans Unicode, Lucida Grande, Lucida Sans, Arial,sans-serif;font-size:.6875em;padding-bottom:6px;}#VDNAQuiz_container .brands-row .form input.text{font-family:"Trebuchet MS", Trebuchet, Lucida Sans Unicode, Lucida Grande, Lucida Sans, Arial, sans-serif; font-size:.6875em;width:111px;padding:2px 5px 3px 5px;float:left;display:block;color:#333;background-color:#fff;border:solid 1px #999;}#VDNAQuiz_container #brands-container .s{position:static;text-align:left;left:37px;top:68px;}';for(brandType in brands)
{for(bIdent in brands[brandType])
{css+='#VDNAQuiz_container .brands-row .brand .brand_'+bIdent+' { background-image: url('+VDNAQuiz.config.brands.imgPath+brands[brandType][bIdent].img+'); }';}}
var head=document.getElementsByTagName('head')[0];var cssStyle=document.createElement('style');var rules=document.createTextNode(css);cssStyle.type='text/css';if(cssStyle.styleSheet)
cssStyle.styleSheet.cssText=rules.nodeValue;else cssStyle.appendChild(rules);head.appendChild(cssStyle);}},htmlize:{container:function()
{if(document.getElementById(VDNAQuiz.config.skin.containerId)==null)
{var container_html='<div id="'+VDNAQuiz.config.skin.containerId+'">';container_html+='<div id="flash-message">';container_html+='<p>Hello there - please hold on whilst we load your<br/> quiz right now - it\'s really worth the short wait</p>';container_html+='<img src="'+VDNAQuiz.config.skin.imgPath+'load.gif" alt="loading..." /></div>';container_html+='</div>';$(container_html).insertBefore('.instructions');}},quiz:function()
{var statements=VDNAQuiz.config.quiz.statements;var i=1;var html='';var statements_count=statements.length;jQuery.each(statements,function(){var seg_ident=this.ident;var seg_title=this.title;html+='<div id="page'+seg_ident+'" class="page summary">';html+='<div class="s"><h3>'+seg_title+'</h3></div>';html+='<div class="q" style="display:none"><ul class="ql">';jQuery.each(this.choices,function(idx,item){html+='<li><div><span><img src="'+VDNAQuiz.config.skin.imgPath+'shadow.png" alt="" /></span><a onclick="return VDNAQuiz.act.r(this, \''+seg_ident+'\', \''+item.ident+'\', \'\')" href="#" rel="'+item.img+'"><img src="'+VDNAQuiz.config.skin.imgPath+'t.gif" alt="" /></a></div></li>';});html+='</ul><div style="clear:both;"></div></div>';html+='<div class="p"><span class="progress"><span class="bar" style="float:left;width: '+(100/statements_count*i)+'%"></span></span></div>';html+='<div style="height:10px;clear:both;"></div>';html+='</div>';i++;});html+='<div id="pagefinish" class="page summary">';html+='<div class="s"><div><h3>Almost there...</h3></div></div>';html+='<div class="q">';html+='<p>Please wait whilst we load up the last question before you get your results</p>';html+='<img style="margin: 20px auto 0 auto;" src="'+VDNAQuiz.config.skin.imgPath+'load.gif" alt="loading..." />';html+='</div>';html+='<div class="p"><span class="progress"><span class="bar" style="width: 100%"></span></span></div>';html+='</div>';html+='<div style="clear:both;"></div>';jQuery(html).appendTo(jQuery("#"+VDNAQuiz.config.skin.containerId));VDNAQuiz.act.load();},brands:function()
{var brands=VDNAQuiz.config.brands.names;var selects=VDNAQuiz.config.brands.selects;var html='<div id="'+VDNAQuiz.config.skin.brandsContainerId+'">';html+='<div class="s start" style="width:850px"><h3>Please select your favourite brand from each row</h3></div>';html+='<div class="s finish" style="display:none;width:850px"><h3>Thank you. Please wait while we access your result... <img style="display:inline;margin: 15px auto 0 auto;" src="'+VDNAQuiz.config.skin.imgPath+'load.gif" alt="loading..." /></h3></div>';html+='<div id="save-vdna">';html+='<form action="">';html+='<input type="checkbox" class="saveMyvdna" checked="checked" id="save-my-vdna" onclick="return VDNAQuiz.brandsAct.setSaveVdna(this);" /> ';html+='<label>';html+='<a href="http://my.visualdna.com/" target="_blank" title="Visit my.visualdna.com (opens in a new window)">';html+='<img src="'+VDNAQuiz.config.skin.imgPath+'save.gif" alt="Save my VisualDNA" />';html+='</a></label>';html+='<script type="text/javascript">VDNAQuiz.brandsAct.checkSaveVdna(document.getElementById("save-my-vdna"));</script>';html+='</form></div>';jQuery.each(brands,function(brandType,brandsRow){html+='<div class="brands-row">';jQuery.each(brandsRow,function(bIdent,bData){html+='<div class="brand">';html+='<div class="brand-image brand_'+bIdent+'">';html+='<label for="brand_'+bIdent+'">'+bData.label+'</label>';html+='</div>';html+='<div class="check">';html+='<input type="checkbox" id="brand_'+bIdent+'" name="'+brandType+'_'+bIdent+'" class="checkbox" />';html+='</div></div>';});html+='<div class="brand form">';html+='<div class="inner">';html+='<select name="other_'+brandType+'">';html+='<option value="">Other choice...</option>';jQuery.each(selects[brandType],function(bIdentS,bDataS){html+='<option value="'+bIdentS+'">'+bDataS+'</option>';});html+='</select>';html+='<input type="checkbox" class="hide"/>';html+='<div class="clear"></div>';html+='<input class="text" type="text" name="user_choice_'+brandType+'" value="... or type another" />';html+='<input type="checkbox" class="hide" />';html+='</div></div>';html+='</div>';html+='<div class="clear"></div>';});html+='</div>';jQuery(html).appendTo(jQuery("#"+VDNAQuiz.config.skin.containerId));VDNAQuiz.brandsAct.bindEvents();},results:function()
{VDNAQuiz.util.require("/json2.js");var html='<div id="'+VDNAQuiz.config.skin.containerId+'" style="overflow:scroll;">';html+='<h1 style="color: '+VDNAQuiz.config.skin.statement_font_colour+'"><strong><a title="VisualDNA - Patented Profiling Technology" href="http://www.visualdna.com">VisualDNA - Patented Profiling Technology</a></strong></h1>';html+='<h2 style="color: '+VDNAQuiz.config.skin.statement_font_colour+'">API Example Page</h2>';html+='<div class="col"><h3 style="color: '+VDNAQuiz.config.skin.statement_font_colour+'">Feedback Data from <strong>VDNA_GetUserFeedback()</strong></h3><div id="output_1"></div></div><br /><div class="hr"><hr /></div>';html+='<div class="col"><h3 style="color: '+VDNAQuiz.config.skin.statement_font_colour+'">Scored Response Data from <strong>VDNA_GetSharedResponse()</strong></h3><div id="output_2"></div><br /><div class="hr"><hr /></div>';html+='<h3 style="color: '+VDNAQuiz.config.skin.statement_font_colour+'">Scored Response Data from <strong>VDNA_GetLastResponse()</strong></h3><div id="output_3"></div></div></div>';document.write(html);VDNA_GetLastResponse(VDNAQuiz.config.quiz.moduleId,VDNAQuiz.config.results.functions.getLastResponseProcessfunction);VDNA_GetUserFeedback(VDNAQuiz.config.quiz.responseId,VDNAQuiz.config.results.feedbackSchemaId,VDNAQuiz.config.results.functions.getUserFeedbackProcessfunction);VDNA_GetSharedResponse(VDNAQuiz.config.quiz.responseId,VDNAQuiz.config.results.functions.getSharedResponseProcessfunction);}},brandsAct:{saveSelectedBrands:function()
{var brandsParams='&param1='+VDNAQuiz.config.quiz.responseId;var j=2;for(var i in VDNAQuiz.config.brands.names)
{brandsParams+="&param"+j+"=brands-"+i+"&param"+(j+1)+"="+VDNAQuiz.config.brands.selectedBrands[i];j=j+2;}
var callUrl=VDNAQuiz.config.gateway.url+"?method=api.soa.us.saveResponseExtraData"+brandsParams+VDNAQuiz.config.gateway.defaultParams+"&callback=?";jQuery.getJSON(callUrl,function(response)
{if(response['@attributes'].stat=="ok")
{VDNAQuiz.config.quiz.thisResultPage=VDNAQuiz.config.quiz.quizResultPage+'?response_id='+VDNAQuiz.config.quiz.responseId;VDNA_Redirect(VDNAQuiz.config.quiz.thisResultPage,'_self');}
else
{alert("An error has ocured. Pls redo the quiz or come back later");}});},checkSaveVdna:function(check)
{save=VDNA_FlashSendUserPerm();if(save&&save!='false'&&save!='0'){check.checked=true;}else{check.checked=false;}
return check;},setSaveVdna:function(check)
{if(check.value&&check.checked)
{VDNA_FlashSetVDNA('true');}else{if(VDNA_FlashSetVDNA('false')=='true')
check.checked=true;}},bindEvents:function()
{var $brands=jQuery('#brands-container').children('div.brands-row');jQuery.each($brands,function(){var $brand=jQuery(this).children('div.brand:not(.form)');jQuery.each($brand,function(){jQuery(this).bind('mouseover',function(){jQuery(this).addClass('over');});jQuery(this).bind('mouseout',function(){jQuery(this).removeClass('over');});jQuery(this).bind('click',function(){var $parent=jQuery(this).parent();$parent.children('div.on').removeClass('on');$parent.children('div.brand').children().find('input:checkbox').attr('checked','');jQuery(this).children().find('input:checkbox').attr('checked','checked')
jQuery(this).addClass('on').removeClass('over');$parent.children().find('select').children('option:first-child').attr('selected','selected');$parent.children().find('input:text').val('... or type another');var thisBrandArr=jQuery(this).children().find('input:checkbox').attr('name').split("_");VDNAQuiz.config.brands.selectedBrands[thisBrandArr[0]]=thisBrandArr[1];var thisIndex=jQuery(this).parent().children('div.brand:not(.form)').index(jQuery(this));if(VDNAQuiz.config.brands.suspiciousBrands){if(thisIndex==VDNAQuiz.config.brands.selectedBrand){if(VDNAQuiz.config.brands.clickedBrand!=0)
VDNAQuiz.config.brands.suspiciousBrands=true;}else{if(VDNAQuiz.config.brands.clickedBrand!=0)
VDNAQuiz.config.brands.suspiciousBrands=false;}
VDNAQuiz.config.brands.clickedBrand=1;}
VDNAQuiz.config.brands.selectedBrand=thisIndex;VDNAQuiz.brandsAct.checkStatus();});})});var $texts=$brands.children().find('input:text');jQuery.each($texts,function(){jQuery(this).bind('paste',function(e){e.preventDefault();});jQuery(this).bind('cut',function(e){e.preventDefault();});jQuery(this).focus(function(){var $val=jQuery(this).val();if($val==='... or type another'){jQuery(this).val('');}
jQuery(this).keyup(function(e){var key=e.charCode||e.keyCode||0;if(key===8){var val=(jQuery(this).val().length)-1;}else{var val=(jQuery(this).val().length)+1;}
if(val>0){jQuery(this).parents('div.brands-row').children('div.on').removeClass('on');jQuery(this).parents('div.brands-row').children('div.brand').children().find('input:checkbox').attr('checked','');jQuery(this).next('input:checkbox').attr('checked','checked').attr('id','brand-'+jQuery(this).val().toLowerCase().split(' ').join('+'));var inputVal=jQuery(this).val().toLowerCase().split(' ').join('+');var thisBrandArr=jQuery(this).attr('name').split("_");VDNAQuiz.config.brands.selectedBrands[thisBrandArr[2]]=inputVal;var $parent=jQuery(this).parent();$parent.parent().addClass('on');$parent.children('select').children('option:first-child').attr('selected','selected')
$parent.next('input:checkbox').attr('checked','');}else{jQuery(this).next('input:checkbox').attr('checked','');jQuery(this).parent().parent('div.brand').removeClass('on');}});VDNAQuiz.brandsAct.checkStatus();});jQuery(this).blur(function(){var $val=jQuery(this).val();if($val.length===0){jQuery(this).val('... or type another');}
VDNAQuiz.brandsAct.checkStatus();});});var $selects=$brands.children().find('select');jQuery.each($selects,function(){jQuery(this).change(function(){if(jQuery(this).children().index(jQuery(this).children(':selected'))){var $brandsrow=jQuery(this).parents('div.brands-row');jQuery(this).next('input').attr('checked','checked').attr('id','brand-'+jQuery(this).children(':selected').attr('value').toLowerCase());$brandsrow.children('div.on').removeClass('on').children().find('input:checkbox').attr('checked','');var selectVal=jQuery(this).children(':selected').attr('value').toLowerCase();var thisBrandArr=jQuery(this).attr('name').split("_");VDNAQuiz.config.brands.selectedBrands[thisBrandArr[1]]=selectVal;jQuery(this).parent().parent('div.brand').addClass('on');jQuery(this).parent().children('input:text').val('... or type another').next('input:checkbox').attr('checked','');}else{jQuery(this).next('input').attr('checked','');jQuery(this).parent().parent('div.brand').removeClass('on');}
VDNAQuiz.brandsAct.checkStatus();});if(jQuery(this).children().index(jQuery(this).children(':selected'))){jQuery(this).next('input').attr('checked','checked').attr('id','brand-'+jQuery(this).children(':selected').attr('value').toLowerCase());}else{jQuery(this).next('input').attr('checked','');}});},checkStatus:function()
{var total=0;jQuery.each(jQuery('#brands-container').children('div.brands-row'),function(){var $done=jQuery(this).children().find('input:checkbox:checked').size();if($done){jQuery(this).children().addClass('fade');total++;}});if(total>5){jQuery('.start').hide();jQuery('.finish').show();jQuery.each(jQuery('#brands-container').children('div.brands-row'),function(){var $input=jQuery(this).children().find('input:text');var $value=$input.val();if($value==='... or type another'){$input.val('');}});jQuery('#suspicious').val(''+VDNAQuiz.config.brands.suspiciousBrands);VDNAQuiz.brandsAct.saveSelectedBrands();}}},act:{load:function()
{for(var k=0;k<VDNAQuiz.config.quiz.statements.length;k++)
{VDNAQuiz.runtime.pages.push(VDNAQuiz.config.quiz.statements[k].ident);}
VDNAQuiz.runtime.pages.push("finish");if(VDNAQuiz.config.tracking.isActive)
{sendImpressionEvent("START");}
var uls=jQuery(".q");for(var i=0;i<uls.length;i++)
{var choices=jQuery(uls[i]).find("img");for(var j=0;j<choices.length;j++)
{if(j%2)
{var obj=choices[j];jQuery(obj).mouseover(function(e){e=e||event;var target=e.target||e.srcElement;VDNAQuiz.act.highlightImage(target,'over');});jQuery(obj).mouseout(function(e){e=e||event;var target=e.target||e.srcElement;VDNAQuiz.act.highlightImage(target,'out');});}}}
VDNAQuiz.act.nextPage(null,"",VDNAQuiz.runtime.pages[0]);jQuery("#flash-message").remove();},nextPage:function(el,subq,page)
{var next_page_index=0;if(page==VDNAQuiz.runtime.pages[0]&&VDNAQuiz.runtime.moduleStarted===false)
{setTimeout(function(){VDNAQuiz.act.loadImages(VDNAQuiz.runtime.pages[0])},100);}
else
{jQuery("#page"+page).hide();next_page_index=VDNAQuiz.util.getNextIndex(VDNAQuiz.runtime.pages,page);page=VDNAQuiz.runtime.pages[next_page_index];}
jQuery("#page"+page).show();if(page.toLowerCase()==="finish")
{VDNAQuiz.act.finishUp();return;}
else
{inner=jQuery("#page"+page+" div.q:first");inner.fadeOut(100);if(VDNAQuiz.config.tracking.isActive)
{VDNAQuiz.act.sendEventAfterAllImgLoad(page);}
VDNAQuiz.act.randomizeImages(page);inner.fadeIn(100);var $ql=jQuery("#page"+page+" ul.ql");var $li=jQuery("#page"+page+" ul.ql li");if($li.size()==6||$li.size()==3)
{$ql.css({"padding-left":"80px","width":"500px"});}
if($li.size()==5)
{$ql.css({"padding-left":"80px","width":"500px"});}
if($li.size()==2)
{$ql.css({"padding-left":"150px","width":"500px"});}
if(next_page_index>0)
{VDNAQuiz.act.loadImages(page);}}},highlightImage:function(obj,type)
{var span=obj.parentNode.parentNode.firstChild;span.style.display='block';var spanimg=span.firstChild;if(type=="over")
{jQuery(spanimg).animate({width:"158px",height:"158px"},80);}
else
{jQuery(spanimg).animate({width:"150px",height:"150"},80,function(){jQuery(spanimg).hide();});};},loadImages:function(page)
{var ims=jQuery("#page"+page+" img");for(var i=0;i<ims.length;i++)
{if(ims[i].src.indexOf(VDNAQuiz.config.skin.imgPath+"t.gif")!=-1)
{$(ims[i]).attr("src",ims[i].parentNode.rel).css({opacity:0,visibility:"visible"}).animate({opacity:100},10000);}}},sendEventAfterAllImgLoad:function(page)
{if(VDNAQuiz.act.checkImagesFullLoad(page))
{sendStatementEvent(page,"IMPRESSION");}
else
{setTimeout("VDNAQuiz.act.sendEventAfterAllImgLoad('"+page+"')","500");}},checkImagesFullLoad:function(page)
{var allImagesLoaded=true;var ims=jQuery("page"+page).find("img");for(i=0;i<ims.length;i++)
{if(ims[i].src.indexOf(VDNAQuiz.config.skin.imgPath+"shadow.png")==-1)
{if(!ims[i].complete||ims[i].src.indexOf(VDNAQuiz.config.skin.imgPath+"t.gif")!=-1)
{allImagesLoaded=false;break;}
if(typeof ims[i].naturalWidth!="undefined"&&ims[i].naturalWidth==0)
{allImagesLoaded=false;break;}}}
return allImagesLoaded;},randomizeImages:function(page)
{var ims=jQuery("#page"+page+" li");for(var i=0;i<ims.length*2;i++)
{el1=ims[Math.round(VDNAQuiz.act.getRandomArbitary(0,ims.length-1))];el2=ims[Math.round(VDNAQuiz.act.getRandomArbitary(0,ims.length-1))];el2.parentNode.insertBefore(el2,el1);}},getRandomArbitary:function(min,max)
{return Math.random()*(max-min)+min;},r:function(el,page,response,subq)
{if(!VDNAQuiz.runtime.moduleStarted)
{VDNAQuiz.runtime.moduleStarted=true;if(VDNAQuiz.config.tracking.isActive)
{sendModuleStartEvent();}}
var img=el.childNodes[0];if(img.src=="")return false;if(Explorra.Image.IsLoaded(img)==false)return false;VDNAQuiz.config.quiz.choices.push({segment_ident:page,choice_ident:response,choice_img:img.src})
if(VDNAQuiz.config.tracking.isActive)
{sendStatementEvent(page,"CLICK");if(page=="age")
{switch(response)
{case"choice_72787":VDNAQuiz.config.tracking.Ba15="18-24";break;case"choice_72788":VDNAQuiz.config.tracking.Ba15="25-34";break;case"choice_72789":VDNAQuiz.config.tracking.Ba15="35-44";break;case"choice_72790":VDNAQuiz.config.tracking.Ba15="45-54";break;case"choice_72791":VDNAQuiz.config.tracking.Ba15="55+";break;}}
if(page=="demog_gender")
{switch(response)
{case"choice_54204":VDNAQuiz.config.tracking.Ba16="M";break;case"choice_54205":VDNAQuiz.config.tracking.Ba16="F";break;}}
if(page=="relationship")
{switch(response)
{case"choice_83970":VDNAQuiz.config.tracking.Ba19="Y";break;case"choice_83971":VDNAQuiz.config.tracking.Ba19="N";break;}}}
VDNAQuiz.act.nextPage(el,subq,page);return false;},finishUp:function()
{var tDate=new Date();var tDiff=tDate.getTime()-VDNAQuiz.runtime.tStart.getTime();tDate.setTime(tDiff);rrs="";var responses=VDNAQuiz.config.quiz.choices;for(i in responses)
{rrs+="&"+i+"="+responses[i].choice_ident;}
VDNAQuiz.gateway.setUserResponse();}},util:{sortArrayByKeys:function(thisArray)
{var sortedArray=new Array();var keys=new Array();for(k in thisArray)
{keys.push(k);}
keys.sort(function(a,b){return(a>b)-(a<b);});for(var i=0;i<keys.length;i++)
{sortedArray[keys[i]]=thisArray[keys[i]];}
return sortedArray;},require:function(script_url)
{var html_doc=document.getElementsByTagName("head").item(0);var js=document.createElement("script");js.setAttribute("language","javascript");js.setAttribute("type","text/javascript");js.setAttribute("src",script_url);html_doc.appendChild(js);return false;},makeChoiceXML:function(choices)
{var xml="<"+'?xml version="1.0"'+"?"+">"+'<response moduleId="'+VDNAQuiz.config.quiz.moduleId+'" schemaVersion="'+VDNAQuiz.config.quiz.schemaVersion+'"><answers>';jQuery.each(choices,function(key,val){xml+="<"+val.segment_ident+">"+val.choice_ident+"</"+val.segment_ident+">";});xml+="</answers><extradata></extradata></response>";return xml;},getNextIndex:function(arr,currentIndex)
{for(key in arr)
{if(arr[key]==currentIndex)
{return parseInt(key)+1;}}
return false;},urlParam:function(paramName)
{var vars={};if(window.location.href.indexOf('?')==-1)
return false;var hashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');for(var i=0;i<hashes.length;i++)
{var hash=hashes[i].split('=');eval("vars."+hash[0]+" = "+hash[1]);}
eval("var param = vars."+paramName);return param||false;}}};
