/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/
*/

if(window['console']===undefined){window['console']=function(){};console.log=function(){};}
var Depend={};var DependFlash={};var DependUserControls={};Depend.Extend=function(destination,source){for(var property in source.prototype){if(destination.prototype[property]===undefined){destination.prototype[property]=source.prototype[property];}}
return destination;};Depend.Core=function(){};Depend.Core.prototype={InitializeServices:function(){},AttachEvents:function(){},Display:function(){},Initialize:function(){this.InitializeServices();this.AttachEvents();this.Display();},ServiceProxy:function(serviceUrl){var _I=this;this.serviceUrl=serviceUrl;this.invoke=function(method,params,callback,error){var json=JSON.stringify(params);var url=_I.serviceUrl+method;$.ajax({url:url,data:json,type:"POST",processData:false,contentType:"application/json",timeout:10000,dataType:"text",success:function(res){if(!callback)return;var result=JSON.parse(res);for(var property in result){callback(result[property]);break;}},error:function(xhr){if(!error)return;var res=xhr.responseText;if(res&&res.charAt(0)=='{')
var err=JSON.parse(res);if(err)
error(err);else
if(xhr.status!=200)
error({Message:"http://fr.ca.depend.com/sdqa/Scripts/Http Error:"+xhr.statusText});else
error({Message:"Unknown Error Response"});return;}});};}};Depend.Default=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Default.prototype={Initialize:function(){}};Depend.Extend(Depend.Default,Depend.Core);DependFlash.HomeSlideshow=function(serverVars){this.ServerVars=serverVars;this.Initialize();};DependFlash.HomeSlideshow.prototype={Initialize:function(){if(expressInstallAvailable()){$('#'+serverVars.slideshowContainer).flash({swf:"http://fr.ca.depend.com/img/depend/FR_209.swf?baseurl=http://fr.ca.depend.com/sdqa/",width:686,height:263,hasVersion:8,expressInstaller:"http://www.qa.ca.depend.com/Media/ExpressInstaller.swf",flashvars:{config:"http://fr.ca.depend.com/sdqa/Scripts/HomeSlideshow_Config.xml"},params:{base:"/Media/",wmode:"opaque",allowScriptAccess:"sameDomain"}});}else{displayFlashUpdateMessage();}
function expressInstallAvailable(){if(navigator.userAgent.indexOf("Windows NT 6.0")!=-1){return $.hasFlashPlayerVersion("9.0.28");}else{return $.hasFlashPlayerVersion("6.0.65");}}
function displayFlashUpdateMessage(){$(".NoFlash").css("text-indent",0);}}};Depend.Extend(DependFlash.HomeSlideshow,Depend.Core);DependFlash.VideoPlayer=function(serverVars){this.ServerVars=serverVars;this.Initialize();};DependFlash.VideoPlayer.prototype={Initialize:function(){$('#'+serverVars.videoPlayerContainer).flash({swf:"http://www.qa.ca.depend.com/Media/VideoPlayer.swf",width:320,height:285,hasVersion:8,expressInstaller:"http://www.qa.ca.depend.com/Media/ExpressInstaller.swf",flashvars:{video:"http://www.qa.ca.depend.com/Scripts/Videos/Depend_RulesTheWorld_30.flv"},params:{base:"/Media/",wmode:"opaque",allowScriptAccess:"sameDomain"}});}};Depend.Extend(DependFlash.VideoPlayer,Depend.Core);DependUserControls.Confirmation=function(serverVars){this.ServerVars=serverVars;this.Initialize();};DependUserControls.Confirmation.prototype={Initialize:function(){var triggerSelector=this.ServerVars.triggerSelector;var confirmContainerSelector='#'+this.ServerVars.confirmContainer;$(triggerSelector).click(function(e){e.preventDefault();var control=this;confirm(confirmContainerSelector,function(){$(control).click();});});}};function confirm(selector,callback){$(selector).modal({close:false,overlayId:'confirmModalOverlay',containerId:'confirmModalContainer',onShow:function(dialog){dialog.data.find('.yes').click(function(){if($.isFunction(callback)){callback();}
$.modal.close();});dialog.data.find('.no').click(function(){$.modal.close();});$('form:first').bind('keypress',function(e){if(e.keyCode==27){$.modal.close();}});}});}
Depend.Extend(DependUserControls.Confirmation,Depend.Core);DependUserControls.QuickPost=function(serverVars){this.ServerVars=serverVars;this.Initialize();};DependUserControls.QuickPost.prototype={Initialize:function(){var quickPostContainerSelector='#'+serverVars.quickPostContainer;var quickPostService=new this.ServiceProxy('/Services/QuickPostService.asmx/');var intervalId,timeoutId,userId=serverVars.userId;var messagePanel=$('#qpMessage'),responsePanel=$('#qpResponses');var watermark='Enter Answer Here';var enableAnswers=serverVars.enableAnswers;$('#qpResponse').val(watermark);var randomQuickPostParams={quickPostId:serverVars.quickPostId,femaleKey:null,maleKey:null};$('#qpDisplayContainerHat').hide();DisplayAnswers();function DisplayAnswers(){if(enableAnswers===true){InvokeResponses();$('#qpAnswerHat').fadeOut(1000);SetUpTimedResponseDisplay();}else{responsePanel.hide();$('#divider').hide();}}
$('#qpResponse').focus(function(){var response=$('#qpResponse');if(response.val()===watermark){response.val('');}});$('#qpResponse').blur(function(){var response=$('#qpResponse');if(response.val()===''){response.val(watermark);}});var isError=false;var quickPostError=function(){isError=true;window.clearInterval(intervalId);window.clearTimeout(timeoutId);SetMessagePanelText('There has been a server error.  Our system administrators have been notified. Please try again later.');timeoutId=window.setTimeout(function(){SetUpTimedResponseDisplay();},5000);};var isNextAvailable=true;$('#qpNext').click(function(){if(isNextAvailable){isNextAvailable=false;window.clearInterval(intervalId);window.clearTimeout(timeoutId);var hat=$('#qpAnswerHat');hat.fadeIn(250,function(){InvokeResponses();hat.fadeOut(250);SetUpTimedResponseDisplay();isNextAvailable=true;});}});$('#qpSubmitResponse').click(function(){window.clearInterval(intervalId);window.clearTimeout(timeoutId);var response=$('#qpResponse').val();var gender=$('input[@name=gender]:checked').val();if(ValidateSubmission(response,gender)){$('#qpSubmitResponse').attr('disabled','disabled');var submitParams={quickPostId:serverVars.quickPostId,response:response,gender:gender,userId:userId};quickPostService.invoke('SubmitResponse',submitParams,function(result){var m;if(result){m='Thank you for participating! Would you like to connect with others and continue sharing your valuable viewpoint? Join our online community! <a href="http://fr.ca.depend.com/sdqa/Join.aspx" ><img src="http://fr.ca.depend.com/img/depend/FR_253.gif" alt="Inscrivez-vous d\350s maintenant" class="QPJoinNowBtn" /></a>';}else{m='There was an error submitting your response.  Please try again.';}
SetMessagePanelText(m);timeoutId=window.setTimeout(function(){$('#qpResponse').val(watermark);ResetMessagePanel();if(enableAnswers){SetUpTimedResponseDisplay();}
$('#qpSubmitResponse').removeAttr('disabled');},10000);isError=false;},quickPostError);}else{window.clearInterval(intervalId);SetMessagePanelText('Please enter your response, and be sure to click either the "I Am a Man" or "I Am a Woman" radio buttons.');timeoutId=window.setTimeout(function(){ResetMessagePanel();if(enableAnswers){SetUpTimedResponseDisplay();}},8000);}});function SetMessagePanelText(text){var hat=$('#qpDisplayContainerHat');hat.fadeIn(250,function(){responsePanel.hide();$('#qpSubmit').hide();$('#divider').hide();messagePanel.show();$('#qpMessageText').html(text);hat.fadeOut(250);});}
function ResetMessagePanel(){var hat=$('#qpDisplayContainerHat');hat.fadeIn(250,function(){messagePanel.hide();$('#qpMessageText').text('');$('#qpSubmit').show();if(enableAnswers){if(!responsePanel.is(':visible')){responsePanel.show();$('#divider').show();}}
hat.fadeOut(250);});}
function ValidateSubmission(response,gender){var success=true;if(response.length===0||response===watermark){success=false;}
if(gender===undefined){success=false;}
return success;}
function SetUpTimedResponseDisplay(){var hat=$('#qpAnswerHat');intervalId=window.setInterval(function(){hat.fadeIn(250,function(){InvokeResponses();hat.fadeOut(250);});},5000);}
function InvokeResponses(container){quickPostService.invoke('GetRandomResponse',randomQuickPostParams,function(result){$('#qpFemaleResponse').text(result[0].Value);$('#qpMaleResponse').text(result[1].Value);randomQuickPostParams.femaleKey=result[0].PrimaryKey;randomQuickPostParams.maleKey=result[1].PrimaryKey;if(isError){ResetMessagePanel();}
isError=false;},quickPostError);}}};Depend.Extend(DependUserControls.QuickPost,Depend.Core);DependUserControls.CreateComment=function(serverVars){this.ServerVars=serverVars;this.Initialize();};DependUserControls.CreateComment.prototype={Initialize:function(){$('#'+serverVars.commentId).charCounter(500,{container:'#commentTextCounter'});}};function ValidateComment(source,arguments){var length=arguments.Value.length;if(length<2||length>500){$('#'+source.id).html('Please enter your comment.');arguments.IsValid=false;}else{arguments.IsValid=true;}}
Depend.Extend(DependUserControls.CreateComment,Depend.Core);Depend.ProductSelector=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.ProductSelector.prototype={Initialize:function(){var psContainer=this.ServerVars.container;var psSelection=null;var updateContinueState=function(){var next=$('.NavigationNext',psContainer)[0];if(next!==null){if($('input[@type=radio]:checked',psContainer).length==1){$(next).removeClass('NavigationDisabled');$(next).removeAttr("disabled");}else{$(next).addClass('NavigationDisabled');$(next).attr("disabled",true);}}};var updateSelectionState=function(source){var success=false;$('input[@type=radio]',psContainer).each(function(){if(this.checked){$(this).parent().addClass('Selected');}else{$(this).parent().removeClass('Selected');}});updateContinueState();};$('li > a',psContainer).click(function(){var radio=$('input[@type=radio]',this)[0];if(radio!==null){radio.checked=!radio.checked;}
updateSelectionState(this);return false;});updateSelectionState();}};Depend.Extend(Depend.ProductSelector,Depend.Core);Depend.Profile=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Profile.prototype={Initialize:function(){$(serverVars.container+' :input').change(function(){console.log('form changed');});}};Depend.Extend(Depend.Profile,Depend.Core);Depend.Friends=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Friends.prototype={Initialize:function(){$(serverVars.container+' :input').change(function(){console.log('form changed');});}};Depend.Extend(Depend.Friends,Depend.Core);Depend.Bookmark=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Bookmark.prototype={Initialize:function(){$(serverVars.bookmarkSelector).jFav();}};Depend.Extend(Depend.Bookmark,Depend.Core);Depend.Print=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Print.prototype={Initialize:function(){$(serverVars.printSelector).click(function(){window.print();return false;});}};Depend.Extend(Depend.Print,Depend.Core);Depend.Join=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.Join.prototype={Initialize:function(){$(document).ready(function(){var first=$(serverVars.container+' :text:first').focus();ShowToolTip(first);});$(serverVars.container+' :text, :password').focus(function(){ShowToolTip(this);});$(serverVars.container+' :text, :password').blur(function(){$('.RegistrationTooltip').addClass('Hidden');});function ShowToolTip(element){var focusedSelector='#'+$(element).attr('id');var tooltipSelector='#'+$(focusedSelector).attr('class');$(tooltipSelector).removeClass('Hidden');}}};Depend.Extend(Depend.Join,Depend.Core);Depend.AddFriend=function(serverVars){this.ServerVars=serverVars;this.Initialize();};Depend.AddFriend.prototype={Initialize:function(){var watermark=serverVars.watermark;var messageBox=$(serverVars.messageBoxSelector);messageBox.focus(function(){if(messageBox.val()===watermark){messageBox.val('');}});messageBox.blur(function(){if(messageBox.val()===''){messageBox.val(watermark);}});messageBox.charCounter(500,{container:'#charCounter',format:'(%1 characters remaining)'});}};Depend.Extend(Depend.AddFriend,Depend.Core);
