/*
 * jQuery Nivo Slider v1.9
 * http://nivo.dev7studios.com
 *
 * Copyright 2010, Gilbert Pellegrom
 * Free to use and abuse under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * April 2010 - controlNavThumbs option added by Jamie Thompson (http://jamiethompson.co.uk)
 * March 2010 - manualAdvance option added by HelloPablo (http://hellopablo.co.uk)
 */

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(9($){$.1h.1i=9(1T){b 4=$.2b({},$.1h.1i.21,1T);K g.F(9(){b 3={e:0,n:\'\',T:0,u:\'\',H:l,1f:l,1O:l};b 5=$(g);5.1Q(\'7:3\',3);5.f(\'2h\',\'2i\');5.w(\'1X\');5.x(\'1X\');5.1c(\'1i\');b d=5.2f();d.F(9(){b o=$(g);6(!o.J(\'D\')){6(o.J(\'a\')){o.1c(\'7-2e\')}o=o.1n(\'D:1m\')}b 13=o.w();6(13==0)13=o.t(\'w\');b 18=o.x();6(18==0)18=o.t(\'x\');6(13>5.w()){5.w(13)}6(18>5.x()){5.x(18)}o.f(\'S\',\'1z\');3.T++});6(4.16>0){6(4.16>=3.T)4.16=3.T-1;3.e=4.16}6($(d[3.e]).J(\'D\')){3.n=$(d[3.e])}k{3.n=$(d[3.e]).1n(\'D:1m\')}6($(d[3.e]).J(\'a\')){$(d[3.e]).f(\'S\',\'1v\')}5.f(\'Y\',\'W(\'+3.n.t(\'M\')+\') Q-R\');23(b i=0;i<4.h;i++){b E=1d.2a(5.w()/4.h);6(i==4.h-1){5.P($(\'<A B="7-c"></A>\').f({29:(E*i)+\'12\',w:(5.w()-(E*i))+\'12\'}))}k{5.P($(\'<A B="7-c"></A>\').f({29:(E*i)+\'12\',w:E+\'12\'}))}}5.P($(\'<A B="7-L"><p></p></A>\').f({S:\'1z\',y:4.20}));6(3.n.t(\'1a\')!=\'\'){$(\'.7-L p\',5).1B(3.n.t(\'1a\'));$(\'.7-L\',5).1y(4.q)}b j=0;6(!4.1g){j=1o(9(){C(5,d,4,l)},4.1j)}6(4.V){5.P(\'<A B="7-V"><a B="7-25">2d</a><a B="7-27">2k</a></A>\');6(4.1N){$(\'.7-V\',5).24();5.1W(9(){$(\'.7-V\',5).2c()},9(){$(\'.7-V\',5).24()})}$(\'a.7-25\',5).1s(\'1u\',9(){6(3.H)K l;X(j);j=\'\';3.e-=2;C(5,d,4,\'1r\')});$(\'a.7-27\',5).1s(\'1u\',9(){6(3.H)K l;X(j);j=\'\';C(5,d,4,\'1q\')})}6(4.G){b 1l=$(\'<A B="7-G"></A>\');5.P(1l);23(b i=0;i<d.22;i++){6(4.1L){b o=d.1w(i);6(!o.J(\'D\')){o=o.1n(\'D:1m\')}1l.P(\'<a B="7-1t" 1x="\'+i+\'"><D M="\'+o.t(\'M\').2g(4.1R,4.1S)+\'"></a>\')}k{1l.P(\'<a B="7-1t" 1x="\'+i+\'">\'+i+\'</a>\')}}$(\'.7-G a:1w(\'+3.e+\')\',5).1c(\'1b\');$(\'.7-G a\',5).1s(\'1u\',9(){6(3.H)K l;6($(g).2j(\'1b\'))K l;X(j);j=\'\';5.f(\'Y\',\'W(\'+3.n.t(\'M\')+\') Q-R\');3.e=$(g).t(\'1x\')-1;C(5,d,4,\'1t\')})}6(4.1Z){$(2m).2z(9(1A){6(1A.1V==\'2w\'){6(3.H)K l;X(j);j=\'\';3.e-=2;C(5,d,4,\'1r\')}6(1A.1V==\'2y\'){6(3.H)K l;X(j);j=\'\';C(5,d,4,\'1q\')}})}6(4.1U){5.1W(9(){3.1f=N;X(j);j=\'\'},9(){3.1f=l;6(j==\'\'&&!4.1g){j=1o(9(){C(5,d,4,l)},4.1j)}})}5.2A(\'7:U\',9(){3.H=l;$(d).F(9(){6($(g).J(\'a\')){$(g).f(\'S\',\'1z\')}});6($(d[3.e]).J(\'a\')){$(d[3.e]).f(\'S\',\'1v\')}6(j==\'\'&&!3.1f&&!4.1g){j=1o(9(){C(5,d,4,l)},4.1j)}4.1M.1p(g)})});9 C(5,d,4,14){b 3=5.1Q(\'7:3\');6((!3||3.1O)&&!14)K l;4.1K.1p(g);6(!14){5.f(\'Y\',\'W(\'+3.n.t(\'M\')+\') Q-R\')}k{6(14==\'1r\'){5.f(\'Y\',\'W(\'+3.n.t(\'M\')+\') Q-R\')}6(14==\'1q\'){5.f(\'Y\',\'W(\'+3.n.t(\'M\')+\') Q-R\')}}3.e++;6(3.e==3.T){3.e=0;4.1P.1p(g)}6(3.e<0)3.e=(3.T-1);6($(d[3.e]).J(\'D\')){3.n=$(d[3.e])}k{3.n=$(d[3.e]).1n(\'D:1m\')}6(4.G){$(\'.7-G a\',5).2B(\'1b\');$(\'.7-G a:1w(\'+3.e+\')\',5).1c(\'1b\')}6(3.n.t(\'1a\')!=\'\'){6($(\'.7-L\',5).f(\'S\')==\'1v\'){$(\'.7-L p\',5).28(4.q,9(){$(g).1B(3.n.t(\'1a\'));$(g).1y(4.q)})}k{$(\'.7-L p\',5).1B(3.n.t(\'1a\'))}$(\'.7-L\',5).1y(4.q)}k{$(\'.7-L\',5).28(4.q)}b i=0;$(\'.7-c\',5).F(9(){b E=1d.2a(5.w()/4.h);$(g).f({x:\'O\',y:\'0\',Y:\'W(\'+3.n.t(\'M\')+\') Q-R -\'+((E+(i*E))-E)+\'12 0%\'});i++});6(4.m==\'1G\'){b 1J=2x 2u("1H","10","1I","19","1C","Z","1D","1k");3.u=1J[1d.2l(1d.1G()*(1J.22+1))];6(3.u==2n)3.u=\'1k\'}3.H=N;6(4.m==\'2v\'||4.m==\'1H\'||3.u==\'1H\'||4.m==\'10\'||3.u==\'10\'){b r=0;b i=0;b h=$(\'.7-c\',5);6(4.m==\'10\'||3.u==\'10\')h=$(\'.7-c\',5).17();h.F(9(){b c=$(g);c.f(\'1E\',\'O\');6(i==4.h-1){I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q,\'\',9(){5.11(\'7:U\')})},(s+r))}k{I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q)},(s+r))}r+=1e;i++})}k 6(4.m==\'2p\'||4.m==\'1I\'||3.u==\'1I\'||4.m==\'19\'||3.u==\'19\'){b r=0;b i=0;b h=$(\'.7-c\',5);6(4.m==\'19\'||3.u==\'19\')h=$(\'.7-c\',5).17();h.F(9(){b c=$(g);c.f(\'26\',\'O\');6(i==4.h-1){I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q,\'\',9(){5.11(\'7:U\')})},(s+r))}k{I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q)},(s+r))}r+=1e;i++})}k 6(4.m==\'1C\'||4.m==\'2q\'||3.u==\'1C\'||4.m==\'Z\'||3.u==\'Z\'){b r=0;b i=0;b v=0;b h=$(\'.7-c\',5);6(4.m==\'Z\'||3.u==\'Z\')h=$(\'.7-c\',5).17();h.F(9(){b c=$(g);6(i==0){c.f(\'1E\',\'O\');i++}k{c.f(\'26\',\'O\');i=0}6(v==4.h-1){I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q,\'\',9(){5.11(\'7:U\')})},(s+r))}k{I(9(){c.z({x:\'s%\',y:\'1.0\'},4.q)},(s+r))}r+=1e;v++})}k 6(4.m==\'1D\'||3.u==\'1D\'){b r=0;b i=0;$(\'.7-c\',5).F(9(){b c=$(g);b 1F=c.w();c.f({1E:\'O\',x:\'s%\',w:\'O\'});6(i==4.h-1){I(9(){c.z({w:1F,y:\'1.0\'},4.q,\'\',9(){5.11(\'7:U\')})},(s+r))}k{I(9(){c.z({w:1F,y:\'1.0\'},4.q)},(s+r))}r+=1e;i++})}k 6(4.m==\'1k\'||3.u==\'1k\'){b i=0;$(\'.7-c\',5).F(9(){$(g).f(\'x\',\'s%\');6(i==4.h-1){$(g).z({y:\'1.0\'},(4.q*2),\'\',9(){5.11(\'7:U\')})}k{$(g).z({y:\'1.0\'},(4.q*2))}i++})}}};$.1h.1i.21={m:\'1G\',h:15,q:2t,1j:2s,16:0,V:N,1N:N,G:N,1L:l,1R:\'.1Y\',1S:\'2r.1Y\',1Z:N,1U:N,1g:l,20:0.8,1K:9(){},1M:9(){},1P:9(){}};$.1h.17=[].17})(2o);',62,162,'|||vars|settings|slider|if|nivo||function||var|slice|kids|currentSlide|css|this|slices||timer|else|false|effect|currentImage|child||animSpeed|timeBuff|100|attr|randAnim||width|height|opacity|animate|div|class|nivoRun|img|sliceWidth|each|controlNav|running|setTimeout|is|return|caption|src|true|0px|append|no|repeat|display|totalSlides|animFinished|directionNav|url|clearInterval|background|sliceUpDownLeft|sliceDownLeft|trigger|px|childWidth|nudge||startSlide|reverse|childHeight|sliceUpLeft|title|active|addClass|Math|50|paused|manualAdvance|fn|nivoSlider|pauseTime|fade|nivoControl|first|find|setInterval|call|next|prev|live|control|click|block|eq|rel|fadeIn|none|event|html|sliceUpDown|fold|top|origWidth|random|sliceDownRight|sliceUpRight|anims|beforeChange|controlNavThumbs|afterChange|directionNavHide|stop|slideshowEnd|data|controlNavThumbsSearch|controlNavThumbsReplace|options|pauseOnHover|keyCode|hover|1px|jpg|keyboardNav|captionOpacity|defaults|length|for|hide|prevNav|bottom|nextNav|fadeOut|left|round|extend|show|Prev|imageLink|children|replace|position|relative|hasClass|Next|floor|window|undefined|jQuery|sliceUp|sliceUpDownRight|_thumb|3000|500|Array|sliceDown|37|new|39|keypress|bind|removeClass'.split('|'),0,{}))

/* NIVO function */
$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'fade',
		slices:15,
		animSpeed:400,
		pauseTime:4000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});

/* jquery.tweet */

(function($) {
 
  $.fn.tweet = function(o){
    var s = {
      username: ["jvmediadesign"],              // [string]   required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
      list: null,                              //[string]   optional name of list belonging to username
      avatar_size: null,                      // [integer]  height and width of avatar if displayed (48px max)
      count: 1,                               // [integer]  how many tweets to display?
      intro_text: null,                       // [string]   do you want text BEFORE your your tweets?
      outro_text: null,                       // [string]   do you want text AFTER your tweets?
      join_text:  null,                       // [string]   optional text in between date and tweet, try setting to "auto"
      auto_join_text_default: "",      // [string]   auto text for non verb: "i said" bullocks
      auto_join_text_ed: "",                 // [string]   auto text for past tense: "i" surfed
      auto_join_text_ing: "",             // [string]   auto tense for present tense: "i was" surfing
      auto_join_text_reply: "",   // [string]   auto tense for replies: "i replied to" @someone "with"
      auto_join_text_url: "", // [string]   auto tense for urls: "i was looking at" http:...
      loading_text: null,                     // [string]   optional loading text, displayed while tweets load
      query: null,                            // [string]   optional search query
      refresh_interval: null                  // [integer]  optional number of seconds after which to reload tweets
    };
    
    if(o) $.extend(s, o);
    
    $.fn.extend({
      linkUrl: function() {
        var returning = [];
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"$1\">$1</a>"));
        });
        return $(returning);
      },
      linkUser: function() {
        var returning = [];
        var regexp = /[\@]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"http://twitter.com/$1\">@$1</a>"));
        });
        return $(returning);
      },
      linkHash: function() {
        var returning = [];
        var regexp = /(?:^| )[\#]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp, ' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>'));
        });
        return $(returning);
      },
      capAwesome: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'));
        });
        return $(returning);
      },
      capEpic: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(epic)\b/gi, '<span class="epic">$1</span>'));
        });
        return $(returning);
      },
      makeHeart: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>"));
        });
        return $(returning);
      }
    });

    function parse_date(date_str) {
      // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse
      // cannot handle in IE. We therefore perform the following transformation:
      // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000"
      return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));
    }

   function relative_time(time_value) {
      var parsed_date = parse_date(time_value);
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
      var r = '';
      if (delta < 60) {
	r = delta + ' seconds ago';
     } else if(delta < 120) {
	r = 'a minute ago';
      } else if(delta < (45*60)) {
	r = (parseInt(delta / 60, 10)).toString() + ' minutes ago';
      } else if(delta < (2*60*60)) {
	r = 'an hour ago';
      } else if(delta < (24*60*60)) {
	r = '' + (parseInt(delta / 3600, 10)).toString() + ' hours ago';
      } else if(delta < (48*60*60)) {
	r = 'a day ago';
      } else {
	r = (parseInt(delta / 86400, 10)).toString() + ' days ago';
      }
      return 'about ' + r;
    }

    function build_url() {
      var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
      if (s.list) {
        return proto+"//api.twitter.com/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?per_page="+s.count+"&callback=?";
      } else if (s.query == null && s.username.length == 1) {
        return proto+'//api.twitter.com/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+s.count+'&include_rts=1&callback=?';
      } else {
        var query = (s.query || 'from:'+s.username.join(' OR from:'));
        return proto+'//search.twitter.com/search.json?&q='+encodeURIComponent(query)+'&rpp='+s.count+'&callback=?';
      }
    }

    return this.each(function(i, widget){
      var list = $('<ul class="tweet_list">').appendTo(widget);
      var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
      var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
      var loading = $('<p class="loading">'+s.loading_text+'</p>');

      if(typeof(s.username) == "string"){
        s.username = [s.username];
      }

      if (s.loading_text) $(widget).append(loading);
      $(widget).bind("load", function(){
        $.getJSON(build_url(), function(data){
          if (s.loading_text) loading.remove();
          if (s.intro_text) list.before(intro);
          list.empty();
          var tweets = (data.results || data);
          $.each(tweets, function(i,item){
            // auto join text based on verb tense and content
            if (s.join_text == "auto") {
              if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) {
                var join_text = s.auto_join_text_reply;
              } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) {
                var join_text = s.auto_join_text_url;
              } else if (item.text.match(/^((\w+ed)|just) .*/im)) {
                var join_text = s.auto_join_text_ed;
              } else if (item.text.match(/^(\w*ing) .*/i)) {
                var join_text = s.auto_join_text_ing;
              } else {
                var join_text = s.auto_join_text_default;
              }
            } else {
              var join_text = s.join_text;
            };
   
            var from_user = item.from_user || item.user.screen_name;
            var profile_image_url = item.profile_image_url || item.user.profile_image_url;
            var join_template = '<span class="tweet_join"> '+join_text+' </span>';
            var join = ((s.join_text) ? join_template : ' ');
            var avatar_template = '<a class="tweet_avatar" href="http://twitter.com/'+from_user+'"><img src="'+profile_image_url+'" height="'+s.avatar_size+'" width="'+s.avatar_size+'" alt="'+from_user+'\'s avatar" title="'+from_user+'\'s avatar" border="0"/></a>';
            var avatar = (s.avatar_size ? avatar_template : '');
            var date = '<span class="tweet_time"><a href="http://twitter.com/'+from_user+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a></span>';
            var text = '<span class="tweet_text">' +$([item.text]).linkUrl().linkUser().linkHash().makeHeart().capAwesome().capEpic()[0]+ '</span>';
   
            // until we create a template option, arrange the items below to alter a tweet's display.
            list.append('<li>' + avatar + date + join + text + '</li>');
   
            list.children('li:first').addClass('tweet_first');
            list.children('li:odd').addClass('tweet_even');
            list.children('li:even').addClass('tweet_odd');
          });
          if (s.outro_text) list.after(outro);
          $(widget).trigger("loaded").trigger((tweets.length == 0 ? "empty" : "full"));
          if (s.refresh_interval) {
            window.setTimeout(function() { $(widget).trigger("load"); }, 1000 * s.refresh_interval);
          };
        });
      }).trigger("load");
    });
  };
})(jQuery);

