(function($){$.tid={tooltip:function(b){var c={selector:'.tooltip',xOffset:10,yOffset:25,clickRemove:false,id:'qp_tooltip',content:'',useElement:''};if(typeof b=='string')c.selector=b;var b=$.extend(c,b);var d;return $(b.selector).each(function(){var a=$(this).attr('title');$(this).hover(function(e){d=(b.content!='')?b.content:a;d=(b.useElement!='')?$('#'+b.useElement).html():d;$(this).attr('title','');if(d!=''&&d!=undefined){$('body').append('<div id="'+b.id+'">'+d+'</div>');$('#'+b.id).css({'position':'absolute','display':'none'}).css('top',(e.pageY-b.yOffset)+'px').css('left',(e.pageX+b.xOffset)+'px').fadeIn('fast')}},function(){$('#'+b.id).remove();$(this).attr('title',a)});$(this).mousemove(function(e){var x=((e.pageX+b.xOffset+$(this).width())<$(window).width())?(e.pageX+b.xOffset):(e.pageX-b.xOffset-$(this).width()-16);$('#'+b.id).css('top',(e.pageY-b.yOffset)+'px').css('left',(x+'px'))});if(b.clickRemove){$(this).mousedown(function(e){$('#'+b.id).remove();$(this).attr('title',a)})}})},popup:function(x){var y={selector:'.popup',popupId:'qp_popup',preloadText:'Loading...',errorText:'There has been a problem with your request, please click outside this window to close it.',closeText:'Close',prevText:'&laquo; Previous',nextText:'Next &raquo;'};if(typeof x=='string')y.selector=x;var x=$.extend(y,x);return $(x.selector).each(function(i){if($(this).hasClass('gallery')){var v=$(this).attr('class');v=v.split(' ').join('');$.data(this,'gallery',v);eval('if((typeof '+v+'_arr == "undefined")) '+v+'_arr= new Array()');eval(v+'_arr').push($(this));$.data(this,'index',eval(v+'_arr').length-1)};$(this).bind('click',function(e){e.preventDefault();if($.browser.opera)$.support.opacity=true;var d=$.browser.msie&&$.browser.version.substr(0,1)<7;var f=$.browser.opera&&$.browser.version<=9.5;var w=$(window).width();var h=$(document).height();var g=$(window).width()/2;var j=$(window).height()/2;show=function(){$('#'+x.popupId+'preloader').remove();if(n!=0)$('#'+x.popupId+'content').css('width',n+'px');if(o!=0)$('#'+x.popupId+'content').css('height',o+'px');set($('#'+x.popupId+'content'));$('img','#'+x.popupId+'content').css('visibility','visible')};set=function(a){$(a).css({'padding':'10px','background':'#fff','color':'#333','text-align':'left','float':'left','position':'fixed','z-index':'10001','visible':'hidden'});var b=g-$(a).width()/2;var c=j-$(a).height()/2;$(a).css({'left':b,'top':c,'display':'none'}).fadeIn('1000');if(d)$(a).css({'position':'absolute','top':(c+$(window).scrollTop())+'px'});if(f)$(a).css({'position':'absolute','top':(document.body['clientHeight']/2-$(a).height()/2+$(window).scrollTop())+'px'});$('.caption',a).css({'width':$(a).width()+'px','display':'block'})};if(d)$('embed, object, select').css('visibility','hidden');error=function(){$('#'+x.popupId+'content').text(x.errorText);show()};remove=function(){$('#'+x.popupId).remove();$('#'+x.popupId+'content').remove();$('#'+x.popupId+'preloader').remove();if(d)$('embed, object, select').css('visibility','visible')};if($('#'+x.popupId).length==0){$('<div id="'+x.popupId+'"></div>').appendTo('body').css({'width':w,'height':h,'background':'#000','position':'absolute','top':'0','left':'0','z-index':'10000','opacity':.8}).click(function(){remove()})};var k=$(this).attr('href');var l=k.substr(k.lastIndexOf('.')).toLowerCase();var m;var n=0;var o=0;var p=false;$('<div id="'+x.popupId+'preloader">'+x.preloadText+'</div>').appendTo('body');set($('#'+x.popupId+'preloader'));$('<div id="'+x.popupId+'content"></div>').appendTo('body');if($(this).hasClass('flash')){var q='<object width="100%" height="100%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+k+'" /><embed src="'+k+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%"></embed></object>';$(q).appendTo('#'+x.popupId+'content');n=600;o=400;p=true}else{if(l=='.jpg'||l=='.jpeg'||l=='.gif'||l=='.png'||l=='.bmp'){var r=new Image();$(r).error(function(){error()}).css('visibility','hidden').appendTo('#'+x.popupId+'content');r.onload=function(){show();r.onload=function(){}};r.src=k+'?'+(new Date()).getTime()+' ='+(new Date()).getTime()}else if(k.charAt(0)=='#'){$(k).clone().removeClass('hidden').show().appendTo('#'+x.popupId+'content');$.tid.forms('#'+x.popupId+'content form');p=true}else{$('<iframe frameborder="0" scrolling="auto" style="width:100%;height:100%" src="'+k+'" />').appendTo('#'+x.popupId+'content');n=900;o=500;p=true}};var s=$(this).attr('rel').split(';');$.each(s,function(i){if(s[i].indexOf('width')!=-1)n=s[i].split(':')[1];if(s[i].indexOf('height')!=-1)o=s[i].split(':')[1]});if($(this).attr('title')!=''){$('<span class="caption">'+$(this).attr('title')+'</span>').appendTo('#'+x.popupId+'content').css({'display':'none','padding':'10px 0 0 0'})};if(p)show();$('<small>'+x.closeText+'</small>').appendTo('#'+x.popupId+'content').css({'position':'absolute','float':'left','left':'0','top':'-24px','color':'#fff','font-weight':'700','cursor':'pointer'}).click(function(){remove()});if($(this).hasClass('gallery')){var t=$.data(this,'gallery');t=eval(t+'_arr');var u=$.data(this,'index');if(t.length>1){$('<small>'+(u+1)+'/'+t.length+'</small>').appendTo('#'+x.popupId+'content').css({'position':'absolute','float':'right','right':'0','bottom':'-24px','color':'#fff','cursor':'pointer'});$('<small id="'+x.popupId+'gallery"></small>').appendTo('#'+x.popupId+'content').css({'position':'absolute','float':'left','left':'0','bottom':'-24px','color':'#fff','cursor':'pointer'});if(u!=0){$('<span>'+x.prevText+'</span>').css('margin-right','5px').appendTo('#'+x.popupId+'gallery').click(function(){$('#'+x.popupId+'content').remove();var a=t[u-1];$(a).trigger('click')})}if(u<t.length-1){$('<span>'+x.nextText+'</span>').appendTo('#'+x.popupId+'gallery').click(function(){$('#'+x.popupId+'content').remove();var a=t[u+1];$(a).trigger('click')})}}}})})},external:function(b){var c={selector:'a'};if(typeof b=='string')c.selector=b;var b=$.extend(c,b);var d=window.location.hostname;d=d.replace('www.','').toLowerCase();return $(b.selector).each(function(){var a=$(this).attr('href').toLowerCase();if(a.indexOf('http://')!=-1&&a.indexOf(d)==-1){$(this).attr('target','_blank');$(this).addClass('external')}})},rotate:function(e){var f={selector:'.rotate',pause:5000,randomize:false};if(typeof e=='string')f.selector=e;var e=$.extend(f,e);return $(e.selector).each(function(){var b=$(this);var c=$(b).children().length;var d=0;function getRan(){var a=Math.floor(Math.random()*c)+1;return a};function show(){if(e.randomize){var a=getRan();while(a==d){a=getRan()};d=a}else{d=(d==c)?1:d+1};$(b).children().hide();$(':nth-child('+d+')',b).fadeIn('slow')};show();setInterval(show,e.pause)})},cycle:function(e){var f={selector:'.cycle',effect:'fade',pause:5000};if(typeof e=='string')f.selector=e;var e=$.extend(f,e);return $(e.selector).each(function(){var a=$(this);var b=$(a).children().length;var c=0;var d=-1;var z=1;var h=$(':nth-child(1)',a).height();$(a).css('position','relative').height(h);$(a).children().hide().css({'position':'absolute','top':'0','left':'0'});function show(){c=(c==b)?1:c+1;d=(c==1)?b:c-1;$(':nth-child('+c+')',a).css('z-index',z).fadeIn('slow',function(){$(':nth-child('+d+')',a).fadeOut('slow')});z++};show();setInterval(show,e.pause)})},jump:function(c){var d={selector:'a.jump',speed:1000};if(typeof c=='string')d.selector=c;var c=$.extend(d,c);return $(c.selector).click(function(){var a=$($(this).attr('href'));var b=$(a).offset().top;$('html,body').animate({scrollTop:b},1000,'linear')})},showhide:function(b){var c={selector:'.toggle'};if(typeof b=='string')c.selector=b;var b=$.extend(c,b);return $(b.selector).each(function(){var a;if($(this).hasClass('prev')){a=$(this).prev().hide()}else if($(this).hasClass('id')){a=$(this).attr('href');a=$(a).hide()}else{a=$(this).next().hide()};$(this).css('cursor','pointer');$(this).toggle(function(){$(this).addClass('expanded');$(a).slideDown()},function(){$(a).slideUp();$(this).removeClass('expanded')})})},forms:function(f){var g={selector:'form',err:'This is required',errEmail:'Valid email address is required',errUrl:'URL is required',errPhone:'Phone number is required',notValidClass:'notvalid'};function check(a){if($(a).val()==''||checkLabel(a)){var b=($(a).attr('title')!='')?$(a).attr('title'):f.err;error(a,b)}};function checkRegEx(a,b){var c,err;switch(b){case'url':c=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;err=f.errUrl;break;case'phone':var c=/[\d\s_-]/;err=f.errPhone;break;default:c=/^[^@]+@[^@]+.[a-z]{2,}$/;err=f.errEmail};var d=$(a).val();if(d.search(c)==-1||checkLabel(a)){var e=($(a).attr('title')!='')?$(a).attr('title'):err;error(a,e)}};function checkLabel(a){var b=$('label[for='+$(a).attr('id')+']').text();return(b==$(a).val())};function error(a,b){var c=$(a).parent();c.append('<span class="error">'+b+'</span>');$('span.error',c).hide().fadeIn('fast');$(a).addClass(f.notValidClass);valid=false};$('input.label,textarea.label').each(function(){var a=$('label[for='+$(this).attr('id')+']').text();$('label[for='+$(this).attr('id')+']').css('display','none');$(this).val(a);$(this).focus(function(){if($(this).val()==a)$(this).val('')});$(this).blur(function(){if($(this).val()=='')$(this).val(a)})});if(typeof f=='string')g.selector=f;var f=$.extend(g,f);return $(f.selector).each(function(){$(this).submit(function(){$('.error',this).remove();$('.'+f.notValidClass,this).removeClass(f.notValidClass);valid=true;$(':text.required',this).each(function(){if($(this).hasClass('email')){checkRegEx(this,'email')}else if($(this).hasClass('url')){checkRegEx(this,'url')}else if($(this).hasClass('phone')){checkRegEx(this,'phone')}else{check(this)}});$(':password.required',this).each(function(){check(this)});$('textarea.required',this).each(function(){check(this)});$(':checkbox.required',this).each(function(){if(!$(this).attr('checked')){var a=($(this).attr('title')!='')?$(this).attr('title'):f.err;error(this,a)}});return valid})})}}})(jQuery);