/**
 * Copyright (C) 2009-2010 LeadFormix, Inc. All Rights Reserved.
 * LeadFormix PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * @link http://www.leadformix.com
 *
 * For further information, contact:
 * mailto:support@leadformix.com or mailto:cs@leadformix.com
 */
var LFC=LFC||{};LFC=(function(){var d=document,w=window,n="none",minheight=0,maxheight=266,time=800,timer=null,toggled=false,TTF=1000.0,site="http://www.leadformix.com/",url=site+"bf/uploads/lfxwidget/campaign/";if(typeof lfc!="undefined"){dObj=eval('('+lfc+')');for(var key in dObj){dObj[key]=unescape(dObj[key].replace(/\+/g," "))}}function loadInData(){var mailVal=d.getElementById('Email').value;IN.API.Profile("me").fields(["firstName","lastName","headline","publicProfileUrl","location","industry","positions"]).result(function(result){profile=result.values[0];var pos=profile.positions.values;var posno=pos.length;for(var k=0;k<posno;k++){if(profile.positions.values[k].isCurrent==true){var comp=profile.positions.values[k].company.name}}var inDataStr='LFMIdsite='+dObj.siteid+'&LFMC='+getCookie("_vt_")+'&_form_name_=lfxcampaignleadhook_lfxcampaignleadhook'+dObj.hookid+'&FirstName='+profile.firstName+'&LastName='+profile.lastName+'&Email='+mailVal+'&in_prof_url='+profile.publicProfileUrl+'&in_prof_head='+profile.headline+'&in_prof_loc='+profile.location.name+'&Industry='+profile.industry+'&Company='+comp;lfSendData(inDataStr)});IN.User.logout();LFC.lfFadeOut('lfx_basic_campaign_form');setTimeout("LFC.showappre()",1000);return false}function inAuth(){var mailVal=d.getElementById('Email');if(mailVal.value==''||mailVal.value=='Email'){alert("Please provide your email id");mailVal.focus();return false}else if(mailVal.value!=''){var emailPat=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var matchArray;var emailStr=mailVal.value;if(emailStr.length>0){matchArray=emailStr.match(emailPat);if(matchArray==null){alert("Please enter correct email id.");mailVal.focus();return false}else{IN.User.authorize(LFC.inLData)}}}}function facebookLogin(){FB.login(function(response){if(response.session){FB.api({method:'fql.query',query:'SELECT first_name,last_name,locale FROM user WHERE uid='+FB.getSession().uid},function(response){var fbDataStr='LFMIdsite='+dObj.siteid+'&LFMC='+getCookie("_vt_")+'&_form_name_=lfxcampaignleadhook_lfxcampaignleadhook'+dObj.hookid+'&FirstName='+response[0].first_name+'&LastName='+response[0].last_name+'&Email='+d.getElementById('Email').value+'&Location='+response[0].locale;lfSendData(fbDataStr);FB.logout(function(response){});LFC.lfFadeOut('lfx_basic_campaign_form');setTimeout("LFC.showappre()",1000);return false})}},{perms:'email'})}function fbAuth(){var mailVal=d.getElementById('Email');if(mailVal.value==''||mailVal.value=='Email'){alert("Please provide your email id");mailVal.focus();return false}else if(mailVal.value!=''){var emailPat=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var matchArray;var emailStr=mailVal.value;if(emailStr.length>0){matchArray=emailStr.match(emailPat);if(matchArray==null){alert("Please enter correct email id.");mailVal.focus();return false}else{facebookLogin()}}}}function addEventListener(element,eventType,eventHandler,useCapture){var browserName=navigator.userAgent;if(element.addEventListener){element.addEventListener(eventType,eventHandler,useCapture);return true}else if(element.attachEvent){return element.attachEvent('on'+eventType,eventHandler)}element['on'+eventType]=eventHandler}function getCookie(cookieName,path,domain){var cookiePattern=new RegExp('(^|;)[ ]*'+cookieName+'=([^;]*)'+(path?'(;[ ]*expires=[^;]*)?;[ ]*path='+path.replace('/','\\/')+'':'')+(domain?';[ ]*domain='+domain+'(;|$)':'')),cookieMatch=cookiePattern.exec(d.cookie),unescapeWrapper=w.decodeURIComponent||unescape;return cookieMatch?unescapeWrapper(cookieMatch[2]):0}function clickHandler(tAlias){var buildUrl="idsite="+dObj.siteid+"&link="+encodeURIComponent(d.location.href)+"&rand="+Math.random()+"&redirect=0&title="+encodeURIComponent(d.title)+"&titleAlias="+encodeURIComponent(tAlias)+"&vt_="+encodeURIComponent(getCookie("_vt_"));var image=new Image(1,1),dest="http://vlog.leadformix.com/bf/bf.php";image.src=dest+"?"+buildUrl;image.onLoad=function(){setTimeout("lfKillSomeTime()",1000)}}function setLFMC(){try{d.getElementById('LFMC').value=getCookie("_vt_")}catch(e){}}function lfGetIEVersion(){var browser=-1;if(navigator.appName=='Microsoft Internet Explorer'){var ua=navigator.userAgent;var ieRegex=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(ieRegex.exec(ua)!=null){browser=parseFloat(RegExp.$1)}}return browser}function lfKillTime(){}function lfShowHide(startDate,endDate){var lfTodayDate=new Date();var startDate=new Date(startDate);var endDate=new Date(endDate);var lfStartTimeDiff=(startDate.getTime()-lfTodayDate.getTime());var lfStartDateDiff=Math.ceil(lfStartTimeDiff/(1000*3600*24));var lfEndTimeDiff=(lfTodayDate.getTime()-endDate.getTime());var lfEndDateDiff=Math.floor(lfEndTimeDiff/(1000*3600*24));if(lfStartDateDiff<=0&&lfEndDateDiff<=0){return true}else{return false}}function lfSerialize(formID){var lfAllInputs=d.getElementById(formID).getElementsByTagName('input');var lfInputsLength=lfAllInputs.length;var lfCombineStr="";for(var i=0;i<lfInputsLength;i++){if(lfAllInputs[i].getAttribute("type")=="text"||lfAllInputs[i].getAttribute("type")=="hidden"){lfInputName=lfAllInputs[i].getAttribute("name");lfInputValue=lfAllInputs[i].value;lfCombineStr+=lfInputName+'='+lfInputValue+'&'}else{lfCombineStr+=''}}lfSendData(lfCombineStr)}function lfBuildc(){var OutputStr='<div style="background:url('+url+'backgrounds/'+dObj.design+dObj.color+'.png) no-repeat left top;width:616px;position:fixed;'+dObj.align+'bottom:0;font-family:Arial, Helvetica, sans-serif !important;font-size:12px !important;line-height:normal !important;z-index:999999"><div style="width:190px;height:39px;float:left;padding:'+dObj.tpad+';font-weight:bold !important;text-align:center !important;color:#47484a !important;vertical-align:middle;">'+dObj.head+'<img id="lfx_basic_slide_toggle" src="'+url+'open.png" style="cursor:pointer;position:absolute;top:40px;'+dObj.toggler+'" /></div><div id="lfx_basic_slider" style="width:546px;height:0;float:left;display:block;padding:0 35px !important"><div style="width:304px;height:266px;float:left;margin:0 20px 0 0 !important"><div style="width:304px;height:224px;float:left"><div style="width:304px;max-height:74px;height:auto;min-height:50px;float:left;font-size:30px !important;font-weight:bold !important;color:#000000 !important;text-align:left !important;line-height:31px !important;overflow:hidden">'+dObj.title+'</div><div style="width:150px;height:150px;float:left;margin:0 8px 0 0 !important;overflow:hidden"><img src="'+url+dObj.banner+'" width="'+dObj.width+'" height="'+dObj.height+'" align="left"></div><div style="width:146px;height:150px;float:right;text-align:left !important;line-height:normal !important;font-size:13px !important;color:#1a1a1a !important;overflow:hidden">'+dObj.desc+'</div></div><div style="width:304px;height:25px;float:left;margin:17px 0 0 0 !important"><a href="http://www.leadformix.com/"><img src="'+site+'bf/uploads/lfxwidget/'+dObj.power+'" width="82" height="10" border="0" /></a></div></div>';if(dObj.form==1){OutputStr+='<div id="lfx_basic_dynamic" style="background:url('+url+'bg_form.png) no-repeat left top;width:198px;height:246px;float:right;margin:0 0 10px 0 !important;padding:10px 12px 0 12px !important"><div id="lfx_basic_campaign_form" style="width:198px;height:246px"><input type="hidden" name="LFMIdsite" value="'+dObj.siteid+'" /><input type="hidden" name="LFMC" id="LFMC" value="0" /><input type="hidden" name="_form_name_" value="lfxcampaignleadhook_lfxcampaignleadhook'+dObj.hookid+'" /><table cellspacing="0" cellpadding="0" border="0" width="198">';var fieldStr=dObj.fields;var dataArray=new Array();dataArray=fieldStr.split(",");for(var j=0;j<dataArray.length;j++){if(dataArray[j]=="Name"){OutputStr+='<tr><td width="99" height="40" align="left" valign="top"><input id="FirstName" type="text" value="FirstName" name="FirstName" style="width:88px;height:26px;border:solid 1px #c6c6c6;padding:0 0 0 5px;line-height:28px;color:#999;font-size:14px" onfocus="LFC.lfFocus(this.id)" onblur="LFC.lfBlur(this.id)" /></td><td width="99" height="40" align="right" valign="top"><input id="LastName" type="text" value="LastName" name="LastName" style="width:88px;height:26px;border:solid 1px #c6c6c6;padding:0 0 0 5px;line-height:28px;color:#999;font-size:14px" onfocus="LFC.lfFocus(this.id)" onblur="LFC.lfBlur(this.id)" /></td></tr>'}else{OutputStr+='<tr><td colspan="2" height="40" valign="top"><input id="'+dataArray[j]+'" type="text" value="'+dataArray[j]+'" name="'+dataArray[j]+'" style="width:191px;height:26px;border:solid 1px #c6c6c6;margin:0;padding:0 0 0 5px;line-height:28px;color:#999;font-size:14px" onfocus="LFC.lfFocus(this.id)" onblur="LFC.lfBlur(this.id)" /></td></tr>'}}OutputStr+='<tr><td colspan="2" height="55" align="center" valign="top"><input id="submit" type="submit" value="" name="submit" onclick="return LFC.lfCheck();" style="width:192px;height:47px;background:url('+url+'buttons/'+dObj.button+'.png) no-repeat left top;border:none;cursor:pointer;padding:0;display:block;" /></td></tr><tr><td colspan="2" align="center" height="20" id="lfx_basic_poperror" style="font-size:11px !important;color:red !important"></td></tr>';if(dObj.linked!=""||dObj.facebook!=""){var social=(dObj.linked!="")?'<img align="absmiddle" src="'+url+'btn_linkedin1.png" width="27" height="27" border="0" onclick="LFC.inData()" style="cursor:pointer;float:left;margin:0 0 0 5px" />&nbsp;':'';social+=(dObj.facebook!="")?'<div id="fb-root" style="display:none;"></div><img align="absmiddle" src="'+url+'btn_facebook1.png" width="27" height="27" border="0" onclick="LFC.fbLog();return false;" style="cursor:pointer;float:left;margin:0 0 0 5px" />':'';OutputStr+='<tr><td colspan="2" height="37"><div style="background:url('+url+'img_bg.png) no-repeat left top;width:188px;height:27px;float:left;margin:0 !important;padding:5px 0 5px 10px !important;line-height:27px !important;font-size:14px !important;color:#5b5b5b"><span style="float:left">Or access using</span>&nbsp;&nbsp;&nbsp;'+social+'</div></td></tr>'}OutputStr+='</table></div><div id="lfx_basic_appre" style="width:198px;height:231px;text-align:justify !important;color:#1a1a1a !important;opacity:0;-moz-opacity:0.0;-khtml-opacity:0;filter:alpha(opacity=0);display:block">'+dObj.thank+'</div></div>'}else{OutputStr+='<div id="lfx_basic_dynamic" style="background:url('+url+'bg_social.png) no-repeat left top;width:198px;height:140px;float:right;margin:74px 0 42px 0 !important;padding:10px 12px 0 12px !important"><div id="lfx_basic_campaign_form" style="width:198px;height:130px;margin:10px 0 0 0 !important"><table width="198" border="0" cellspacing="0" cellpadding="0"><tr><td height="33" align="center" valign="top"><input id="Email" type="text" value="Email" name="Email" style="width:184px;height:26px;border:solid 1px #c6c6c6;margin:0;padding:0 0 0 5px;line-height:28px;color:#999;font-size:14px" onfocus="LFC.lfFocus(this.id)" onblur="LFC.lfBlur(this.id)" /></td></tr>';OutputStr+=(dObj.linked!="")?'<tr><td height="45" align="center"><img align="absmiddle" src="'+url+'btn_linkedin.png" width="189" height="43" border="0" onclick="LFC.inData()" style="cursor:pointer" /></td></tr>':'';OutputStr+=(dObj.facebook!="")?'<tr><td height="45" align="center"><div id="fb-root" style="display:none;"></div><img src="'+url+'btn_facebook.png" width="189" height="43" border="0" onclick="LFC.fbLog();return false;" style="cursor:pointer" /></td></tr>':'';OutputStr+='</table></div><div id="lfx_basic_appre" style="width:198px;height:231px;text-align:justify !important;color:#1a1a1a !important;opacity:0;-moz-opacity:0.0;-khtml-opacity:0;filter:alpha(opacity=0);display:block">'+dObj.thank+'</div></div>'}OutputStr+='</div></div>';if(dObj.linked!=""){OutputStr+='<script type="text/javascript" src="http://platform.linkedin.com/in.js">\napi_key: '+dObj.linked+'\nauthorize: true\n</script>'}if(dObj.facebook!=""){OutputStr+='<script src="http://connect.facebook.net/en_US/all.js"></script>\n<script>\nFB.init({ appId: \''+dObj.facebook+'\', status: true, cookie: true, xfbml: true });\n</script>'}try{var b=d.getElementsByTagName('body');var div_=d.createElement('div');div_.innerHTML=OutputStr;b[0].appendChild(div_)}catch(e){}}function lfSendData(formData){var image=new Image(1,1),dest="http://www.leadformix.com/bf/FormCapture.php";image.src=dest+"?"+formData;image.onLoad=function(){setTimeout("lfKillSomeTime()",1000)}}function chkForm(){var lfAllInputs=d.getElementById('lfx_basic_campaign_form').getElementsByTagName('input');var lfInputsLength=lfAllInputs.length;for(var i=0;i<lfInputsLength;i++){if(lfAllInputs[i].getAttribute("type")=="text"){if(lfAllInputs[i].value==''||lfAllInputs[i].value==lfAllInputs[i].getAttribute("name")){d.getElementById('lfx_basic_poperror').innerHTML="Please enter your "+lfAllInputs[i].getAttribute("name");lfAllInputs[i].focus();return false}else if(lfAllInputs[i].getAttribute("name")=='Email'){var emailPat=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;var matchArray;var emailStr=lfAllInputs[i].value;if(emailStr.length>0){matchArray=emailStr.match(emailPat);if(matchArray==null){d.getElementById('lfx_basic_poperror').innerHTML="Please enter correct email id.";lfAllInputs[i].focus();return false}}}}}lfSerialize('lfx_basic_campaign_form');LFC.lfFadeOut('lfx_basic_campaign_form');setTimeout("LFC.showappre()",1000);return false}function lfSliderc(){var controler1=d.getElementById('lfx_basic_slide_toggle');var slider1=d.getElementById('lfx_basic_slider');clearInterval(timer);var instanceheight=parseInt(slider1.style.height);var init=(new Date()).getTime();var height=(toggled=!toggled)?maxheight:minheight;var disp=height-parseInt(slider1.style.height);(parseInt(slider1.style.height)==0)?clickHandler("CAMPAIGNHOOKOPENCLICK"+dObj.hookid):clickHandler("CAMPAIGNHOOKCLOSECLICK"+dObj.hookid);timer=setInterval(function(){var instance=(new Date()).getTime()-init;if(instance<time){var pos=Math.floor(disp*instance/time);result=instanceheight+pos;slider1.style.height=result+'px'}else{slider1.style.height=height+'px';clearInterval(timer);controler1.src=toggled?url+'close.png':url+'open.png'}},1)}return{processc:function(){if(typeof dObj!="undefined"){if(lfShowHide(dObj.startdate,dObj.enddate)==true&&(lfGetIEVersion()>=7.0||lfGetIEVersion()==-1)){lfBuildc();setLFMC();var controler=d.getElementById('lfx_basic_slide_toggle');var slider=d.getElementById('lfx_basic_slider');slider.style.height=minheight+'px';addEventListener(controler,'click',lfSliderc)}}},lfSetOpac:function(fid,opac){elem=d.getElementById(fid);elem.style.opacity=opac;elem.style.MozOpacity=opac;elem.style.KhtmlOpacity=opac;elem.style.filter='alpha(opacity='+(opac*100)+');'},showappre:function(){var child=d.getElementById('lfx_basic_campaign_form');var parent=d.getElementById('lfx_basic_campaign_form').parentNode;parent.removeChild(child);LFC.lfFadeIn('lfx_basic_appre')},lfFadeOut:function(fid){for(i=0;i<=1;i+=0.01){setTimeout("LFC.lfSetOpac('"+fid+"',"+(1-i)+")",i*TTF)}},lfFadeIn:function(fid){for(i=0;i<=1;i+=.01){setTimeout("LFC.lfSetOpac('"+fid+"',"+i+")",i*TTF)}},lfFocus:function(getid){if(d.getElementById(getid).value==getid){d.getElementById(getid).value=''}},lfBlur:function(getid){if(d.getElementById(getid).value==''){d.getElementById(getid).value=getid}},lfCheck:function(){return chkForm()},inData:function(){return inAuth()},inLData:function(){return loadInData()},fbLog:function(){return fbAuth()}}})();LFC.processc();