/* TWEET */
 jQuery(document).ready(function($) {
      $(".tweet").tweet({
        join_text: "auto",
        username: "jvmediadesign",
        avatar_size: 0,
        count: 1,
        //auto_join_text_default: "we said,", 
        //auto_join_text_ed: "we",
       // auto_join_text_ing: "we were",
        //auto_join_text_reply: "we replied",
        //auto_join_text_url: "we were checking out",
        loading_text: "loading tweets..."
      });
      $("#query").tweet({
        avatar_size: 0,
        count: 1,
        query: "tweet.seaofclouds.com",
        loading_text: "searching twitter..."
      });
      $("#userandquery").tweet({
        count: 1,
        query: "from:seaofclouds http",
        loading_text: "searching twitter..."
      });
      $("#fromtwo").tweet({
        avatar_size: 0,
        count: 1,
        username: ["seaofclouds", "laughingsquid"],
        loading_text: "searching twitter...",
        refresh_interval: 10
      });
      $("#list").tweet({
        avatar_size: 0,
        count: 1,
        username: "twitter",
        list: "team",
        loading_text: "loading list..."
      });
      $("#empty").tweet({
        avatar_size: 0,
        count: 1,
        query: "cieR8oog",
        loading_text: "searching twitter..."
      }).bind("empty", function() { $(this).append("No matching tweets found"); });
    })
	
/* ContactPop jQuery Plugin
 *
 * By Jon Raasch
 * http://jonraasch.com
 *
 * Copyright (c)2009 Jon Raasch. All rights reserved.
 * Released under FreeBSD License, see readme.txt
 * Do not remove the above copyright notice or text.
 *
 * For more information please visit: 
 * http://jonraasch.com/blog/contact-pop-jquery-plugin
*/


ContactPop = {
    /************ config **************/
    
    // make sure to keep the trailing comma after each of these variable definitions
    
    replaceHref : 'quote.html', // can be array or string of hrefs or nothing if you want to use jQuery selectors (below)
    
    formPhpLocation : 'contact-pop.php', // relative path to the backend contact form
    
    pathToContactPop : '/', // relative path to the Contact-Pop directory
    
    contactHeadline : 'Request a Proposal',
    headerBgColor : '#3e2f1f', // background color of overlay panel header
    
    overlayFadeIn : 600, // overlay fade in speed (milliseconds)
    overlayFadeOut : 500, // overlay fade out speed (milliseconds)
    
    overlayEasing : '', // if you install the easing plugin (http://gsgd.co.uk/sandbox/jquery/easing/), the info goes here, example: 'easeInOutQuad'
    
    openButtonSelector : '', // set this to use jQuery selectors in addition to the hrefs - string (ex: '.contact, #contact-link')
    closeButtonSelector : '.close-overlay', // this works with any jQuery selector - string (ex: '#close-button, .close')
    
    resetFormEachTime : 0, // resets the form if the overlay is hidden and shown again
    
    fadeOverlayIE : 0, // default off - in IE 7/8 alpha transparency flashes black when ffaded
    fadeOverlayIE6 : 0, // default off - for performance
    
    
    
    /********** end config ************/
    
    obj : {},
    formFields : {},
    submitEvent : 0,
    overlayFade : 1,
    
    appendOverlay : function() {
        // append overlay and panel divs
        ContactPop.obj.overlay = jQuery('<div id="contact-pop-overlay"></div>').appendTo( jQuery('BODY') );
        
        ContactPop.obj.panelWrapper = jQuery('<div id="contact-pop-panel-wrapper"></div>').appendTo( ContactPop.obj.overlay );
        
        ContactPop.obj.panel = jQuery('<div id="contact-pop-panel"></div>').appendTo( ContactPop.obj.panelWrapper );
        
        // append panel headline
        ContactPop.obj.panelHeadline = $( '<h2 id="contact-pop-header">' + ContactPop.contactHeadline + '</h2>') . appendTo( ContactPop.obj.panel );
        
        // set panel headline background color
        if ( ContactPop.headerBgColor != '#3e2f1f' ) ContactPop.obj.panelHeadline.css( 'backgroundColor', ContactPop.headerBgColor );
        
        // append panel header close button
        ContactPop.obj.panelHeadline.append( '<a href="#" class="close-overlay">X</a></h2>' );
        
        // append form
        ContactPop.obj.form = jQuery('<form action="' + ContactPop.formPhpLocation + '" method="get" id="contact-pop-form"></div>').appendTo( ContactPop.obj.panel );
        
        // append loading graphic
        ContactPop.obj.loading = jQuery('<div id="contact-pop-loading-gif-wrapper"></div>').appendTo( ContactPop.obj.panel );
        
        ContactPop.obj.loading.append('<img src="' + ContactPop.pathToContactPop + '/img/ajax-loader.gif" alt="" id="contact-pop-loading-gif" />');
    },

    getFormContent : function() {
        // grab form html using jQuery's AJAX API
        jQuery.get( ContactPop.formPhpLocation, { 'ajaxForm' : 1 },  function(html) {                
            if ( html ) {
                ContactPop.obj.loading.fadeOut(200);
                ContactPop.obj.form.html( html );
                ContactPop.attachFormEvents();
            }
        });
    },
    
    attachFormEvents : function() {
        // close buttons
        jQuery( ContactPop.closeButtonSelector, ContactPop.obj.panel).click( function(ev) {
            ev.preventDefault();
            ContactPop.hideOverlay();
        });
        
        // attach submit event each time for IE
        if ( jQuery.browser.msie ) {
            jQuery('input.submit', ContactPop.obj.form).click( function(ev) {
                ev.preventDefault();                
                ContactPop.submitForm();
            });
        }
        // only attach submit event once for other browsers
        else if ( !ContactPop.submitEvent ) {            
            ContactPop.obj.form.submit( function(ev) {
                ev.preventDefault();                
                ContactPop.submitForm();
            });
            
            ContactPop.submitEvent = 1;
        }
    },
    
    checkOverlayFade : function() {
        if ( $.browser.msie && !ContactPop.fadeOverlayIE && !( $.browser.version < 7 && ContactPop.fadeOverlayIE6 ) ) return false;
        else return true;
    },
    
    showOverlay : function() {
        // if first time append the overlay and get the form content
        if ( typeof(ContactPop.obj.overlay) == 'undefined' ) {         
            ContactPop.appendOverlay();
            ContactPop.getFormContent();
        }
        else if ( ContactPop.resetFormEachTime ) ContactPop.getFormContent();
        
        if ( ContactPop.overlayFade ) ContactPop.obj.overlay.fadeIn( ContactPop.overlayFadeOut, ContactPop.overlayEasing );
        else ContactPop.obj.overlay.show();
    },
    
    hideOverlay : function() {
        if ( ContactPop.overlayFade ) ContactPop.obj.overlay.fadeOut( ContactPop.overlayFadeIn, ContactPop.overlayEasing );
        else ContactPop.obj.overlay.hide();
    },
    
    submitForm : function() {
        // add form fields to array
         jQuery('input, select, textarea', ContactPop.obj.form).each( function() {
            ContactPop.addFormField( jQuery(this) );
         });
         
         // set the ajaxForm post value
         ContactPop.formFields['ajaxForm'] = 1;
         
         // fade in the loading graphic
         ContactPop.obj.form.fadeOut(200);
         ContactPop.obj.loading.fadeIn(200);
         
         // post the form with jQuery's AJAX API
        jQuery.post( ContactPop.formPhpLocation, ContactPop.formFields, function(html) {                
            if ( html ) {
                ContactPop.obj.form.html( html );
                ContactPop.obj.loading.fadeOut(200);
                ContactPop.obj.form.fadeIn(200);
                
                ContactPop.attachFormEvents();
            }
          });
    },
    
    addFormField : function( $field ) {
        var fieldName = $field.attr('name');
        if ( fieldName ) ContactPop.formFields[ fieldName ] = $field.val();
    },
    
    init : function() {
        var anchorSelector = '';
        // force array
        if ( typeof( ContactPop.replaceHref ) != 'object' ) ContactPop.replaceHref = [ ContactPop.replaceHref ];
        
        // add anchor selectors
        for ( var i = 0; i < ContactPop.replaceHref.length; i++ ) {
            if ( ContactPop.replaceHref[i] ) anchorSelector += 'a[href=' + ContactPop.replaceHref[i] + '], ';
        }
        
        // add  additional jQuery selectors
        if ( ContactPop.openButtonSelector ) anchorSelector += ContactPop.openButtonSelector;
        else anchorSelector = anchorSelector.substr(0, anchorSelector.length - 2);

        // define ctas and click event
        ContactPop.obj.ctas = jQuery(anchorSelector);
        
        ContactPop.obj.ctas.click( function(ev) {
            ev.preventDefault();
            ContactPop.showOverlay();
        });
        
        // determine if fading overlay or just hide/showing
        ContactPop.overlayFade = ContactPop.checkOverlayFade();
        
        // preload overlay image - keep this in the init() function so the rest of the page loads first
        
        var overlayImg = new Image();
        if ( jQuery.browser.msie && jQuery.browser.version < 7 ) overlayImg.src = ContactPop.pathToContactPop + '/img/overlay-ie6.png';
        
        else overlayImg.src = ContactPop.pathToContactPop + '/img/overlay.png';
    }
};

jQuery(function() {
    // initiate ContactPop once the page loads
    ContactPop.init();
});

/* Roll it on over */

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
<!--

function SD_openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

/**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
